@royalschedule/maps 3.3.12 → 3.3.14
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/README.md +0 -1
- package/dist/Additio/to/index.d.ts +2 -2
- package/dist/PlanDigital/to/index.d.ts +2 -2
- package/dist/RS/v2/to/dynamic-locked-times.js +5 -2
- package/dist/RS/v2/to/dynamic-locked-times.js.map +1 -1
- package/dist/RS/v3/to/available-dependencies.d.ts +2 -2
- package/dist/RS/v3/to/available-dependencies.js.map +1 -1
- package/dist/RS/v3/to/collections.js.map +1 -1
- package/dist/RS/v3/to/configurations.js.map +1 -1
- package/dist/RS/v3/to/constraints.js +13 -1
- package/dist/RS/v3/to/constraints.js.map +1 -1
- package/dist/RS/v3/to/course-events/days.js.map +1 -1
- package/dist/RS/v3/to/course-events/dependencies.js.map +1 -1
- package/dist/RS/v3/to/course-events/groups.js.map +1 -1
- package/dist/RS/v3/to/course-events/in-locations.js.map +1 -1
- package/dist/RS/v3/to/course-events/index.d.ts +2 -2
- package/dist/RS/v3/to/course-events/index.js.map +1 -1
- package/dist/RS/v3/to/course-events/intervals.js.map +1 -1
- package/dist/RS/v3/to/course-events/meta.js.map +1 -1
- package/dist/RS/v3/to/default.js.map +1 -1
- package/dist/RS/v3/to/dependencies.d.ts +2 -2
- package/dist/RS/v3/to/dependencies.js.map +1 -1
- package/dist/RS/v3/to/destructure.js.map +1 -1
- package/dist/RS/v3/to/dynamic-locked-times.js +1 -0
- package/dist/RS/v3/to/dynamic-locked-times.js.map +1 -1
- package/dist/RS/v3/to/groups.js.map +1 -1
- package/dist/RS/v3/to/index.d.ts +12 -8
- package/dist/RS/v3/to/individuals.js.map +1 -1
- package/dist/RS/v3/to/locked-times.js.map +1 -1
- package/dist/RS/v3/to/persons.js.map +1 -1
- package/dist/RS/v3/to/schedules.js +1 -0
- package/dist/RS/v3/to/schedules.js.map +1 -1
- package/dist/RS/v3/to/teachers.js.map +1 -1
- package/dist/RS/v3/to/util.js.map +1 -1
- package/dist/RS/v3/types/algorithm-parameters.d.ts +6 -0
- package/dist/RS/v3/types/out-options.d.ts +13 -6
- package/dist/RS/v3/types/schedules.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Types } from "../../core/v2/types/index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as xlsx0 from "xlsx";
|
|
3
3
|
|
|
4
4
|
//#region src/Additio/to/index.d.ts
|
|
5
5
|
declare class export_default {
|
|
@@ -12,7 +12,7 @@ declare class export_default {
|
|
|
12
12
|
teachers: Types.teacher[];
|
|
13
13
|
courses: Types.course[];
|
|
14
14
|
events: Types.event[];
|
|
15
|
-
}) =>
|
|
15
|
+
}) => xlsx0.WorkBook;
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
|
18
18
|
export { export_default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Types } from "../../core/v2/types/index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as xlsx1 from "xlsx";
|
|
3
3
|
|
|
4
4
|
//#region src/PlanDigital/to/index.d.ts
|
|
5
5
|
declare class export_default {
|
|
6
|
-
static schedules: (courseEvents: Types.course[]) =>
|
|
6
|
+
static schedules: (courseEvents: Types.course[]) => xlsx1.WorkBook;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
export { export_default };
|
|
@@ -24,8 +24,10 @@ var dynamic_locked_times_default = (docs, settings, options, set, destructMap) =
|
|
|
24
24
|
if (duration == null) throw new Error("(RS::V2::To::DynamicLockedTimes) Length of a locked time is null");
|
|
25
25
|
if (duration < 5) throw new Error("(RS::V2::To::DynamicLockedTimes) Length of a locked time is less than 5 min");
|
|
26
26
|
if (!coalesced) throw new Error("(RS::V2::To::DynamicLockedTimes) Length of a locked time is less than 5 min");
|
|
27
|
-
let days = intervals?.map(({ start }) => (moment(start).day() + 6) % 7);
|
|
27
|
+
let days = intervals?.length ? intervals.map(({ start }) => (moment(start).day() + 6) % 7) : void 0;
|
|
28
28
|
if (days) days = [...new Set(days)];
|
|
29
|
+
const day = days?.length == 1 ? days[0] : void 0;
|
|
30
|
+
if (day != null && group.days?.length && !group.days.some((x) => x.day == day)) return acc$1;
|
|
29
31
|
let groups = coalesced.filter((x) => x.toModel != "locations")?.map(({ to, toModel }) => `${toModel}.${to[idKey]?.toString()}`);
|
|
30
32
|
if (destructMap?.size) groups = coalesced.filter((x) => x.toModel == "groups").map(({ to }) => to[idKey]?.toString()).filter(Boolean).reduce((acc$2, groupId) => {
|
|
31
33
|
if (destructMap.has(groupId)) {
|
|
@@ -42,7 +44,8 @@ var dynamic_locked_times_default = (docs, settings, options, set, destructMap) =
|
|
|
42
44
|
length: duration,
|
|
43
45
|
minBreakLength: false,
|
|
44
46
|
intervals: intervals_default(intervals, settings),
|
|
45
|
-
...days &&
|
|
47
|
+
...days && { days },
|
|
48
|
+
...day && { day },
|
|
46
49
|
...durationVariance != null && { maxLengthVariance: durationVariance }
|
|
47
50
|
});
|
|
48
51
|
}, []));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-locked-times.js","names":["idKey: 'id' | '_id' | 'ids'","lunch","id: string","acc","set","_intervals"],"sources":["../../../../src/RS/v2/to/dynamic-locked-times.ts"],"sourcesContent":["import moment from 'moment';\nimport { nanoid } from 'nanoid';\n\nimport { OutOptions } from '../types/out-options';\nimport { CourseEvent } from '../types/course-events';\n\nimport _intervals from './intervals';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { pick } from 'lodash-es';\n\nexport default (docs: (Deserialized<CoreTypes.group> | Deserialized<CoreTypes.teacher>)[],\n settings: Deserialized<CoreTypes.divisionSettings>,\n options: OutOptions,\n set: Set<string>,\n destructMap?: Map<string | null, Set<string>>) => {\n //let docs: SourceLockedTime[] = (Array.isArray(lockedTimes) ? lockedTimes : [lockedTimes]);\n const idKey: 'id' | '_id' | 'ids' = (options.idKey ?? 'id');\n\n return docs.filter(x => !!x).reduce((acc: CourseEvent[], group): CourseEvent[] => {\n let lunch = group.lunch;\n if (lunch == null) {\n lunch = settings.defaultLunch?.map(lunch => ({ ...lunch, coalesced: [{ to: pick(group, idKey), toModel: '' }] }));\n }\n\n if (lunch == null)\n return acc;\n\n\n return acc.concat(\n lunch.reduce((acc: CourseEvent[], lockedTime) => {\n\n const { _id, intervals, duration, durationVariance, coalesced } = lockedTime;\n\n const id: string = (lockedTime[idKey as keyof CoreTypes.lockedTime] || _id)?.toString() ?? nanoid();\n\n if (set.has(id))\n return acc;\n\n set.add(id);\n\n if (duration == null)\n throw new Error('(RS::V2::To::DynamicLockedTimes) Length of a locked time is null');\n\n if (duration < 5)\n throw new Error('(RS::V2::To::DynamicLockedTimes) Length of a locked time is less than 5 min');\n\n if (!coalesced)\n throw new Error('(RS::V2::To::DynamicLockedTimes) Length of a locked time is less than 5 min');\n /*\n
|
|
1
|
+
{"version":3,"file":"dynamic-locked-times.js","names":["idKey: 'id' | '_id' | 'ids'","lunch","id: string","acc","set","_intervals"],"sources":["../../../../src/RS/v2/to/dynamic-locked-times.ts"],"sourcesContent":["import moment from 'moment';\nimport { nanoid } from 'nanoid';\n\nimport { OutOptions } from '../types/out-options';\nimport { CourseEvent } from '../types/course-events';\n\nimport _intervals from './intervals';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { pick } from 'lodash-es';\n\nexport default (docs: (Deserialized<CoreTypes.group> | Deserialized<CoreTypes.teacher>)[],\n settings: Deserialized<CoreTypes.divisionSettings>,\n options: OutOptions,\n set: Set<string>,\n destructMap?: Map<string | null, Set<string>>) => {\n //let docs: SourceLockedTime[] = (Array.isArray(lockedTimes) ? lockedTimes : [lockedTimes]);\n const idKey: 'id' | '_id' | 'ids' = (options.idKey ?? 'id');\n\n return docs.filter(x => !!x).reduce((acc: CourseEvent[], group): CourseEvent[] => {\n let lunch = group.lunch;\n if (lunch == null) {\n lunch = settings.defaultLunch?.map(lunch => ({ ...lunch, coalesced: [{ to: pick(group, idKey), toModel: '' }] }));\n }\n\n if (lunch == null)\n return acc;\n\n\n return acc.concat(\n lunch.reduce((acc: CourseEvent[], lockedTime) => {\n\n const { _id, intervals, duration, durationVariance, coalesced } = lockedTime;\n\n const id: string = (lockedTime[idKey as keyof CoreTypes.lockedTime] || _id)?.toString() ?? nanoid();\n\n if (set.has(id))\n return acc;\n\n set.add(id);\n\n if (duration == null)\n throw new Error('(RS::V2::To::DynamicLockedTimes) Length of a locked time is null');\n\n if (duration < 5)\n throw new Error('(RS::V2::To::DynamicLockedTimes) Length of a locked time is less than 5 min');\n\n if (!coalesced)\n throw new Error('(RS::V2::To::DynamicLockedTimes) Length of a locked time is less than 5 min');\n\n /*\n find the day(s) the events should be placed on\n */\n let days = intervals?.length\n ? intervals.map(({ start }) => (moment(start).day() + 6) % 7)\n : undefined;\n if (days) days = [...new Set(days)];\n const day = days?.length == 1 ? days[0] : undefined;\n\n // ignore locked times that reside on days that are not part of the group's days\n if (day != null && group.days?.length && !group.days.some(x => x.day == day)) return acc;\n\n /*\n find all references to destructured groups and replace with composite\n */\n let groups = coalesced.filter(x => x.toModel != 'locations')?.map(({ to, toModel }) => `${ toModel }.${ to[idKey]?.toString() }`);\n if (destructMap?.size) {\n groups = coalesced.filter(x => x.toModel == 'groups')\n .map(({ to }) => to[idKey]?.toString()!)\n .filter(Boolean)\n .reduce((acc: string[], groupId) => {\n if (destructMap.has(groupId)) {\n const set = destructMap.get(groupId)!;\n const destructuredGroups = Array.from(set).map(x => `persons.${ x }`);\n acc = acc.concat(destructuredGroups);\n }\n return acc;\n }, groups);\n }\n\n return acc.concat({\n id: `${ group.lunch == null ? 'virtual' : 'lockedTimes' }.${ id }`,\n groups: [...new Set(groups.filter(Boolean))].map(x => [x]),\n dependencies: [...new Set(coalesced.filter(x => x.toModel == 'locations').map(({ to }) => to[idKey]?.toString()!)\n .filter(Boolean))].map(x => [x]),\n length: duration,\n minBreakLength: false,\n intervals: _intervals(intervals, settings),\n ...days && { days },\n ...day && { day },\n ...durationVariance != null && { maxLengthVariance: durationVariance },\n });\n }, []));\n\n }, [])\n .flat()\n .filter(Boolean);\n};"],"mappings":";;;;;;AAYA,oCAAgB,MACd,UACA,SACA,KACA,gBAAkD;CAElD,MAAMA,QAA+B,QAAQ,SAAS;AAEtD,QAAO,KAAK,QAAO,MAAK,CAAC,CAAC,GAAG,QAAQ,KAAoB,UAAyB;EAChF,IAAI,QAAQ,MAAM;AAClB,MAAI,SAAS,KACX,SAAQ,SAAS,cAAc,KAAI,aAAU;GAAE,GAAGC;GAAO,WAAW,CAAC;IAAE,IAAI,KAAK,OAAO;IAAQ,SAAS;;;AAG1G,MAAI,SAAS,KACX,QAAO;AAGT,SAAO,IAAI,OACT,MAAM,QAAQ,OAAoB,eAAe;GAE/C,MAAM,EAAE,KAAK,WAAW,UAAU,kBAAkB,cAAc;GAElE,MAAMC,MAAc,WAAW,UAAwC,MAAM,cAAc;AAE3F,OAAI,IAAI,IAAI,IACV,QAAOC;AAET,OAAI,IAAI;AAER,OAAI,YAAY,KACd,OAAM,IAAI,MAAM;AAElB,OAAI,WAAW,EACb,OAAM,IAAI,MAAM;AAElB,OAAI,CAAC,UACH,OAAM,IAAI,MAAM;GAKlB,IAAI,OAAO,WAAW,SAClB,UAAU,KAAK,EAAE,aAAa,OAAO,OAAO,QAAQ,KAAK,KACzD;AACJ,OAAI,KAAM,QAAO,CAAC,GAAG,IAAI,IAAI;GAC7B,MAAM,MAAM,MAAM,UAAU,IAAI,KAAK,KAAK;AAG1C,OAAI,OAAO,QAAQ,MAAM,MAAM,UAAU,CAAC,MAAM,KAAK,MAAK,MAAK,EAAE,OAAO,KAAM,QAAOA;GAKrF,IAAI,SAAS,UAAU,QAAO,MAAK,EAAE,WAAW,cAAc,KAAK,EAAE,IAAI,cAAc,GAAI,QAAS,GAAI,GAAG,QAAQ;AACnH,OAAI,aAAa,KACf,UAAS,UAAU,QAAO,MAAK,EAAE,WAAW,UACzC,KAAK,EAAE,SAAS,GAAG,QAAQ,YAC3B,OAAO,SACP,QAAQ,OAAe,YAAY;AAClC,QAAI,YAAY,IAAI,UAAU;KAC5B,MAAMC,QAAM,YAAY,IAAI;KAC5B,MAAM,qBAAqB,MAAM,KAAKA,OAAK,KAAI,MAAK,WAAY;AAChE,aAAMD,MAAI,OAAO;;AAEnB,WAAOA;MACN;AAGP,UAAOA,MAAI,OAAO;IAChB,IAAc,GAAI,MAAM,SAAS,OAAO,YAAY,cAAe,GAAI;IACvE,QAAc,CAAC,GAAG,IAAI,IAAI,OAAO,OAAO,WAAW,KAAI,MAAK,CAAC;IAC7D,cAAc,CAAC,GAAG,IAAI,IAAI,UAAU,QAAO,MAAK,EAAE,WAAW,aAAa,KAAK,EAAE,SAAS,GAAG,QAAQ,YAClG,OAAO,WAAW,KAAI,MAAK,CAAC;IAC/B,QAAgB;IAChB,gBAAgB;IAChB,WAAgBE,kBAAW,WAAW;IACtC,GAAG,QAAQ,EAAE;IACb,GAAG,OAAO,EAAE;IACZ,GAAG,oBAAoB,QAAS,EAAE,mBAAmB;;KAEtD;IAEJ,IACA,OACA,OAAO"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Types } from "../../../core/v2/types/index.js";
|
|
2
2
|
import { Deserialized } from "../../../core/types/index.js";
|
|
3
3
|
import { AvailableDependency } from "../types/available-dependencies.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ParsedOutOptions } from "../types/out-options.js";
|
|
5
5
|
|
|
6
6
|
//#region src/RS/v3/to/available-dependencies.d.ts
|
|
7
|
-
declare function export_default(availableLocations: Deserialized<Types.availableLocation>[], options:
|
|
7
|
+
declare function export_default(availableLocations: Deserialized<Types.availableLocation>[], options: ParsedOutOptions): AvailableDependency[][];
|
|
8
8
|
//#endregion
|
|
9
9
|
export { export_default };
|
|
10
10
|
//# sourceMappingURL=available-dependencies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"available-dependencies.js","names":["idKey: keyof CoreTypes.location"],"sources":["../../../../src/RS/v3/to/available-dependencies.ts"],"sourcesContent":["import { OutOptions
|
|
1
|
+
{"version":3,"file":"available-dependencies.js","names":["idKey: keyof CoreTypes.location"],"sources":["../../../../src/RS/v3/to/available-dependencies.ts"],"sourcesContent":["import { ParsedOutOptions as OutOptions } from '../types/out-options';\nimport { AvailableDependency } from '../types/available-dependencies';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { groupBy, pick, values } from 'lodash-es';\n\nexport default function (\n availableLocations: Deserialized<CoreTypes.availableLocation>[],\n options: OutOptions\n) {\n const idKey: keyof CoreTypes.location = options.idKey || 'id';\n\n if (!idKey) {\n throw new Error('(RS::V3::To::AvailableDependencies) property \"idKey\" in options is undefined');\n }\n\n\n const A = availableLocations\n .map(({ locations, groupIndex, rank }) => {\n const id = locations?.at(0)?.[idKey]?.toString();\n if (!id) return;\n\n return {\n dependency: id,\n ...rank != null && { rank },\n groupBy: groupIndex\n };\n })\n .filter((x): x is NonNullable<typeof x> => !!x)\n .filter(x => {\n // filter location references based on partial schedule options\n const includedLocations = options.partialScheduleOptions?.includedLocations;\n if (!includedLocations) return true;\n return includedLocations.has(x.dependency);\n });\n\n const B = values(groupBy(A, x => x.groupBy))\n\n return B.map(xs => xs.map((x): AvailableDependency => pick(x, 'dependency', 'rank')));\n}"],"mappings":";;;AAOA,wCACE,oBACA,SACA;CACA,MAAMA,QAAkC,QAAQ,SAAS;AAEzD,KAAI,CAAC,MACH,OAAM,IAAI,MAAM;CAIlB,MAAM,IAAI,mBACP,KAAK,EAAE,WAAW,YAAY,WAAW;EACxC,MAAM,KAAK,WAAW,GAAG,KAAK,QAAQ;AACtC,MAAI,CAAC,GAAI;AAET,SAAO;GACL,YAAY;GACZ,GAAG,QAAQ,QAAQ,EAAE;GACrB,SAAY;;IAGf,QAAQ,MAAkC,CAAC,CAAC,GAC5C,QAAO,MAAK;EAEX,MAAM,oBAAoB,QAAQ,wBAAwB;AAC1D,MAAI,CAAC,kBAAmB,QAAO;AAC/B,SAAO,kBAAkB,IAAI,EAAE;;CAGnC,MAAM,IAAI,OAAO,QAAQ,IAAG,MAAK,EAAE;AAEnC,QAAO,EAAE,KAAI,OAAM,GAAG,KAAK,MAA2B,KAAK,GAAG,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","names":["idKey: keyof CoreTypes.course","doc: Collection & { groupBy?: string }","courseEvents","availableDependencies","intervals","days","breakLength","lockedTimes"],"sources":["../../../../src/RS/v3/to/collections.ts"],"sourcesContent":["import days from './days';\nimport lockedTimes from './locked-times';\nimport intervals from './intervals';\nimport availableDependencies from './available-dependencies';\nimport courseEvents from './course-events';\nimport breakLength from './break-lengths';\n\nimport { Collection } from '../types/collections';\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"collections.js","names":["idKey: keyof CoreTypes.course","doc: Collection & { groupBy?: string }","courseEvents","availableDependencies","intervals","days","breakLength","lockedTimes"],"sources":["../../../../src/RS/v3/to/collections.ts"],"sourcesContent":["import days from './days';\nimport lockedTimes from './locked-times';\nimport intervals from './intervals';\nimport availableDependencies from './available-dependencies';\nimport courseEvents from './course-events';\nimport breakLength from './break-lengths';\n\nimport { Collection } from '../types/collections';\nimport { ParsedOutOptions as OutOptions } from '../types/out-options';\nimport { Individual } from '../types/individuals';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { mapGroupReferences } from './course-events/groups';\nimport { groupBy, omit, values } from 'lodash-es';\n\nexport default (\n courses: Deserialized<CoreTypes.course> | Deserialized<CoreTypes.course>[],\n events: Deserialized<CoreTypes.event>[] = [],\n overlapGroups: Deserialized<CoreTypes.overlapGroup>[] = [],\n settings: CoreTypes.divisionSettings,\n options: OutOptions,\n periodsMap: Map<string | undefined, number>,\n destructMap: Map<string | null, Individual> = new Map()\n): (Collection[] | Collection)[] => {\n\n const idKey: keyof CoreTypes.course = options.idKey || 'id';\n\n const eventMap = new Map(events\n .map(x => x.id ? [x.id, x] as [string, typeof x] : null)\n .filter((x): x is NonNullable<typeof x> => !!x)\n );\n\n const collections = (Array.isArray(courses) ? courses : [courses])\n .map(course => {\n const id = course[idKey]?.toString();\n\n if (!id) {\n throw new Error('(RS::V3::To::Collections) A course does not have a unique key');\n }\n\n // link events to course if not already done\n course.events ??= events.filter(x => x.course?.[idKey]?.toString() == id);\n\n // merge potentially missing event data\n course.events.forEach(event => {\n if (!event.id) return;\n Object.assign(event, eventMap.get(event.id), { course });\n });\n\n\n if (course.period && periodsMap.size && !periodsMap.has(course.period.id)) {\n throw new Error(`(RS::V3::To::Collections) Course ${course[idKey]} has a period that does not exist`);\n }\n\n const doc: Collection & { groupBy?: string } = {\n id,\n distributionKey: id,\n events: courseEvents(course.events, overlapGroups, settings, options, periodsMap, destructMap),\n // optional\n ...'weight' in course && { weight: course.weight },\n ...'density' in course && { density: course.density },\n ...course.eventDurationVariance != null && { maxEventLengthVariance: course.eventDurationVariance },\n ...course.locations?.length && { dependencies: availableDependencies(course.locations, options) },\n ...course.intervals?.length && { intervals: intervals(course.intervals, settings) },\n ...course.days?.length && { days: days(course.days, settings.numDays) },\n ...(course.minBreakLength != null) && { minBreakLength: breakLength(course.minBreakLength) },\n ...course.lockedTimes?.length && { lockedTimes: lockedTimes(course.lockedTimes, options) },\n ...course.lockedTimes?.length && { lockedTimes: lockedTimes(course.lockedTimes, options) },\n ...course.centerOfAttraction && { potentialCenter: parseFloat(course.centerOfAttraction.replace(':', '.')) },\n ...course.period && periodsMap.size && { period: periodsMap.get(course.period?.id) }\n };\n\n const groups = mapGroupReferences(course, options, destructMap);\n if (groups) doc.groups = groups;\n\n if (options.meta) {\n Object.assign(doc, {\n ...'color' in course && { color: course.color },\n ...'ids' in course && { ids: course.ids },\n ...course.displayName && { name: course.displayName },\n });\n }\n\n // temporarily attach overlap group\n doc.groupBy = course.overlapGroup?.id?.toString();\n\n return doc;\n });\n\n const overlapping = values(groupBy(\n collections.filter(x => x.groupBy != null),\n x => x.groupBy\n ))\n .map(xs => xs.map(x => omit(x, 'groupBy') as Collection));\n\n const plain = collections\n .filter(x => x.groupBy == null)\n .map(x => omit(x, 'groupBy') as Collection);\n\n return overlapping.concat(plain);\n};"],"mappings":";;;;;;;;;;AAgBA,2BACE,SACA,SAAiD,IACjD,gBAAwD,IACxD,UACA,SACA,YACA,8BAAgD,IAAI,UAClB;CAElC,MAAMA,QAAgC,QAAQ,SAAS;CAEvD,MAAM,WAAW,IAAI,IAAI,OACtB,KAAI,MAAK,EAAE,KAAK,CAAC,EAAE,IAAI,KAA2B,MAClD,QAAQ,MAAkC,CAAC,CAAC;CAG/C,MAAM,eAAe,MAAM,QAAQ,WAAW,UAAU,CAAC,UACtD,KAAI,WAAU;EACb,MAAM,KAAK,OAAO,QAAQ;AAE1B,MAAI,CAAC,GACH,OAAM,IAAI,MAAM;AAIlB,SAAO,WAAW,OAAO,QAAO,MAAK,EAAE,SAAS,QAAQ,cAAc;AAGtE,SAAO,OAAO,SAAQ,UAAS;AAC7B,OAAI,CAAC,MAAM,GAAI;AACf,UAAO,OAAO,OAAO,SAAS,IAAI,MAAM,KAAK,EAAE;;AAIjD,MAAI,OAAO,UAAU,WAAW,QAAQ,CAAC,WAAW,IAAI,OAAO,OAAO,IACpE,OAAM,IAAI,MAAM,oCAAoC,OAAO,OAAO;EAGpE,MAAMC,MAAyC;GAC7C;GACA,iBAAiB;GACjB,QAAiBC,sBAAa,OAAO,QAAQ,eAAe,UAAU,SAAS,YAAY;GAE3F,GAAG,YAA2B,UAAa,EAAE,QAAwB,OAAO;GAC5E,GAAG,aAA2B,UAAa,EAAE,SAAwB,OAAO;GAC5E,GAAG,OAAO,yBAAyB,QAAQ,EAAE,wBAAwB,OAAO;GAC5E,GAAG,OAAO,WAAW,UAAsB,EAAE,cAAwBC,+BAAsB,OAAO,WAAW;GAC7G,GAAG,OAAO,WAAW,UAAsB,EAAE,WAAwBC,kBAAU,OAAO,WAAW;GACjG,GAAG,OAAO,MAAM,UAA2B,EAAE,MAAwBC,aAAK,OAAO,MAAM,SAAS;GAChG,GAAI,OAAO,kBAAkB,QAAc,EAAE,gBAAwBC,sBAAY,OAAO;GACxF,GAAG,OAAO,aAAa,UAAoB,EAAE,aAAwBC,qBAAY,OAAO,aAAa;GACrG,GAAG,OAAO,aAAa,UAAoB,EAAE,aAAwBA,qBAAY,OAAO,aAAa;GACrG,GAAG,OAAO,sBAAiC,EAAE,iBAAwB,WAAW,OAAO,mBAAmB,QAAQ,KAAK;GACvH,GAAG,OAAO,UAAU,WAAW,QAAY,EAAE,QAAwB,WAAW,IAAI,OAAO,QAAQ;;EAGrG,MAAM,SAAS,mBAAmB,QAAQ,SAAS;AACnD,MAAI,OAAQ,KAAI,SAAS;AAEzB,MAAI,QAAQ,KACV,QAAO,OAAO,KAAK;GACjB,GAAG,WAAkB,UAAU,EAAE,OAAO,OAAO;GAC/C,GAAG,SAAkB,UAAU,EAAE,KAAO,OAAO;GAC/C,GAAG,OAAO,eAAqB,EAAE,MAAO,OAAO;;AAKnD,MAAI,UAAU,OAAO,cAAc,IAAI;AAEvC,SAAO;;CAGX,MAAM,cAAc,OAAO,QACzB,YAAY,QAAO,MAAK,EAAE,WAAW,QACrC,MAAK,EAAE,UAEN,KAAI,OAAM,GAAG,KAAI,MAAK,KAAK,GAAG;CAEjC,MAAM,QAAQ,YACX,QAAO,MAAK,EAAE,WAAW,MACzB,KAAI,MAAK,KAAK,GAAG;AAEpB,QAAO,YAAY,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurations.js","names":["idKey: keyof (CoreTypes.event & CoreTypes.course)"],"sources":["../../../../src/RS/v3/to/configurations.ts"],"sourcesContent":["import moment from 'moment';\nimport { isObject } from 'lodash-es';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\n\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"configurations.js","names":["idKey: keyof (CoreTypes.event & CoreTypes.course)"],"sources":["../../../../src/RS/v3/to/configurations.ts"],"sourcesContent":["import moment from 'moment';\nimport { isObject } from 'lodash-es';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\n\nimport { ParsedOutOptions as OutOptions } from '../types/out-options';\nimport { Configuration } from '../types/configurations';\nimport { Placement } from '../types/placements';\n\nexport default (events: Deserialized<CoreTypes.event>[], options: OutOptions): Configuration[] => {\n\n const idKey: keyof (CoreTypes.event & CoreTypes.course) = options.idKey || 'id';\n\n return [\n {\n events: (events || []).reduce((acc: Placement[], event) => {\n if (event.parked) return acc;\n\n const mmtMidnight = moment.utc(event.start).clone()\n .startOf('day');\n\n return acc.concat({\n id: event[idKey],\n collection: event.course?.[idKey],\n day: (moment.utc(event.start).day() + 6) % 7,\n dependencies: (event.inLocations)?.map(x => isObject(x) ? x[idKey] : null).filter(x => x !== null) ?? [],\n end: moment.utc(event.end).diff(mmtMidnight, 'minutes'),\n start: moment.utc(event.start).diff(mmtMidnight, 'minutes')\n } as Placement);\n }, [])\n }\n ];\n};"],"mappings":";;;;AAUA,8BAAgB,QAAyC,YAAyC;CAEhG,MAAMA,QAAoD,QAAQ,SAAS;AAE3E,QAAO,CACL,EACE,SAAS,UAAU,IAAI,QAAQ,KAAkB,UAAU;AACzD,MAAI,MAAM,OAAQ,QAAO;EAEzB,MAAM,cAAc,OAAO,IAAI,MAAM,OAAO,QACzC,QAAQ;AAEX,SAAO,IAAI,OAAO;GAChB,IAAc,MAAM;GACpB,YAAc,MAAM,SAAS;GAC7B,MAAe,OAAO,IAAI,MAAM,OAAO,QAAQ,KAAK;GACpD,cAAe,MAAM,aAAc,KAAI,MAAK,SAAS,KAAK,EAAE,SAAS,MAAM,QAAO,MAAK,MAAM,SAAS;GACtG,KAAc,OAAO,IAAI,MAAM,KAAK,KAAK,aAAa;GACtD,OAAc,OAAO,IAAI,MAAM,OAAO,KAAK,aAAa;;IAEzD"}
|
|
@@ -11,7 +11,19 @@ import { parsePeriods } from "./periods.js";
|
|
|
11
11
|
import { pick } from "lodash-es";
|
|
12
12
|
|
|
13
13
|
//#region src/RS/v3/to/constraints.ts
|
|
14
|
-
var constraints_default = (schedule,
|
|
14
|
+
var constraints_default = (schedule, _options = {}) => {
|
|
15
|
+
const options = (() => {
|
|
16
|
+
const pso = _options.partialScheduleOptions;
|
|
17
|
+
const partialScheduleOptions = pso ? {
|
|
18
|
+
includedEvents: pso.includedEvents ? new Set(pso.includedEvents) : void 0,
|
|
19
|
+
includedLocations: pso.includedLocations ? new Set(pso.includedLocations) : void 0,
|
|
20
|
+
omittedEventsHandling: pso.omittedEventsHandling
|
|
21
|
+
} : void 0;
|
|
22
|
+
return {
|
|
23
|
+
..._options,
|
|
24
|
+
partialScheduleOptions
|
|
25
|
+
};
|
|
26
|
+
})();
|
|
15
27
|
if (options.partialScheduleOptions?.includedEvents?.size) options.partialScheduleOptions.includedEvents = new Set([...options.partialScheduleOptions.includedEvents].map((x) => {
|
|
16
28
|
if (x.startsWith("events.") || x.startsWith("lockedTimes.")) return x;
|
|
17
29
|
return `events.${x}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraints.js","names":["idKey: keyof CoreTypes.course","groupMap","_destructure","data: Constraint","getSettings","getDefault","getCollections","getDependencies","getGroups","getTeachers","getDynamicLockedTimes"],"sources":["../../../../src/RS/v3/to/constraints.ts"],"sourcesContent":["import { pick } from 'lodash-es';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\n\nimport { Constraint } from '../types/constraints';\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"constraints.js","names":["partialScheduleOptions: ParsedOutOptions['partialScheduleOptions']","idKey: keyof CoreTypes.course","groupMap","_destructure","data: Constraint","getSettings","getDefault","getCollections","getDependencies","getGroups","getTeachers","getDynamicLockedTimes"],"sources":["../../../../src/RS/v3/to/constraints.ts"],"sourcesContent":["import { pick } from 'lodash-es';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\n\nimport { Constraint } from '../types/constraints';\nimport { OutOptions, ParsedOutOptions } from '../types/out-options';\n\nimport _destructure from './destructure';\nimport getDependencies from './dependencies';\nimport getTeachers from './teachers';\nimport getGroups from './groups';\nimport getCollections from './collections';\nimport getSettings from './settings';\nimport getDefault from './default';\nimport getDynamicLockedTimes from './dynamic-locked-times';\nimport { parsePeriods } from './periods';\nimport { personsToIndividuals,\n groupsToIndividuals,\n teachersToIndividuals } from './individuals';\n\nexport default (\n schedule: Partial<Deserialized<CoreTypes.schedule> & { division: Deserialized<CoreTypes.division> }>,\n _options: OutOptions = {}\n): Constraint => {\n ////\n //// parse the output options\n ////\n const options = ((): ParsedOutOptions => {\n const pso = _options.partialScheduleOptions;\n const partialScheduleOptions: ParsedOutOptions['partialScheduleOptions'] = pso\n ? {\n includedEvents: pso.includedEvents ? new Set(pso.includedEvents) : undefined,\n includedLocations: pso.includedLocations ? new Set(pso.includedLocations) : undefined,\n omittedEventsHandling: pso.omittedEventsHandling\n }\n : undefined;\n\n return { ..._options, partialScheduleOptions };\n })();\n\n ////\n //// for backward compatibility: add default collection to included events set\n ////\n if (options.partialScheduleOptions?.includedEvents?.size) {\n options.partialScheduleOptions.includedEvents = new Set(\n [...options.partialScheduleOptions.includedEvents]\n .map(x => {\n // should start with 'events.' or 'lockedTimes.' prefix\n if (x.startsWith('events.') || x.startsWith('lockedTimes.')) return x;\n return `events.${x}`;\n })\n );\n }\n\n\n // clone schedule to avoid mutating the original object\n schedule = structuredClone(schedule);\n\n if (schedule == null) return {};\n const idKey: keyof CoreTypes.course = options.idKey || 'id';\n\n const settings = schedule.settings;\n if (!settings) throw new Error('settings missing in schedule');\n\n const area = schedule.area;\n const groups = schedule.groups ?? [];\n const teachers = schedule.teachers ?? [];\n const locations = schedule.locations ?? [];\n const events = schedule.events ?? [];\n const overlapGroups = schedule.overlapGroups ?? [];\n const courses = schedule.courses ?? [];\n const periods = schedule.periods ?? [];\n const persons = schedule.persons ?? [];\n\n ////\n //// populate some group references to ensure that the types are correct\n ////\n {\n const groupMap = new Map(groups\n .map(x => ([x[idKey]?.toString(), x] as const))\n .filter(x => !!x[0])\n );\n // group.parentGroups\n groups?.forEach(item => {\n if (!item.parentGroups) return;\n item.parentGroups = item.parentGroups\n .map((x: Deserialized<CoreTypes.group> | string) => {\n return typeof x === 'string' ? groupMap.get(x) : groupMap.get(x[idKey]?.toString());\n })\n .filter((x): x is NonNullable<typeof x> => !!x);\n });\n // course.groups.to and event.groups.to\n courses.concat(events).forEach(item => {\n if (!item.groups) return;\n item.groups.forEach((x: { to: Deserialized<CoreTypes.group> | string }) => {\n const group = typeof x.to === 'string' ? groupMap.get(x.to) : groupMap.get(x.to[idKey]?.toString());\n if (group) x.to = group;\n });\n });\n }\n\n // unfortunately the division is set either as \"division\" or \"divisions\" so we need to handle both cases\n const division = schedule.divisions ?? schedule.division;\n\n // map periods\n const { map: periodsMap, matrix: periodsMatrix } = parsePeriods(periods, pick(division, 'start', 'end'));\n\n const destructMap = _destructure(courses, events, groups, settings, options);\n\n const data: Constraint = {\n settings: getSettings(settings),\n default: getDefault(settings, periodsMap, options),\n ...periodsMatrix && { periods: periodsMatrix },\n ...area && {\n areas: {\n breakLengthMatrix: area.breakLengthMatrix,\n list: area.list\n }\n },\n // intervals: getRootIntervals(rootIntervals, settings!),\n events: getCollections(courses, events, overlapGroups, settings, options, periodsMap, destructMap),\n dependencies: getDependencies(locations, settings, options),\n groups: getGroups(groups, settings, options)\n .concat(getTeachers(teachers, settings, options)),\n individuals: personsToIndividuals(persons, settings, options)\n .concat(groupsToIndividuals(groups, settings, options))\n .concat(teachersToIndividuals(teachers, settings, options)),\n };\n\n /*\n create map of groups if some groups are destructed\n groupMap: group id -> group\n */\n const groupMap = new Map<string, Deserialized<CoreTypes.group>>();\n if (destructMap.size) {\n groups?.forEach(x => groupMap.set(x[idKey]!.toString(), x));\n\n /*\n Find group and clone and substitute id with person id\n */\n data.individuals = data.individuals?.concat(Array.from(destructMap.values()));\n }\n\n /*\n handle groups.lunch and teachers.lunch\n append to events list\n */\n const lunchSet = new Set<string>();\n /**\n * Only add lunch if the group is a class\n */\n if (groups?.some(group => 'lunch' in group))\n data.events = (data.events ?? []).concat(getDynamicLockedTimes(groups.filter(x => x.species == 'class'), settings, options, lunchSet, destructMap));\n\n if (teachers?.some(teacher => 'lunch' in teacher || 'complementaryTimes' in teacher))\n data.events = (data.events ?? []).concat(getDynamicLockedTimes(teachers, settings, options, lunchSet));\n\n return data;\n};"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"days.js","names":["inherit: boolean","_days"],"sources":["../../../../../src/RS/v3/to/course-events/days.ts"],"sourcesContent":["import _days from '../days';\n\nimport { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"days.js","names":["inherit: boolean","_days"],"sources":["../../../../../src/RS/v3/to/course-events/days.ts"],"sourcesContent":["import _days from '../days';\n\nimport { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\nimport { ParsedOutOptions as OutOptions } from '../../types/out-options';\n\nexport default function (event: Deserialized<CoreTypes.event>,\n settings: CoreTypes.divisionSettings,\n options: OutOptions) {\n const inherit: boolean = event.days === null;\n\n if (inherit || !('days' in event)) {\n return undefined;\n } else {\n return { days: _days(event.days!, settings.numDays) };\n }\n}"],"mappings":";;;AAOA,wBAAyB,OACvB,UACA,SAAsB;CACtB,MAAMA,UAAmB,MAAM,SAAS;AAExC,KAAI,WAAW,EAAE,UAAU,OACzB,QAAO;KAEP,QAAO,EAAE,MAAMC,aAAM,MAAM,MAAO,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","names":["inherit: boolean","availableDependencies"],"sources":["../../../../../src/RS/v3/to/course-events/dependencies.ts"],"sourcesContent":["import { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"dependencies.js","names":["inherit: boolean","availableDependencies"],"sources":["../../../../../src/RS/v3/to/course-events/dependencies.ts"],"sourcesContent":["import { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\nimport { ParsedOutOptions as OutOptions } from '../../types/out-options';\n\nimport availableDependencies from '../available-dependencies';\n\nexport default function (event: Deserialized<CoreTypes.event>,\n options: OutOptions) {\n if (!('locations' in event))\n return undefined;\n\n const inherit: boolean = event.locations === null;\n\n if (inherit) {\n return undefined;\n }\n\n const dependencies = availableDependencies(event.locations!, options);\n return { dependencies: [...new Set(dependencies)] };\n}\n"],"mappings":";;;AAOA,8BAAyB,OACvB,SAAqB;AACrB,KAAI,EAAE,eAAe,OACnB,QAAO;CAET,MAAMA,UAAmB,MAAM,cAAc;AAE7C,KAAI,QACF,QAAO;CAGT,MAAM,eAAeC,+BAAsB,MAAM,WAAY;AAC7D,QAAO,EAAE,cAAc,CAAC,GAAG,IAAI,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups.js","names":[],"sources":["../../../../../src/RS/v3/to/course-events/groups.ts"],"sourcesContent":["import { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\nimport { Individual } from '../../types/individuals';\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"groups.js","names":[],"sources":["../../../../../src/RS/v3/to/course-events/groups.ts"],"sourcesContent":["import { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\nimport { Individual } from '../../types/individuals';\nimport { ParsedOutOptions as OutOptions } from '../../types/out-options';\nimport { mergeWithParentGroups } from '../util';\n\n/**\n * @description replaces groups references with their composites while taking into account excluded participants\n */\nexport function deconstructGroups (\n groups: NonNullable<Deserialized<CoreTypes.event>['groups']>,\n participantIds: { individuals: string | string[] }[],\n destructMap: Map<string | null, Individual>,\n options: OutOptions\n): NonNullable<Deserialized<CoreTypes.event>['groups']> {\n const idKey = options.idKey || 'id';\n\n // include and prioritize parent groups by replacing references to the same group\n\n if (destructMap.size) {\n groups = groups\n .map(group => {\n\n if (!group.exclude?.length) return group;\n\n const arr = [group.to[idKey]?.toString()].concat(group.exclude.map(y => y[idKey]?.toString()!));\n const key = arr.sort().join('.');\n const destructed = destructMap.get(key);\n if (!destructed) return group;\n\n // push to array of participants\n participantIds.push({ individuals: destructed.id });\n return null;\n })\n .filter((x): x is NonNullable<typeof x> => x != null);\n }\n\n return groups;\n}\n\nexport function mapGroupReferences (\n source: Deserialized<CoreTypes.event> & Deserialized<CoreTypes.course>,\n options: OutOptions,\n destructMap: Map<string | null, Individual>\n) {\n const idKey = options.idKey || 'id';\n\n const teachers = (source.teachers ?? source.course?.teachers ?? []).filter(x => x.to != null); // filter out dead references\n const groups = (source.groups ?? source.course?.groups ?? []).filter(x => x.to != null); // filter out dead references\n const participants = (source.participants ?? source.course?.participants ?? []).filter(x => x.to != null); // filter out dead references\n\n const teacherIds = teachers .map(({ to }) => to[idKey]).filter((x): x is NonNullable<typeof x> => !!x)\n .map(x => ({ individuals: ['teachers.individuals.' + x.toString()] }));\n const participantIds = participants.map(({ to }) => to[idKey]).filter((x): x is NonNullable<typeof x> => !!x)\n .map(x => ({ individuals: ['persons.' + x.toString()] }));\n\n // merge the group references with their parent groups\n const groupReferences = mergeWithParentGroups(groups, options);\n\n const deconstructed = deconstructGroups(groupReferences, participantIds, destructMap, options);\n\n const groupIds = deconstructed.map(({ to }) => {\n const id = 'groups.' + to[idKey]?.toString();\n if (to.species == null) return { individuals: id };\n return id;\n });\n\n const out = [...new Set(teacherIds), ...new Set(groupIds), ...new Set(participantIds)].map(x => [x]);\n return out;\n}"],"mappings":";;;;;;AAUA,SAAgB,kBACd,QACA,gBACA,aACA,SACsD;CACtD,MAAM,QAAQ,QAAQ,SAAS;AAI/B,KAAI,YAAY,KACd,UAAS,OACN,KAAI,UAAS;AAEZ,MAAI,CAAC,MAAM,SAAS,OAAQ,QAAO;EAEnC,MAAM,MAAM,CAAC,MAAM,GAAG,QAAQ,YAAY,OAAO,MAAM,QAAQ,KAAI,MAAK,EAAE,QAAQ;EAClF,MAAM,MAAM,IAAI,OAAO,KAAK;EAC5B,MAAM,aAAa,YAAY,IAAI;AACnC,MAAI,CAAC,WAAY,QAAO;AAGxB,iBAAe,KAAK,EAAE,aAAa,WAAW;AAC9C,SAAO;IAER,QAAQ,MAAkC,KAAK;AAGpD,QAAO;;AAGT,SAAgB,mBACd,QACA,SACA,aACA;CACA,MAAM,QAAQ,QAAQ,SAAS;CAE/B,MAAM,YAAgB,OAAO,YAAgB,OAAO,QAAQ,YAAgB,IAAI,QAAO,MAAK,EAAE,MAAM;CACpG,MAAM,UAAgB,OAAO,UAAgB,OAAO,QAAQ,UAAgB,IAAI,QAAO,MAAK,EAAE,MAAM;CACpG,MAAM,gBAAgB,OAAO,gBAAgB,OAAO,QAAQ,gBAAgB,IAAI,QAAO,MAAK,EAAE,MAAM;CAEpG,MAAM,aAAiB,SAAa,KAAK,EAAE,SAAS,GAAG,QAAQ,QAAQ,MAAkC,CAAC,CAAC,GACxG,KAAI,OAAM,EAAE,aAAa,CAAC,0BAA0B,EAAE;CACzD,MAAM,iBAAiB,aAAa,KAAK,EAAE,SAAS,GAAG,QAAQ,QAAQ,MAAkC,CAAC,CAAC,GACxG,KAAI,OAAM,EAAE,aAAa,CAAC,aAAc,EAAE;CAG7C,MAAM,kBAAkB,sBAAsB,QAAQ;CAEtD,MAAM,gBAAgB,kBAAkB,iBAAiB,gBAAgB,aAAa;CAEtF,MAAM,WAAW,cAAc,KAAK,EAAE,SAAS;EAC7C,MAAM,KAAK,YAAY,GAAG,QAAQ;AAClC,MAAI,GAAG,WAAW,KAAM,QAAO,EAAE,aAAa;AAC9C,SAAO;;CAGT,MAAM,MAAM;EAAC,GAAG,IAAI,IAAI;EAAa,GAAG,IAAI,IAAI;EAAW,GAAG,IAAI,IAAI;GAAiB,KAAI,MAAK,CAAC;AACjG,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-locations.js","names":["idKey: Id","inherit: boolean","availableDependencies"],"sources":["../../../../../src/RS/v3/to/course-events/in-locations.ts"],"sourcesContent":["import availableDependencies from '../available-dependencies';\n\nimport { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\nimport { OutOptions,\n Id } from '../../types/out-options';\n\nexport default function (event: Deserialized<CoreTypes.event>, options: OutOptions) {\n const idKey: Id = options.idKey || 'id';\n\n if (!event)\n throw new Error('(RS::V3::To::CourseEvent::InLocations) Mapping in-locations failed due to event being undefined');\n\n const course = event.course;\n\n if (!course)\n throw new Error('(RS::V3::To::CourseEvent::InLocations) Mapping in-locations failed due to event course being undefined');\n\n const inherit: boolean = event.locations === null;\n\n const dependencies = inherit\n ? availableDependencies(course.locations!, options) :\n availableDependencies(event.locations!, options);\n\n const inLocation = event.inLocations || [];\n\n if (inLocation.length === dependencies.length) {\n return inLocation\n .map(x => typeof x === 'string' ? x : x?.[idKey]?.toString() ?? null);\n } else {\n return inLocation\n .map(x => typeof x === 'string' ? x : x?.[idKey]?.toString() ?? null)\n .concat(Array.from({ length: Math.max(dependencies.length - inLocation.length, 0) }).map(() => null as string | null));\n }\n}"],"mappings":";;;AAQA,8BAAyB,OAAsC,SAAqB;CAClF,MAAMA,QAAwB,QAAQ,SAAS;AAE/C,KAAI,CAAC,MACH,OAAM,IAAI,MAAM;CAElB,MAAM,SAAS,MAAM;AAErB,KAAI,CAAC,OACH,OAAM,IAAI,MAAM;CAElB,MAAMC,UAAwB,MAAM,cAAc;CAElD,MAAM,eAAe,UACjBC,+BAAsB,OAAO,WAAY,WAC3CA,+BAAsB,MAAM,WAAY;CAE1C,MAAM,aAAa,MAAM,eAAe;AAExC,KAAI,WAAW,WAAW,aAAa,OACrC,QAAO,WACJ,KAAI,MAAK,OAAO,MAAM,WAAW,IAAI,IAAI,QAAQ,cAAc;KAElE,QAAO,WACJ,KAAI,MAAK,OAAO,MAAM,WAAW,IAAI,IAAI,QAAQ,cAAc,MAC/D,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,aAAa,SAAS,WAAW,QAAQ,MAAM,UAAU"}
|
|
1
|
+
{"version":3,"file":"in-locations.js","names":["idKey: Id","inherit: boolean","availableDependencies"],"sources":["../../../../../src/RS/v3/to/course-events/in-locations.ts"],"sourcesContent":["import availableDependencies from '../available-dependencies';\n\nimport { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\nimport { ParsedOutOptions as OutOptions,\n Id } from '../../types/out-options';\n\nexport default function (event: Deserialized<CoreTypes.event>, options: OutOptions) {\n const idKey: Id = options.idKey || 'id';\n\n if (!event)\n throw new Error('(RS::V3::To::CourseEvent::InLocations) Mapping in-locations failed due to event being undefined');\n\n const course = event.course;\n\n if (!course)\n throw new Error('(RS::V3::To::CourseEvent::InLocations) Mapping in-locations failed due to event course being undefined');\n\n const inherit: boolean = event.locations === null;\n\n const dependencies = inherit\n ? availableDependencies(course.locations!, options) :\n availableDependencies(event.locations!, options);\n\n const inLocation = event.inLocations || [];\n\n if (inLocation.length === dependencies.length) {\n return inLocation\n .map(x => typeof x === 'string' ? x : x?.[idKey]?.toString() ?? null);\n } else {\n return inLocation\n .map(x => typeof x === 'string' ? x : x?.[idKey]?.toString() ?? null)\n .concat(Array.from({ length: Math.max(dependencies.length - inLocation.length, 0) }).map(() => null as string | null));\n }\n}"],"mappings":";;;AAQA,8BAAyB,OAAsC,SAAqB;CAClF,MAAMA,QAAwB,QAAQ,SAAS;AAE/C,KAAI,CAAC,MACH,OAAM,IAAI,MAAM;CAElB,MAAM,SAAS,MAAM;AAErB,KAAI,CAAC,OACH,OAAM,IAAI,MAAM;CAElB,MAAMC,UAAwB,MAAM,cAAc;CAElD,MAAM,eAAe,UACjBC,+BAAsB,OAAO,WAAY,WAC3CA,+BAAsB,MAAM,WAAY;CAE1C,MAAM,aAAa,MAAM,eAAe;AAExC,KAAI,WAAW,WAAW,aAAa,OACrC,QAAO,WACJ,KAAI,MAAK,OAAO,MAAM,WAAW,IAAI,IAAI,QAAQ,cAAc;KAElE,QAAO,WACJ,KAAI,MAAK,OAAO,MAAM,WAAW,IAAI,IAAI,QAAQ,cAAc,MAC/D,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,aAAa,SAAS,WAAW,QAAQ,MAAM,UAAU"}
|
|
@@ -2,12 +2,12 @@ import { Types } from "../../../../core/v2/types/index.js";
|
|
|
2
2
|
import { Deserialized } from "../../../../core/types/index.js";
|
|
3
3
|
import { CourseEvent } from "../../types/course-events.js";
|
|
4
4
|
import { Individual } from "../../types/individuals.js";
|
|
5
|
-
import {
|
|
5
|
+
import { ParsedOutOptions } from "../../types/out-options.js";
|
|
6
6
|
import moment from "moment";
|
|
7
7
|
|
|
8
8
|
//#region src/RS/v3/to/course-events/index.d.ts
|
|
9
9
|
|
|
10
|
-
declare function export_default(courseEvents: Deserialized<Types.event>[] | Deserialized<Types.event>, overlapGroups: Deserialized<Types.overlapGroup>[] | undefined, settings: Types.divisionSettings, options:
|
|
10
|
+
declare function export_default(courseEvents: Deserialized<Types.event>[] | Deserialized<Types.event>, overlapGroups: Deserialized<Types.overlapGroup>[] | undefined, settings: Types.divisionSettings, options: ParsedOutOptions, periodsMap: Map<string | undefined, number>, destructMap?: Map<string | null, Individual>): CourseEvent[];
|
|
11
11
|
//#endregion
|
|
12
12
|
export { export_default };
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["idKey: keyof CoreTypes.event","id","doc: CourseEvent","lockedTimes","breakLength","_dependencies","_meta","_days","_intervals"],"sources":["../../../../../src/RS/v3/to/course-events/index.ts"],"sourcesContent":["import moment from 'moment';\n\nimport breakLength from '../break-lengths';\nimport lockedTimes from '../locked-times';\n\nimport { CourseEvent } from '../../types/course-events';\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"index.js","names":["idKey: keyof CoreTypes.event","id","doc: CourseEvent","lockedTimes","breakLength","_dependencies","_meta","_days","_intervals"],"sources":["../../../../../src/RS/v3/to/course-events/index.ts"],"sourcesContent":["import moment from 'moment';\n\nimport breakLength from '../break-lengths';\nimport lockedTimes from '../locked-times';\n\nimport { CourseEvent } from '../../types/course-events';\nimport { ParsedOutOptions as OutOptions } from '../../types/out-options';\nimport { Individual } from '../../types/individuals';\n\nimport { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\n\nimport { mapGroupReferences } from './groups';\nimport _meta from './meta';\nimport _dependencies from './dependencies';\nimport _days from './days';\nimport _intervals from './intervals';\nimport { AvailableDependency } from '../../types/available-dependencies';\n\nexport function toDayAndStart (start: string | moment.Moment | Date) {\n return {\n start: parseFloat(moment.utc(start).format('HH.mm')),\n day: (moment.utc(start).day() + 6) % 7\n };\n}\n\nexport default function (\n courseEvents: Deserialized<CoreTypes.event>[] | Deserialized<CoreTypes.event>,\n overlapGroups: Deserialized<CoreTypes.overlapGroup>[] = [],\n settings: CoreTypes.divisionSettings,\n options: OutOptions,\n periodsMap: Map<string | undefined, number>,\n destructMap: Map<string | null, Individual> = new Map()\n): CourseEvent[] {\n const idKey: keyof CoreTypes.event = options.idKey ?? 'id';\n\n return (Array.isArray(courseEvents) ? courseEvents : [courseEvents])\n .map(event => {\n const id = (event[idKey] ?? event._id)?.toString();\n if (!id) return;\n\n let forcedOverlapId;\n if (event?.overlapSpecies != null) {\n const { species: _species = [] } = overlapGroups.find(({ id }) => event.overlapSpecies!.id == id) ?? {};\n const species = _species.find(({ to: { id }, toModel }) => (toModel == 'events' || toModel == 'courseevents') && event.id == id);\n if (species) forcedOverlapId = species.id;\n }\n\n if (event.period && periodsMap.size && !periodsMap.has(event.period.id)) {\n throw new Error(`(RS::V3::To::Collections) Course ${event[idKey]} has a period that does not exist`);\n }\n\n const duration = event.preferredDuration ?? event.duration;\n if (!duration) return;\n\n /*\n preferredDuration overrides duration\n */\n const doc: CourseEvent = {\n id: `events.${ id }`,\n // temporary, should be preferred duration only!\n length: duration,\n // optional\n ...event.durationVariance != null && { maxLengthVariance: event.durationVariance },\n ...'weight' in event && { weight: event.weight },\n ...'density' in event && { density: event.density },\n ...event.lockedTimes?.length && { lockedTimes: lockedTimes((event.lockedTimes), options) },\n ...(event.minBreakLength != null) && { minBreakLength: breakLength(event.minBreakLength) },\n ...event.centerOfAttraction && { potentialCenter: parseFloat(event.centerOfAttraction.replace(':', '.')) },\n ...(forcedOverlapId != null) && { forcedOverlapId },\n ...event.period && periodsMap.size && { period: periodsMap.get(event.period?.id) },\n };\n\n const groups = mapGroupReferences(event, options, destructMap);\n if (groups) doc.groups = groups;\n\n const dependencies = _dependencies(event, options);\n if (dependencies)\n Object.assign(doc, dependencies);\n\n if (options.meta) {\n Object.assign(doc, _meta(event, options));\n }\n\n const days = _days(event, settings, options);\n if (days)\n Object.assign(doc, days);\n\n const intervals = _intervals(event, settings, options);\n if (intervals)\n Object.assign(doc, intervals);\n\n if (event.fixedStart && event.start) {\n Object.assign(doc, toDayAndStart(event.start));\n }\n\n ////\n //// filter events based on partialScheduleOptions\n ////\n if (options.partialScheduleOptions) {\n const { includedEvents, omittedEventsHandling } = options.partialScheduleOptions;\n if (includedEvents && !includedEvents.has(doc.id)) {\n\n if (omittedEventsHandling == 'ignore') return;\n\n if (omittedEventsHandling == 'freeze') {\n // must not be parked and have a start and duration to be frozen, otherwise it's ignored\n if (event.parked || !event.start || !event.duration) return;\n\n // fix day, start and end\n Object.assign(doc, toDayAndStart(event.start));\n doc.length = event.duration;\n doc.maxLengthVariance = 0;\n\n // override intervals and days to not cause conflicts\n const numDays = settings.numDays ?? 5;\n doc.days = Array.from({ length: numDays }, (_, i) => i);\n doc.intervals = Array.from({ length: numDays }, () => [{ beg: 0, end: 23.55 }]);\n\n // fix locations\n doc.dependencies = (event.inLocations ?? [])\n .map(x => {\n const id = typeof x === 'string' ? x : x?.[idKey]?.toString();\n if (!id) return;\n\n const includedLocations = options.partialScheduleOptions?.includedLocations;\n if (includedLocations && !includedLocations.has(id)) return;\n\n return [{ dependency: id }] as AvailableDependency[];\n })\n .filter((x): x is NonNullable<typeof x> => !!x);\n }\n\n }\n }\n\n return doc;\n })\n .filter((x): x is NonNullable<typeof x> => !!x);\n}"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervals.js","names":["_intervals"],"sources":["../../../../../src/RS/v3/to/course-events/intervals.ts"],"sourcesContent":["import _intervals from '../intervals';\n\nimport { Types as CoreTypes } from '../../../../core/types';\n\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"intervals.js","names":["_intervals"],"sources":["../../../../../src/RS/v3/to/course-events/intervals.ts"],"sourcesContent":["import _intervals from '../intervals';\n\nimport { Types as CoreTypes } from '../../../../core/types';\n\nimport { ParsedOutOptions as OutOptions } from '../../types/out-options';\n\nexport default function (event: CoreTypes.event,\n settings: CoreTypes.divisionSettings,\n options: OutOptions) {\n\n if (event.intervals?.length)\n return { intervals: _intervals(event.intervals, settings) };\n return undefined;\n}"],"mappings":";;;AAMA,6BAAyB,OACvB,UACA,SAAsB;AAEtB,KAAI,MAAM,WAAW,OACnB,QAAO,EAAE,WAAWA,kBAAW,MAAM,WAAW;AAClD,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","names":["meta: Meta","_inLocations"],"sources":["../../../../../src/RS/v3/to/course-events/meta.ts"],"sourcesContent":["import moment from 'moment';\n\nimport { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\nimport { OutOptions,\n Id } from '../../types/out-options';\n\nimport _inLocations from './in-locations';\n\ntype Meta = {\n course?: string;\n name?: string;\n ids?: string;\n parked?: boolean;\n visible?: boolean;\n start?: moment.Moment;\n end?: moment.Moment;\n inLocations?: (string | null)[];\n};\n\nexport default function (event: Deserialized<CoreTypes.event>,\n options: OutOptions): Meta {\n const idKey: Id = options.idKey || 'id';\n\n const meta: Meta = {\n ...event.displayName && { name: event.displayName },\n ...event.hasOwnProperty('ids') && { ids: event.ids },\n ...event.hasOwnProperty('parked') && { parked: event.parked },\n ...event.hasOwnProperty('visible') && { visible: event.visible },\n ...event.hasOwnProperty('start') && { startDate: event.start as moment.Moment },\n ...event.hasOwnProperty('end') && { endDate: event.end as moment.Moment },\n };\n\n if (event.course?.id)\n meta.course = event.course.id;\n\n if (event.inLocations)\n meta.inLocations = _inLocations(event, options);\n\n return meta;\n}"],"mappings":";;;AAqBA,sBAAyB,OACvB,SAA2B;AACG,SAAQ;CAEtC,MAAMA,OAAa;EACjB,GAAG,MAAM,eAAoC,EAAE,MAAgB,MAAM;EACrE,GAAG,MAAM,eAAe,UAAqB,EAAE,KAAgB,MAAM;EACrE,GAAG,MAAM,eAAe,aAAqB,EAAE,QAAgB,MAAM;EACrE,GAAG,MAAM,eAAe,cAAqB,EAAE,SAAgB,MAAM;EACrE,GAAG,MAAM,eAAe,YAAqB,EAAE,WAAgB,MAAM;EACrE,GAAG,MAAM,eAAe,UAAqB,EAAE,SAAgB,MAAM;;AAGvE,KAAI,MAAM,QAAQ,GAChB,MAAK,SAAc,MAAM,OAAO;AAElC,KAAI,MAAM,YACR,MAAK,cAAcC,qBAAa,OAAO;AAEzC,QAAO"}
|
|
1
|
+
{"version":3,"file":"meta.js","names":["meta: Meta","_inLocations"],"sources":["../../../../../src/RS/v3/to/course-events/meta.ts"],"sourcesContent":["import moment from 'moment';\n\nimport { Types as CoreTypes } from '../../../../core/types';\nimport { Deserialized } from '../../../../core/types';\n\nimport { ParsedOutOptions as OutOptions,\n Id } from '../../types/out-options';\n\nimport _inLocations from './in-locations';\n\ntype Meta = {\n course?: string;\n name?: string;\n ids?: string;\n parked?: boolean;\n visible?: boolean;\n start?: moment.Moment;\n end?: moment.Moment;\n inLocations?: (string | null)[];\n};\n\nexport default function (event: Deserialized<CoreTypes.event>,\n options: OutOptions): Meta {\n const idKey: Id = options.idKey || 'id';\n\n const meta: Meta = {\n ...event.displayName && { name: event.displayName },\n ...event.hasOwnProperty('ids') && { ids: event.ids },\n ...event.hasOwnProperty('parked') && { parked: event.parked },\n ...event.hasOwnProperty('visible') && { visible: event.visible },\n ...event.hasOwnProperty('start') && { startDate: event.start as moment.Moment },\n ...event.hasOwnProperty('end') && { endDate: event.end as moment.Moment },\n };\n\n if (event.course?.id)\n meta.course = event.course.id;\n\n if (event.inLocations)\n meta.inLocations = _inLocations(event, options);\n\n return meta;\n}"],"mappings":";;;AAqBA,sBAAyB,OACvB,SAA2B;AACG,SAAQ;CAEtC,MAAMA,OAAa;EACjB,GAAG,MAAM,eAAoC,EAAE,MAAgB,MAAM;EACrE,GAAG,MAAM,eAAe,UAAqB,EAAE,KAAgB,MAAM;EACrE,GAAG,MAAM,eAAe,aAAqB,EAAE,QAAgB,MAAM;EACrE,GAAG,MAAM,eAAe,cAAqB,EAAE,SAAgB,MAAM;EACrE,GAAG,MAAM,eAAe,YAAqB,EAAE,WAAgB,MAAM;EACrE,GAAG,MAAM,eAAe,UAAqB,EAAE,SAAgB,MAAM;;AAGvE,KAAI,MAAM,QAAQ,GAChB,MAAK,SAAc,MAAM,OAAO;AAElC,KAAI,MAAM,YACR,MAAK,cAAcC,qBAAa,OAAO;AAEzC,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","names":["res: Default"],"sources":["../../../../src/RS/v3/to/default.ts"],"sourcesContent":["import { Default } from '../types/default';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"default.js","names":["res: Default"],"sources":["../../../../src/RS/v3/to/default.ts"],"sourcesContent":["import { Default } from '../types/default';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { ParsedOutOptions as OutOptions } from '../types/out-options';\nimport { min2hrs } from './util';\n\nfunction toTime (str: string) {\n return parseFloat(str.replace(':', '.'));\n}\n\nexport default (\n settings: Deserialized<CoreTypes.divisionSettings>,\n periodMap: Map<string | undefined, number>,\n options: OutOptions\n) => {\n\n\n const { dayStart, dayEnd } = settings;\n\n if (!dayStart) throw new Error('(RS::V3::To::Default) \"dayStart\" is falsy');\n if (!dayEnd) throw new Error('(RS::V3::To::Default) \"dayEnd\" is falsy');\n\n if (periodMap.size && !periodMap.has(settings.period?.id)) throw new Error('(RS::V3::To::Default) \"period\" is not in periodMap');\n\n const maxNumWorkingHours = options.useMaximumScheduleSpan\n ? min2hrs(settings.defaultMaximumScheduleSpan?.daily) ?? false\n : settings.defaultMaxNumWorkingHours ?? false;\n\n const maxNumDailyWorkingHours = options.useMaximumScheduleSpan\n ? min2hrs(settings.defaultMaximumScheduleSpan?.daily) ?? false\n : settings.defaultMaxNumDailyWorkingHours ?? false;\n\n const res: Default = {\n intervals: [[{ beg: toTime(dayStart), end: toTime(dayEnd) }]],\n\n groupMinBreakLength: settings.defaultGroupMinimumBreakLength ?? 0,\n dependencyMinBreakLength: settings.defaultDependencyMinimumBreakLength ?? 0,\n eventMinBreakLength: settings.defaultEventMinimumBreakLength ?? 0,\n\n potentialCenter: toTime(settings.potentialCenter ?? '12:00'),\n eventDensity: settings.defaultEventDensity ?? 0,\n\n maxEventLengthVariance: settings.defaultEventDurationVariance ?? 0,\n\n maxNumWorkingHours: maxNumWorkingHours,\n maxNumDailyWorkingHours: maxNumDailyWorkingHours,\n\n dependencyRank: settings.defaultDependencyRank ?? 0,\n groupRank: settings.defaultGroupRank ?? 0,\n dayRank: settings.defaultDayRank ?? 0,\n\n groupWeight: settings.defaultGroupWeight ?? 0,\n collectionWeight: settings.defaultCourseWeight ?? 0,\n eventWeight: settings.defaultEventWeight ?? 0,\n\n ...periodMap.size && { period: periodMap.get(settings.period?.id)! }\n };\n\n return res;\n};"],"mappings":";;;AAOA,SAAS,OAAQ,KAAa;AAC5B,QAAO,WAAW,IAAI,QAAQ,KAAK;;AAGrC,uBACE,UACA,WACA,YACG;CAGH,MAAM,EAAE,UAAU,WAAW;AAE7B,KAAI,CAAC,SAAU,OAAM,IAAI,MAAM;AAC/B,KAAI,CAAC,OAAU,OAAM,IAAI,MAAM;AAE/B,KAAI,UAAU,QAAQ,CAAC,UAAU,IAAI,SAAS,QAAQ,IAAK,OAAM,IAAI,MAAM;CAE3E,MAAM,qBAAqB,QAAQ,yBAC/B,QAAQ,SAAS,4BAA4B,UAAU,QACvD,SAAS,6BAA8C;CAE3D,MAAM,0BAA0B,QAAQ,yBACpC,QAAQ,SAAS,4BAA4B,UAAU,QACvD,SAAS,kCAA8C;CAE3D,MAAMA,MAAe;EACnB,WAAW,CAAC,CAAC;GAAE,KAAK,OAAO;GAAW,KAAK,OAAO;;EAElD,qBAA0B,SAAS,kCAAuC;EAC1E,0BAA0B,SAAS,uCAAuC;EAC1E,qBAA0B,SAAS,kCAAuC;EAE1E,iBAAiB,OAAO,SAAS,mBAAuC;EACxE,cAAiB,SAAS,uBAAuC;EAEjE,wBAAwB,SAAS,gCAAuC;EAE/C;EACA;EAEzB,gBAAgB,SAAS,yBAAuC;EAChE,WAAgB,SAAS,oBAAuC;EAChE,SAAgB,SAAS,kBAAuC;EAEhE,aAAkB,SAAS,sBAAuC;EAClE,kBAAkB,SAAS,uBAAuC;EAClE,aAAkB,SAAS,sBAAuC;EAElE,GAAG,UAAU,QAAQ,EAAE,QAAQ,UAAU,IAAI,SAAS,QAAQ;;AAGhE,QAAO"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Types } from "../../../core/v2/types/index.js";
|
|
2
2
|
import { Deserialized } from "../../../core/types/index.js";
|
|
3
3
|
import { Dependency } from "../types/dependencies.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ParsedOutOptions } from "../types/out-options.js";
|
|
5
5
|
|
|
6
6
|
//#region src/RS/v3/to/dependencies.d.ts
|
|
7
|
-
declare function export_default(locations: Deserialized<Types.location>[], settings: Types.divisionSettings, options:
|
|
7
|
+
declare function export_default(locations: Deserialized<Types.location>[], settings: Types.divisionSettings, options: ParsedOutOptions): Dependency[];
|
|
8
8
|
//#endregion
|
|
9
9
|
export { export_default };
|
|
10
10
|
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","names":["idKey: keyof CoreTypes.location","doc: Dependency","days","breakLengths","lockedTimes"],"sources":["../../../../src/RS/v3/to/dependencies.ts"],"sourcesContent":["import days from './days';\nimport lockedTimes from './locked-times';\nimport breakLengths from './break-lengths';\n\nimport { Dependency } from '../types/dependencies';\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"dependencies.js","names":["idKey: keyof CoreTypes.location","doc: Dependency","days","breakLengths","lockedTimes"],"sources":["../../../../src/RS/v3/to/dependencies.ts"],"sourcesContent":["import days from './days';\nimport lockedTimes from './locked-times';\nimport breakLengths from './break-lengths';\n\nimport { Dependency } from '../types/dependencies';\nimport { ParsedOutOptions as OutOptions } from '../types/out-options';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\n\nexport default function (\n locations: Deserialized<CoreTypes.location>[],\n settings: CoreTypes.divisionSettings,\n options: OutOptions\n) {\n const idKey: keyof CoreTypes.location = options.idKey || 'id';\n\n if (locations == null) return [];\n\n return (Array.isArray(locations) ? locations : [locations])\n .map((location, index) => {\n const id = location[idKey]?.toString();\n if (!id) {\n throw new Error(`(RS::V3::To::Dependencies) A location must have an id, index: ${ index }`);\n }\n\n // filter location references based on partial schedule options\n const includedLocations = options.partialScheduleOptions?.includedLocations;\n if (includedLocations && !includedLocations.has(id)) return;\n\n const doc: Dependency = {\n id: location[idKey]!.toString(),\n ...location.area && { area: location.area },\n ...location.days?.length && { days: days(location.days, settings.numDays) },\n ...(location.minBreakLength != null) && { minBreakLength: breakLengths(location.minBreakLength) as number },\n ...location.lockedTimes?.length && { lockedTimes: lockedTimes(location.lockedTimes, options) }\n };\n\n if (options.meta) {\n Object.assign(doc, {\n ...location.ids && { ids: location.ids },\n ...location.displayName && { name: location.displayName }\n });\n }\n\n return doc;\n })\n .filter((x): x is NonNullable<typeof x> => !!x);\n}"],"mappings":";;;;;AAUA,8BACE,WACA,UACA,SACA;CACA,MAAMA,QAAkC,QAAQ,SAAS;AAEzD,KAAI,aAAa,KAAM,QAAO;AAE9B,SAAQ,MAAM,QAAQ,aAAa,YAAY,CAAC,YAC7C,KAAK,UAAU,UAAU;EACxB,MAAM,KAAK,SAAS,QAAQ;AAC5B,MAAI,CAAC,GACH,OAAM,IAAI,MAAM,iEAAkE;EAIpF,MAAM,oBAAoB,QAAQ,wBAAwB;AAC1D,MAAI,qBAAqB,CAAC,kBAAkB,IAAI,IAAK;EAErD,MAAMC,MAAkB;GACtB,IAAI,SAAS,OAAQ;GACrB,GAAG,SAAS,QAA4B,EAAE,MAAgB,SAAS;GACnE,GAAG,SAAS,MAAM,UAAsB,EAAE,MAAgBC,aAAK,SAAS,MAAM,SAAS;GACvF,GAAI,SAAS,kBAAkB,QAAS,EAAE,gBAAgBC,sBAAa,SAAS;GAChF,GAAG,SAAS,aAAa,UAAe,EAAE,aAAgBC,qBAAY,SAAS,aAAa;;AAG9F,MAAI,QAAQ,KACV,QAAO,OAAO,KAAK;GACjB,GAAG,SAAS,OAA0B,EAAE,KAAgB,SAAS;GACjE,GAAG,SAAS,eAA0B,EAAE,MAAgB,SAAS;;AAIrE,SAAO;IAER,QAAQ,MAAkC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destructure.js","names":["idKey: keyof CoreTypes.course"],"sources":["../../../../src/RS/v3/to/destructure.ts"],"sourcesContent":["import { OutOptions
|
|
1
|
+
{"version":3,"file":"destructure.js","names":["idKey: keyof CoreTypes.course"],"sources":["../../../../src/RS/v3/to/destructure.ts"],"sourcesContent":["import { ParsedOutOptions as OutOptions } from '../types/out-options';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { groupsToIndividuals } from './individuals';\nimport { Individual } from '../types/individuals';\nimport { mergeWithParentGroups } from './util';\n\nexport default (\n courses: Deserialized<CoreTypes.course> | Deserialized<CoreTypes.course>[],\n events: Deserialized<CoreTypes.event> | Deserialized<CoreTypes.event>[] = [],\n groups: Deserialized<CoreTypes.group>[] = [],\n settings: CoreTypes.divisionSettings,\n options: OutOptions\n) => {\n\n const groupMembersMap = new Map<string, Set<Deserialized<CoreTypes.person>>>();\n groups.forEach(group => groupMembersMap.set(group.id!, new Set(group.members)));\n const destructMap = new Map<string | null, Individual>();\n\n const idKey: keyof CoreTypes.course = options.idKey || 'id';\n\n courses = Array.isArray(courses) ? courses : [courses];\n events = Array.isArray(events) ? events : [events];\n /*\n if a person is excluded or included add said person to list of groups and decompose every instance of the group\n into two parts. one with the person and one with the remainder of the group\n [g_m] => [(g_m-p_i), p_i]\n */\n courses.concat(events).forEach(source => {\n if (!source[idKey])\n throw new Error('(RS::V3::To::Destructure) A course/event does not have a unique key');\n\n if (!source.groups) return;\n /*\n destructure every group with persons excluded\n this should become a new individuals group\n */\n\n // merge the group references with their parent groups\n const groupReferences = mergeWithParentGroups(source.groups, options);\n\n groupReferences.forEach(x => {\n if (!x.exclude?.length) return;\n const arr = [x.to[idKey]?.toString()].concat(x.exclude.map(y => y[idKey]?.toString()!));\n const key = arr.sort().join('.');\n if (destructMap.has(key)) return;\n const group = groupsToIndividuals({\n [idKey]: key,\n members: Array.from(groupMembersMap.get(x.to.id!)!).filter(y => !x.exclude?.some(z => z[idKey]?.toString() == y[idKey]?.toString()))\n }, settings, options)[0];\n destructMap.set(key, group);\n });\n });\n\n return destructMap;\n};"],"mappings":";;;;AAQA,2BACE,SACA,SAA4E,IAC5E,SAA4C,IAC5C,UACA,YACG;CAEH,MAAM,kCAAkB,IAAI;AAC5B,QAAO,SAAQ,UAAS,gBAAgB,IAAI,MAAM,IAAK,IAAI,IAAI,MAAM;CACrE,MAAM,8BAAc,IAAI;CAExB,MAAMA,QAAgC,QAAQ,SAAS;AAEvD,WAAU,MAAM,QAAQ,WAAW,UAAU,CAAC;AAC9C,UAAU,MAAM,QAAQ,UAAW,SAAU,CAAC;AAM9C,SAAQ,OAAO,QAAQ,SAAQ,WAAU;AACvC,MAAI,CAAC,OAAO,OACV,OAAM,IAAI,MAAM;AAElB,MAAI,CAAC,OAAO,OAAQ;EAOpB,MAAM,kBAAkB,sBAAsB,OAAO,QAAQ;AAE7D,kBAAgB,SAAQ,MAAK;AAC3B,OAAI,CAAC,EAAE,SAAS,OAAQ;GACxB,MAAM,MAAM,CAAC,EAAE,GAAG,QAAQ,YAAY,OAAO,EAAE,QAAQ,KAAI,MAAK,EAAE,QAAQ;GAC1E,MAAM,MAAM,IAAI,OAAO,KAAK;AAC5B,OAAI,YAAY,IAAI,KAAM;GAC1B,MAAM,QAAQ,oBAAoB;KAC/B,QAAQ;IACT,SAAS,MAAM,KAAK,gBAAgB,IAAI,EAAE,GAAG,KAAO,QAAO,MAAK,CAAC,EAAE,SAAS,MAAK,MAAK,EAAE,QAAQ,cAAc,EAAE,QAAQ;MACvH,UAAU,SAAS;AACtB,eAAY,IAAI,KAAK;;;AAIzB,QAAO"}
|
|
@@ -45,6 +45,7 @@ var dynamic_locked_times_default = (docs, settings, options, set, destructMap) =
|
|
|
45
45
|
let days = intervals?.length ? intervals.map(({ start }) => (moment(start).day() + 6) % 7) : void 0;
|
|
46
46
|
if (days) days = [...new Set(days)];
|
|
47
47
|
const day = days?.length == 1 ? days[0] : void 0;
|
|
48
|
+
if (day != null && group.days?.length && !group.days.some((x) => x.day == day)) return acc$1;
|
|
48
49
|
const groups = mapCoalescedReferences(coalesced, options, destructMap);
|
|
49
50
|
const distributionKey = lockedTime.type == "COMPLEMENTARY_TIME" ? "COMPLEMENTARY_TIME." + lockedTime.tags?.at(0)?.value : void 0;
|
|
50
51
|
const doc = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-locked-times.js","names":["idKey: 'id' | '_id' | 'ids'","lunch","id: string","acc","doc: CourseEvent","_intervals"],"sources":["../../../../src/RS/v3/to/dynamic-locked-times.ts"],"sourcesContent":["import moment from 'moment';\nimport { nanoid } from 'nanoid';\nimport { pick } from 'lodash-es';\n\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"dynamic-locked-times.js","names":["idKey: 'id' | '_id' | 'ids'","lunch","id: string","acc","doc: CourseEvent","_intervals"],"sources":["../../../../src/RS/v3/to/dynamic-locked-times.ts"],"sourcesContent":["import moment from 'moment';\nimport { nanoid } from 'nanoid';\nimport { pick } from 'lodash-es';\n\nimport { ParsedOutOptions as OutOptions } from '../types/out-options';\nimport { CourseEvent } from '../types/course-events';\nimport { Individual } from '../types/individuals';\n\nimport _intervals from './intervals';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { toDayAndStart } from './course-events';\n\nfunction mapCoalescedReferences (\n coalesced: Deserialized<CoreTypes.lockedTime>['coalesced'],\n options: OutOptions,\n destructMap?: Map<string | null, Individual>\n) {\n const idKey = options.idKey || 'id';\n\n if (!coalesced) return [];\n\n const teachers = coalesced.filter(x => x.toModel == 'teachers');\n const groups = coalesced.filter(x => x.toModel == 'groups');\n const participants = coalesced.filter(x => x.toModel == 'persons');\n\n const teacherIds = teachers .map(({ to }) => to[idKey]).filter((x): x is NonNullable<typeof x> => !!x)\n .map(x => ({ individuals: ['teachers.individuals.' + x.toString()] }));\n const groupIds = groups .map(({ to }) => to[idKey]).filter((x): x is NonNullable<typeof x> => !!x)\n .map(x => 'groups.' + x.toString());\n const participantIds = participants.map(({ to }) => to[idKey]).filter((x): x is NonNullable<typeof x> => !!x)\n .map(x => ({ individuals: ['persons.' + x.toString()] }));\n\n\n const out = [...new Set(teacherIds), ...new Set(groupIds), ...new Set(participantIds)].map(x => [x]);\n return out;\n}\n\nexport default (\n docs: (Deserialized<CoreTypes.group> | Deserialized<CoreTypes.teacher>)[],\n settings: Deserialized<CoreTypes.divisionSettings>,\n options: OutOptions,\n set: Set<string>,\n destructMap?: Map<string | null, Individual>\n) => {\n //let docs: SourceLockedTime[] = (Array.isArray(lockedTimes) ? lockedTimes : [lockedTimes]);\n const idKey: 'id' | '_id' | 'ids' = (options.idKey ?? 'id');\n\n return docs\n .filter(x => !!x)\n .reduce((acc: CourseEvent[], group): CourseEvent[] => {\n let lunch = group.lunch;\n if (lunch == null) {\n lunch = settings.defaultLunch?.map(lunch => ({ ...lunch, coalesced: [{ to: pick(group, idKey), toModel: '' }] }));\n }\n\n if ('complementaryTimes' in group) {\n lunch = lunch?.concat(group.complementaryTimes ?? []);\n }\n\n if (lunch == null)\n return acc;\n\n return acc.concat(\n lunch.reduce((acc: CourseEvent[], lockedTime) => {\n\n const { _id, intervals, duration, durationVariance, coalesced } = lockedTime;\n\n const id: string = (lockedTime[idKey as keyof CoreTypes.lockedTime] || _id)?.toString() ?? nanoid();\n\n if (set.has(id))\n return acc;\n\n set.add(id);\n\n if (duration == null)\n throw new Error('(RS::V3::To::DynamicLockedTimes) Length of a locked time is null');\n\n if (duration < 5)\n throw new Error('(RS::V3::To::DynamicLockedTimes) Length of a locked time is less than 5 min');\n\n if (!coalesced)\n throw new Error('(RS::V3::To::DynamicLockedTimes) Length of a locked time is less than 5 min');\n\n /*\n find the day(s) the events should be placed on\n */\n let days = intervals?.length\n ? intervals.map(({ start }) => (moment(start).day() + 6) % 7)\n : undefined;\n if (days) days = [...new Set(days)];\n const day = days?.length == 1 ? days[0] : undefined;\n\n // ignore locked times that reside on days that are not part of the group's days\n if (day != null && group.days?.length && !group.days.some(x => x.day == day)) return acc;\n\n const groups = mapCoalescedReferences(coalesced, options, destructMap);\n\n const distributionKey = lockedTime.type == 'COMPLEMENTARY_TIME'\n ? 'COMPLEMENTARY_TIME.' + lockedTime.tags?.at(0)?.value\n : undefined;\n\n\n const doc: CourseEvent = {\n id: `${ group.lunch == null ? 'virtual' : 'lockedTimes' }.${ id }`,\n groups: [...new Set(groups.filter(Boolean))],\n dependencies: [...new Set(coalesced.filter(x => x.toModel == 'locations').map(({ to }) => to[idKey]?.toString()!)\n .filter(Boolean))].map(x => [x]),\n length: duration,\n minBreakLength: false,\n intervals: intervals?.length ? _intervals(intervals, settings) : undefined,\n ...distributionKey && { distributionKey },\n ...days && { days },\n ...day && { day },\n ...durationVariance != null && { maxLengthVariance: durationVariance },\n };\n\n\n\n ////\n //// filter events based on partialScheduleOptions\n ////\n if (options.partialScheduleOptions) {\n const { includedEvents, omittedEventsHandling } = options.partialScheduleOptions;\n if (includedEvents && !includedEvents.has(doc.id)) {\n\n if (omittedEventsHandling == 'ignore') return acc;\n\n if (omittedEventsHandling == 'freeze') {\n // must not be parked and have a start and duration to be frozen, otherwise it's ignored\n if (lockedTime.parked || !lockedTime.start || !lockedTime.duration) return acc;\n\n // fix day, start and end\n Object.assign(doc, toDayAndStart(lockedTime.start));\n doc.length = lockedTime.duration;\n doc.maxLengthVariance = 0;\n\n // override intervals and days to not cause conflicts\n const numDays = settings.numDays ?? 5;\n doc.days = Array.from({ length: numDays }, (_, i) => i);\n doc.intervals = Array.from({ length: numDays }, () => [{ beg: 0, end: 23.55 }]);\n\n // fix locations\n // > locations are always fixed for locked times\n }\n }\n }\n\n return acc.concat(doc);\n }, []));\n\n }, [])\n .flat()\n .filter(Boolean);\n};"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups.js","names":["idKey: keyof CoreTypes.group","doc: Group","intervals","days","lockedTimes","breakLengths"],"sources":["../../../../src/RS/v3/to/groups.ts"],"sourcesContent":["import breakLengths from './break-lengths';\nimport days from './days';\nimport lockedTimes from './locked-times';\nimport intervals from './intervals';\n\nimport { Group } from '../types/groups';\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"groups.js","names":["idKey: keyof CoreTypes.group","doc: Group","intervals","days","lockedTimes","breakLengths"],"sources":["../../../../src/RS/v3/to/groups.ts"],"sourcesContent":["import breakLengths from './break-lengths';\nimport days from './days';\nimport lockedTimes from './locked-times';\nimport intervals from './intervals';\n\nimport { Group } from '../types/groups';\nimport { ParsedOutOptions as OutOptions } from '../types/out-options';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { parseMaxWorkingHours } from './util';\n\nexport default (\n groups: Deserialized<CoreTypes.group>[] | Deserialized<CoreTypes.group>,\n settings: CoreTypes.divisionSettings,\n options: OutOptions\n): Group[] => {\n if (groups == null)\n return [];\n\n const idKey: keyof CoreTypes.group = options.idKey || 'id';\n\n return (Array.isArray(groups) ? groups : [groups])\n .filter(group => group.species == 'class')\n .map((group, index) => {\n\n if (group[idKey] == undefined) throw new Error(`(RS::V3::To::Groups) A group must have an id, index: ${ index }`);\n\n const hasIntervals = Boolean(group.intervals?.length || (group.rootInterval ?? settings.defaultRootInterval));\n\n const doc: Group = {\n id: `groups.${ group[idKey]!.toString() }`,\n group_type: 'classes',\n ...parseMaxWorkingHours(group, options),\n ...'weight' in group && { weight: group.weight },\n ...hasIntervals && { intervals: intervals(group.intervals, settings, group.rootInterval ?? settings.defaultRootInterval as CoreTypes.rootInterval) },\n ...(group.days?.length) && { days: days(group.days, settings.numDays) },\n ...(group.lockedTimes?.length) && { lockedTimes: lockedTimes(group.lockedTimes, options) },\n ...(group.minBreakLength != null) && { minBreakLength: breakLengths(group.minBreakLength) },\n minimizeGaps: true,\n minimizeDependencyAlternation: false,\n };\n\n if (options.meta) {\n Object.assign(doc, {\n ...group.ids && { ids: group.ids },\n ...group.displayName && { name: group.displayName },\n });\n }\n\n return doc;\n }, []);\n};\n"],"mappings":";;;;;;;AAYA,sBACE,QACA,UACA,YACY;AACZ,KAAI,UAAU,KACZ,QAAO;CAET,MAAMA,QAA+B,QAAQ,SAAS;AAEtD,SAAQ,MAAM,QAAQ,UAAU,SAAS,CAAC,SACvC,QAAO,UAAS,MAAM,WAAW,SACjC,KAAK,OAAO,UAAU;AAErB,MAAI,MAAM,UAAU,OAAW,OAAM,IAAI,MAAM,wDAAyD;EAExG,MAAM,eAAe,QAAQ,MAAM,WAAW,WAAW,MAAM,gBAAgB,SAAS;EAExF,MAAMC,MAAa;GACjB,IAA+B,UAAW,MAAM,OAAQ;GACxD,YAA+B;GAC/B,GAAG,qBAAqB,OAAO;GAC/B,GAAG,YAAgC,SAAS,EAAE,QAA4B,MAAM;GAChF,GAAG,gBAAyC,EAAE,WAA4BC,kBAAU,MAAM,WAAW,UAAU,MAAM,gBAAgB,SAAS;GAC9I,GAAI,MAAM,MAAM,UAA4B,EAAE,MAA4BC,aAAK,MAAM,MAAM,SAAS;GACpG,GAAI,MAAM,aAAa,UAAqB,EAAE,aAA4BC,qBAAY,MAAM,aAAa;GACzG,GAAI,MAAM,kBAAkB,QAAgB,EAAE,gBAA4BC,sBAAa,MAAM;GAC7F,cAA+B;GAC/B,+BAA+B;;AAGjC,MAAI,QAAQ,KACV,QAAO,OAAO,KAAK;GACjB,GAAG,MAAM,OAAiC,EAAE,KAA4B,MAAM;GAC9E,GAAG,MAAM,eAAiC,EAAE,MAA4B,MAAM;;AAIlF,SAAO;IACN"}
|
package/dist/RS/v3/to/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { DivisionSettings } from "../../../core/v2/types/division-settings.js";
|
|
|
13
13
|
import { Division } from "../../../core/v2/types/divisions.js";
|
|
14
14
|
import { Types as Types$1 } from "../../../core/v2/types/index.js";
|
|
15
15
|
import { Deserialized, Serialized } from "../../../core/types/index.js";
|
|
16
|
+
import { AlgorithmWeightParameters } from "../types/algorithm-parameters.js";
|
|
16
17
|
import { Configuration } from "../types/configurations.js";
|
|
17
18
|
import { Settings } from "../types/settings.js";
|
|
18
19
|
import { LockedTime as LockedTime$1 } from "../types/locked-times.js";
|
|
@@ -21,7 +22,7 @@ import { Collection } from "../types/collections.js";
|
|
|
21
22
|
import { Group } from "../types/groups.js";
|
|
22
23
|
import { Individual } from "../types/individuals.js";
|
|
23
24
|
import { Constraint } from "../types/constraints.js";
|
|
24
|
-
import { OutOptions } from "../types/out-options.js";
|
|
25
|
+
import { OutOptions, ParsedOutOptions } from "../types/out-options.js";
|
|
25
26
|
import { export_default } from "./available-dependencies.js";
|
|
26
27
|
import { export_default as export_default$1 } from "./course-events/index.js";
|
|
27
28
|
import { export_default as export_default$2 } from "./dependencies.js";
|
|
@@ -31,18 +32,18 @@ import * as lodash1 from "lodash";
|
|
|
31
32
|
//#region src/RS/v3/to/index.d.ts
|
|
32
33
|
declare class export_default$3 {
|
|
33
34
|
static availableDependency: typeof export_default;
|
|
34
|
-
static configuration: (events: Deserialized<Types$1.event>[], options:
|
|
35
|
+
static configuration: (events: Deserialized<Types$1.event>[], options: ParsedOutOptions) => Configuration[];
|
|
35
36
|
static constraints: (schedule: Partial<Deserialized<Types$1.schedule> & {
|
|
36
37
|
division: Deserialized<Types$1.division>;
|
|
37
|
-
}>,
|
|
38
|
+
}>, _options?: OutOptions) => Constraint;
|
|
38
39
|
static courseEvent: typeof export_default$1;
|
|
39
|
-
static course: (courses: Deserialized<Types$1.course> | Deserialized<Types$1.course>[], events: Deserialized<Types$1.event>[] | undefined, overlapGroups: Deserialized<Types$1.overlapGroup>[] | undefined, settings: Types$1.divisionSettings, options:
|
|
40
|
+
static course: (courses: Deserialized<Types$1.course> | Deserialized<Types$1.course>[], events: Deserialized<Types$1.event>[] | undefined, overlapGroups: Deserialized<Types$1.overlapGroup>[] | undefined, settings: Types$1.divisionSettings, options: ParsedOutOptions, periodsMap: Map<string | undefined, number>, destructMap?: Map<string | null, Individual>) => (Collection[] | Collection)[];
|
|
40
41
|
static day: (days: Types$1.day[], numDays: number) => number[];
|
|
41
42
|
static dependency: typeof export_default$2;
|
|
42
|
-
static group: (groups: Deserialized<Types$1.group>[] | Deserialized<Types$1.group>, settings: Types$1.divisionSettings, options:
|
|
43
|
+
static group: (groups: Deserialized<Types$1.group>[] | Deserialized<Types$1.group>, settings: Types$1.divisionSettings, options: ParsedOutOptions) => Group[];
|
|
43
44
|
static interval: (intervals: Types$1.interval[] | undefined, settings: Types$1.divisionSettings, rootInterval?: Types$1.rootInterval) => Interval$1[][];
|
|
44
|
-
static lockedTime: (lockedTimes: Types$1.lockedTime[] | Types$1.lockedTime, options:
|
|
45
|
-
static persons: (persons: Deserialized<Types$1.person>[] | Deserialized<Types$1.person>, settings: Types$1.divisionSettings, options:
|
|
45
|
+
static lockedTime: (lockedTimes: Types$1.lockedTime[] | Types$1.lockedTime, options: ParsedOutOptions) => LockedTime$1[] | never;
|
|
46
|
+
static persons: (persons: Deserialized<Types$1.person>[] | Deserialized<Types$1.person>, settings: Types$1.divisionSettings, options: ParsedOutOptions) => Group[];
|
|
46
47
|
static schedules: (schedule: Deserialized<Types$1.schedule>, options?: OutOptions) => {
|
|
47
48
|
input: Constraint;
|
|
48
49
|
output?: Configuration[] | undefined;
|
|
@@ -277,9 +278,12 @@ declare class export_default$3 {
|
|
|
277
278
|
structure: "RS/algorithm-3.0.0";
|
|
278
279
|
division: Pick<Deserialized<Division>, "start" | "end" | "displayName">;
|
|
279
280
|
};
|
|
281
|
+
algorithmParameters: {
|
|
282
|
+
weights: AlgorithmWeightParameters | undefined;
|
|
283
|
+
};
|
|
280
284
|
};
|
|
281
285
|
static setting: (settings: Types$1.divisionSettings) => Settings;
|
|
282
|
-
static teacher: (teachers: Deserialized<Types$1.teacher>[] | Deserialized<Types$1.teacher>, settings: Types$1.divisionSettings, options:
|
|
286
|
+
static teacher: (teachers: Deserialized<Types$1.teacher>[] | Deserialized<Types$1.teacher>, settings: Types$1.divisionSettings, options: ParsedOutOptions) => Group[];
|
|
283
287
|
}
|
|
284
288
|
//#endregion
|
|
285
289
|
export { export_default$3 as export_default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"individuals.js","names":["idKey: keyof CoreTypes.group","doc: Individual","idKey: keyof CoreTypes.person"],"sources":["../../../../src/RS/v3/to/individuals.ts"],"sourcesContent":["import { OutOptions
|
|
1
|
+
{"version":3,"file":"individuals.js","names":["idKey: keyof CoreTypes.group","doc: Individual","idKey: keyof CoreTypes.person"],"sources":["../../../../src/RS/v3/to/individuals.ts"],"sourcesContent":["import { ParsedOutOptions as OutOptions } from '../types/out-options';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { Individual } from '../types/individuals';\n\ntype GroupType = Exclude<Deserialized<CoreTypes.group>, { species: string }>;\n\nexport function groupsToIndividuals (\n groups: GroupType[] | GroupType,\n settings: CoreTypes.divisionSettings,\n options: OutOptions\n): Individual[] {\n if (groups == null)\n return [];\n\n const idKey: keyof CoreTypes.group = options.idKey || 'id';\n\n return (Array.isArray(groups) ? groups : [groups])\n .filter(group => group.species == null)\n .map((group, index) => {\n\n if (group[idKey] == undefined) throw new Error(`(RS::V3::To::Individuals) A group must have an id, index: ${ index }`);\n\n const doc: Individual = {\n id: `groups.${ group[idKey]!.toString() }`,\n individuals: group.members?.map((member) => `persons.${ member[idKey] }`) || [],\n };\n\n if (options.meta) {\n Object.assign(doc, {\n ...group.ids && { ids: group.ids },\n ...group.displayName && { name: group.displayName },\n });\n }\n\n return doc;\n }, []);\n}\n\nexport function personsToIndividuals (\n persons: Deserialized<CoreTypes.person>[] | Deserialized<CoreTypes.person>,\n settings: CoreTypes.divisionSettings,\n options: OutOptions\n): Individual[] {\n if (persons == null)\n return [];\n\n const idKey: keyof CoreTypes.person = options.idKey || 'id';\n\n return (Array.isArray(persons) ? persons : [persons]).map((person, index) => {\n\n if (person[idKey] == undefined) throw new Error(`(RS::V3::To::Individuals) A person must have an id, index: ${ index }`);\n\n const doc: Individual = {\n id: `persons.${ person[idKey]!.toString() }`,\n ...(person.group && person.group.species) && { group: `groups.${ person.group[idKey]!.toString() }` },\n };\n\n if (options.meta) {\n Object.assign(doc, {\n ...person.ids && { ids: person.ids },\n ...person.displayName && { name: person.displayName },\n });\n }\n\n return doc;\n }, []);\n}\n\nexport function teachersToIndividuals (\n teachers: Deserialized<CoreTypes.teacher>[] | Deserialized<CoreTypes.teacher>,\n settings: CoreTypes.divisionSettings,\n options: OutOptions\n): Individual[] {\n if (teachers == null)\n return [];\n\n const idKey: keyof CoreTypes.person = options.idKey || 'id';\n\n return (Array.isArray(teachers) ? teachers : [teachers]).map((person, index) => {\n\n if (person[idKey] == undefined) throw new Error(`(RS::V3::To::Individuals) A teacher must have an id, index: ${ index }`);\n\n const doc: Individual = {\n id: `teachers.individuals.${ person[idKey]!.toString() }`,\n group: `teachers.${ person[idKey]!.toString() }`,\n };\n\n return doc;\n }, []);\n}"],"mappings":";AAQA,SAAgB,oBACd,QACA,UACA,SACc;AACd,KAAI,UAAU,KACZ,QAAO;CAET,MAAMA,QAA+B,QAAQ,SAAS;AAEtD,SAAQ,MAAM,QAAQ,UAAU,SAAS,CAAC,SACvC,QAAO,UAAS,MAAM,WAAW,MACjC,KAAK,OAAO,UAAU;AAErB,MAAI,MAAM,UAAU,OAAW,OAAM,IAAI,MAAM,6DAA8D;EAE7G,MAAMC,MAAkB;GACtB,IAAa,UAAW,MAAM,OAAQ;GACtC,aAAa,MAAM,SAAS,KAAK,WAAW,WAAY,OAAO,aAAc;;AAG/E,MAAI,QAAQ,KACV,QAAO,OAAO,KAAK;GACjB,GAAG,MAAM,OAAiC,EAAE,KAA4B,MAAM;GAC9E,GAAG,MAAM,eAAiC,EAAE,MAA4B,MAAM;;AAIlF,SAAO;IACN;;AAGP,SAAgB,qBACd,SACA,UACA,SACc;AACd,KAAI,WAAW,KACb,QAAO;CAET,MAAMC,QAAgC,QAAQ,SAAS;AAEvD,SAAQ,MAAM,QAAQ,WAAW,UAAU,CAAC,UAAU,KAAK,QAAQ,UAAU;AAE3E,MAAI,OAAO,UAAU,OAAW,OAAM,IAAI,MAAM,8DAA+D;EAE/G,MAAMD,MAAkB;GACtB,IAAI,WAAY,OAAO,OAAQ;GAC/B,GAAI,OAAO,SAAS,OAAO,MAAM,WAAY,EAAE,OAAO,UAAW,OAAO,MAAM,OAAQ;;AAGxF,MAAI,QAAQ,KACV,QAAO,OAAO,KAAK;GACjB,GAAG,OAAO,OAAgB,EAAE,KAA4B,OAAO;GAC/D,GAAG,OAAO,eAAgB,EAAE,MAA4B,OAAO;;AAInE,SAAO;IACN;;AAGL,SAAgB,sBACd,UACA,UACA,SACc;AACd,KAAI,YAAY,KACd,QAAO;CAET,MAAMC,QAAgC,QAAQ,SAAS;AAEvD,SAAQ,MAAM,QAAQ,YAAY,WAAW,CAAC,WAAW,KAAK,QAAQ,UAAU;AAE9E,MAAI,OAAO,UAAU,OAAW,OAAM,IAAI,MAAM,+DAAgE;EAEhH,MAAMD,MAAkB;GACtB,IAAO,wBAAyB,OAAO,OAAQ;GAC/C,OAAO,YAAa,OAAO,OAAQ;;AAGrC,SAAO;IACN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locked-times.js","names":["startDate: moment.Moment","endDate: moment.Moment","length: number | undefined","start: number | undefined","doc: LockedTime"],"sources":["../../../../src/RS/v3/to/locked-times.ts"],"sourcesContent":["import moment from 'moment';\n\nimport { LockedTime } from '../types/locked-times';\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"locked-times.js","names":["startDate: moment.Moment","endDate: moment.Moment","length: number | undefined","start: number | undefined","doc: LockedTime"],"sources":["../../../../src/RS/v3/to/locked-times.ts"],"sourcesContent":["import moment from 'moment';\n\nimport { LockedTime } from '../types/locked-times';\nimport { ParsedOutOptions as OutOptions } from '../types/out-options';\n\nimport { Types as CoreTypes } from '../../../core/types';\n\nconst typeMap = new Map();\ntypeMap.set('teachers', 'teachers');\ntypeMap.set('groups', 'groups');\ntypeMap.set('locations', 'dependencies');\ntypeMap.set('courses', 'courses');\ntypeMap.set('courseevents', 'events');\n\nexport default (lockedTimes: CoreTypes.lockedTime[] | CoreTypes.lockedTime,\n options: OutOptions): LockedTime[] | never => {\n\n const docs = (Array.isArray(lockedTimes) ? lockedTimes : [lockedTimes]);\n\n return docs.map((lockedTime): LockedTime => {\n let startDate: moment.Moment;\n let endDate: moment.Moment;\n if (lockedTime.start) {\n startDate = moment.utc(lockedTime.start);\n\n if (!startDate.isValid())\n throw new Error('(RS::V3::To::LockedTimes) start is not a valid date');\n } else {\n throw new Error('(RS::V3::To::LockedTimes) A locked time must have a start time');\n }\n\n if (lockedTime.end) {\n endDate = moment.utc(lockedTime.end);\n\n if (!endDate.isValid())\n throw new Error('(RS::V3::To::LockedTimes) end is not a valid date');\n } else {\n throw new Error('(RS::V3::To::LockedTimes) A locked time must have an end time');\n }\n\n if (endDate.isBefore(startDate))\n throw new Error('(RS::V3::To::LockedTimes) start is after end');\n\n let length: number | undefined;\n\n if (startDate && endDate)\n length = endDate.diff(startDate, 'minutes', true);\n\n if (length == null)\n throw new Error('(RS::V3::To::LockedTimes) Length of a locked time is null');\n\n if (length < 5)\n throw new Error('(RS::V3::To::LockedTimes) Length of a locked time is less than 5 min');\n\n let start: number | undefined;\n if (startDate) {\n start = parseFloat(startDate.format('HH.mm'));\n if (start == null) {\n throw new Error('(RS::V3::To::LockedTimes) start could not be converted to float');\n }\n }\n\n const doc: LockedTime = {\n length: length,\n day: (startDate.day() + 6) % 7,\n start: start,\n };\n\n if (options.meta) {\n Object.assign(doc, {\n id: lockedTime.id,\n ...lockedTime.hasOwnProperty('visible') && { visible: lockedTime.visible },\n ...lockedTime.displayName && { name: lockedTime.displayName },\n });\n }\n return doc;\n });\n};"],"mappings":";;;AAOA,MAAM,0BAAiB,IAAI;AAC3B,QAAQ,IAAI,YAAkB;AAC9B,QAAQ,IAAI,UAAkB;AAC9B,QAAQ,IAAI,aAAkB;AAC9B,QAAQ,IAAI,WAAkB;AAC9B,QAAQ,IAAI,gBAAkB;AAE9B,4BAAgB,aACd,YAAkD;CAElD,MAAM,OAAQ,MAAM,QAAQ,eAAe,cAAc,CAAC;AAE1D,QAAO,KAAK,KAAK,eAA2B;EAC1C,IAAIA;EACJ,IAAIC;AACJ,MAAI,WAAW,OAAO;AACpB,eAAY,OAAO,IAAI,WAAW;AAElC,OAAI,CAAC,UAAU,UACb,OAAM,IAAI,MAAM;QAElB,OAAM,IAAI,MAAM;AAGlB,MAAI,WAAW,KAAK;AAClB,aAAU,OAAO,IAAI,WAAW;AAEhC,OAAI,CAAC,QAAQ,UACX,OAAM,IAAI,MAAM;QAElB,OAAM,IAAI,MAAM;AAGlB,MAAI,QAAQ,SAAS,WACnB,OAAM,IAAI,MAAM;EAElB,IAAIC;AAEJ,MAAI,aAAa,QACf,UAAS,QAAQ,KAAK,WAAW,WAAW;AAE9C,MAAI,UAAU,KACZ,OAAM,IAAI,MAAM;AAElB,MAAI,SAAS,EACX,OAAM,IAAI,MAAM;EAElB,IAAIC;AACJ,MAAI,WAAW;AACb,WAAQ,WAAW,UAAU,OAAO;AACpC,OAAI,SAAS,KACX,OAAM,IAAI,MAAM;;EAIpB,MAAMC,MAAkB;GACd;GACR,MAAS,UAAU,QAAQ,KAAK;GACxB;;AAGV,MAAI,QAAQ,KACV,QAAO,OAAO,KAAK;GACjB,IAAI,WAAW;GACf,GAAG,WAAW,eAAe,cAAc,EAAE,SAAW,WAAW;GACnE,GAAG,WAAW,eAA6B,EAAE,MAAW,WAAW;;AAGvE,SAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persons.js","names":["idKey: keyof CoreTypes.person","doc: Group"],"sources":["../../../../src/RS/v3/to/persons.ts"],"sourcesContent":["import { Group } from '../types/groups';\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"persons.js","names":["idKey: keyof CoreTypes.person","doc: Group"],"sources":["../../../../src/RS/v3/to/persons.ts"],"sourcesContent":["import { Group } from '../types/groups';\nimport { ParsedOutOptions as OutOptions } from '../types/out-options';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\n\nexport default (persons: Deserialized<CoreTypes.person>[] | Deserialized<CoreTypes.person>,\n settings: CoreTypes.divisionSettings,\n options: OutOptions): Group[] => {\n if (persons == null)\n return [];\n\n const idKey: keyof CoreTypes.person = options.idKey || 'id';\n\n return (Array.isArray(persons) ? persons : [persons]).filter(x => !x.group).map((person, index) => {\n\n if (person[idKey] == undefined) throw new Error(`(RS::V3::To::Persons) A person must have an id, index: ${ index }`);\n\n const doc: Group = {\n id: `persons.${ person[idKey]!.toString() }`,\n group_type: 'persons',\n minimizeDependencyAlternation: false,\n };\n\n if (options.meta) {\n Object.assign(doc, {\n ...person.ids && { ids: person.ids },\n ...person.firstName && { name: `${ person.firstName } ${ person.lastName }` },\n });\n }\n\n return doc;\n }, []);\n};\n"],"mappings":";AAMA,uBAAgB,SACd,UACA,YAAkC;AAClC,KAAI,WAAW,KACb,QAAO;CAET,MAAMA,QAAgC,QAAQ,SAAS;AAEvD,SAAQ,MAAM,QAAQ,WAAW,UAAU,CAAC,UAAU,QAAO,MAAK,CAAC,EAAE,OAAO,KAAK,QAAQ,UAAU;AAEjG,MAAI,OAAO,UAAU,OAAW,OAAM,IAAI,MAAM,0DAA2D;EAE3G,MAAMC,MAAa;GACjB,IAA+B,WAAY,OAAO,OAAQ;GAC1D,YAA+B;GAC/B,+BAA+B;;AAGjC,MAAI,QAAQ,KACV,QAAO,OAAO,KAAK;GACjB,GAAG,OAAO,OAAiC,EAAE,KAA4B,OAAO;GAChF,GAAG,OAAO,aAAiC,EAAE,MAA4B,GAAI,OAAO,UAAW,GAAI,OAAO;;AAI9G,SAAO;IACN"}
|
|
@@ -11,6 +11,7 @@ var schedules_default = (schedule, options = {}) => {
|
|
|
11
11
|
structure: "RS/algorithm-3.0.0",
|
|
12
12
|
division: pick(schedule.divisions, "displayName", "start", "end")
|
|
13
13
|
},
|
|
14
|
+
algorithmParameters: { weights: options.algorithmWeightParameters },
|
|
14
15
|
...options.appendCoreData && { coreData: CoreMap.to.schedules(JSON.parse(JSON.stringify(schedule))) },
|
|
15
16
|
...options.appendOutput && schedule.events && { output: configurations_default(schedule.events, options) },
|
|
16
17
|
input: constraints_default(schedule, options)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","names":["_configurations","_constraints"],"sources":["../../../../src/RS/v3/to/schedules.ts"],"sourcesContent":["import { pick } from 'lodash-es';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { CoreMap } from '../../../index';\n\nimport { Schedule } from '../types/schedules';\nimport { OutOptions } from '../types/out-options';\n\nimport _constraints from './constraints';\nimport _configurations from './configurations';\n\nexport default (schedule: Deserialized<CoreTypes.schedule>, options: OutOptions = {}) => {\n\n return {\n meta: {\n structure: 'RS/algorithm-3.0.0',\n division: pick(schedule.divisions, 'displayName', 'start', 'end'),\n },\n ...options.appendCoreData && { coreData: CoreMap.to.schedules(JSON.parse(JSON.stringify(schedule))) },\n ...options.appendOutput && schedule.events && { output: _configurations(schedule.events, options) },\n input: _constraints(schedule, options),\n } satisfies Schedule;\n};"],"mappings":";;;;;;;AAYA,yBAAgB,UAA4C,UAAsB,OAAO;AAEvF,QAAO;EACL,MAAM;GACJ,WAAW;GACX,UAAW,KAAK,SAAS,WAAW,eAAe,SAAS;;EAE9D,GAAG,QAAQ,kBAAkB,EAAE,UAAU,QAAQ,GAAG,UAAU,KAAK,MAAM,KAAK,UAAU;EACxF,GAAG,QAAQ,gBAAgB,SAAS,UAAU,EAAE,QAAQA,uBAAgB,SAAS,QAAQ;EACzF,OAAOC,oBAAa,UAAU"}
|
|
1
|
+
{"version":3,"file":"schedules.js","names":["_configurations","_constraints"],"sources":["../../../../src/RS/v3/to/schedules.ts"],"sourcesContent":["import { pick } from 'lodash-es';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { CoreMap } from '../../../index';\n\nimport { Schedule } from '../types/schedules';\nimport { OutOptions } from '../types/out-options';\n\nimport _constraints from './constraints';\nimport _configurations from './configurations';\n\nexport default (schedule: Deserialized<CoreTypes.schedule>, options: OutOptions = {}) => {\n\n return {\n meta: {\n structure: 'RS/algorithm-3.0.0',\n division: pick(schedule.divisions, 'displayName', 'start', 'end'),\n },\n algorithmParameters: {\n weights: options.algorithmWeightParameters,\n },\n ...options.appendCoreData && { coreData: CoreMap.to.schedules(JSON.parse(JSON.stringify(schedule))) },\n ...options.appendOutput && schedule.events && { output: _configurations(schedule.events, options) },\n input: _constraints(schedule, options),\n } satisfies Schedule;\n};"],"mappings":";;;;;;;AAYA,yBAAgB,UAA4C,UAAsB,OAAO;AAEvF,QAAO;EACL,MAAM;GACJ,WAAW;GACX,UAAW,KAAK,SAAS,WAAW,eAAe,SAAS;;EAE9D,qBAAqB,EACnB,SAAS,QAAQ;EAEnB,GAAG,QAAQ,kBAAkB,EAAE,UAAU,QAAQ,GAAG,UAAU,KAAK,MAAM,KAAK,UAAU;EACxF,GAAG,QAAQ,gBAAgB,SAAS,UAAU,EAAE,QAAQA,uBAAgB,SAAS,QAAQ;EACzF,OAAOC,oBAAa,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teachers.js","names":["idKey: keyof CoreTypes.teacher","doc: Group","intervals","days","lockedTimes","breakLengths"],"sources":["../../../../src/RS/v3/to/teachers.ts"],"sourcesContent":["import breakLengths from './break-lengths';\nimport days from './days';\nimport lockedTimes from './locked-times';\nimport intervals from './intervals';\n\nimport { Group } from '../types/groups';\nimport { OutOptions
|
|
1
|
+
{"version":3,"file":"teachers.js","names":["idKey: keyof CoreTypes.teacher","doc: Group","intervals","days","lockedTimes","breakLengths"],"sources":["../../../../src/RS/v3/to/teachers.ts"],"sourcesContent":["import breakLengths from './break-lengths';\nimport days from './days';\nimport lockedTimes from './locked-times';\nimport intervals from './intervals';\n\nimport { Group } from '../types/groups';\nimport { ParsedOutOptions as OutOptions } from '../types/out-options';\n\nimport { Types as CoreTypes } from '../../../core/types';\nimport { Deserialized } from '../../../core/types';\nimport { parseMaxWorkingHours } from './util';\n\nexport default (\n teachers: Deserialized<CoreTypes.teacher>[] | Deserialized<CoreTypes.teacher>,\n settings: CoreTypes.divisionSettings,\n options: OutOptions\n): Group[] => {\n if (teachers == null)\n return [];\n\n const idKey: keyof CoreTypes.teacher = options.idKey || 'id';\n\n return (Array.isArray(teachers) ? teachers : [teachers]).map((teacher, index: number) => {\n\n if (teacher[idKey] == undefined) throw new Error(`(RS::V3::To::Teachers) Teachers must have an id, index: ${ index }`);\n\n const hasIntervals = Boolean(teacher.intervals?.length || (teacher.rootInterval ?? settings.defaultRootInterval));\n\n const doc: Group = {\n id: `teachers.${ teacher[idKey]!.toString() }`,\n group_type: 'personal',\n ...parseMaxWorkingHours(teacher, options),\n ...'weight' in teacher && { weight: teacher.weight },\n ...hasIntervals && { intervals: intervals(teacher.intervals, settings, teacher.rootInterval ?? settings.defaultRootInterval as CoreTypes.rootInterval) },\n ...teacher.days?.length && { days: days(teacher.days, settings.numDays) },\n ...teacher.lockedTimes?.length && { lockedTimes: lockedTimes(teacher.lockedTimes, options) },\n ...(teacher.minBreakLength != null) && { minBreakLength: breakLengths(teacher.minBreakLength) },\n minimizeGaps: false,\n minimizeDependencyAlternation: true,\n };\n\n if (options.meta) {\n Object.assign(doc, {\n ...teacher.ids && { ids: teacher.ids },\n ...teacher.displayName && { name: teacher.displayName },\n });\n }\n\n return doc;\n }, []);\n};\n"],"mappings":";;;;;;;AAYA,wBACE,UACA,UACA,YACY;AACZ,KAAI,YAAY,KACd,QAAO;CAET,MAAMA,QAAiC,QAAQ,SAAS;AAExD,SAAQ,MAAM,QAAQ,YAAY,WAAW,CAAC,WAAW,KAAK,SAAS,UAAkB;AAEvF,MAAI,QAAQ,UAAU,OAAW,OAAM,IAAI,MAAM,2DAA4D;EAE7G,MAAM,eAAe,QAAQ,QAAQ,WAAW,WAAW,QAAQ,gBAAgB,SAAS;EAE5F,MAAMC,MAAa;GACjB,IAA+B,YAAa,QAAQ,OAAQ;GAC5D,YAA+B;GAC/B,GAAG,qBAAqB,SAAS;GACjC,GAAG,YAAgC,WAAW,EAAE,QAA4B,QAAQ;GACpF,GAAG,gBAA2C,EAAE,WAA4BC,kBAAU,QAAQ,WAAW,UAAU,QAAQ,gBAAgB,SAAS;GACpJ,GAAG,QAAQ,MAAM,UAA6B,EAAE,MAA4BC,aAAK,QAAQ,MAAM,SAAS;GACxG,GAAG,QAAQ,aAAa,UAAsB,EAAE,aAA4BC,qBAAY,QAAQ,aAAa;GAC7G,GAAI,QAAQ,kBAAkB,QAAgB,EAAE,gBAA4BC,sBAAa,QAAQ;GACjG,cAA+B;GAC/B,+BAA+B;;AAGjC,MAAI,QAAQ,KACV,QAAO,OAAO,KAAK;GACjB,GAAG,QAAQ,OAAiC,EAAE,KAA4B,QAAQ;GAClF,GAAG,QAAQ,eAAiC,EAAE,MAA4B,QAAQ;;AAItF,SAAO;IACN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","names":[],"sources":["../../../../src/RS/v3/to/util.ts"],"sourcesContent":["import { Types as CoreTypes, Deserialized } from '../../../core/types';\nimport { Group } from '../types/groups';\nimport { OutOptions } from '../types/out-options';\nimport { groupBy, values } from 'lodash-es';\n\nexport function min2hrs (min: number | undefined | null) {\n return min ? min / 60 : undefined;\n}\n\nexport function parseMaxWorkingHours (\n group: Deserialized<CoreTypes.group>,\n options: OutOptions\n): Pick<Group, 'maxNumWorkingHours' | 'maxNumDailyWorkingHours'> | undefined {\n // new format\n if (options.useMaximumScheduleSpan && group.maximumScheduleSpan) {\n return {\n maxNumWorkingHours: min2hrs(group.maximumScheduleSpan.daily) ?? false,\n maxNumDailyWorkingHours: min2hrs(group.maximumScheduleSpan.daily) ?? false,\n };\n }\n\n // old format, to become deprecated\n if (!options.useMaximumScheduleSpan) {\n return {\n ...'maxNumWorkingHours' in group && { maxNumWorkingHours: group.maxNumWorkingHours },\n ...'maxNumDailyWorkingHours' in group && { maxNumDailyWorkingHours: group.maxNumDailyWorkingHours },\n };\n }\n\n return;\n}\n\n\ntype GroupReferences = NonNullable<Deserialized<CoreTypes.event>['groups']>;\n/**\n * Merges group references with their parent groups while ensuring that a group is present at\n * most once while ensuring that parent groups are prioritized as they carry no member exclusions.\n */\nexport function mergeWithParentGroups (\n references: GroupReferences,\n options: OutOptions\n): GroupReferences {\n if (!references) return [];\n\n const idKey = options.idKey || 'id';\n\n return values(groupBy(\n references\n .flatMap((x): ((typeof x) & { isParentGroup?: boolean })[] => ([\n x, ...(x.to.parentGroups ?? []).map(y => ({ to: y, isParentGroup: true }))\n ])),\n x => x.to[idKey]?.toString()\n ))\n .map(xs => xs.find(x => x.isParentGroup) ?? xs.find(x => !x.isParentGroup))\n .filter((x): x is NonNullable<typeof x> => !!x);\n}"],"mappings":";;;AAKA,SAAgB,QAAS,KAAgC;AACvD,QAAO,MAAM,MAAM,KAAK;;AAG1B,SAAgB,qBACd,OACA,SAC2E;AAE3E,KAAI,QAAQ,0BAA0B,MAAM,oBAC1C,QAAO;EACL,oBAAyB,QAAQ,MAAM,oBAAoB,UAAU;EACrE,yBAAyB,QAAQ,MAAM,oBAAoB,UAAU;;AAKzE,KAAI,CAAC,QAAQ,uBACX,QAAO;EACL,GAAG,wBAA6B,SAAS,EAAE,oBAA4B,MAAM;EAC7E,GAAG,6BAA6B,SAAS,EAAE,yBAA4B,MAAM;;;;;;;AAanF,SAAgB,sBACd,YACA,SACiB;AACjB,KAAI,CAAC,WAAY,QAAO;CAExB,MAAM,QAAQ,QAAQ,SAAS;AAE/B,QAAO,OAAO,QACZ,WACG,SAAS,MAAqD,CAC7D,GAAG,IAAI,EAAE,GAAG,gBAAgB,IAAI,KAAI,OAAM;EAAE,IAAI;EAAG,eAAe;SAEtE,MAAK,EAAE,GAAG,QAAQ,aAEjB,KAAI,OAAM,GAAG,MAAK,MAAK,EAAE,kBAAkB,GAAG,MAAK,MAAK,CAAC,EAAE,gBAC3D,QAAQ,MAAkC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"util.js","names":[],"sources":["../../../../src/RS/v3/to/util.ts"],"sourcesContent":["import { Types as CoreTypes, Deserialized } from '../../../core/types';\nimport { Group } from '../types/groups';\nimport { ParsedOutOptions as OutOptions } from '../types/out-options';\nimport { groupBy, values } from 'lodash-es';\n\nexport function min2hrs (min: number | undefined | null) {\n return min ? min / 60 : undefined;\n}\n\nexport function parseMaxWorkingHours (\n group: Deserialized<CoreTypes.group>,\n options: OutOptions\n): Pick<Group, 'maxNumWorkingHours' | 'maxNumDailyWorkingHours'> | undefined {\n // new format\n if (options.useMaximumScheduleSpan && group.maximumScheduleSpan) {\n return {\n maxNumWorkingHours: min2hrs(group.maximumScheduleSpan.daily) ?? false,\n maxNumDailyWorkingHours: min2hrs(group.maximumScheduleSpan.daily) ?? false,\n };\n }\n\n // old format, to become deprecated\n if (!options.useMaximumScheduleSpan) {\n return {\n ...'maxNumWorkingHours' in group && { maxNumWorkingHours: group.maxNumWorkingHours },\n ...'maxNumDailyWorkingHours' in group && { maxNumDailyWorkingHours: group.maxNumDailyWorkingHours },\n };\n }\n\n return;\n}\n\n\ntype GroupReferences = NonNullable<Deserialized<CoreTypes.event>['groups']>;\n/**\n * Merges group references with their parent groups while ensuring that a group is present at\n * most once while ensuring that parent groups are prioritized as they carry no member exclusions.\n */\nexport function mergeWithParentGroups (\n references: GroupReferences,\n options: OutOptions\n): GroupReferences {\n if (!references) return [];\n\n const idKey = options.idKey || 'id';\n\n return values(groupBy(\n references\n .flatMap((x): ((typeof x) & { isParentGroup?: boolean })[] => ([\n x, ...(x.to.parentGroups ?? []).map(y => ({ to: y, isParentGroup: true }))\n ])),\n x => x.to[idKey]?.toString()\n ))\n .map(xs => xs.find(x => x.isParentGroup) ?? xs.find(x => !x.isParentGroup))\n .filter((x): x is NonNullable<typeof x> => !!x);\n}"],"mappings":";;;AAKA,SAAgB,QAAS,KAAgC;AACvD,QAAO,MAAM,MAAM,KAAK;;AAG1B,SAAgB,qBACd,OACA,SAC2E;AAE3E,KAAI,QAAQ,0BAA0B,MAAM,oBAC1C,QAAO;EACL,oBAAyB,QAAQ,MAAM,oBAAoB,UAAU;EACrE,yBAAyB,QAAQ,MAAM,oBAAoB,UAAU;;AAKzE,KAAI,CAAC,QAAQ,uBACX,QAAO;EACL,GAAG,wBAA6B,SAAS,EAAE,oBAA4B,MAAM;EAC7E,GAAG,6BAA6B,SAAS,EAAE,yBAA4B,MAAM;;;;;;;AAanF,SAAgB,sBACd,YACA,SACiB;AACjB,KAAI,CAAC,WAAY,QAAO;CAExB,MAAM,QAAQ,QAAQ,SAAS;AAE/B,QAAO,OAAO,QACZ,WACG,SAAS,MAAqD,CAC7D,GAAG,IAAI,EAAE,GAAG,gBAAgB,IAAI,KAAI,OAAM;EAAE,IAAI;EAAG,eAAe;SAEtE,MAAK,EAAE,GAAG,QAAQ,aAEjB,KAAI,OAAM,GAAG,MAAK,MAAK,EAAE,kBAAkB,GAAG,MAAK,MAAK,CAAC,EAAE,gBAC3D,QAAQ,MAAkC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/RS/v3/types/algorithm-parameters.d.ts
|
|
2
|
+
type ParameterName = 'overlap' | 'doubleBooking' | 'timeFrame' | 'breakLength' | 'clustering' | 'dailyOvertime' | 'position' | 'gap' | 'dependencyAlternation' | 'overtime' | 'dependencyRank' | 'dayRank' | 'groupRank';
|
|
3
|
+
type AlgorithmWeightParameters = Record<ParameterName, number | false>;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { AlgorithmWeightParameters };
|
|
6
|
+
//# sourceMappingURL=algorithm-parameters.d.ts.map
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { AlgorithmWeightParameters } from "./algorithm-parameters.js";
|
|
2
|
+
|
|
1
3
|
//#region src/RS/v3/types/out-options.d.ts
|
|
2
4
|
type Id = 'id' | '_id';
|
|
5
|
+
type PartialScheduleOptions<IDs extends Array<string> | Set<string>> = {
|
|
6
|
+
includedEvents?: IDs;
|
|
7
|
+
includedLocations?: IDs;
|
|
8
|
+
omittedEventsHandling: 'ignore' | 'freeze';
|
|
9
|
+
};
|
|
3
10
|
interface OutOptions {
|
|
4
11
|
idKey?: Id;
|
|
5
12
|
meta?: boolean;
|
|
@@ -7,13 +14,13 @@ interface OutOptions {
|
|
|
7
14
|
isPublicId?: boolean;
|
|
8
15
|
appendCoreData?: boolean;
|
|
9
16
|
appendOutput?: boolean;
|
|
10
|
-
partialScheduleOptions?:
|
|
11
|
-
|
|
12
|
-
includedLocations?: Set<string>;
|
|
13
|
-
omittedEventsHandling: 'ignore' | 'freeze';
|
|
14
|
-
};
|
|
17
|
+
partialScheduleOptions?: PartialScheduleOptions<Array<string> | Set<string>>;
|
|
18
|
+
algorithmWeightParameters?: AlgorithmWeightParameters;
|
|
15
19
|
useMaximumScheduleSpan?: boolean;
|
|
16
20
|
}
|
|
21
|
+
type ParsedOutOptions = Omit<OutOptions, 'partialScheduleOptions'> & {
|
|
22
|
+
partialScheduleOptions?: PartialScheduleOptions<Set<string>>;
|
|
23
|
+
};
|
|
17
24
|
//#endregion
|
|
18
|
-
export { OutOptions };
|
|
25
|
+
export { OutOptions, ParsedOutOptions };
|
|
19
26
|
//# sourceMappingURL=out-options.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Types } from "../../../core/v2/types/index.js";
|
|
2
2
|
import { Serialized } from "../../../core/types/index.js";
|
|
3
|
+
import { AlgorithmWeightParameters } from "./algorithm-parameters.js";
|
|
3
4
|
import { Configuration } from "./configurations.js";
|
|
4
5
|
import { Constraint } from "./constraints.js";
|
|
5
6
|
|
|
@@ -14,6 +15,9 @@ interface Schedule {
|
|
|
14
15
|
input?: Constraint;
|
|
15
16
|
output?: Configuration[];
|
|
16
17
|
coreData?: Serialized<Omit<Types.division, 'settings' | 'syllabuses'>> & Pick<Types.division, 'settings'>;
|
|
18
|
+
algorithmParameters?: {
|
|
19
|
+
weights?: AlgorithmWeightParameters;
|
|
20
|
+
};
|
|
17
21
|
}
|
|
18
22
|
//#endregion
|
|
19
23
|
export { Schedule };
|