@royalschedule/maps 4.0.33 → 4.1.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Additio/from/courses.js.map +1 -1
- package/dist/Additio/from/events.js.map +1 -1
- package/dist/Additio/from/groups.js.map +1 -1
- package/dist/Additio/from/index.js.map +1 -1
- package/dist/Additio/from/locations.js.map +1 -1
- package/dist/Additio/from/persons.js.map +1 -1
- package/dist/Additio/from/schedules.d.ts +0 -1
- package/dist/Additio/from/schedules.js +4 -2
- package/dist/Additio/from/schedules.js.map +1 -1
- package/dist/Additio/from/teachers.js.map +1 -1
- package/dist/Additio/to/index.d.ts +2 -4
- package/dist/Additio/to/schedules.js +4 -2
- package/dist/Additio/to/schedules.js.map +1 -1
- package/dist/Admentum/from/courses.js.map +1 -1
- package/dist/Admentum/from/events.js.map +1 -1
- package/dist/Admentum/from/groups.js.map +1 -1
- package/dist/Admentum/from/index.js.map +1 -1
- package/dist/Admentum/from/locations.js.map +1 -1
- package/dist/Admentum/from/persons.js.map +1 -1
- package/dist/Admentum/from/schedules.d.ts +0 -1
- package/dist/Admentum/from/schedules.js +6 -3
- package/dist/Admentum/from/schedules.js.map +1 -1
- package/dist/Admentum/from/teachers.js.map +1 -1
- package/dist/Admentum/to/index.d.ts +0 -1
- package/dist/Admentum/to/schedules.js +7 -4
- package/dist/Admentum/to/schedules.js.map +1 -1
- package/dist/Excel/index.d.ts +1 -1
- package/dist/Excel/v1/from/index.js +1 -1
- package/dist/Excel/v1/from/index.js.map +1 -1
- package/dist/Excel/v1/index.d.ts +4 -4
- package/dist/Excel/v2/from/index.js +54 -45
- package/dist/Excel/v2/from/index.js.map +1 -1
- package/dist/Excel/v2/index.d.ts +4 -4
- package/dist/IdunSoft/from/courses.js.map +1 -1
- package/dist/IdunSoft/from/events.js +2 -1
- package/dist/IdunSoft/from/events.js.map +1 -1
- package/dist/IdunSoft/from/groups.js.map +1 -1
- package/dist/IdunSoft/from/index.js.map +1 -1
- package/dist/IdunSoft/from/locations.js.map +1 -1
- package/dist/IdunSoft/from/schedules.d.ts +0 -1
- package/dist/IdunSoft/from/schedules.js.map +1 -1
- package/dist/IdunSoft/from/teachers.js.map +1 -1
- package/dist/IdunSoft/to/index.d.ts +0 -1
- package/dist/IdunSoft/to/schedules.js +7 -4
- package/dist/IdunSoft/to/schedules.js.map +1 -1
- package/dist/InfoMentor/to/index.d.ts +0 -1
- package/dist/InfoMentor/to/schedules.js +3 -2
- package/dist/InfoMentor/to/schedules.js.map +1 -1
- package/dist/PlanDigital/from/index.js.map +1 -1
- package/dist/PlanDigital/from/schedules.js +11 -9
- package/dist/PlanDigital/from/schedules.js.map +1 -1
- package/dist/PlanDigital/index.d.ts +0 -1
- package/dist/Quiculum/file/to/index.d.ts +0 -1
- package/dist/Quiculum/file/to/schedules.js +9 -5
- package/dist/Quiculum/file/to/schedules.js.map +1 -1
- package/dist/RS/from/division.d.ts +0 -1
- package/dist/RS/from/division.js +2 -1
- package/dist/RS/from/division.js.map +1 -1
- package/dist/RS/from/index.js.map +1 -1
- package/dist/RS/from/schedules.d.ts +0 -1
- package/dist/RS/from/schedules.js.map +1 -1
- package/dist/RS/make-connected.d.ts +2 -4
- package/dist/RS/make-connected.js +46 -54
- package/dist/RS/make-connected.js.map +1 -1
- package/dist/RS/to/index.js.map +1 -1
- package/dist/RS/to/initial-configuration.js +7 -5
- package/dist/RS/to/initial-configuration.js.map +1 -1
- package/dist/RS/to/input/default.js +16 -21
- package/dist/RS/to/input/default.js.map +1 -1
- package/dist/RS/to/input/dependencies.js +12 -10
- package/dist/RS/to/input/dependencies.js.map +1 -1
- package/dist/RS/to/input/events.js +53 -41
- package/dist/RS/to/input/events.js.map +1 -1
- package/dist/RS/to/input/groups.js +7 -15
- package/dist/RS/to/input/groups.js.map +1 -1
- package/dist/RS/to/input/individuals.js +4 -6
- package/dist/RS/to/input/individuals.js.map +1 -1
- package/dist/RS/to/input/input.js +21 -13
- package/dist/RS/to/input/input.js.map +1 -1
- package/dist/RS/to/input/intervals.js +10 -8
- package/dist/RS/to/input/intervals.js.map +1 -1
- package/dist/RS/to/input/linked-events-sets.js +96 -0
- package/dist/RS/to/input/linked-events-sets.js.map +1 -0
- package/dist/RS/to/input/locked-times.js +91 -0
- package/dist/RS/to/input/locked-times.js.map +1 -0
- package/dist/RS/to/input/periods.js +5 -36
- package/dist/RS/to/input/periods.js.map +1 -1
- package/dist/RS/to/input/settings.js +1 -8
- package/dist/RS/to/input/settings.js.map +1 -1
- package/dist/RS/to/input/teachers.js +8 -16
- package/dist/RS/to/input/teachers.js.map +1 -1
- package/dist/RS/to/input/util/parse-days.js +2 -2
- package/dist/RS/to/input/util/parse-days.js.map +1 -1
- package/dist/RS/to/input/util/parse-group-references.js +2 -10
- package/dist/RS/to/input/util/parse-group-references.js.map +1 -1
- package/dist/RS/to/input/util/parse-location-references.js +1 -7
- package/dist/RS/to/input/util/parse-location-references.js.map +1 -1
- package/dist/RS/to/input/util/parse-max-working-hours.js +4 -7
- package/dist/RS/to/input/util/parse-max-working-hours.js.map +1 -1
- package/dist/RS/to/input/util/parse-minimum-break-length.js +2 -2
- package/dist/RS/to/input/util/parse-minimum-break-length.js.map +1 -1
- package/dist/RS/to/input/util/util.js +5 -11
- package/dist/RS/to/input/util/util.js.map +1 -1
- package/dist/RS/to/schedules.js.map +1 -1
- package/dist/RS/types/algorithm-parameters.d.ts +1 -2
- package/dist/RS/types/index.d.ts +2 -31
- package/dist/RS/types/schedule-data.d.ts +12 -15
- package/dist/RS/types/to.d.ts +10 -18
- package/dist/RS/types/to.js +1 -1
- package/dist/RS/types/to.js.map +1 -1
- package/dist/SS12000/from/activities.js +2 -1
- package/dist/SS12000/from/activities.js.map +1 -1
- package/dist/SS12000/from/calendar-events.js.map +1 -1
- package/dist/SS12000/from/duties.js.map +1 -1
- package/dist/SS12000/from/groups.js.map +1 -1
- package/dist/SS12000/from/index.js.map +1 -1
- package/dist/SS12000/from/persons.js.map +1 -1
- package/dist/SS12000/from/resources.js.map +1 -1
- package/dist/SS12000/from/rooms.js.map +1 -1
- package/dist/SS12000/from/syllabuses.js.map +1 -1
- package/dist/SS12000/index.d.ts +9 -12782
- package/dist/SS12000/to/activities.js.map +1 -1
- package/dist/SS12000/to/calendar-events.js.map +1 -1
- package/dist/SS12000/to/common.js.map +1 -1
- package/dist/SS12000/to/duties.js.map +1 -1
- package/dist/SS12000/to/groups.js.map +1 -1
- package/dist/SS12000/to/index.d.ts +0 -1
- package/dist/SS12000/to/persons.js.map +1 -1
- package/dist/SS12000/to/resources.js.map +1 -1
- package/dist/SS12000/to/rooms.js.map +1 -1
- package/dist/SS12000/to/syllabuses.js.map +1 -1
- package/dist/SchoolSoft/api/from/index.js.map +1 -1
- package/dist/SchoolSoft/api/from/schedules.js +12 -8
- package/dist/SchoolSoft/api/from/schedules.js.map +1 -1
- package/dist/SchoolSoft/api/index.d.ts +7 -6
- package/dist/SchoolSoft/file/from/index.js.map +1 -1
- package/dist/SchoolSoft/file/from/schedules.js +87 -83
- package/dist/SchoolSoft/file/from/schedules.js.map +1 -1
- package/dist/SchoolSoft/file/index.d.ts +0 -1
- package/dist/SchoolSoft/file/to/index.d.ts +2 -3
- package/dist/SchoolSoft/file/to/schedules.js +2 -1
- package/dist/SchoolSoft/file/to/schedules.js.map +1 -1
- package/dist/SchoolSoft/index.d.ts +0 -1
- package/dist/Schoolity/txt/to/index.d.ts +0 -1
- package/dist/Schoolity/txt/to/schedules.js +14 -7
- package/dist/Schoolity/txt/to/schedules.js.map +1 -1
- package/dist/Skola24/mdb/from/course-and-events.js +5 -3
- package/dist/Skola24/mdb/from/course-and-events.js.map +1 -1
- package/dist/Skola24/mdb/from/groups.js.map +1 -1
- package/dist/Skola24/mdb/from/index.js.map +1 -1
- package/dist/Skola24/mdb/from/locations.js.map +1 -1
- package/dist/Skola24/mdb/from/schedule.d.ts +0 -1
- package/dist/Skola24/mdb/from/schedule.js.map +1 -1
- package/dist/Skola24/mdb/from/teachers.js.map +1 -1
- package/dist/Skola24/txt/from/calendar-exceptions.js +2 -1
- package/dist/Skola24/txt/from/calendar-exceptions.js.map +1 -1
- package/dist/Skola24/txt/from/division.js.map +1 -1
- package/dist/Skola24/txt/from/index.js.map +1 -1
- package/dist/Skola24/txt/from/period.js +34 -31
- package/dist/Skola24/txt/from/period.js.map +1 -1
- package/dist/Skola24/txt/from/schedules.d.ts +0 -1
- package/dist/Skola24/txt/from/schedules.js +10 -6
- package/dist/Skola24/txt/from/schedules.js.map +1 -1
- package/dist/Skola24/txt/from/util.js.map +1 -1
- package/dist/Skola24/txt/index.d.ts +0 -1
- package/dist/Skola24/txt/to/index.d.ts +0 -1
- package/dist/Skola24/txt/to/schedules.js +15 -8
- package/dist/Skola24/txt/to/schedules.js.map +1 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/functions.js +2 -2
- package/dist/common/functions.js.map +1 -1
- package/dist/common/get-date.js.map +1 -1
- package/dist/common/make-chainable/index.js.map +1 -1
- package/dist/common/types.d.ts +28 -2
- package/dist/core/from/configurations.js.map +1 -1
- package/dist/core/from/courses.js.map +1 -1
- package/dist/core/from/events.js.map +1 -1
- package/dist/core/from/exceptions.js.map +1 -1
- package/dist/core/from/groups.js.map +1 -1
- package/dist/core/from/index.js.map +1 -1
- package/dist/core/from/locations.js.map +1 -1
- package/dist/core/from/locked-times.js.map +1 -1
- package/dist/core/from/overlap-groups.js.map +1 -1
- package/dist/core/from/periods.js.map +1 -1
- package/dist/core/from/persons.js.map +1 -1
- package/dist/core/from/root-intervals.js.map +1 -1
- package/dist/core/from/schedules.js.map +1 -1
- package/dist/core/from/settings.js.map +1 -1
- package/dist/core/from/syllabuses.js.map +1 -1
- package/dist/core/from/teachers.js.map +1 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/interfaces/other/companies.d.ts +0 -1
- package/dist/core/interfaces/other/companies.js.map +1 -1
- package/dist/core/interfaces/other/operations.d.ts +0 -1
- package/dist/core/interfaces/vertices/companies.d.ts +0 -1
- package/dist/core/interfaces/vertices/configurations.d.ts +0 -1
- package/dist/core/interfaces/vertices/courses.d.ts +0 -1
- package/dist/core/interfaces/vertices/division-settings.d.ts +2 -3
- package/dist/core/interfaces/vertices/divisions.d.ts +0 -1
- package/dist/core/interfaces/vertices/events.d.ts +3 -1
- package/dist/core/interfaces/vertices/exceptions.d.ts +0 -1
- package/dist/core/interfaces/vertices/generations.d.ts +1 -3
- package/dist/core/interfaces/vertices/groups.d.ts +0 -1
- package/dist/core/interfaces/vertices/index.d.ts +15 -8
- package/dist/core/interfaces/vertices/linked-events-sets.d.ts +18 -0
- package/dist/core/interfaces/vertices/locations.d.ts +0 -1
- package/dist/core/interfaces/vertices/locked-times.d.ts +0 -2
- package/dist/core/interfaces/vertices/overlap-groups.d.ts +0 -1
- package/dist/core/interfaces/vertices/periods.d.ts +0 -3
- package/dist/core/interfaces/vertices/persons.d.ts +0 -1
- package/dist/core/interfaces/vertices/properties/belongs-to.d.ts +0 -1
- package/dist/core/interfaces/vertices/properties/coalesced.d.ts +0 -1
- package/dist/core/interfaces/vertices/root-intervals.d.ts +0 -2
- package/dist/core/interfaces/vertices/syllabuses.d.ts +0 -1
- package/dist/core/interfaces/vertices/teachers.d.ts +0 -1
- package/dist/core/interfaces/vertices/threads.d.ts +0 -1
- package/dist/core/interfaces/vertices/users.d.ts +0 -1
- package/dist/core/interfaces/vertices/util/custom-vertex-export/index.d.ts +6 -6
- package/dist/core/interfaces/vertices/util/custom-vertex-export/util.d.ts +4 -4
- package/dist/core/interfaces/vertices/util/deep-vertex-export/index.d.ts +10 -10
- package/dist/core/interfaces/vertices/util/edges.d.ts +7 -7
- package/dist/core/interfaces/vertices/util/util.d.ts +24 -20
- package/dist/core/interfaces/vertices/util/vertex-query/index.d.ts +11 -11
- package/dist/core/interfaces/vertices/util/vertex.d.ts +5 -4
- package/dist/core/interfaces/vertices/vertex-query.d.ts +29 -27
- package/dist/core/interfaces/vertices/vertex-query.js +4 -0
- package/dist/core/interfaces/vertices/vertex-query.js.map +1 -1
- package/dist/core/to/configurations.js +2 -1
- package/dist/core/to/configurations.js.map +1 -1
- package/dist/core/to/courses.js +2 -1
- package/dist/core/to/courses.js.map +1 -1
- package/dist/core/to/division.js.map +1 -1
- package/dist/core/to/events.js +3 -1
- package/dist/core/to/events.js.map +1 -1
- package/dist/core/to/exceptions.js +2 -1
- package/dist/core/to/exceptions.js.map +1 -1
- package/dist/core/to/groups.js +2 -1
- package/dist/core/to/groups.js.map +1 -1
- package/dist/core/to/linked-events-sets.js +18 -0
- package/dist/core/to/linked-events-sets.js.map +1 -0
- package/dist/core/to/locations.js +2 -1
- package/dist/core/to/locations.js.map +1 -1
- package/dist/core/to/locked-times.js +2 -1
- package/dist/core/to/locked-times.js.map +1 -1
- package/dist/core/to/overlap-groups.js +2 -1
- package/dist/core/to/overlap-groups.js.map +1 -1
- package/dist/core/to/periods.js +2 -1
- package/dist/core/to/periods.js.map +1 -1
- package/dist/core/to/persons.js +2 -1
- package/dist/core/to/persons.js.map +1 -1
- package/dist/core/to/root-intervals.js +2 -1
- package/dist/core/to/root-intervals.js.map +1 -1
- package/dist/core/to/schedules.d.ts +2 -1
- package/dist/core/to/schedules.js +3 -1
- package/dist/core/to/schedules.js.map +1 -1
- package/dist/core/to/settings.js +2 -1
- package/dist/core/to/settings.js.map +1 -1
- package/dist/core/to/syllabuses.js +2 -1
- package/dist/core/to/syllabuses.js.map +1 -1
- package/dist/core/to/teachers.js +2 -1
- package/dist/core/to/teachers.js.map +1 -1
- package/dist/core/to/util.d.ts +0 -2
- package/dist/core/to/util.js +2 -1
- package/dist/core/to/util.js.map +1 -1
- package/dist/core/types/index.d.ts +5 -1
- package/dist/core/util.js +5 -3
- package/dist/core/util.js.map +1 -1
- package/dist/identify/constants/index.d.ts +1 -1
- package/dist/identify/constants/index.js.map +1 -1
- package/dist/identify/index.js +2 -1
- package/dist/identify/index.js.map +1 -1
- package/dist/sdui/from/classes.js.map +1 -1
- package/dist/sdui/from/courses.js.map +1 -1
- package/dist/sdui/from/holidays.js.map +1 -1
- package/dist/sdui/from/index.js.map +1 -1
- package/dist/sdui/from/lessons.js.map +1 -1
- package/dist/sdui/from/rooms.js.map +1 -1
- package/dist/sdui/from/schedules.d.ts +0 -2
- package/dist/sdui/from/schedules.js.map +1 -1
- package/dist/sdui/from/school-years.js.map +1 -1
- package/dist/sdui/from/substitution-plans.js.map +1 -1
- package/dist/sdui/from/teachers.js.map +1 -1
- package/dist/sdui/to/classes.js.map +1 -1
- package/dist/sdui/to/courses.js.map +1 -1
- package/dist/sdui/to/holidays.js +1 -1
- package/dist/sdui/to/holidays.js.map +1 -1
- package/dist/sdui/to/hours.js.map +1 -1
- package/dist/sdui/to/index.d.ts +0 -2
- package/dist/sdui/to/lessons.js +1 -1
- package/dist/sdui/to/lessons.js.map +1 -1
- package/dist/sdui/to/rooms.js.map +1 -1
- package/dist/sdui/to/schedules.js.map +1 -1
- package/dist/sdui/to/school-years.js +1 -1
- package/dist/sdui/to/school-years.js.map +1 -1
- package/dist/sdui/to/substitution-plans.js +7 -4
- package/dist/sdui/to/substitution-plans.js.map +1 -1
- package/dist/sdui/to/teachers.js.map +1 -1
- package/dist/vKlass/from/index.js.map +1 -1
- package/dist/vKlass/from/schedule.d.ts +0 -1
- package/dist/vKlass/from/schedule.js.map +1 -1
- package/dist/vKlass/to/schedules.js +17 -6
- package/dist/vKlass/to/schedules.js.map +1 -1
- package/package.json +29 -24
- package/dist/RS/to/input/collections.js +0 -58
- package/dist/RS/to/input/collections.js.map +0 -1
- package/dist/RS/to/input/dynamic-locked-times.js +0 -69
- package/dist/RS/to/input/dynamic-locked-times.js.map +0 -1
- package/dist/RS/to/input/util/attach-locked-times.js +0 -27
- package/dist/RS/to/input/util/attach-locked-times.js.map +0 -1
- package/dist/RS/to/input/util/parse-intervals.js +0 -56
- package/dist/RS/to/input/util/parse-intervals.js.map +0 -1
- package/dist/RS/types/collections.d.ts +0 -33
- package/dist/RS/types/default.d.ts +0 -31
- package/dist/RS/types/dependencies.d.ts +0 -16
- package/dist/RS/types/events.d.ts +0 -34
- package/dist/RS/types/groups.d.ts +0 -27
- package/dist/RS/types/individuals.d.ts +0 -16
- package/dist/RS/types/locked-times.d.ts +0 -12
- package/dist/RS/types/period.d.ts +0 -27
- package/dist/RS/types/root-intervals.d.ts +0 -10
- package/dist/RS/types/settings.d.ts +0 -15
- package/dist/RS/types/shared.d.ts +0 -27
- package/dist/core/interfaces/index.d.ts +0 -23
- package/dist/core/interfaces/other/index.d.ts +0 -6
- package/dist/core/interfaces/vertices/util/index.d.ts +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teachers.js","names":["doc: Types.
|
|
1
|
+
{"version":3,"file":"teachers.js","names":["doc: Types.Entities.Group"],"sources":["../../../../src/RS/to/input/teachers.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { parseDayIndices } from './util/parse-days';\nimport { idOf } from './util/util';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromTeachers (\n teachers: ConnectedTypes.teacher[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.Entities.Group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return teachers\n .map(teacher => {\n const intervals = teacher.intervals ?? defaultInterval;\n const rootInterval = teacher.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.Entities.Group = {\n id: idOf.teacher(teacher, options),\n group_type: 'personal',\n minimizeGaps: false,\n minimizeDependencyAlternation: true,\n weight: teacher.weight,\n intervals: idOf.intervalPairReference(intervals, rootInterval, options),\n days: parseDayIndices(teacher.days, settings),\n blockedTimes: teacher.lockedTimes?.map(x => idOf.lockedTime(x, options)),\n minBreakDuration: teacher.minBreakLength,\n ...parseMaxWorkingHours(teacher),\n };\n\n if (options.includeEntityMeta) {\n doc.name = teacher.displayName;\n }\n\n return omitBy(doc, x => x == null) as Types.Entities.Group;\n });\n};\n"],"mappings":";;;;;;;AAQA,SAAgB,aACd,UACA,UACA,SACwB;CACxB,MAAM,kBAAkB,mBAAmB;AAE3C,QAAO,SACJ,KAAI,YAAW;EACd,MAAM,YAAe,QAAQ,aAAgB;EAC7C,MAAM,eAAe,QAAQ,gBAAgB,SAAS;EAEtD,MAAMA,MAA4B;GAChC,IAA+B,KAAK,QAAQ,SAAS;GACrD,YAA+B;GAC/B,cAA+B;GAC/B,+BAA+B;GAC/B,QAA+B,QAAQ;GACvC,WAA+B,KAAK,sBAAsB,WAAW,cAAc;GACnF,MAA+B,gBAAgB,QAAQ,MAAM;GAC7D,cAA+B,QAAQ,aAAa,KAAI,MAAK,KAAK,WAAW,GAAG;GAChF,kBAA+B,QAAQ;GACvC,GAAG,qBAAqB;;AAG1B,MAAI,QAAQ,kBACV,KAAI,OAAO,QAAQ;AAGrB,SAAO,OAAO,MAAK,MAAK,KAAK"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/RS/to/input/util/parse-days.ts
|
|
2
|
-
function
|
|
2
|
+
function parseDayIndices(days, settings) {
|
|
3
3
|
if (!days) return;
|
|
4
4
|
if (days.length) return days.map((x) => x.day);
|
|
5
5
|
return [...Array.from({ length: settings.numDays })].map((_, i) => i);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
|
-
export {
|
|
9
|
+
export { parseDayIndices };
|
|
10
10
|
//# sourceMappingURL=parse-days.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-days.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-days.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\n\nexport function
|
|
1
|
+
{"version":3,"file":"parse-days.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-days.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\n\nexport function parseDayIndices (\n days: ConnectedTypes.event['days'] | ConnectedTypes.course['days'],\n settings: ConnectedTypes.divisionSettings\n): Types.Shared.DayIndices | undefined {\n if (!days) return;\n\n if (days.length) return days.map(x => x.day);\n\n // empty days means all days selected (since no days selected is prohibited)\n return [...Array.from({ length: settings.numDays })].map((_, i) => i);\n}"],"mappings":";AAGA,SAAgB,gBACd,MACA,UACqC;AACrC,KAAI,CAAC,KAAM;AAEX,KAAI,KAAK,OAAQ,QAAO,KAAK,KAAI,MAAK,EAAE;AAGxC,QAAO,CAAC,GAAG,MAAM,KAAK,EAAE,QAAQ,SAAS,YAAY,KAAK,GAAG,MAAM"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getVertexId } from "../../../../core/util.js";
|
|
2
2
|
import { makeChainable } from "../../../../common/make-chainable/index.js";
|
|
3
3
|
import { idOf } from "./util.js";
|
|
4
|
-
import { groupBy
|
|
4
|
+
import { groupBy } from "lodash-es";
|
|
5
5
|
|
|
6
6
|
//#region src/RS/to/input/util/parse-group-references.ts
|
|
7
7
|
/**
|
|
@@ -36,21 +36,13 @@ function getSources(itemAndType) {
|
|
|
36
36
|
*/
|
|
37
37
|
function parseGroupReferences(itemAndType, options) {
|
|
38
38
|
const sources = getSources(itemAndType);
|
|
39
|
-
if (options.oldFormat) return makeChainable([
|
|
40
|
-
...(sources.teachers ?? []).map((x) => idOf.teacher(x.to, options)),
|
|
41
|
-
...mergeWithParentGroups(sources.groups ?? [], options).flatMap((ref) => {
|
|
42
|
-
if (ref.to.species == "class") return idOf.group(ref.to, options);
|
|
43
|
-
return (ref.to.members ?? []).filter((x) => !ref.exclude?.includes(x)).map((x) => x.group ? idOf.group(x.group, options) : void 0).filter((x) => x != null);
|
|
44
|
-
}),
|
|
45
|
-
...(sources.participants ?? []).map((x) => x.to.group ? idOf.group(x.to.group, options) : void 0).filter((x) => x != null)
|
|
46
|
-
]).chain((x) => uniq(x).map((x$1) => [x$1])).value;
|
|
47
39
|
const teacherReferences = (sources.teachers ?? []).map((x) => ({ group: idOf.teacher(x.to, options) }));
|
|
48
40
|
const groupReferences = mergeWithParentGroups(sources.groups ?? [], options).map((x) => {
|
|
49
41
|
if (x.to.species != "class" || x.exclude?.length) return { individuals: idOf.groupReference(x, options) };
|
|
50
42
|
return { group: idOf.group(x.to, options) };
|
|
51
43
|
});
|
|
52
44
|
const participantReferences = sources.participants?.length ? { individuals: sources.participants.map((x) => idOf.person(x.to, options)) } : void 0;
|
|
53
|
-
return
|
|
45
|
+
return new Array().concat(teacherReferences, groupReferences, participantReferences ? [participantReferences] : []).map((x) => [x]);
|
|
54
46
|
}
|
|
55
47
|
|
|
56
48
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-group-references.js","names":["x"],"sources":["../../../../../src/RS/to/input/util/parse-group-references.ts"],"sourcesContent":["import { groupBy
|
|
1
|
+
{"version":3,"file":"parse-group-references.js","names":["x"],"sources":["../../../../../src/RS/to/input/util/parse-group-references.ts"],"sourcesContent":["import { groupBy } from 'lodash-es';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport { idOf } from './util';\nimport { getVertexId } from '../../../../core/util';\nimport type { Types } from '../../../types';\nimport { makeChainable } from '../../../../common/make-chainable';\nimport type { GroupWithExclude, Wrapped } from '../../../../core/interfaces/vertices/util/edges';\n\n/**\n * Merges group references with their parent groups while ensuring that a group is present at\n * most once and that parent groups are prioritized as they carry no member exclusions.\n */\nfunction mergeWithParentGroups (\n references: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>[],\n options: Types.parsedToOptions\n): GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>[] {\n return makeChainable(references)\n .chain(\n x => x.flatMap((x): ((typeof x) & { isParentGroup?: boolean })[] => ([\n x, ...(x.to.parentGroups ?? []).map(y => ({ to: y, isParentGroup: true }))\n ])),\n x => groupBy(x, x => getVertexId(x.to, options)),\n x => Object.values(x)\n .map(xs => xs.find(x => x.isParentGroup) ?? xs.at(0))\n .filter(x => x != null)\n )\n .value;\n}\n\ntype ItemAndType =\n | { item: ConnectedTypes.event, type: 'event' }\n | { item: ConnectedTypes.lockedTime, type: 'lockedTime' };\n\ntype Source = {\n teachers?: Wrapped.Util.Value<'to', ConnectedTypes.teacher>[];\n groups?: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>[];\n participants?: Wrapped.Util.Value<'to', ConnectedTypes.person>[];\n};\n\n/**\n * Returns the source of group, teacher, and participant references for a given item while taking into account event inheritance.\n */\nfunction getSources (itemAndType: ItemAndType): Source {\n if (itemAndType.type == 'lockedTime') return {\n teachers: itemAndType.item.coalesced?.filter(x => x.toModel == 'teachers'),\n groups: itemAndType.item.coalesced?.filter(x => x.toModel == 'groups' )\n };\n\n const item = itemAndType.item;\n const teachersSource = item.teachers\n ? item\n : ('course' in item && item.course ? item.course : item);\n const groupsAndParticipantsSource = (item.groups || item.participants)\n ? item\n : ('course' in item && item.course ? item.course : item);\n return {\n teachers: teachersSource.teachers ?? undefined,\n groups: groupsAndParticipantsSource.groups ?? undefined,\n participants: groupsAndParticipantsSource.participants ?? undefined\n };\n}\n\n/**\n * Parses group references from a course or event while carrying out event inheritance and taking into account parent groups.\n */\nexport function parseGroupReferences (\n itemAndType: ItemAndType,\n options: Types.parsedToOptions\n): Types.Shared.GroupReferenceSets {\n const sources = getSources(itemAndType);\n\n const teacherReferences = (sources.teachers ?? [])\n .map((x): Types.Shared.GroupReference => ({ group: idOf.teacher(x.to, options) }));\n\n const groupReferences = mergeWithParentGroups(sources.groups ?? [], options)\n .map((x): Types.Shared.GroupReference | Types.Shared.IndividualsReference => {\n if (x.to.species != 'class' || x.exclude?.length) return { individuals: idOf.groupReference(x, options) }; // use individuals set if not a plain group reference\n return { group: idOf.group(x.to, options) };\n });\n\n const participantReferences = sources.participants?.length\n ? { individuals: sources.participants.map(x => idOf.person(x.to, options)) } as Types.Shared.IndividualsReference\n : undefined;\n\n // combine all references\n return new Array<Types.Shared.GroupReference | Types.Shared.IndividualsReference>()\n .concat(\n teacherReferences,\n groupReferences,\n participantReferences ? [participantReferences] : []\n )\n .map(x => [x]);\n}"],"mappings":";;;;;;;;;;AAYA,SAAS,sBACP,YACA,SAC4E;AAC5E,QAAO,cAAc,YAClB,OACC,MAAK,EAAE,SAAS,QAAqD,CACnEA,KAAG,IAAIA,IAAE,GAAG,gBAAgB,IAAI,KAAI,OAAM;EAAE,IAAI;EAAG,eAAe;SAEpE,MAAK,QAAQ,IAAG,QAAK,YAAYA,IAAE,IAAI,YACvC,MAAK,OAAO,OAAO,GAChB,KAAI,OAAM,GAAG,MAAK,QAAKA,IAAE,kBAAkB,GAAG,GAAG,IACjD,QAAO,QAAKA,OAAK,OAErB;;;;;AAgBL,SAAS,WAAY,aAAkC;AACrD,KAAI,YAAY,QAAQ,aAAc,QAAO;EAC3C,UAAU,YAAY,KAAK,WAAW,QAAO,MAAK,EAAE,WAAW;EAC/D,QAAU,YAAY,KAAK,WAAW,QAAO,MAAK,EAAE,WAAW;;CAGjE,MAAM,OAAO,YAAY;CACzB,MAAM,iBAAiB,KAAK,WACxB,OACC,YAAY,QAAQ,KAAK,SAAS,KAAK,SAAS;CACrD,MAAM,8BAA+B,KAAK,UAAU,KAAK,eACrD,OACC,YAAY,QAAQ,KAAK,SAAS,KAAK,SAAS;AACrD,QAAO;EACL,UAAc,eAAe,YAA6B;EAC1D,QAAc,4BAA4B,UAAgB;EAC1D,cAAc,4BAA4B,gBAAgB;;;;;;AAO9D,SAAgB,qBACd,aACA,SACiC;CACjC,MAAM,UAAU,WAAW;CAE3B,MAAM,qBAAqB,QAAQ,YAAY,IAC5C,KAAK,OAAoC,EAAE,OAAO,KAAK,QAAQ,EAAE,IAAI;CAExE,MAAM,kBAAkB,sBAAsB,QAAQ,UAAU,IAAI,SACjE,KAAK,MAAuE;AAC3E,MAAI,EAAE,GAAG,WAAW,WAAW,EAAE,SAAS,OAAQ,QAAO,EAAE,aAAa,KAAK,eAAe,GAAG;AAC/F,SAAO,EAAE,OAAO,KAAK,MAAM,EAAE,IAAI;;CAGrC,MAAM,wBAAwB,QAAQ,cAAc,SAChD,EAAE,aAAa,QAAQ,aAAa,KAAI,MAAK,KAAK,OAAO,EAAE,IAAI,cAC/D;AAGJ,QAAO,IAAI,QACR,OACC,mBACA,iBACA,wBAAwB,CAAC,yBAAyB,IAEnD,KAAI,MAAK,CAAC"}
|
|
@@ -18,13 +18,7 @@ function parseLocationReferences(references, options) {
|
|
|
18
18
|
...x$1.rank != null && { rank: x$1.rank }
|
|
19
19
|
})))).value;
|
|
20
20
|
}
|
|
21
|
-
function parseSelectedLocations(event, options) {
|
|
22
|
-
const dependencies = parseLocationReferences(event.locations ?? event.course?.locations, options);
|
|
23
|
-
const inLocations = event.inLocations ?? [];
|
|
24
|
-
if (inLocations.length === dependencies?.length) return inLocations.map((x) => x ? getVertexId(x, options) : null);
|
|
25
|
-
return inLocations.map((x) => x ? getVertexId(x, options) : null).concat(Array.from({ length: Math.max((dependencies?.length ?? 0) - inLocations.length, 0) }).map(() => null));
|
|
26
|
-
}
|
|
27
21
|
|
|
28
22
|
//#endregion
|
|
29
|
-
export { parseLocationReferences
|
|
23
|
+
export { parseLocationReferences };
|
|
30
24
|
//# sourceMappingURL=parse-location-references.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-location-references.js","names":["x"],"sources":["../../../../../src/RS/to/input/util/parse-location-references.ts"],"sourcesContent":["import { groupBy } from 'lodash-es';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport { getVertexId } from '../../../../core/util';\nimport { makeChainable } from '../../../../common/make-chainable';\nimport type { AvailableLocation } from '../../../../core/interfaces/vertices/util/edges';\n\n\nexport function parseLocationReferences (\n references: AvailableLocation.Util.Value<ConnectedTypes.location, { groupIndex?: number; rank?: number; }>[] | null | undefined,\n options: Types.parsedToOptions\n) {\n if (!references) return;\n\n return makeChainable(references)\n .chain(\n x => x\n .map(({ locations, groupIndex, rank }) => ({\n dependency: getVertexId(locations[0], options),\n rank: rank,\n groupIndex: groupIndex\n }))\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 x => groupBy(x, x => x.groupIndex),\n x => Object.values(x)\n .map(xs => xs.map(x => ({\n dependency: x.dependency,\n ...x.rank != null && { rank: x.rank },\n }) as Types.
|
|
1
|
+
{"version":3,"file":"parse-location-references.js","names":["x"],"sources":["../../../../../src/RS/to/input/util/parse-location-references.ts"],"sourcesContent":["import { groupBy } from 'lodash-es';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport { getVertexId } from '../../../../core/util';\nimport { makeChainable } from '../../../../common/make-chainable';\nimport type { AvailableLocation } from '../../../../core/interfaces/vertices/util/edges';\n\n\nexport function parseLocationReferences (\n references: AvailableLocation.Util.Value<ConnectedTypes.location, { groupIndex?: number; rank?: number; }>[] | null | undefined,\n options: Types.parsedToOptions\n) {\n if (!references) return;\n\n return makeChainable(references)\n .chain(\n x => x\n .map(({ locations, groupIndex, rank }) => ({\n dependency: getVertexId(locations[0], options),\n rank: rank,\n groupIndex: groupIndex\n }))\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 x => groupBy(x, x => x.groupIndex),\n x => Object.values(x)\n .map(xs => xs.map(x => ({\n dependency: x.dependency,\n ...x.rank != null && { rank: x.rank },\n }) as Types.Shared.DependencyReference))\n )\n .value;\n}\n\nexport function parseSelectedLocations (event: ConnectedTypes.event, options: Types.parsedToOptions) {\n\n const locationsRef = event.locations ?? event.course?.locations;\n const dependencies = parseLocationReferences(locationsRef, options);\n const inLocations = event.inLocations ?? [];\n\n // simply use inLocations if they match the number of dependencies\n if (inLocations.length === dependencies?.length) {\n return inLocations.map(x => x ? getVertexId(x, options) : null);\n }\n\n // otherwise, fill inLocations with nulls to match the number of dependencies\n return inLocations\n .map(x => x ? getVertexId(x, options) : null)\n .concat(Array\n .from({ length: Math.max((dependencies?.length ?? 0) - inLocations.length, 0) })\n .map(() => null as string | null)\n );\n}"],"mappings":";;;;;AAQA,SAAgB,wBACd,YACA,SACA;AACA,KAAI,CAAC,WAAY;AAEjB,QAAO,cAAc,YAClB,OACC,MAAK,EACF,KAAK,EAAE,WAAW,YAAY,YAAY;EACzC,YAAY,YAAY,UAAU,IAAI;EAC1B;EACA;KAEb,QAAO,QAAK;EAEX,MAAM,oBAAoB,QAAQ,wBAAwB;AAC1D,MAAI,CAAC,kBAAmB,QAAO;AAC/B,SAAO,kBAAkB,IAAIA,IAAE;MAEnC,MAAK,QAAQ,IAAG,QAAKA,IAAE,cACvB,MAAK,OAAO,OAAO,GAChB,KAAI,OAAM,GAAG,KAAI,SAAM;EACtB,YAAYA,IAAE;EACd,GAAGA,IAAE,QAAQ,QAAQ,EAAE,MAAMA,IAAE;OAGpC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { min2hrs } from "./util.js";
|
|
2
2
|
|
|
3
3
|
//#region src/RS/to/input/util/parse-max-working-hours.ts
|
|
4
|
-
function parseMaxWorkingHours(group
|
|
5
|
-
if (
|
|
6
|
-
|
|
4
|
+
function parseMaxWorkingHours(group) {
|
|
5
|
+
if (!group.maximumScheduleSpan) return;
|
|
6
|
+
return {
|
|
7
|
+
maxNumWorkingHours: min2hrs(group.maximumScheduleSpan.weekly) ?? false,
|
|
7
8
|
maxNumDailyWorkingHours: min2hrs(group.maximumScheduleSpan.daily) ?? false
|
|
8
9
|
};
|
|
9
|
-
if (!options.useMaximumScheduleSpan) return {
|
|
10
|
-
..."maxNumWorkingHours" in group && { maxNumWorkingHours: group.maxNumWorkingHours },
|
|
11
|
-
..."maxNumDailyWorkingHours" in group && { maxNumDailyWorkingHours: group.maxNumDailyWorkingHours }
|
|
12
|
-
};
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-max-working-hours.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-max-working-hours.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport { min2hrs } from './util';\n\nexport function parseMaxWorkingHours (\n group:
|
|
1
|
+
{"version":3,"file":"parse-max-working-hours.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-max-working-hours.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport { min2hrs } from './util';\n\nexport function parseMaxWorkingHours (\n group: ConnectedTypes.group | ConnectedTypes.teacher\n): Pick<Types.Entities.Group, 'maxNumWorkingHours' | 'maxNumDailyWorkingHours'> | undefined {\n if (!group.maximumScheduleSpan) return;\n\n return {\n maxNumWorkingHours: min2hrs(group.maximumScheduleSpan.weekly) ?? false,\n maxNumDailyWorkingHours: min2hrs(group.maximumScheduleSpan.daily ) ?? false,\n };\n}\n"],"mappings":";;;AAIA,SAAgB,qBACd,OAC0F;AAC1F,KAAI,CAAC,MAAM,oBAAqB;AAEhC,QAAO;EACL,oBAAyB,QAAQ,MAAM,oBAAoB,WAAW;EACtE,yBAAyB,QAAQ,MAAM,oBAAoB,UAAW"}
|
|
@@ -4,14 +4,14 @@ function parseMinimumBreakLength(value) {
|
|
|
4
4
|
if (typeof value === "boolean") return value;
|
|
5
5
|
if (typeof value === "number") return value;
|
|
6
6
|
if (Array.isArray(value)) {
|
|
7
|
-
if (value.length !== 2) throw new Error("(RS::To::
|
|
7
|
+
if (value.length !== 2) throw new Error("(RS::To::parseMinimumBreakLength) BreakLength array must have exactly two elements");
|
|
8
8
|
const [bef, aft] = value;
|
|
9
9
|
return {
|
|
10
10
|
bef,
|
|
11
11
|
aft
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
throw new Error("(RS::To::
|
|
14
|
+
throw new Error("(RS::To::parseMinimumBreakLength) BreakLength is neither boolean, number or number array");
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-minimum-break-length.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-minimum-break-length.ts"],"sourcesContent":["import type { CoreTypes } from '../../../../core';\nimport type { Types } from '../../../types';\n\nexport function parseMinimumBreakLength (value: CoreTypes.breakLength | null | undefined): Types.
|
|
1
|
+
{"version":3,"file":"parse-minimum-break-length.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-minimum-break-length.ts"],"sourcesContent":["import type { CoreTypes } from '../../../../core';\nimport type { Types } from '../../../types';\n\nexport function parseMinimumBreakLength (value: CoreTypes.breakLength | null | undefined): Types.Shared.EventBreakDuration | undefined {\n if (value == null) return;\n\n if (typeof value === 'boolean') return value;\n if (typeof value === 'number') return value;\n\n if (Array.isArray(value)) {\n if (value.length !== 2) throw new Error('(RS::To::parseMinimumBreakLength) BreakLength array must have exactly two elements');\n const [bef, aft] = value;\n return { bef, aft };\n }\n\n throw new Error('(RS::To::parseMinimumBreakLength) BreakLength is neither boolean, number or number array');\n};\n"],"mappings":";AAGA,SAAgB,wBAAyB,OAA8F;AACrI,KAAI,SAAS,KAAM;AAEnB,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,OAAO,UAAU,SAAU,QAAO;AAEtC,KAAI,MAAM,QAAQ,QAAQ;AACxB,MAAI,MAAM,WAAW,EAAG,OAAM,IAAI,MAAM;EACxC,MAAM,CAAC,KAAK,OAAO;AACnB,SAAO;GAAE;GAAK;;;AAGhB,OAAM,IAAI,MAAM"}
|
|
@@ -2,7 +2,8 @@ import { getVertexId } from "../../../../core/util.js";
|
|
|
2
2
|
|
|
3
3
|
//#region src/RS/to/input/util/util.ts
|
|
4
4
|
function min2hrs(min) {
|
|
5
|
-
|
|
5
|
+
if (min == null) return;
|
|
6
|
+
return min / 60;
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* Converts a time string in the format "HH:MM" to a float representation, e.g., "12:30" becomes 12.3.
|
|
@@ -10,14 +11,6 @@ function min2hrs(min) {
|
|
|
10
11
|
function toTimeFloat(str) {
|
|
11
12
|
return parseFloat(str.replace(":", "."));
|
|
12
13
|
}
|
|
13
|
-
function getPeriodIndex(period, periodsMap, options) {
|
|
14
|
-
if (periodsMap.size == 0) return;
|
|
15
|
-
if (!period) return;
|
|
16
|
-
const id = getVertexId(period, options);
|
|
17
|
-
const periodIndex = periodsMap.get(id);
|
|
18
|
-
if (periodIndex === void 0) throw new Error(`(RS::To::getPeriodIndex) Period "${id}" is not in periodsMap`);
|
|
19
|
-
return periodIndex;
|
|
20
|
-
}
|
|
21
14
|
const COLLECTION_ID = {
|
|
22
15
|
persons: "persons",
|
|
23
16
|
groups: "groups",
|
|
@@ -55,11 +48,12 @@ let idOf;
|
|
|
55
48
|
if (interval === null) interval = void 0;
|
|
56
49
|
if (rootInterval === null) rootInterval = void 0;
|
|
57
50
|
if (interval && interval.length == 0) interval = void 0;
|
|
58
|
-
|
|
51
|
+
const out = (rootInterval ? getVertexId(rootInterval, options) + "&" : "") + JSON.stringify(interval);
|
|
52
|
+
return out;
|
|
59
53
|
}
|
|
60
54
|
_idOf.intervalPairReference = intervalPairReference;
|
|
61
55
|
})(idOf || (idOf = {}));
|
|
62
56
|
|
|
63
57
|
//#endregion
|
|
64
|
-
export { COLLECTION_ID,
|
|
58
|
+
export { COLLECTION_ID, idOf, min2hrs, toTimeFloat };
|
|
65
59
|
//# sourceMappingURL=util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","names":["person","group","teacher","event","lockedTime"],"sources":["../../../../../src/RS/to/input/util/util.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport type { Collection } from '../../../../core/types/common';\nimport { getVertexId } from '../../../../core/util';\nimport type { GroupWithExclude } from '../../../../core/interfaces/vertices/util/edges';\nimport type { Interval } from '../../../../core/interfaces';\n\nexport function min2hrs (min: number | undefined | null) {\n
|
|
1
|
+
{"version":3,"file":"util.js","names":["person","group","teacher","event","lockedTime"],"sources":["../../../../../src/RS/to/input/util/util.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport type { Collection } from '../../../../core/types/common';\nimport { getVertexId } from '../../../../core/util';\nimport type { GroupWithExclude } from '../../../../core/interfaces/vertices/util/edges';\nimport type { Interval } from '../../../../core/interfaces';\n\nexport function min2hrs (min: number | undefined | null) {\n if (min == null) return;\n return min / 60;\n}\n\n/**\n * Converts a time string in the format \"HH:MM\" to a float representation, e.g., \"12:30\" becomes 12.3.\n */\nexport function toTimeFloat (str: string) {\n return parseFloat(str.replace(':', '.'));\n}\n\nexport function getPeriodIndex (\n period: ConnectedTypes.period | string | undefined | null,\n periodsMap: Map<string | undefined, number>,\n options: Types.parsedToOptions\n): number | undefined {\n // if no periods exist, return undefined\n if (periodsMap.size == 0) return;\n\n // if no period is given, return undefined\n if (!period) return;\n\n const id = getVertexId(period, options);\n const periodIndex = periodsMap.get(id);\n if (periodIndex === undefined) {\n throw new Error(`(RS::To::getPeriodIndex) Period \"${id}\" is not in periodsMap`);\n }\n return periodIndex;\n}\n\nexport const COLLECTION_ID = {\n persons: 'persons',\n groups: 'groups',\n teachers: 'teachers',\n events: 'events',\n lockedTimes: 'lockedtimes',\n} satisfies Partial<Record<Collection, string>>;\n\n/**\n * returns a combined id for the vertex or edge by combining the type(s) and id(s).\n */\nexport namespace idOf {\n /** `persons.id` */\n export function person (\n person: ConnectedTypes.person | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.persons}.${ getVertexId(person, options) }`;\n }\n\n /** `groups.id` */\n export function group (\n group: ConnectedTypes.group,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group, options) }`;\n }\n\n /** `teachers.id` */\n export function teacher (\n teacher: ConnectedTypes.teacher,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.teachers}.${ getVertexId(teacher, options) }`;\n }\n\n /** `events.id` */\n export function event (\n event: ConnectedTypes.event,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.events}.${ getVertexId(event, options) }`;\n }\n\n /** `lockedtimes.id` */\n export function lockedTime (\n lockedTime: ConnectedTypes.lockedTime,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.lockedTimes}.${ getVertexId(lockedTime, options) }`;\n }\n\n /** `groups.id<.exclude.id1.id2...>` */\n export function groupReference (\n group: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group.to, options) }`\n + (group.exclude?.length\n ? '.exclude.' + group.exclude\n .map(x => getVertexId(x, options))\n .sort()\n .join('.')\n : '');\n }\n\n /** `<rootIntervalsId&>JSON.stringify(intervals)>` */\n export function intervalPairReference (\n interval: Interval[] | undefined,\n rootInterval: ConnectedTypes.rootInterval | undefined,\n options: Types.parsedToOptions\n ): string {\n // replace null with undefined\n if (interval === null) interval = undefined;\n if (rootInterval === null) rootInterval = undefined;\n\n // replace empty intervals with undefined\n if (interval && interval.length == 0) interval = undefined;\n\n const out = (rootInterval ? getVertexId(rootInterval, options) + '&' : '') + JSON.stringify(interval);\n return out;\n }\n}\n"],"mappings":";;;AAOA,SAAgB,QAAS,KAAgC;AACvD,KAAI,OAAO,KAAM;AACjB,QAAO,MAAM;;;;;AAMf,SAAgB,YAAa,KAAa;AACxC,QAAO,WAAW,IAAI,QAAQ,KAAK;;AAsBrC,MAAa,gBAAgB;CAC3B,SAAa;CACb,QAAa;CACb,UAAa;CACb,QAAa;CACb,aAAa;;;;CAQN,SAAS,OACd,UACA,SACQ;AACR,SAAO,GAAG,cAAc,QAAQ,GAAI,YAAYA,UAAQ;;;CAInD,SAAS,MACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYC,SAAO;;;CAIjD,SAAS,QACd,WACA,SACQ;AACR,SAAO,GAAG,cAAc,SAAS,GAAI,YAAYC,WAAS;;;CAIrD,SAAS,MACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYC,SAAO;;;CAIjD,SAAS,WACd,cACA,SACQ;AACR,SAAO,GAAG,cAAc,YAAY,GAAI,YAAYC,cAAY;;;CAI3D,SAAS,eACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYH,QAAM,IAAI,cACpDA,QAAM,SAAS,SACd,cAAcA,QAAM,QACnB,KAAI,MAAK,YAAY,GAAG,UACxB,OACA,KAAK,OACN;;;CAID,SAAS,sBACd,UACA,cACA,SACQ;AAER,MAAI,aAAiB,KAAM,YAAe;AAC1C,MAAI,iBAAiB,KAAM,gBAAe;AAG1C,MAAI,YAAY,SAAS,UAAU,EAAG,YAAW;EAEjD,MAAM,OAAO,eAAe,YAAY,cAAc,WAAW,MAAM,MAAM,KAAK,UAAU;AAC5F,SAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","names":["partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions']"],"sources":["../../../src/RS/to/schedules.ts"],"sourcesContent":["import { pick } from 'lodash-es';\nimport { parseInput } from './input/input';\nimport { makeConnected } from '../make-connected';\nimport { initialConfiguration } from './initial-configuration';\nimport type { Types } from '../types';\nimport { CoreMap } from '../../core';\nimport { structure } from '../types/to';\nimport { COLLECTION_ID } from './input/util/util';\n\nfunction transformId (id: string): string {\n // should be interpreted as event id\n const indexOfDot = id.indexOf('.');\n if (indexOfDot == -1) return COLLECTION_ID.events + '.' + id;\n\n // split on first dot only\n const prefix = id.substring(0, indexOfDot).toLowerCase();\n const suffix = id.substring(indexOfDot + 1);\n\n if (prefix == COLLECTION_ID.lockedTimes.toLowerCase()) return COLLECTION_ID.lockedTimes + '.' + suffix;\n if (prefix == COLLECTION_ID.events .toLowerCase()) return COLLECTION_ID.events + '.' + suffix;\n\n throw new Error(`(RS::To::transformId) Unknown id prefix \"${prefix}\" in id \"${id}\"`);\n}\n\nexport function schedules (\n data: Types.toInput,\n _options: Types.toOptions = {}\n): Types.toOutput {\n ////\n //// parse the options\n ////\n const options = ((): Types.parsedToOptions => {\n const x = _options.partialScheduleOptions;\n const partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions'] = x\n ? {\n includedEvents: x.includedEvents ? new Set(x.includedEvents) : undefined,\n includedLocations: x.includedLocations ? new Set(x.includedLocations) : undefined,\n omittedEventsHandling: x.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].map(x => transformId(x))\n );\n }\n\n\n // we will work only with connected schedule data\n const connectedData = makeConnected(data);\n\n return {\n meta: {\n structure: structure,\n division: pick(connectedData.division, 'displayName', 'start', 'end'),\n },\n algorithmParameters: {\n weights: options.algorithmWeightParameters,\n computeTimeMultiplier: options.computeTimeMultiplier\n },\n input: parseInput(connectedData, options),\n ...options.appendCoreData && { coreData: CoreMap.to.schedules(data) },\n ...options.appendOutput && { output: initialConfiguration(connectedData.events, connectedData.lockedTimes, options) },\n };\n};"],"mappings":";;;;;;;;;AASA,SAAS,YAAa,IAAoB;CAExC,MAAM,aAAa,GAAG,QAAQ
|
|
1
|
+
{"version":3,"file":"schedules.js","names":["partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions']"],"sources":["../../../src/RS/to/schedules.ts"],"sourcesContent":["import { pick } from 'lodash-es';\nimport { parseInput } from './input/input';\nimport { makeConnected } from '../make-connected';\nimport { initialConfiguration } from './initial-configuration';\nimport type { Types } from '../types';\nimport { CoreMap } from '../../core';\nimport { structure } from '../types/to';\nimport { COLLECTION_ID } from './input/util/util';\n\nfunction transformId (id: string): string {\n // should be interpreted as event id\n const indexOfDot = id.indexOf('.');\n if (indexOfDot == -1) return COLLECTION_ID.events + '.' + id;\n\n // split on first dot only\n const prefix = id.substring(0, indexOfDot).toLowerCase();\n const suffix = id.substring(indexOfDot + 1);\n\n if (prefix == COLLECTION_ID.lockedTimes.toLowerCase()) return COLLECTION_ID.lockedTimes + '.' + suffix;\n if (prefix == COLLECTION_ID.events .toLowerCase()) return COLLECTION_ID.events + '.' + suffix;\n\n throw new Error(`(RS::To::transformId) Unknown id prefix \"${prefix}\" in id \"${id}\"`);\n}\n\nexport function schedules (\n data: Types.toInput,\n _options: Types.toOptions = {}\n): Types.toOutput {\n ////\n //// parse the options\n ////\n const options = ((): Types.parsedToOptions => {\n const x = _options.partialScheduleOptions;\n const partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions'] = x\n ? {\n includedEvents: x.includedEvents ? new Set(x.includedEvents) : undefined,\n includedLocations: x.includedLocations ? new Set(x.includedLocations) : undefined,\n omittedEventsHandling: x.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].map(x => transformId(x))\n );\n }\n\n\n // we will work only with connected schedule data\n const connectedData = makeConnected(data);\n\n return {\n meta: {\n structure: structure,\n division: pick(connectedData.division, 'displayName', 'start', 'end'),\n },\n algorithmParameters: {\n weights: options.algorithmWeightParameters,\n computeTimeMultiplier: options.computeTimeMultiplier\n },\n input: parseInput(connectedData, options),\n ...options.appendCoreData && { coreData: CoreMap.to.schedules(data) },\n ...options.appendOutput && { output: initialConfiguration(connectedData.events, connectedData.lockedTimes, options) },\n };\n};"],"mappings":";;;;;;;;;AASA,SAAS,YAAa,IAAoB;CAExC,MAAM,aAAa,GAAG,QAAQ;AAC9B,KAAI,cAAc,GAAI,QAAO,cAAc,SAAS,MAAM;CAG1D,MAAM,SAAS,GAAG,UAAU,GAAG,YAAY;CAC3C,MAAM,SAAS,GAAG,UAAU,aAAa;AAEzC,KAAI,UAAU,cAAc,YAAY,cAAe,QAAO,cAAc,cAAc,MAAM;AAChG,KAAI,UAAU,cAAc,OAAY,cAAe,QAAO,cAAc,SAAc,MAAM;AAEhG,OAAM,IAAI,MAAM,4CAA4C,OAAO,WAAW,GAAG;;AAGnF,SAAgB,UACd,MACA,WAA4B,IACZ;CAIhB,MAAM,iBAAwC;EAC5C,MAAM,IAAI,SAAS;EACnB,MAAMA,yBAA0E,IAC5E;GACA,gBAAuB,EAAE,iBAAoB,IAAI,IAAI,EAAE,kBAAqB;GAC5E,mBAAuB,EAAE,oBAAoB,IAAI,IAAI,EAAE,qBAAqB;GAC5E,uBAAuB,EAAE;MAEzB;AAEJ,SAAO;GAAE,GAAG;GAAU;;;AAMxB,KAAI,QAAQ,wBAAwB,gBAAgB,KAClD,SAAQ,uBAAuB,iBAAiB,IAAI,IAClD,CAAC,GAAG,QAAQ,uBAAuB,gBAAgB,KAAI,MAAK,YAAY;CAM5E,MAAM,gBAAgB,cAAc;AAEpC,QAAO;EACL,MAAM;GACO;GACX,UAAW,KAAK,cAAc,UAAU,eAAe,SAAS;;EAElE,qBAAqB;GACnB,SAAuB,QAAQ;GAC/B,uBAAuB,QAAQ;;EAEjC,OAAO,WAAW,eAAe;EACjC,GAAG,QAAQ,kBAAkB,EAAE,UAAU,QAAQ,GAAG,UAAU;EAC9D,GAAG,QAAQ,gBAAkB,EAAE,QAAQ,qBAAqB,cAAc,QAAQ,cAAc,aAAa"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/RS/types/algorithm-parameters.d.ts
|
|
2
|
-
type ParameterName = 'overlap' | 'doubleBooking' | 'timeFrame' | '
|
|
2
|
+
type ParameterName = 'overlap' | 'doubleBooking' | 'timeFrame' | 'insufficientBreak' | 'dailyOvertime' | 'gap' | 'dependencyAlternation' | 'overtime' | 'dependencyRank' | 'dayRank' | 'groupRank' | 'distribution' | 'preferredTime';
|
|
3
3
|
type AlgorithmWeightParameters = Record<ParameterName, number | false>;
|
|
4
4
|
type AlgorithmParameters = {
|
|
5
5
|
/**
|
|
@@ -8,7 +8,6 @@ type AlgorithmParameters = {
|
|
|
8
8
|
weights?: AlgorithmWeightParameters;
|
|
9
9
|
/**
|
|
10
10
|
* A multiplier that lets the schedule algorithm run for a longer time to find better solutions.
|
|
11
|
-
*
|
|
12
11
|
* @default 1
|
|
13
12
|
*/
|
|
14
13
|
computeTimeMultiplier?: number;
|
package/dist/RS/types/index.d.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import { Collection } from "./collections.js";
|
|
2
|
-
import { Default } from "./default.js";
|
|
3
|
-
import { Dependency } from "./dependencies.js";
|
|
4
|
-
import { Group } from "./groups.js";
|
|
5
|
-
import { Individual, IndividualsSet } from "./individuals.js";
|
|
6
|
-
import { LockedTime } from "./locked-times.js";
|
|
7
|
-
import { RootInterval } from "./root-intervals.js";
|
|
8
|
-
import { Settings } from "./settings.js";
|
|
9
|
-
import { Event } from "./events.js";
|
|
10
|
-
import { Period } from "./period.js";
|
|
11
|
-
import { AvailableDependency, BreakLength, Day, GroupReference, Interval } from "./shared.js";
|
|
12
1
|
import { ParsedToOptions, Structure, ToInput, ToOptions, ToOutput } from "./to.js";
|
|
13
2
|
import { EventConfiguration } from "./event-configuration.js";
|
|
14
3
|
import { Configuration } from "./configurations.js";
|
|
@@ -16,26 +5,8 @@ import { ScheduleData } from "./schedule-data.js";
|
|
|
16
5
|
|
|
17
6
|
//#region src/RS/types/index.d.ts
|
|
18
7
|
declare namespace Types {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated To be replaced by `Types.period` in future versions
|
|
23
|
-
*/
|
|
24
|
-
type periods = string;
|
|
25
|
-
type period = Period;
|
|
26
|
-
type rootInterval = RootInterval;
|
|
27
|
-
type dependency = Dependency;
|
|
28
|
-
type group = Group;
|
|
29
|
-
type individual = Individual;
|
|
30
|
-
type individualsSet = IndividualsSet;
|
|
31
|
-
type collection = Collection;
|
|
32
|
-
type event = Event;
|
|
33
|
-
type lockedTime = LockedTime;
|
|
34
|
-
type availableDependency = AvailableDependency;
|
|
35
|
-
type day = Day;
|
|
36
|
-
type interval = Interval;
|
|
37
|
-
type groupReference = GroupReference;
|
|
38
|
-
type breakLength = BreakLength;
|
|
8
|
+
export import Shared = _Shared;
|
|
9
|
+
export import Entities = _Entities;
|
|
39
10
|
type scheduleData = ScheduleData;
|
|
40
11
|
type toInput = ToInput;
|
|
41
12
|
type toOptions = ToOptions;
|
|
@@ -2,21 +2,18 @@ import { Types } from "./index.js";
|
|
|
2
2
|
|
|
3
3
|
//#region src/RS/types/schedule-data.d.ts
|
|
4
4
|
interface ScheduleData {
|
|
5
|
-
settings
|
|
6
|
-
default
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
dependencies?: Types.dependency[];
|
|
18
|
-
individuals?: (Types.individual | Types.individualsSet)[];
|
|
19
|
-
intervals?: Types.rootInterval[];
|
|
5
|
+
settings: Types.Entities.Settings;
|
|
6
|
+
default: Types.Entities.DefaultValues;
|
|
7
|
+
periods: Types.Entities.Period[];
|
|
8
|
+
intervals: Types.Entities.Interval[];
|
|
9
|
+
events: Types.Entities.Event[];
|
|
10
|
+
groups: Types.Entities.Group[];
|
|
11
|
+
dependencies: Types.Entities.Dependency[];
|
|
12
|
+
individuals: (Types.Entities.Individual | Types.Entities.IndividualsSet)[];
|
|
13
|
+
blockedTimes: Types.Entities.BlockedTime[];
|
|
14
|
+
activities: Types.Entities.Activity[];
|
|
15
|
+
unitableEvents: Types.Entities.UnitableEventsSet[];
|
|
16
|
+
linkedEvents: Types.Entities.LinkedEventsSet[];
|
|
20
17
|
}
|
|
21
18
|
//#endregion
|
|
22
19
|
export { ScheduleData };
|
package/dist/RS/types/to.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BaseOptions } from "../../common/types.js";
|
|
2
2
|
import { Types } from "../../core/types/index.js";
|
|
3
|
-
import "../../core/index.js";
|
|
4
3
|
import { MixedScheduleData } from "../make-connected.js";
|
|
5
4
|
import { AlgorithmParameters, AlgorithmWeightParameters } from "./algorithm-parameters.js";
|
|
6
5
|
import { Types as Types$1 } from "./index.js";
|
|
@@ -16,9 +15,8 @@ type PartialScheduleOptions<IDs extends Array<string> | Set<string>> = {
|
|
|
16
15
|
};
|
|
17
16
|
interface ToOptions extends BaseOptions {
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Note: This is distinct from the root-level `meta` object in the mapped output which is always included.
|
|
18
|
+
* Includes some metadata about entities. Currently this only includes name but might be extended in the future.
|
|
19
|
+
* This is useful when running the algorithm locally from its GUI.
|
|
22
20
|
* @default false
|
|
23
21
|
*/
|
|
24
22
|
includeEntityMeta?: boolean;
|
|
@@ -33,29 +31,23 @@ interface ToOptions extends BaseOptions {
|
|
|
33
31
|
*/
|
|
34
32
|
appendOutput?: boolean;
|
|
35
33
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* If not set to true, these new features are taken into account:
|
|
39
|
-
*
|
|
40
|
-
* - New root level entries: `intervals` and `individuals`
|
|
41
|
-
* - As the there is now a root level `intervals` the former may be references from `Collection.intervals`, `Group.intervals` etc.
|
|
42
|
-
* - The `Collection.groups` and `Event.groups` supports referencing `individuals` (and `individuals sets`) in addition to `groups`
|
|
43
|
-
* - The `Group.forbidOverlappingEvents` has been removed.
|
|
44
|
-
* - The `Group.disableDayLengthPunishment` has been replaced by `Group.minimizeGaps`
|
|
34
|
+
* Allows to specify that only a subset of events and/or locations should be included in the schedule optimization, and how the omitted events should be handled.
|
|
45
35
|
*/
|
|
46
|
-
oldFormat?: boolean;
|
|
47
36
|
partialScheduleOptions?: PartialScheduleOptions<Array<string> | Set<string>>;
|
|
37
|
+
/**
|
|
38
|
+
* The weight parameters to be used by the algorithm. One may also specify `false` for any of the parameters to disable the corresponding feature.
|
|
39
|
+
*/
|
|
48
40
|
algorithmWeightParameters?: AlgorithmWeightParameters;
|
|
49
|
-
computeTimeMultiplier?: number;
|
|
50
41
|
/**
|
|
51
|
-
* to be used
|
|
42
|
+
* The time multiplier to be used by the algorithm. A number twice as large implies that the algorithm will spend twice as much time optimizing the schedule.
|
|
43
|
+
* @default 1
|
|
52
44
|
*/
|
|
53
|
-
|
|
45
|
+
computeTimeMultiplier?: number;
|
|
54
46
|
}
|
|
55
47
|
interface ParsedToOptions extends Omit<ToOptions, 'partialScheduleOptions'> {
|
|
56
48
|
partialScheduleOptions?: PartialScheduleOptions<Set<string>>;
|
|
57
49
|
}
|
|
58
|
-
declare const structure = "RS/algorithm-
|
|
50
|
+
declare const structure = "RS/algorithm-6.0.0";
|
|
59
51
|
type Structure = typeof structure;
|
|
60
52
|
interface ToOutput {
|
|
61
53
|
meta: {
|
package/dist/RS/types/to.js
CHANGED
package/dist/RS/types/to.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to.js","names":[],"sources":["../../../src/RS/types/to.ts"],"sourcesContent":["import type { BaseOptions } from '../../common/types';\nimport type { CoreTypes } from '../../core';\nimport type { MixedScheduleData } from '../make-connected';\nimport type { Types } from './';\nimport type { AlgorithmParameters, AlgorithmWeightParameters } from './algorithm-parameters';\n\n\nexport type ToInput = MixedScheduleData;\n\ntype PartialScheduleOptions<IDs extends Array<string> | Set<string>> = {\n /** @description undefined means all included */\n includedEvents?: IDs;\n /** @description undefined means all included */\n includedLocations?: IDs;\n omittedEventsHandling: 'ignore' | 'freeze';\n};\n\nexport interface ToOptions extends BaseOptions {\n /**\n *
|
|
1
|
+
{"version":3,"file":"to.js","names":[],"sources":["../../../src/RS/types/to.ts"],"sourcesContent":["import type { BaseOptions } from '../../common/types';\nimport type { CoreTypes } from '../../core';\nimport type { MixedScheduleData } from '../make-connected';\nimport type { Types } from './';\nimport type { AlgorithmParameters, AlgorithmWeightParameters } from './algorithm-parameters';\n\n\nexport type ToInput = MixedScheduleData;\n\ntype PartialScheduleOptions<IDs extends Array<string> | Set<string>> = {\n /** @description undefined means all included */\n includedEvents?: IDs;\n /** @description undefined means all included */\n includedLocations?: IDs;\n omittedEventsHandling: 'ignore' | 'freeze';\n};\n\nexport interface ToOptions extends BaseOptions {\n /**\n * Includes some metadata about entities. Currently this only includes name but might be extended in the future.\n * This is useful when running the algorithm locally from its GUI.\n * @default false\n */\n includeEntityMeta?: boolean;\n\n /**\n * If true, the output will include the full core data. This enables the resulting output file to be uploaded as a new schedule.\n * @default false\n */\n appendCoreData?: boolean;\n\n /**\n * If true, the output will include current configuration of events and locked times as `output` entry.\n * @default false\n */\n appendOutput?: boolean;\n\n /**\n * Allows to specify that only a subset of events and/or locations should be included in the schedule optimization, and how the omitted events should be handled.\n */\n partialScheduleOptions?: PartialScheduleOptions<Array<string> | Set<string>>\n\n /**\n * The weight parameters to be used by the algorithm. One may also specify `false` for any of the parameters to disable the corresponding feature.\n */\n algorithmWeightParameters?: AlgorithmWeightParameters;\n\n /**\n * The time multiplier to be used by the algorithm. A number twice as large implies that the algorithm will spend twice as much time optimizing the schedule.\n * @default 1\n */\n computeTimeMultiplier?: number;\n}\n\nexport interface ParsedToOptions extends Omit<ToOptions, 'partialScheduleOptions'> {\n partialScheduleOptions?: PartialScheduleOptions<Set<string>>\n}\n\nexport const structure = 'RS/algorithm-6.0.0';\nexport type Structure = typeof structure;\nexport interface ToOutput {\n meta: {\n structure?: Structure;\n division: Pick<CoreTypes.Deep.Division, 'displayName' | 'start' | 'end'>;\n };\n algorithmParameters: AlgorithmParameters;\n score?: [number, number, number, number];\n input: Types.scheduleData;\n output?: Types.configuration[];\n coreData?: Partial<CoreTypes.SerializedWithOptionalId.Schedule>;\n}"],"mappings":";AA0DA,MAAa,YAAY"}
|
|
@@ -7,7 +7,7 @@ var activities_default = (activities, options) => {
|
|
|
7
7
|
return activities.map((activity) => {
|
|
8
8
|
if (parentActivities.has(activity.id)) return;
|
|
9
9
|
const groupIndexSet = [...new Set([void 0, ...activity.rooms?.map(({ index }) => index) ?? []])];
|
|
10
|
-
|
|
10
|
+
const doc = {
|
|
11
11
|
ids: activity.id,
|
|
12
12
|
startDate: activity.startDate,
|
|
13
13
|
...omitBy({
|
|
@@ -27,6 +27,7 @@ var activities_default = (activities, options) => {
|
|
|
27
27
|
})) },
|
|
28
28
|
...activity._embedded?.syllabus && { subject: activity._embedded.syllabus.subjectCode }
|
|
29
29
|
};
|
|
30
|
+
return doc;
|
|
30
31
|
}).filter((x) => x != null);
|
|
31
32
|
};
|
|
32
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activities.js","names":[],"sources":["../../../src/SS12000/from/activities.ts"],"sourcesContent":["import { isNil, omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Activity } from '../types/activities';\n\nexport default (\n activities: Activity[],\n options?: { interval?: { start: string, end: string } }\n) => {\n if (!Array.isArray(activities))\n throw new Error('(SS12000::From::Activities) Activities input is not of array type', { cause: 'invalid_input' });\n\n const parentActivities = new Set(activities.map(x => x.parentActivity?.id).filter(Boolean));\n\n return activities\n .map((activity): CoreTypes.MixedWithoutInternalId.Course | undefined => {\n // Skip activities that are above courses\n if (parentActivities.has(activity.id)) return;\n\n const groupIndexSet = [...new Set<number | undefined>([undefined, ...(activity.rooms?.map(({ index }) => index) ?? [])])];\n\n const doc = {\n ids: activity.id,\n startDate: activity.startDate,\n ...omitBy({\n displayName: activity.displayName,\n comment: activity.comment,\n subject: activity.subject,\n endDate: activity.endDate,\n syllabus: activity._embedded?.syllabus,\n }, isNil),\n ...activity.minutesPlanned && { plannedDuration: `${ Math.ceil(activity.minutesPlanned / 60) } hrs` },\n type: activity.activityType,\n groups: activity.groups?.map(({ id }) => ({ to: id })),\n teachers: activity.teachers?.map(({ duty: { id } }) => ({ to: id })),\n // not in the standard\n ...activity.rooms && {\n locations: activity.rooms?.map(({ room, index }) => ({ locations: [room.id!] as [string], groupIndex: groupIndexSet.indexOf(index) })),\n },\n ...activity._embedded?.syllabus && {\n subject: activity._embedded.syllabus.subjectCode,\n }\n };\n return doc;\n })\n .filter(x => x != null);\n};"],"mappings":";;;AAIA,0BACE,YACA,
|
|
1
|
+
{"version":3,"file":"activities.js","names":[],"sources":["../../../src/SS12000/from/activities.ts"],"sourcesContent":["import { isNil, omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Activity } from '../types/activities';\n\nexport default (\n activities: Activity[],\n options?: { interval?: { start: string, end: string } }\n): CoreTypes.MixedWithoutInternalId.Course[] => {\n if (!Array.isArray(activities))\n throw new Error('(SS12000::From::Activities) Activities input is not of array type', { cause: 'invalid_input' });\n\n const parentActivities = new Set(activities.map(x => x.parentActivity?.id).filter(Boolean));\n\n return activities\n .map((activity): CoreTypes.MixedWithoutInternalId.Course | undefined => {\n // Skip activities that are above courses\n if (parentActivities.has(activity.id)) return;\n\n const groupIndexSet = [...new Set<number | undefined>([undefined, ...(activity.rooms?.map(({ index }) => index) ?? [])])];\n\n const doc = {\n ids: activity.id,\n startDate: activity.startDate,\n ...omitBy({\n displayName: activity.displayName,\n comment: activity.comment,\n subject: activity.subject,\n endDate: activity.endDate,\n syllabus: activity._embedded?.syllabus,\n }, isNil),\n ...activity.minutesPlanned && { plannedDuration: `${ Math.ceil(activity.minutesPlanned / 60) } hrs` },\n type: activity.activityType,\n groups: activity.groups?.map(({ id }) => ({ to: id })),\n teachers: activity.teachers?.map(({ duty: { id } }) => ({ to: id })),\n // not in the standard\n ...activity.rooms && {\n locations: activity.rooms?.map(({ room, index }) => ({ locations: [room.id!] as [string], groupIndex: groupIndexSet.indexOf(index) })),\n },\n ...activity._embedded?.syllabus && {\n subject: activity._embedded.syllabus.subjectCode,\n }\n };\n return doc;\n })\n .filter(x => x != null);\n};"],"mappings":";;;AAIA,0BACE,YACA,YAC+C;AAC/C,KAAI,CAAC,MAAM,QAAQ,YACjB,OAAM,IAAI,MAAM,qEAAqE,EAAE,OAAO;CAEhG,MAAM,mBAAmB,IAAI,IAAI,WAAW,KAAI,MAAK,EAAE,gBAAgB,IAAI,OAAO;AAElF,QAAO,WACJ,KAAK,aAAkE;AAEtE,MAAI,iBAAiB,IAAI,SAAS,IAAK;EAEvC,MAAM,gBAAgB,CAAC,GAAG,IAAI,IAAwB,CAAC,QAAW,GAAI,SAAS,OAAO,KAAK,EAAE,YAAY,UAAU;EAEnH,MAAM,MAAM;GACV,KAAW,SAAS;GACpB,WAAW,SAAS;GACpB,GAAG,OAAO;IACR,aAAa,SAAS;IACtB,SAAa,SAAS;IACtB,SAAa,SAAS;IACtB,SAAa,SAAS;IACtB,UAAa,SAAS,WAAW;MAChC;GACH,GAAG,SAAS,kBAAkB,EAAE,iBAAiB,GAAI,KAAK,KAAK,SAAS,iBAAiB,IAAK;GAC9F,MAAU,SAAS;GACnB,QAAU,SAAS,QAAQ,KAAK,EAAE,UAAU,EAAE,IAAI;GAClD,UAAU,SAAS,UAAU,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI;GAE9D,GAAG,SAAS,SAAS,EACnB,WAAW,SAAS,OAAO,KAAK,EAAE,MAAM,aAAa;IAAE,WAAW,CAAC,KAAK;IAAkB,YAAY,cAAc,QAAQ;;GAE9H,GAAG,SAAS,WAAW,YAAY,EACjC,SAAS,SAAS,UAAU,SAAS;;AAGzC,SAAO;IAER,QAAO,MAAK,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-events.js","names":["toRoom"],"sources":["../../../src/SS12000/from/calendar-events.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { CalendarEvent } from '../types/calendar-events';\nimport toRoom from './rooms';\n\nexport default (events: CalendarEvent[]) => {\n if (!Array.isArray(events))\n throw new Error('(SS12000::From::CalendarEvents) CalendarEvent input is not of array type', { cause: 'invalid_input' });\n\n return events\n .map((event): CoreTypes.MixedWithoutInternalId.Event => ({\n ids: event.id,\n start: event.startTime.toString(),\n end: event.endTime.toString(),\n duration: moment(event.endTime).diff(event.endTime, 'm'),\n preferredDuration: moment(event.endTime).diff(event.endTime, 'm'),\n course: event.activity.id,\n inLocations: toRoom(event.rooms ?? []),\n // resources: toResource([])\n }));\n};\n"],"mappings":";;;;AAKA,+BAAgB,
|
|
1
|
+
{"version":3,"file":"calendar-events.js","names":["toRoom"],"sources":["../../../src/SS12000/from/calendar-events.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { CalendarEvent } from '../types/calendar-events';\nimport toRoom from './rooms';\n\nexport default (events: CalendarEvent[]): CoreTypes.MixedWithoutInternalId.Event[] => {\n if (!Array.isArray(events))\n throw new Error('(SS12000::From::CalendarEvents) CalendarEvent input is not of array type', { cause: 'invalid_input' });\n\n return events\n .map((event): CoreTypes.MixedWithoutInternalId.Event => ({\n ids: event.id,\n start: event.startTime.toString(),\n end: event.endTime.toString(),\n duration: moment(event.endTime).diff(event.endTime, 'm'),\n preferredDuration: moment(event.endTime).diff(event.endTime, 'm'),\n course: event.activity.id,\n inLocations: toRoom(event.rooms ?? []),\n // resources: toResource([])\n }));\n};\n"],"mappings":";;;;AAKA,+BAAgB,WAAsE;AACpF,KAAI,CAAC,MAAM,QAAQ,QACjB,OAAM,IAAI,MAAM,4EAA4E,EAAE,OAAO;AAEvG,QAAO,OACJ,KAAK,WAAmD;EACvD,KAAmB,MAAM;EACzB,OAAmB,MAAM,UAAU;EACnC,KAAmB,MAAM,QAAQ;EACjC,UAAmB,OAAO,MAAM,SAAS,KAAK,MAAM,SAAS;EAC7D,mBAAmB,OAAO,MAAM,SAAS,KAAK,MAAM,SAAS;EAC7D,QAAmB,MAAM,SAAS;EAClC,aAAmBA,cAAO,MAAM,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duties.js","names":["toPerson"],"sources":["../../../src/SS12000/from/duties.ts"],"sourcesContent":["import { omit } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Duty } from '../types/duties';\nimport toPerson from './persons';\n\nexport default (duties: Duty[]) => {\n if (!Array.isArray(duties))\n throw new Error('(SS12000::From::Duties) Teacher input is not of array type', { cause: 'invalid_input' });\n\n const toDisplayName = (firstName?: string, lastName?: string) => {\n const first = firstName?.trim();\n const last = lastName?.trim();\n if (first && last) return `${ first } ${ last }`;\n return first || last || undefined;\n };\n\n return duties\n .map((duty): CoreTypes.MixedWithoutInternalId.Teacher => {\n const person = duty._embedded?.person ?? duty.person;\n const displayName = duty.displayName\n ?? toDisplayName(person?.givenName, person?.familyName)\n ?? person?.displayName;\n\n return ({\n ids: duty.id,\n displayName: displayName,\n signature: duty.signature,\n ...(duty.person || duty._embedded?.person) && {\n person: {\n type: 'Teacher',\n ...duty.person && { ids: duty.person.id },\n ...duty._embedded?.person && omit(toPerson([ duty._embedded.person ])[0], 'type')\n }\n }\n });\n });\n};\n"],"mappings":";;;;AAKA,sBAAgB,
|
|
1
|
+
{"version":3,"file":"duties.js","names":["toPerson"],"sources":["../../../src/SS12000/from/duties.ts"],"sourcesContent":["import { omit } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Duty } from '../types/duties';\nimport toPerson from './persons';\n\nexport default (duties: Duty[]): CoreTypes.MixedWithoutInternalId.Teacher[] => {\n if (!Array.isArray(duties))\n throw new Error('(SS12000::From::Duties) Teacher input is not of array type', { cause: 'invalid_input' });\n\n const toDisplayName = (firstName?: string, lastName?: string) => {\n const first = firstName?.trim();\n const last = lastName?.trim();\n if (first && last) return `${ first } ${ last }`;\n return first || last || undefined;\n };\n\n return duties\n .map((duty): CoreTypes.MixedWithoutInternalId.Teacher => {\n const person = duty._embedded?.person ?? duty.person;\n const displayName = duty.displayName\n ?? toDisplayName(person?.givenName, person?.familyName)\n ?? person?.displayName;\n\n return ({\n ids: duty.id,\n displayName: displayName,\n signature: duty.signature,\n ...(duty.person || duty._embedded?.person) && {\n person: {\n type: 'Teacher',\n ...duty.person && { ids: duty.person.id },\n ...duty._embedded?.person && omit(toPerson([ duty._embedded.person ])[0], 'type')\n }\n }\n });\n });\n};\n"],"mappings":";;;;AAKA,sBAAgB,WAA+D;AAC7E,KAAI,CAAC,MAAM,QAAQ,QACjB,OAAM,IAAI,MAAM,8DAA8D,EAAE,OAAO;CAEzF,MAAM,iBAAiB,WAAoB,aAAsB;EAC/D,MAAM,QAAQ,WAAW;EACzB,MAAM,OAAO,UAAU;AACvB,MAAI,SAAS,KAAM,QAAO,GAAI,MAAO,GAAI;AACzC,SAAO,SAAS,QAAQ;;AAG1B,QAAO,OACJ,KAAK,SAAmD;EACvD,MAAM,SAAS,KAAK,WAAW,UAAU,KAAK;EAC9C,MAAM,cAAc,KAAK,eACpB,cAAc,QAAQ,WAAW,QAAQ,eACzC,QAAQ;AAEb,SAAQ;GACN,KAAa,KAAK;GACL;GACb,WAAa,KAAK;GAClB,IAAI,KAAK,UAAU,KAAK,WAAW,WAAW,EAC5C,QAAQ;IACN,MAAM;IACN,GAAG,KAAK,UAAU,EAAE,KAAK,KAAK,OAAO;IACrC,GAAG,KAAK,WAAW,UAAU,KAAKA,gBAAS,CAAE,KAAK,UAAU,SAAU,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups.js","names":[],"sources":["../../../src/SS12000/from/groups.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { Group } from '../types/groups';\n\nfunction _transformGroupMembers (\n members: Group['groupMemberships'],\n options?: Pick<CoreTypes.Deep.Division, 'start' | 'end'>\n) {\n return [\n ...new Set(\n members?.filter(member => {\n if (options?.end && member.startDate && !moment(member.startDate).isBefore(moment(options.end)))\n return false;\n if (options?.start && member.endDate && !moment(member.endDate).isAfter(moment(options.start)))\n return false;\n return true;\n })\n .map((member) => member.person.id)\n .filter(Boolean)\n )\n ];\n}\n\nexport default (\n groups: Group[],\n options?: Pick<CoreTypes.Deep.Division, 'start' | 'end'>\n) => {\n if (!Array.isArray(groups))\n throw new Error('(SS12000::From::Groups) Group input is not of array type', { cause: 'invalid_input' });\n\n return groups\n .map((group): CoreTypes.MixedWithoutInternalId.Group => ({\n ids: group.id,\n displayName: group.displayName,\n ...group.groupType == 'Klass' && { species: 'class' },\n ...group.groupMemberships && {\n members: _transformGroupMembers(group.groupMemberships, options)\n }\n }));\n};"],"mappings":";;;AAIA,SAAS,uBACP,SACA,SACA;AACA,QAAO,CACL,GAAG,IAAI,IACL,SAAS,QAAO,WAAU;AACxB,MAAI,SAAS,OAAO,OAAO,aAAa,CAAC,OAAO,OAAO,
|
|
1
|
+
{"version":3,"file":"groups.js","names":[],"sources":["../../../src/SS12000/from/groups.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { Group } from '../types/groups';\n\nfunction _transformGroupMembers (\n members: Group['groupMemberships'],\n options?: Pick<CoreTypes.Deep.Division, 'start' | 'end'>\n) {\n return [\n ...new Set(\n members?.filter(member => {\n if (options?.end && member.startDate && !moment(member.startDate).isBefore(moment(options.end)))\n return false;\n if (options?.start && member.endDate && !moment(member.endDate).isAfter(moment(options.start)))\n return false;\n return true;\n })\n .map((member) => member.person.id)\n .filter(Boolean)\n )\n ];\n}\n\nexport default (\n groups: Group[],\n options?: Pick<CoreTypes.Deep.Division, 'start' | 'end'>\n): CoreTypes.MixedWithoutInternalId.Group[] => {\n if (!Array.isArray(groups))\n throw new Error('(SS12000::From::Groups) Group input is not of array type', { cause: 'invalid_input' });\n\n return groups\n .map((group): CoreTypes.MixedWithoutInternalId.Group => ({\n ids: group.id,\n displayName: group.displayName,\n ...group.groupType == 'Klass' && { species: 'class' },\n ...group.groupMemberships && {\n members: _transformGroupMembers(group.groupMemberships, options)\n }\n }));\n};"],"mappings":";;;AAIA,SAAS,uBACP,SACA,SACA;AACA,QAAO,CACL,GAAG,IAAI,IACL,SAAS,QAAO,WAAU;AACxB,MAAI,SAAS,OAAO,OAAO,aAAa,CAAC,OAAO,OAAO,WAAW,SAAS,OAAO,QAAQ,MACxF,QAAO;AACT,MAAI,SAAS,SAAS,OAAO,WAAW,CAAC,OAAO,OAAO,SAAS,QAAQ,OAAO,QAAQ,QACrF,QAAO;AACT,SAAO;IAEN,KAAK,WAAW,OAAO,OAAO,IAC9B,OAAO;;AAKhB,sBACE,QACA,YAC6C;AAC7C,KAAI,CAAC,MAAM,QAAQ,QACjB,OAAM,IAAI,MAAM,4DAA4D,EAAE,OAAO;AAEvF,QAAO,OACJ,KAAK,WAAmD;EACvD,KAAa,MAAM;EACnB,aAAa,MAAM;EACnB,GAAG,MAAM,aAAa,WAAW,EAAE,SAAS;EAC5C,GAAG,MAAM,oBAAoB,EAC3B,SAAS,uBAAuB,MAAM,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_activities","_calendarEvents","_duties","_groups","_persons","_resources","_rooms","_syllabuses"],"sources":["../../../src/SS12000/from/index.ts"],"sourcesContent":["import _activities from './activities';\nimport _calendarEvents from './calendar-events';\nimport _duties from './duties';\nimport _groups from './groups';\nimport _persons from './persons';\nimport _resources from './resources';\nimport _rooms from './rooms';\nimport _syllabuses from './syllabuses';\n\nexport default {\n activities: _activities,\n calendarEvents: _calendarEvents,\n duties: _duties,\n groups: _groups,\n persons: _persons,\n resources: _resources,\n rooms: _rooms,\n syllabuses: _syllabuses,\n};"],"mappings":";;;;;;;;;;AASA,mBAAe;CACb,YAAgBA;CAChB,gBAAgBC;CAChB,QAAgBC;CAChB,QAAgBC;CAChB,SAAgBC;CAChB,WAAgBC;CAChB,OAAgBC;CAChB,YAAgBC
|
|
1
|
+
{"version":3,"file":"index.js","names":["_activities","_calendarEvents","_duties","_groups","_persons","_resources","_rooms","_syllabuses"],"sources":["../../../src/SS12000/from/index.ts"],"sourcesContent":["import _activities from './activities';\nimport _calendarEvents from './calendar-events';\nimport _duties from './duties';\nimport _groups from './groups';\nimport _persons from './persons';\nimport _resources from './resources';\nimport _rooms from './rooms';\nimport _syllabuses from './syllabuses';\n\nexport default {\n activities: _activities,\n calendarEvents: _calendarEvents,\n duties: _duties,\n groups: _groups,\n persons: _persons,\n resources: _resources,\n rooms: _rooms,\n syllabuses: _syllabuses,\n};"],"mappings":";;;;;;;;;;AASA,mBAAe;CACb,YAAgBA;CAChB,gBAAgBC;CAChB,QAAgBC;CAChB,QAAgBC;CAChB,SAAgBC;CAChB,WAAgBC;CAChB,OAAgBC;CAChB,YAAgBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persons.js","names":["SexMap: Record<NonNullable<Person['sex']>, CoreTypes.Deep.Person['sex']>","TypeMap: Record<\n NonNullable<\n Person['phoneNumbers']\n >[0]['type'],\n NonNullable<\n CoreTypes.Deep.Person['phoneNumbers']\n >[0]['type']\n>"],"sources":["../../../src/SS12000/from/persons.ts"],"sourcesContent":["import { get, omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Person } from '../types/persons';\n\nconst SexMap: Record<NonNullable<Person['sex']>, CoreTypes.Deep.Person['sex']> = { Man: 'Man', Kvinna: 'Woman', Okänt: undefined };\nconst TypeMap: Record<\n NonNullable<\n Person['phoneNumbers']\n >[0]['type'],\n NonNullable<\n CoreTypes.Deep.Person['phoneNumbers']\n >[0]['type']\n> = {\n 'Privat': 'private',\n 'Hem': 'private',\n 'Arbete övrigt': 'organization',\n 'Arbete': 'organization',\n 'Skola elev': 'organization',\n 'Skola personal': 'organization'\n};\n\nexport default (groups: Person[]) => {\n if (!Array.isArray(groups))\n throw new Error('(SS12000::From::Person) Person input is not of array type', { cause: 'invalid_input' });\n\n return groups\n .map((person): CoreTypes.MixedWithoutInternalId.Person => ({\n ids: person.id,\n displayName: person.displayName,\n type: 'Student',\n ...omitBy({\n sex: person.sex ? get(SexMap, person.sex, undefined) : undefined,\n displayName: person.displayName,\n firstName: person.givenName,\n lastName: person.familyName,\n SSN: person.civicNo,\n emails: person.emails?.map(({ type, ...arg }) => ({ type: get(TypeMap, type, undefined), ...arg })),\n phoneNumbers: person.phoneNumbers?.map(({ type, ...arg }) => ({ type: get(TypeMap, type, undefined), ...arg })),\n }, x => x == null)\n }));\n};"],"mappings":";;;AAIA,MAAMA,SAA2E;CAAE,KAAK;CAAO,QAAQ;CAAS,OAAO
|
|
1
|
+
{"version":3,"file":"persons.js","names":["SexMap: Record<NonNullable<Person['sex']>, CoreTypes.Deep.Person['sex']>","TypeMap: Record<\n NonNullable<\n Person['phoneNumbers']\n >[0]['type'],\n NonNullable<\n CoreTypes.Deep.Person['phoneNumbers']\n >[0]['type']\n>"],"sources":["../../../src/SS12000/from/persons.ts"],"sourcesContent":["import { get, omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Person } from '../types/persons';\n\nconst SexMap: Record<NonNullable<Person['sex']>, CoreTypes.Deep.Person['sex']> = { Man: 'Man', Kvinna: 'Woman', Okänt: undefined };\nconst TypeMap: Record<\n NonNullable<\n Person['phoneNumbers']\n >[0]['type'],\n NonNullable<\n CoreTypes.Deep.Person['phoneNumbers']\n >[0]['type']\n> = {\n 'Privat': 'private',\n 'Hem': 'private',\n 'Arbete övrigt': 'organization',\n 'Arbete': 'organization',\n 'Skola elev': 'organization',\n 'Skola personal': 'organization'\n};\n\nexport default (groups: Person[]): CoreTypes.MixedWithoutInternalId.Person[] => {\n if (!Array.isArray(groups))\n throw new Error('(SS12000::From::Person) Person input is not of array type', { cause: 'invalid_input' });\n\n return groups\n .map((person): CoreTypes.MixedWithoutInternalId.Person => ({\n ids: person.id,\n displayName: person.displayName,\n type: 'Student',\n ...omitBy({\n sex: person.sex ? get(SexMap, person.sex, undefined) : undefined,\n displayName: person.displayName,\n firstName: person.givenName,\n lastName: person.familyName,\n SSN: person.civicNo,\n emails: person.emails?.map(({ type, ...arg }) => ({ type: get(TypeMap, type, undefined), ...arg })),\n phoneNumbers: person.phoneNumbers?.map(({ type, ...arg }) => ({ type: get(TypeMap, type, undefined), ...arg })),\n }, x => x == null)\n }));\n};"],"mappings":";;;AAIA,MAAMA,SAA2E;CAAE,KAAK;CAAO,QAAQ;CAAS,OAAO;;AACvH,MAAMC,UAOF;CACF,UAAkB;CAClB,OAAkB;CAClB,iBAAkB;CAClB,UAAkB;CAClB,cAAkB;CAClB,kBAAkB;;AAGpB,uBAAgB,WAAgE;AAC9E,KAAI,CAAC,MAAM,QAAQ,QACjB,OAAM,IAAI,MAAM,6DAA6D,EAAE,OAAO;AAExF,QAAO,OACJ,KAAK,YAAqD;EACzD,KAAa,OAAO;EACpB,aAAa,OAAO;EACpB,MAAa;EACb,GAAG,OAAO;GACR,KAAc,OAAO,MAAM,IAAI,QAAQ,OAAO,KAAK,UAAa;GAChE,aAAc,OAAO;GACrB,WAAc,OAAO;GACrB,UAAc,OAAO;GACrB,KAAc,OAAO;GACrB,QAAc,OAAO,QAAQ,KAAK,EAAE,KAAM,GAAG,WAAW;IAAE,MAAM,IAAI,SAAS,MAAM;IAAY,GAAG;;GAClG,cAAc,OAAO,cAAc,KAAK,EAAE,KAAM,GAAG,WAAW;IAAE,MAAM,IAAI,SAAS,MAAM;IAAY,GAAG;;MACvG,MAAK,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","names":[],"sources":["../../../src/SS12000/from/resources.ts"],"sourcesContent":["\nimport type { Resource } from '../types/resources';\n\nexport default (resources: Resource[]) => {\n if (!Array.isArray(resources))\n throw new Error('(SS12000::From::Resources) Resources input is not of array type', { cause: 'invalid_input' });\n\n return resources.map((resource) => ({\n ids: resource.id,\n }));\n};\n"],"mappings":";AAGA,yBAAgB,cAA0B;AACxC,KAAI,CAAC,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"resources.js","names":[],"sources":["../../../src/SS12000/from/resources.ts"],"sourcesContent":["\nimport type { Resource } from '../types/resources';\n\nexport default (resources: Resource[]) => {\n if (!Array.isArray(resources))\n throw new Error('(SS12000::From::Resources) Resources input is not of array type', { cause: 'invalid_input' });\n\n return resources.map((resource) => ({\n ids: resource.id,\n }));\n};\n"],"mappings":";AAGA,yBAAgB,cAA0B;AACxC,KAAI,CAAC,MAAM,QAAQ,WACjB,OAAM,IAAI,MAAM,mEAAmE,EAAE,OAAO;AAE9F,QAAO,UAAU,KAAK,cAAc,EAClC,KAAK,SAAS"}
|