@royalschedule/maps 4.0.32 → 4.0.33
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 +1 -0
- package/dist/Additio/from/schedules.js +2 -4
- 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 -0
- package/dist/Additio/to/schedules.js +2 -4
- 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 +1 -0
- package/dist/Admentum/from/schedules.js +3 -6
- 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 +1 -0
- package/dist/Admentum/to/schedules.js +4 -7
- package/dist/Admentum/to/schedules.js.map +1 -1
- package/dist/Excel/index.d.ts +4 -3
- 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 +1 -0
- package/dist/Excel/v2/from/index.js +45 -54
- package/dist/Excel/v2/from/index.js.map +1 -1
- package/dist/Excel/v2/index.d.ts +1 -0
- package/dist/IdunSoft/from/courses.js.map +1 -1
- package/dist/IdunSoft/from/events.js +1 -2
- 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 +1 -0
- 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 +1 -0
- package/dist/IdunSoft/to/schedules.js +3 -6
- package/dist/IdunSoft/to/schedules.js.map +1 -1
- package/dist/InfoMentor/to/index.d.ts +1 -0
- package/dist/InfoMentor/to/schedules.js +1 -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 +9 -11
- package/dist/PlanDigital/from/schedules.js.map +1 -1
- package/dist/PlanDigital/index.d.ts +1 -0
- package/dist/Quiculum/file/to/index.d.ts +1 -0
- package/dist/Quiculum/file/to/schedules.js +5 -9
- package/dist/Quiculum/file/to/schedules.js.map +1 -1
- package/dist/RS/from/division.d.ts +1 -0
- package/dist/RS/from/division.js +1 -2
- 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 +1 -0
- package/dist/RS/from/schedules.js.map +1 -1
- package/dist/RS/make-connected.d.ts +3 -1
- package/dist/RS/make-connected.js +34 -42
- 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 +4 -6
- package/dist/RS/to/initial-configuration.js.map +1 -1
- package/dist/RS/to/input/collections.js.map +1 -1
- package/dist/RS/to/input/default.js +1 -2
- package/dist/RS/to/input/default.js.map +1 -1
- package/dist/RS/to/input/dependencies.js +1 -2
- package/dist/RS/to/input/dependencies.js.map +1 -1
- package/dist/RS/to/input/dynamic-locked-times.js +1 -2
- package/dist/RS/to/input/dynamic-locked-times.js.map +1 -1
- package/dist/RS/to/input/events.js.map +1 -1
- package/dist/RS/to/input/groups.js.map +1 -1
- package/dist/RS/to/input/individuals.js +1 -2
- package/dist/RS/to/input/individuals.js.map +1 -1
- package/dist/RS/to/input/input.js +1 -2
- package/dist/RS/to/input/input.js.map +1 -1
- package/dist/RS/to/input/intervals.js +2 -4
- package/dist/RS/to/input/intervals.js.map +1 -1
- package/dist/RS/to/input/periods.js +2 -4
- package/dist/RS/to/input/periods.js.map +1 -1
- package/dist/RS/to/input/settings.js.map +1 -1
- package/dist/RS/to/input/teachers.js +1 -1
- package/dist/RS/to/input/teachers.js.map +1 -1
- package/dist/RS/to/input/util/attach-locked-times.js.map +1 -1
- package/dist/RS/to/input/util/parse-days.js.map +1 -1
- package/dist/RS/to/input/util/parse-group-references.js.map +1 -1
- package/dist/RS/to/input/util/parse-intervals.js +2 -4
- package/dist/RS/to/input/util/parse-intervals.js.map +1 -1
- package/dist/RS/to/input/util/parse-location-references.js +1 -2
- package/dist/RS/to/input/util/parse-location-references.js.map +1 -1
- 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.map +1 -1
- package/dist/RS/to/input/util/util.js +1 -2
- package/dist/RS/to/input/util/util.js.map +1 -1
- package/dist/RS/to/schedules.js.map +1 -1
- package/dist/RS/types/to.d.ts +1 -0
- package/dist/SS12000/from/activities.js +1 -2
- 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 +236 -201
- 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 +1 -0
- 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 +8 -12
- package/dist/SchoolSoft/api/from/schedules.js.map +1 -1
- package/dist/SchoolSoft/api/index.d.ts +1 -0
- package/dist/SchoolSoft/file/from/index.js.map +1 -1
- package/dist/SchoolSoft/file/from/schedules.js +83 -87
- package/dist/SchoolSoft/file/from/schedules.js.map +1 -1
- package/dist/SchoolSoft/file/index.d.ts +1 -0
- package/dist/SchoolSoft/file/to/index.d.ts +1 -0
- package/dist/SchoolSoft/file/to/schedules.js +1 -2
- package/dist/SchoolSoft/file/to/schedules.js.map +1 -1
- package/dist/SchoolSoft/index.d.ts +1 -0
- package/dist/Schoolity/txt/to/index.d.ts +1 -0
- package/dist/Schoolity/txt/to/schedules.js +5 -12
- package/dist/Schoolity/txt/to/schedules.js.map +1 -1
- package/dist/Skola24/mdb/from/course-and-events.js +3 -5
- 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 +1 -0
- 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 +1 -2
- 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 +31 -34
- package/dist/Skola24/txt/from/period.js.map +1 -1
- package/dist/Skola24/txt/from/schedules.d.ts +1 -0
- package/dist/Skola24/txt/from/schedules.js +6 -10
- 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 +1 -0
- package/dist/Skola24/txt/to/index.d.ts +1 -0
- package/dist/Skola24/txt/to/schedules.js +5 -12
- package/dist/Skola24/txt/to/schedules.js.map +1 -1
- package/dist/common/constants.js.map +1 -1
- 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 +1 -3
- 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 +1 -0
- package/dist/core/interfaces/index.d.ts +23 -0
- package/dist/core/interfaces/other/companies.d.ts +1 -0
- package/dist/core/interfaces/other/companies.js.map +1 -1
- package/dist/core/interfaces/other/index.d.ts +6 -0
- package/dist/core/interfaces/other/operations.d.ts +1 -0
- package/dist/core/interfaces/vertices/companies.d.ts +1 -0
- package/dist/core/interfaces/vertices/configurations.d.ts +1 -0
- package/dist/core/interfaces/vertices/courses.d.ts +1 -0
- package/dist/core/interfaces/vertices/division-settings.d.ts +2 -0
- package/dist/core/interfaces/vertices/divisions.d.ts +1 -0
- package/dist/core/interfaces/vertices/events.d.ts +1 -0
- package/dist/core/interfaces/vertices/exceptions.d.ts +1 -0
- package/dist/core/interfaces/vertices/generations.d.ts +2 -0
- package/dist/core/interfaces/vertices/groups.d.ts +1 -0
- package/dist/core/interfaces/vertices/index.d.ts +1 -0
- package/dist/core/interfaces/vertices/locations.d.ts +1 -0
- package/dist/core/interfaces/vertices/locked-times.d.ts +2 -0
- package/dist/core/interfaces/vertices/overlap-groups.d.ts +1 -0
- package/dist/core/interfaces/vertices/periods.d.ts +3 -0
- package/dist/core/interfaces/vertices/persons.d.ts +1 -0
- package/dist/core/interfaces/vertices/properties/belongs-to.d.ts +1 -0
- package/dist/core/interfaces/vertices/properties/coalesced.d.ts +1 -0
- package/dist/core/interfaces/vertices/root-intervals.d.ts +2 -0
- package/dist/core/interfaces/vertices/syllabuses.d.ts +1 -0
- package/dist/core/interfaces/vertices/teachers.d.ts +1 -0
- package/dist/core/interfaces/vertices/threads.d.ts +6 -4
- package/dist/core/interfaces/vertices/users.d.ts +1 -0
- 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 +9 -9
- package/dist/core/interfaces/vertices/util/edges.d.ts +7 -7
- package/dist/core/interfaces/vertices/util/index.d.ts +6 -0
- package/dist/core/interfaces/vertices/util/util.d.ts +20 -24
- package/dist/core/interfaces/vertices/util/vertex-query/index.d.ts +11 -11
- package/dist/core/interfaces/vertices/util/vertex.d.ts +1 -1
- package/dist/core/interfaces/vertices/vertex-query.d.ts +27 -26
- package/dist/core/interfaces/vertices/vertex-query.js.map +1 -1
- package/dist/core/to/configurations.js +1 -2
- package/dist/core/to/configurations.js.map +1 -1
- package/dist/core/to/courses.js +1 -2
- package/dist/core/to/courses.js.map +1 -1
- package/dist/core/to/division.js.map +1 -1
- package/dist/core/to/events.js +1 -2
- package/dist/core/to/events.js.map +1 -1
- package/dist/core/to/exceptions.js +1 -2
- package/dist/core/to/exceptions.js.map +1 -1
- package/dist/core/to/groups.js +1 -2
- package/dist/core/to/groups.js.map +1 -1
- package/dist/core/to/locations.js +1 -2
- package/dist/core/to/locations.js.map +1 -1
- package/dist/core/to/locked-times.js +1 -2
- package/dist/core/to/locked-times.js.map +1 -1
- package/dist/core/to/overlap-groups.js +1 -2
- package/dist/core/to/overlap-groups.js.map +1 -1
- package/dist/core/to/periods.js +1 -2
- package/dist/core/to/periods.js.map +1 -1
- package/dist/core/to/persons.js +1 -2
- package/dist/core/to/persons.js.map +1 -1
- package/dist/core/to/root-intervals.js +1 -2
- package/dist/core/to/root-intervals.js.map +1 -1
- package/dist/core/to/schedules.d.ts +1 -0
- package/dist/core/to/schedules.js.map +1 -1
- package/dist/core/to/settings.js +1 -2
- package/dist/core/to/settings.js.map +1 -1
- package/dist/core/to/syllabuses.js +1 -2
- package/dist/core/to/syllabuses.js.map +1 -1
- package/dist/core/to/teachers.js +1 -2
- package/dist/core/to/teachers.js.map +1 -1
- package/dist/core/to/util.d.ts +2 -0
- package/dist/core/to/util.js +1 -2
- package/dist/core/to/util.js.map +1 -1
- package/dist/core/types/index.d.ts +1 -0
- package/dist/core/util.js +1 -2
- package/dist/core/util.js.map +1 -1
- package/dist/identify/constants/index.js.map +1 -1
- package/dist/identify/index.js +1 -2
- 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 +2 -0
- 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.map +1 -1
- package/dist/sdui/to/hours.js.map +1 -1
- package/dist/sdui/to/index.d.ts +2 -0
- 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.map +1 -1
- package/dist/sdui/to/substitution-plans.js +3 -6
- 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 +1 -0
- package/dist/vKlass/from/schedule.js.map +1 -1
- package/dist/vKlass/to/schedules.js +6 -17
- package/dist/vKlass/to/schedules.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","names":["options: BaseOptions","_division","_settings","_exceptions","_periods","_locations","_teachers","_groups","_persons","_courses","_events","_lockedTimes","_overlapGroups","_rootIntervals","_syllabuses","_configurations"],"sources":["../../../src/core/to/schedules.ts"],"sourcesContent":["import type { CoreTypes } from '../';\nimport _exceptions from './exceptions';\nimport _periods from './periods';\nimport _locations from './locations';\nimport _teachers from './teachers';\nimport _groups from './groups';\nimport _persons from './persons';\nimport _courses from './courses';\nimport _events from './events';\nimport _lockedTimes from './locked-times';\nimport _overlapGroups from './overlap-groups';\nimport _rootIntervals from './root-intervals';\nimport _settings from './settings';\nimport _division from './division';\nimport _syllabuses from './syllabuses';\nimport _configurations from './configurations';\nimport type { InternalIdKey } from '../types/common';\nimport type { InternalKeysOmitted } from './util';\nimport type { BaseOptions } from '../../common/types';\n\nexport namespace OutTypes {\n export type division = Omit<InternalKeysOmitted<CoreTypes.Serialized.Division>, InternalIdKey>;\n export type settings = InternalKeysOmitted<CoreTypes.Serialized.Settings>;\n export type configuration = InternalKeysOmitted<CoreTypes.Serialized.Configuration>;\n export type exception = InternalKeysOmitted<CoreTypes.Serialized.Exception>;\n export type period = InternalKeysOmitted<CoreTypes.Serialized.Period>;\n export type location = InternalKeysOmitted<CoreTypes.Serialized.Location>;\n export type teacher = InternalKeysOmitted<CoreTypes.Serialized.Teacher>;\n export type group = InternalKeysOmitted<CoreTypes.Serialized.Group>;\n export type person = InternalKeysOmitted<CoreTypes.Serialized.Person>;\n export type course = InternalKeysOmitted<CoreTypes.Serialized.Course>;\n export type event = InternalKeysOmitted<CoreTypes.Serialized.Event>;\n export type lockedTime = InternalKeysOmitted<CoreTypes.Serialized.LockedTime>;\n export type overlapGroup = InternalKeysOmitted<CoreTypes.Serialized.OverlapGroup>;\n export type rootInterval = InternalKeysOmitted<CoreTypes.Serialized.RootInterval>;\n export type syllabus = InternalKeysOmitted<CoreTypes.Serialized.Syllabus>;\n}\n\ntype Out = {\n division?: OutTypes.division;\n settings?: OutTypes.settings;\n exceptions?: OutTypes.exception[];\n periods?: OutTypes.period[];\n locations?: OutTypes.location[];\n teachers?: OutTypes.teacher[];\n groups?: OutTypes.group[];\n persons?: OutTypes.person[];\n courses?: OutTypes.course[];\n events?: OutTypes.event[];\n lockedTimes?: OutTypes.lockedTime[];\n overlapGroups?: OutTypes.overlapGroup[];\n rootIntervals?: OutTypes.rootInterval[];\n syllabuses?: OutTypes.syllabus[];\n configurations?: OutTypes.configuration[];\n\n meta: { structure: string };\n};\n\nexport default function (\n schedule: Partial<CoreTypes.Mixed.Schedule>\n): Out {\n const options: BaseOptions = {};\n\n return {\n meta: { structure: 'RS/core-2.0.0' },\n ...schedule.divisions && { division: _division (schedule.divisions, options) },\n ...schedule.settings && { settings: _settings (schedule.settings, options) },\n ...schedule.exceptions && { exceptions: _exceptions (schedule.exceptions, options) },\n ...schedule.periods && { periods: _periods (schedule.periods, options) },\n ...schedule.locations && { locations: _locations (schedule.locations, options) },\n ...schedule.teachers && { teachers: _teachers (schedule.teachers, options) },\n ...schedule.groups && { groups: _groups (schedule.groups, options) },\n ...schedule.persons && { persons: _persons (schedule.persons, options) },\n ...schedule.courses && { courses: _courses (schedule.courses, options) },\n ...schedule.events && { events: _events (schedule.events, options) },\n ...schedule.lockedTimes && { lockedTimes: _lockedTimes (schedule.lockedTimes, options) },\n ...schedule.overlapGroups && { overlapGroups: _overlapGroups (schedule.overlapGroups, options) },\n ...schedule.rootIntervals && { rootIntervals: _rootIntervals (schedule.rootIntervals, options) },\n ...schedule.syllabuses && { syllabuses: _syllabuses (schedule.syllabuses, options) },\n ...schedule.configurations && { configurations: _configurations(schedule.configurations, options) },\n };\n}"],"mappings":";;;;;;;;;;;;;;;;;AA0DA,2BACE,UACK;CACL,MAAMA,UAAuB;
|
|
1
|
+
{"version":3,"file":"schedules.js","names":["options: BaseOptions","_division","_settings","_exceptions","_periods","_locations","_teachers","_groups","_persons","_courses","_events","_lockedTimes","_overlapGroups","_rootIntervals","_syllabuses","_configurations"],"sources":["../../../src/core/to/schedules.ts"],"sourcesContent":["import type { CoreTypes } from '../';\nimport _exceptions from './exceptions';\nimport _periods from './periods';\nimport _locations from './locations';\nimport _teachers from './teachers';\nimport _groups from './groups';\nimport _persons from './persons';\nimport _courses from './courses';\nimport _events from './events';\nimport _lockedTimes from './locked-times';\nimport _overlapGroups from './overlap-groups';\nimport _rootIntervals from './root-intervals';\nimport _settings from './settings';\nimport _division from './division';\nimport _syllabuses from './syllabuses';\nimport _configurations from './configurations';\nimport type { InternalIdKey } from '../types/common';\nimport type { InternalKeysOmitted } from './util';\nimport type { BaseOptions } from '../../common/types';\n\nexport namespace OutTypes {\n export type division = Omit<InternalKeysOmitted<CoreTypes.Serialized.Division>, InternalIdKey>;\n export type settings = InternalKeysOmitted<CoreTypes.Serialized.Settings>;\n export type configuration = InternalKeysOmitted<CoreTypes.Serialized.Configuration>;\n export type exception = InternalKeysOmitted<CoreTypes.Serialized.Exception>;\n export type period = InternalKeysOmitted<CoreTypes.Serialized.Period>;\n export type location = InternalKeysOmitted<CoreTypes.Serialized.Location>;\n export type teacher = InternalKeysOmitted<CoreTypes.Serialized.Teacher>;\n export type group = InternalKeysOmitted<CoreTypes.Serialized.Group>;\n export type person = InternalKeysOmitted<CoreTypes.Serialized.Person>;\n export type course = InternalKeysOmitted<CoreTypes.Serialized.Course>;\n export type event = InternalKeysOmitted<CoreTypes.Serialized.Event>;\n export type lockedTime = InternalKeysOmitted<CoreTypes.Serialized.LockedTime>;\n export type overlapGroup = InternalKeysOmitted<CoreTypes.Serialized.OverlapGroup>;\n export type rootInterval = InternalKeysOmitted<CoreTypes.Serialized.RootInterval>;\n export type syllabus = InternalKeysOmitted<CoreTypes.Serialized.Syllabus>;\n}\n\ntype Out = {\n division?: OutTypes.division;\n settings?: OutTypes.settings;\n exceptions?: OutTypes.exception[];\n periods?: OutTypes.period[];\n locations?: OutTypes.location[];\n teachers?: OutTypes.teacher[];\n groups?: OutTypes.group[];\n persons?: OutTypes.person[];\n courses?: OutTypes.course[];\n events?: OutTypes.event[];\n lockedTimes?: OutTypes.lockedTime[];\n overlapGroups?: OutTypes.overlapGroup[];\n rootIntervals?: OutTypes.rootInterval[];\n syllabuses?: OutTypes.syllabus[];\n configurations?: OutTypes.configuration[];\n\n meta: { structure: string };\n};\n\nexport default function (\n schedule: Partial<CoreTypes.Mixed.Schedule>\n): Out {\n const options: BaseOptions = {};\n\n return {\n meta: { structure: 'RS/core-2.0.0' },\n ...schedule.divisions && { division: _division (schedule.divisions, options) },\n ...schedule.settings && { settings: _settings (schedule.settings, options) },\n ...schedule.exceptions && { exceptions: _exceptions (schedule.exceptions, options) },\n ...schedule.periods && { periods: _periods (schedule.periods, options) },\n ...schedule.locations && { locations: _locations (schedule.locations, options) },\n ...schedule.teachers && { teachers: _teachers (schedule.teachers, options) },\n ...schedule.groups && { groups: _groups (schedule.groups, options) },\n ...schedule.persons && { persons: _persons (schedule.persons, options) },\n ...schedule.courses && { courses: _courses (schedule.courses, options) },\n ...schedule.events && { events: _events (schedule.events, options) },\n ...schedule.lockedTimes && { lockedTimes: _lockedTimes (schedule.lockedTimes, options) },\n ...schedule.overlapGroups && { overlapGroups: _overlapGroups (schedule.overlapGroups, options) },\n ...schedule.rootIntervals && { rootIntervals: _rootIntervals (schedule.rootIntervals, options) },\n ...schedule.syllabuses && { syllabuses: _syllabuses (schedule.syllabuses, options) },\n ...schedule.configurations && { configurations: _configurations(schedule.configurations, options) },\n };\n}"],"mappings":";;;;;;;;;;;;;;;;;AA0DA,2BACE,UACK;CACL,MAAMA,UAAuB,EAAE;AAE/B,QAAO;EACL,MAAM,EAAE,WAAW,iBAAiB;EACpC,GAAG,SAAS,aAAkB,EAAE,UAAgBC,iBAAgB,SAAS,WAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,YAAkB,EAAE,UAAgBC,iBAAgB,SAAS,UAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,cAAkB,EAAE,YAAgBC,mBAAgB,SAAS,YAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,WAAkB,EAAE,SAAgBC,gBAAgB,SAAS,SAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,aAAkB,EAAE,WAAgBC,kBAAgB,SAAS,WAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,YAAkB,EAAE,UAAgBC,iBAAgB,SAAS,UAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,UAAkB,EAAE,QAAgBC,eAAgB,SAAS,QAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,WAAkB,EAAE,SAAgBC,gBAAgB,SAAS,SAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,WAAkB,EAAE,SAAgBC,gBAAgB,SAAS,SAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,UAAkB,EAAE,QAAgBC,eAAgB,SAAS,QAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,eAAkB,EAAE,aAAgBC,qBAAgB,SAAS,aAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,iBAAkB,EAAE,eAAgBC,uBAAgB,SAAS,eAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,iBAAkB,EAAE,eAAgBC,uBAAgB,SAAS,eAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,cAAkB,EAAE,YAAgBC,mBAAgB,SAAS,YAAgB,QAAQ,EAAE;EACnG,GAAG,SAAS,kBAAkB,EAAE,gBAAgBC,uBAAgB,SAAS,gBAAgB,QAAQ,EAAE;EACpG"}
|
package/dist/core/to/settings.js
CHANGED
|
@@ -7,9 +7,8 @@ var settings_default = (settings, options) => {
|
|
|
7
7
|
period: settings.period ? getVertexId(settings.period, options) : void 0,
|
|
8
8
|
defaultRootInterval: settings.defaultRootInterval ? getVertexId(settings.defaultRootInterval, options) : void 0
|
|
9
9
|
};
|
|
10
|
-
const nonEdges = omitEdgesAndInternalProperties(settings, edges);
|
|
11
10
|
return {
|
|
12
|
-
...
|
|
11
|
+
...omitEdgesAndInternalProperties(settings, edges),
|
|
13
12
|
...edges
|
|
14
13
|
};
|
|
15
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","names":["edges: SerializedEdgesOnlyVertexExport<DivisionSettingsVertex>"],"sources":["../../../src/core/to/settings.ts"],"sourcesContent":["import type { BaseOptions } from '../../common/types';\nimport type { DivisionSettingsVertex } from '../interfaces/vertices/division-settings';\nimport type { Types } from '../types';\nimport { getVertexId } from '../util';\nimport type { OutTypes } from './schedules';\nimport { omitEdgesAndInternalProperties, type SerializedEdgesOnlyVertexExport, type SerializedEdgesShape } from './util';\n\nexport default (\n settings: Types.Mixed.Settings,\n options: BaseOptions\n): OutTypes.settings => {\n const edges: SerializedEdgesOnlyVertexExport<DivisionSettingsVertex> = {\n period: settings.period ? getVertexId(settings.period, options) : undefined,\n defaultRootInterval: settings.defaultRootInterval ? getVertexId(settings.defaultRootInterval, options) : undefined,\n } satisfies SerializedEdgesShape<SerializedEdgesOnlyVertexExport<DivisionSettingsVertex>>;\n const nonEdges = omitEdgesAndInternalProperties(settings, edges);\n\n return { ...nonEdges, ...edges };\n};\n"],"mappings":";;;;AAOA,wBACE,UACA,YACsB;CACtB,MAAMA,QAAiE;EACrE,QAAqB,SAAS,SAAsB,YAAY,SAAS,QAAqB,
|
|
1
|
+
{"version":3,"file":"settings.js","names":["edges: SerializedEdgesOnlyVertexExport<DivisionSettingsVertex>"],"sources":["../../../src/core/to/settings.ts"],"sourcesContent":["import type { BaseOptions } from '../../common/types';\nimport type { DivisionSettingsVertex } from '../interfaces/vertices/division-settings';\nimport type { Types } from '../types';\nimport { getVertexId } from '../util';\nimport type { OutTypes } from './schedules';\nimport { omitEdgesAndInternalProperties, type SerializedEdgesOnlyVertexExport, type SerializedEdgesShape } from './util';\n\nexport default (\n settings: Types.Mixed.Settings,\n options: BaseOptions\n): OutTypes.settings => {\n const edges: SerializedEdgesOnlyVertexExport<DivisionSettingsVertex> = {\n period: settings.period ? getVertexId(settings.period, options) : undefined,\n defaultRootInterval: settings.defaultRootInterval ? getVertexId(settings.defaultRootInterval, options) : undefined,\n } satisfies SerializedEdgesShape<SerializedEdgesOnlyVertexExport<DivisionSettingsVertex>>;\n const nonEdges = omitEdgesAndInternalProperties(settings, edges);\n\n return { ...nonEdges, ...edges };\n};\n"],"mappings":";;;;AAOA,wBACE,UACA,YACsB;CACtB,MAAMA,QAAiE;EACrE,QAAqB,SAAS,SAAsB,YAAY,SAAS,QAAqB,QAAQ,GAAG;EACzG,qBAAqB,SAAS,sBAAsB,YAAY,SAAS,qBAAqB,QAAQ,GAAG;EAC1G;AAGD,QAAO;EAAE,GAFQ,+BAA+B,UAAU,MAAM;EAE1C,GAAG;EAAO"}
|
|
@@ -4,9 +4,8 @@ import { omitEdgesAndInternalProperties } from "./util.js";
|
|
|
4
4
|
var syllabuses_default = (syllabuses, options) => {
|
|
5
5
|
return syllabuses.map((x) => {
|
|
6
6
|
const edges = {};
|
|
7
|
-
const nonEdges = omitEdgesAndInternalProperties(x, edges);
|
|
8
7
|
return {
|
|
9
|
-
...
|
|
8
|
+
...omitEdgesAndInternalProperties(x, edges),
|
|
10
9
|
...edges
|
|
11
10
|
};
|
|
12
11
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syllabuses.js","names":["edges: SerializedEdgesOnlyVertexExport<SyllabusVertex>"],"sources":["../../../src/core/to/syllabuses.ts"],"sourcesContent":["import type { Types } from '../types';\nimport type { BaseOptions } from '../../common/types';\nimport { omitEdgesAndInternalProperties, type SerializedEdgesOnlyVertexExport, type SerializedEdgesShape } from './util';\nimport type { SyllabusVertex } from '../interfaces/vertices/syllabuses';\nimport type { OutTypes } from './schedules';\n\nexport default (\n syllabuses: Types.Mixed.Syllabus[],\n options: BaseOptions\n): OutTypes.syllabus[] => {\n return syllabuses\n .map(x => {\n const edges: SerializedEdgesOnlyVertexExport<SyllabusVertex> = {\n } satisfies SerializedEdgesShape<SerializedEdgesOnlyVertexExport<SyllabusVertex>>;\n const nonEdges = omitEdgesAndInternalProperties(x, edges);\n\n return { ...nonEdges, ...edges };\n });\n};\n"],"mappings":";;;AAMA,0BACE,YACA,YACwB;AACxB,QAAO,WACJ,KAAI,MAAK;EACR,MAAMA,QAAyD;
|
|
1
|
+
{"version":3,"file":"syllabuses.js","names":["edges: SerializedEdgesOnlyVertexExport<SyllabusVertex>"],"sources":["../../../src/core/to/syllabuses.ts"],"sourcesContent":["import type { Types } from '../types';\nimport type { BaseOptions } from '../../common/types';\nimport { omitEdgesAndInternalProperties, type SerializedEdgesOnlyVertexExport, type SerializedEdgesShape } from './util';\nimport type { SyllabusVertex } from '../interfaces/vertices/syllabuses';\nimport type { OutTypes } from './schedules';\n\nexport default (\n syllabuses: Types.Mixed.Syllabus[],\n options: BaseOptions\n): OutTypes.syllabus[] => {\n return syllabuses\n .map(x => {\n const edges: SerializedEdgesOnlyVertexExport<SyllabusVertex> = {\n } satisfies SerializedEdgesShape<SerializedEdgesOnlyVertexExport<SyllabusVertex>>;\n const nonEdges = omitEdgesAndInternalProperties(x, edges);\n\n return { ...nonEdges, ...edges };\n });\n};\n"],"mappings":";;;AAMA,0BACE,YACA,YACwB;AACxB,QAAO,WACJ,KAAI,MAAK;EACR,MAAMA,QAAyD,EAC9D;AAGD,SAAO;GAAE,GAFQ,+BAA+B,GAAG,MAAM;GAEnC,GAAG;GAAO;GAChC"}
|
package/dist/core/to/teachers.js
CHANGED
|
@@ -12,9 +12,8 @@ var teachers_default = (teachers, options) => {
|
|
|
12
12
|
lunch: x.lunch?.map((x$1) => getVertexId(x$1, options)),
|
|
13
13
|
complementaryTimes: x.complementaryTimes?.map((x$1) => getVertexId(x$1, options))
|
|
14
14
|
};
|
|
15
|
-
const nonEdges = omitEdgesAndInternalProperties(x, edges);
|
|
16
15
|
return {
|
|
17
|
-
...
|
|
16
|
+
...omitEdgesAndInternalProperties(x, edges),
|
|
18
17
|
...edges
|
|
19
18
|
};
|
|
20
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teachers.js","names":["edges: SerializedEdgesOnlyVertexExport<TeacherVertex>","x"],"sources":["../../../src/core/to/teachers.ts"],"sourcesContent":["import type { Types } from '../types';\nimport type { OutTypes } from './schedules';\nimport { getVertexId } from '../util';\nimport { omitEdgesAndInternalProperties, type SerializedEdgesOnlyVertexExport, type SerializedEdgesShape } from './util';\nimport type { BaseOptions } from '../../common/types';\nimport type { TeacherVertex } from '../interfaces/vertices/teachers';\n\nexport default (\n teachers: Types.Mixed.Teacher[],\n options: BaseOptions\n): OutTypes.teacher[] => {\n return teachers\n .map(x => {\n const edges: SerializedEdgesOnlyVertexExport<TeacherVertex> = {\n rootInterval: x.rootInterval ? getVertexId(x.rootInterval, options) : undefined,\n person: x.person ? getVertexId(x.person, options) : undefined,\n exceptions: x.exceptions ?.map(x => getVertexId(x, options)),\n lockedTimes: x.lockedTimes ?.map(x => getVertexId(x, options)),\n lunch: x.lunch ?.map(x => getVertexId(x, options)),\n complementaryTimes: x.complementaryTimes?.map(x => getVertexId(x, options)),\n } satisfies SerializedEdgesShape<SerializedEdgesOnlyVertexExport<TeacherVertex>>;\n const nonEdges = omitEdgesAndInternalProperties(x, edges);\n\n return { ...nonEdges, ...edges };\n });\n};\n"],"mappings":";;;;AAOA,wBACE,UACA,YACuB;AACvB,QAAO,SACJ,KAAI,MAAK;EACR,MAAMA,QAAwD;GAC5D,cAAoB,EAAE,eAAe,YAAY,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"teachers.js","names":["edges: SerializedEdgesOnlyVertexExport<TeacherVertex>","x"],"sources":["../../../src/core/to/teachers.ts"],"sourcesContent":["import type { Types } from '../types';\nimport type { OutTypes } from './schedules';\nimport { getVertexId } from '../util';\nimport { omitEdgesAndInternalProperties, type SerializedEdgesOnlyVertexExport, type SerializedEdgesShape } from './util';\nimport type { BaseOptions } from '../../common/types';\nimport type { TeacherVertex } from '../interfaces/vertices/teachers';\n\nexport default (\n teachers: Types.Mixed.Teacher[],\n options: BaseOptions\n): OutTypes.teacher[] => {\n return teachers\n .map(x => {\n const edges: SerializedEdgesOnlyVertexExport<TeacherVertex> = {\n rootInterval: x.rootInterval ? getVertexId(x.rootInterval, options) : undefined,\n person: x.person ? getVertexId(x.person, options) : undefined,\n exceptions: x.exceptions ?.map(x => getVertexId(x, options)),\n lockedTimes: x.lockedTimes ?.map(x => getVertexId(x, options)),\n lunch: x.lunch ?.map(x => getVertexId(x, options)),\n complementaryTimes: x.complementaryTimes?.map(x => getVertexId(x, options)),\n } satisfies SerializedEdgesShape<SerializedEdgesOnlyVertexExport<TeacherVertex>>;\n const nonEdges = omitEdgesAndInternalProperties(x, edges);\n\n return { ...nonEdges, ...edges };\n });\n};\n"],"mappings":";;;;AAOA,wBACE,UACA,YACuB;AACvB,QAAO,SACJ,KAAI,MAAK;EACR,MAAMA,QAAwD;GAC5D,cAAoB,EAAE,eAAe,YAAY,EAAE,cAAc,QAAQ,GAAG;GAC5E,QAAoB,EAAE,SAAe,YAAY,EAAE,QAAc,QAAQ,GAAG;GAC5E,YAAoB,EAAE,YAAoB,KAAI,QAAK,YAAYC,KAAG,QAAQ,CAAC;GAC3E,aAAoB,EAAE,aAAoB,KAAI,QAAK,YAAYA,KAAG,QAAQ,CAAC;GAC3E,OAAoB,EAAE,OAAoB,KAAI,QAAK,YAAYA,KAAG,QAAQ,CAAC;GAC3E,oBAAoB,EAAE,oBAAoB,KAAI,QAAK,YAAYA,KAAG,QAAQ,CAAC;GAC5E;AAGD,SAAO;GAAE,GAFQ,+BAA+B,GAAG,MAAM;GAEnC,GAAG;GAAO;GAChC"}
|
package/dist/core/to/util.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Intersect } from "../../common/types.js";
|
|
2
|
+
import "../interfaces/vertices/util/common.js";
|
|
3
|
+
import "../interfaces/vertices/util/index.js";
|
|
2
4
|
|
|
3
5
|
//#region src/core/to/util.d.ts
|
|
4
6
|
declare const keys: readonly ["_id", "createdAt", "updatedAt", "lastModifiedBy", "CONTEXT", "belongsTo", "domain", "derivedParentGroups"];
|
package/dist/core/to/util.js
CHANGED
|
@@ -16,8 +16,7 @@ const keys = [
|
|
|
16
16
|
* The output type also omits all edges for ease of use.
|
|
17
17
|
*/
|
|
18
18
|
function omitEdgesAndInternalProperties(v, edgesRecord) {
|
|
19
|
-
|
|
20
|
-
return omit(a, keys);
|
|
19
|
+
return omit(omit(v, Object.keys(edgesRecord)), keys);
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
//#endregion
|
package/dist/core/to/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","names":[],"sources":["../../../src/core/to/util.ts"],"sourcesContent":["import type { Intersect } from '../../common/types';\nimport type { Collection, SerializedVertexExport, Vertex } from '../interfaces/vertices/util';\nimport type { PickEdges } from '../interfaces/vertices/util/common';\nimport { omit } from 'lodash-es';\n\n\nconst keys = ['_id', 'createdAt', 'updatedAt', 'lastModifiedBy', 'CONTEXT', 'belongsTo', 'domain', 'derivedParentGroups'] as const;\nexport type InternalKeysOmitted<V extends object> = Omit<Intersect<V>, typeof keys[number]>;\n\nexport type SerializedEdgesOnlyVertexExport<\n V extends Vertex<Collection>\n> = {\n [K in keyof SerializedVertexExport<V> as K extends keyof InternalKeysOmitted<PickEdges<V>> ? K : never]: SerializedVertexExport<V>[K]\n};\n\n/**\n * Used only as `satisfies` to ensure that no edge property is missing.\n */\nexport type SerializedEdgesShape<V extends object> = Record<keyof Omit<V, 'belongsTo'>, unknown>;\n\n/**\n * Returns a copy of the vertex with internal keys omitted, such as `_id`, `createdAt`, `updatedAt`, etc.\n * The output type also omits all edges for ease of use.\n */\nexport function omitEdgesAndInternalProperties <\n V extends object,\n EdgesRecord extends object\n> (v: V, edgesRecord: EdgesRecord) {\n const a = omit(v, Object.keys(edgesRecord)) as unknown as Omit<V, keyof EdgesRecord>;\n return omit(a, keys) as unknown as InternalKeysOmitted<typeof a>;\n}\n"],"mappings":";;;AAMA,MAAM,OAAQ;CAAC;CAAQ;CAAa;CAAa;CAAkB;CAAW;CAAa;CAAU
|
|
1
|
+
{"version":3,"file":"util.js","names":[],"sources":["../../../src/core/to/util.ts"],"sourcesContent":["import type { Intersect } from '../../common/types';\nimport type { Collection, SerializedVertexExport, Vertex } from '../interfaces/vertices/util';\nimport type { PickEdges } from '../interfaces/vertices/util/common';\nimport { omit } from 'lodash-es';\n\n\nconst keys = ['_id', 'createdAt', 'updatedAt', 'lastModifiedBy', 'CONTEXT', 'belongsTo', 'domain', 'derivedParentGroups'] as const;\nexport type InternalKeysOmitted<V extends object> = Omit<Intersect<V>, typeof keys[number]>;\n\nexport type SerializedEdgesOnlyVertexExport<\n V extends Vertex<Collection>\n> = {\n [K in keyof SerializedVertexExport<V> as K extends keyof InternalKeysOmitted<PickEdges<V>> ? K : never]: SerializedVertexExport<V>[K]\n};\n\n/**\n * Used only as `satisfies` to ensure that no edge property is missing.\n */\nexport type SerializedEdgesShape<V extends object> = Record<keyof Omit<V, 'belongsTo'>, unknown>;\n\n/**\n * Returns a copy of the vertex with internal keys omitted, such as `_id`, `createdAt`, `updatedAt`, etc.\n * The output type also omits all edges for ease of use.\n */\nexport function omitEdgesAndInternalProperties <\n V extends object,\n EdgesRecord extends object\n> (v: V, edgesRecord: EdgesRecord) {\n const a = omit(v, Object.keys(edgesRecord)) as unknown as Omit<V, keyof EdgesRecord>;\n return omit(a, keys) as unknown as InternalKeysOmitted<typeof a>;\n}\n"],"mappings":";;;AAMA,MAAM,OAAQ;CAAC;CAAQ;CAAa;CAAa;CAAkB;CAAW;CAAa;CAAU;CAAsB;;;;;AAkB3H,SAAgB,+BAGb,GAAM,aAA0B;AAEjC,QAAO,KADG,KAAK,GAAG,OAAO,KAAK,YAAY,CAAC,EAC5B,KAAK"}
|
|
@@ -3,6 +3,7 @@ import { Day } from "../interfaces/vertices/properties/days.js";
|
|
|
3
3
|
import { Interval } from "../interfaces/vertices/properties/intervals.js";
|
|
4
4
|
import { MinBreakLength } from "../interfaces/vertices/properties/min-break-length.js";
|
|
5
5
|
import { Deep, Mixed, MixedWithOptionalId, Serialized, SerializedWithOptionalId } from "../interfaces/vertices/index.js";
|
|
6
|
+
import "../interfaces/index.js";
|
|
6
7
|
|
|
7
8
|
//#region src/core/types/index.d.ts
|
|
8
9
|
declare namespace Types {
|
package/dist/core/util.js
CHANGED
|
@@ -24,8 +24,7 @@ function getVertexId(edge, _idKey) {
|
|
|
24
24
|
* Returns the day index in the range 0-6, where 0 is Monday and 6 is Sunday.
|
|
25
25
|
*/
|
|
26
26
|
function getDayIndex(value) {
|
|
27
|
-
|
|
28
|
-
return (day + 6) % 7;
|
|
27
|
+
return ((typeof value === "number" ? value : moment.utc(value).day()) + 6) % 7;
|
|
29
28
|
}
|
|
30
29
|
function parseDateInterval(interval, type) {
|
|
31
30
|
if (!interval.start) throw new Error(`(RS::To::validateInterval) The interval ${type ? `"${type}"` : ""} is missing a start time`);
|
package/dist/core/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","names":["MongooseTypes"],"sources":["../../src/core/util.ts"],"sourcesContent":["import moment from 'moment';\nimport { Types as MongooseTypes } from 'mongoose';\nimport type { IdKey } from './types/common';\nimport type { Vertex, Collection } from './interfaces/vertices/util';\nimport type { DateType } from '../common/types';\nimport type { Interval } from './interfaces';\nimport type { IDType, OmitInternalVertexKeys, PrivateIDType } from './interfaces/vertices/util/vertex';\n\n/**\n * Returns the ID key to use for vertices, which can be either `id`, `_id`, or `ids`.\n */\nexport function getIdKey ({ idKey }: { idKey?: IdKey }) {\n return idKey ?? 'id';\n}\n\n/**\n * Returns the ID of a vertex, which can be either `_id`, `id`, or `ids`.\n */\nexport function getVertexId (\n edge: IDType | PrivateIDType | Partial<OmitInternalVertexKeys<Vertex<Collection>>>,\n _idKey: IdKey | { idKey?: IdKey }\n): string {\n if (typeof edge === 'string') return edge;\n if (edge instanceof MongooseTypes.ObjectId) return edge.toString();\n\n const idKey = typeof _idKey === 'string' ? _idKey : getIdKey(_idKey);\n if (idKey == '_id' && idKey in edge && edge[idKey]) return edge[idKey].toString();\n if (idKey == 'id' && idKey in edge && edge[idKey]) return edge[idKey];\n if (idKey == 'ids' && idKey in edge && edge[idKey]) return edge[idKey];\n\n throw new Error(`Unable to get vertex ID \"${idKey}\" from edge: ${JSON.stringify(edge)}`);\n}\n\n\n/**\n * Returns the day index in the range 0-6, where 0 is Monday and 6 is Sunday.\n */\nexport function getDayIndex (value: DateType | number): number {\n const day = typeof value === 'number' ? value : moment.utc(value).day();\n return (day + 6) % 7;\n}\n\nexport function parseDateInterval (interval: Partial<Interval<DateType>>, type?: string): Interval<moment.Moment> {\n if (!interval.start) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is missing a start time`);\n if (!interval.end ) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is missing an end time`);\n\n const start = moment.utc(interval.start);\n const end = moment.utc(interval.end);\n if (!start.isValid()) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} has an invalid start time`);\n if (!end .isValid()) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} has an invalid end time`);\n\n if (end.isSameOrBefore(start)) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is invalid: end time is before or equal to start time`);\n\n return { start, end };\n}"],"mappings":";;;;;;;AAWA,SAAgB,SAAU,EAAE,SAA4B;AACtD,QAAO,SAAS;;;;;AAMlB,SAAgB,YACd,MACA,QACQ;AACR,KAAI,OAAO,SAAS,SAAU,QAAO;AACrC,KAAI,gBAAgBA,MAAc,SAAU,QAAO,KAAK;
|
|
1
|
+
{"version":3,"file":"util.js","names":["MongooseTypes"],"sources":["../../src/core/util.ts"],"sourcesContent":["import moment from 'moment';\nimport { Types as MongooseTypes } from 'mongoose';\nimport type { IdKey } from './types/common';\nimport type { Vertex, Collection } from './interfaces/vertices/util';\nimport type { DateType } from '../common/types';\nimport type { Interval } from './interfaces';\nimport type { IDType, OmitInternalVertexKeys, PrivateIDType } from './interfaces/vertices/util/vertex';\n\n/**\n * Returns the ID key to use for vertices, which can be either `id`, `_id`, or `ids`.\n */\nexport function getIdKey ({ idKey }: { idKey?: IdKey }) {\n return idKey ?? 'id';\n}\n\n/**\n * Returns the ID of a vertex, which can be either `_id`, `id`, or `ids`.\n */\nexport function getVertexId (\n edge: IDType | PrivateIDType | Partial<OmitInternalVertexKeys<Vertex<Collection>>>,\n _idKey: IdKey | { idKey?: IdKey }\n): string {\n if (typeof edge === 'string') return edge;\n if (edge instanceof MongooseTypes.ObjectId) return edge.toString();\n\n const idKey = typeof _idKey === 'string' ? _idKey : getIdKey(_idKey);\n if (idKey == '_id' && idKey in edge && edge[idKey]) return edge[idKey].toString();\n if (idKey == 'id' && idKey in edge && edge[idKey]) return edge[idKey];\n if (idKey == 'ids' && idKey in edge && edge[idKey]) return edge[idKey];\n\n throw new Error(`Unable to get vertex ID \"${idKey}\" from edge: ${JSON.stringify(edge)}`);\n}\n\n\n/**\n * Returns the day index in the range 0-6, where 0 is Monday and 6 is Sunday.\n */\nexport function getDayIndex (value: DateType | number): number {\n const day = typeof value === 'number' ? value : moment.utc(value).day();\n return (day + 6) % 7;\n}\n\nexport function parseDateInterval (interval: Partial<Interval<DateType>>, type?: string): Interval<moment.Moment> {\n if (!interval.start) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is missing a start time`);\n if (!interval.end ) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is missing an end time`);\n\n const start = moment.utc(interval.start);\n const end = moment.utc(interval.end);\n if (!start.isValid()) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} has an invalid start time`);\n if (!end .isValid()) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} has an invalid end time`);\n\n if (end.isSameOrBefore(start)) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is invalid: end time is before or equal to start time`);\n\n return { start, end };\n}"],"mappings":";;;;;;;AAWA,SAAgB,SAAU,EAAE,SAA4B;AACtD,QAAO,SAAS;;;;;AAMlB,SAAgB,YACd,MACA,QACQ;AACR,KAAI,OAAO,SAAS,SAAU,QAAO;AACrC,KAAI,gBAAgBA,MAAc,SAAU,QAAO,KAAK,UAAU;CAElE,MAAM,QAAQ,OAAO,WAAW,WAAW,SAAS,SAAS,OAAO;AACpE,KAAI,SAAS,SAAS,SAAS,QAAQ,KAAK,OAAQ,QAAO,KAAK,OAAO,UAAU;AACjF,KAAI,SAAS,QAAS,SAAS,QAAQ,KAAK,OAAQ,QAAO,KAAK;AAChE,KAAI,SAAS,SAAS,SAAS,QAAQ,KAAK,OAAQ,QAAO,KAAK;AAEhE,OAAM,IAAI,MAAM,4BAA4B,MAAM,eAAe,KAAK,UAAU,KAAK,GAAG;;;;;AAO1F,SAAgB,YAAa,OAAkC;AAE7D,UADY,OAAO,UAAU,WAAW,QAAQ,OAAO,IAAI,MAAM,CAAC,KAAK,IACzD,KAAK;;AAGrB,SAAgB,kBAAmB,UAAuC,MAAwC;AAChH,KAAI,CAAC,SAAS,MAAO,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG,0BAA0B;AAClI,KAAI,CAAC,SAAS,IAAO,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG,yBAAyB;CAEjI,MAAM,QAAQ,OAAO,IAAI,SAAS,MAAM;CACxC,MAAM,MAAQ,OAAO,IAAI,SAAS,IAAI;AACtC,KAAI,CAAC,MAAM,SAAS,CAAE,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG,4BAA4B;AACrI,KAAI,CAAC,IAAM,SAAS,CAAE,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG,0BAA0B;AAEnI,KAAI,IAAI,eAAe,MAAM,CAAE,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG,wDAAwD;AAE1K,QAAO;EAAE;EAAO;EAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[]","RSstructure"],"sources":["../../../src/identify/constants/index.ts"],"sourcesContent":["import { CoreMap } from '../../core';\nimport type { SchoolSoftFileTypes } from '../../SchoolSoft';\nimport { SchoolSoftMap } from '../../SchoolSoft';\nimport { PlanDigitalMap } from '../../PlanDigital';\nimport { AdmentumMap } from '../../Admentum';\nimport { IdunSoftMap } from '../../IdunSoft';\nimport { Skola24Map } from '../../Skola24';\nimport { RSMap } from '../../RS';\nimport { ExcelMap } from '../../Excel';\nimport { structure as RSstructure } from '../../RS/types/to';\n\n\nconst core_structure = {\n groups: ['id'],\n locations: ['id'],\n teachers: ['id'],\n courses: ['id', 'events', 'groups', 'subject', 'teachers'],\n};\n\nconst excel_structure = {\n meta: [['structure']],\n courses: [],\n groups: [],\n locations: [],\n};\n\nconst RS_structure = {\n events: ['output', 'coreData'],\n};\n\nconst Admentum_structure = {\n schools: ['url', 'id', 'unit_code', 'school_code', 'school_type', 'name'],\n schedule: ['url', 'id', 'school_id', 'school_year', 'start_date', 'end_date', 'start_time', 'end_time', 'is_active', 'archived_at'],\n rooms: ['url', 'id', 'school_id', 'name', 'category', 'capacity'],\n teachers: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n principals: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n courses: ['url', 'id', 'school_id', 'schedule_id', 'name', 'subject_code', 'start_date', 'end_date', 'teachers', 'gymnasium_course'],\n schedule_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'name', 'guid', 'teachers', 'users_primary_groups', 'subjects', 'courses'],\n primary_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'grade', 'name', 'guid', 'teachers', 'start_date', 'end_date', 'start_date_display', 'end_date_display'],\n schedule_events: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start_time', 'end_time', 'rooms', 'teachers', 'schedule_groups', 'primary_groups', 'weekly_interval'],\n schedule_event_instances: ['url', 'id', 'school_id', 'start_date', 'end_date', 'schedule_event'],\n lessons: ['url', 'id', 'school_id', 'date', 'info', 'teachers', 'room', 'weekday'],\n lesson_infos: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start', 'end', 'duration', 'room', 'subject', 'teachers', 'groups', 'weekly_interval'],\n};\n\nconst IdunSoft_structure = {\n Grupp: ['ID', 'Klassnamn'],\n Lärare: ['ID', 'Namn'],\n Rum: ['ID', 'Namn'],\n Ämne: ['Ämne', 'Betygskod'],\n Lektion: ['LektionID', 'Ämne', 'Starttid', 'Sluttid', 'Lektionslängd', 'LärareID', 'GruppID', 'RumID', 'VeckodagID']\n};\n\nconst Skola24_txt_structure = null;\n\nconst Skola24_mdb_structure = {\n unit_tblroom: [ 'PK', 'ID' ],\n school_tblsubject: [ 'PK', 'ID' ],\n school_tblteacher: [ 'PK', 'ID' ],\n school_tblgroup: [ 'PK', 'ID', 'bClass' ],\n school_tblplan: [ 'PK', 'FKSubject' ],\n school_tblcourse: [ ],\n school_tblschedule: [ 'PK', 'Length', 'StartTime', 'DayOfWeek', 'FKSubject', 'CalcActualWeeks' ],\n school_tblgroup_group: [ 'FKGroup', 'FKGroupCon' ],\n school_tblplan_period: [ 'FKPlan', 'FKPeriod' ],\n school_tblplan_teacher: [ 'FKPlan', 'FKTeacher' ],\n school_tblplan_group: [ 'FKPlan', 'FKGroup' ],\n unit_tblperiod_date: [ 'FKPeriod', 'StartDate', 'EndDate' ],\n school_tblschedule_period: [ 'FKSchedule', 'FKPeriod' ],\n school_tblschedule_teacher: [ 'FKSchedule', 'FKTeacher' ],\n school_tblschedule_group: [ 'FKSchedule', 'FKGroup' ],\n school_tblschedule_room: [ 'FKSchedule', 'FKRoom' ]\n};\n\n// this is only temporary\nconst PlanDigital_structure = {\n 'Perioder': [ 'Namn', 'Tidsenhet' ],\n 'Tabell Tjänstefördelning': [ 'Gruppnamn', 'Klass', 'Kurskod', 'Sign', 'Poäng', 'Anteckningar', 'Antal', 'Ämne', 'Kursnamn' ]\n};\n\nconst SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[] = [\n 'id',\n 'group',\n 'dayid',\n 'day',\n 'starttime',\n 'length',\n 'teacher',\n 'subject',\n 'room',\n 'period',\n 'inweek',\n 'exweek',\n 'exclass',\n 'realweeks'\n];\n\nexport const maps = [\n {\n structure: Skola24_txt_structure,\n matchType: 'string',\n name: 'Skola24 (txt)',\n map: Skola24Map.TXT,\n meta: { structure: '' }\n }, {\n structure: Admentum_structure,\n name: 'Admentum',\n map: AdmentumMap,\n meta: { structure: '' }\n }, {\n structure: SchoolSoft_structure,\n name: 'SchoolSoft',\n map: SchoolSoftMap,\n meta: { structure: '' }\n }, {\n structure: PlanDigital_structure,\n name: 'Plan Digital',\n map: PlanDigitalMap,\n meta: { structure: '' }\n }, {\n structure: IdunSoft_structure,\n name: 'IdunSoft',\n map: IdunSoftMap,\n meta: { structure: '' }\n }, {\n structure: Skola24_mdb_structure,\n name: 'Skola24 (mdb)',\n map: Skola24Map.MDB,\n meta: { structure: '' }\n }, {\n structure: RS_structure,\n name: 'Royal Schedule Algorithm',\n map: RSMap,\n meta: { structure: RSstructure }\n }, {\n // structure: core_structure,\n // name: 'Royal Schedule',\n // map: CoreMap.V1,\n // meta: { structure: 'RS/core-1.0.0' }\n // }, {\n structure: core_structure,\n name: 'Royal Schedule',\n map: CoreMap,\n meta: { structure: 'RS/core-2.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V1,\n meta: { structure: 'RS/Excel-1.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V2,\n meta: { structure: 'RS/Excel-2.0.0' }\n }\n] as const;"],"mappings":";;;;;;;;;;;AAYA,MAAM,iBAAiB;CACrB,QAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","names":["SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[]","RSstructure"],"sources":["../../../src/identify/constants/index.ts"],"sourcesContent":["import { CoreMap } from '../../core';\nimport type { SchoolSoftFileTypes } from '../../SchoolSoft';\nimport { SchoolSoftMap } from '../../SchoolSoft';\nimport { PlanDigitalMap } from '../../PlanDigital';\nimport { AdmentumMap } from '../../Admentum';\nimport { IdunSoftMap } from '../../IdunSoft';\nimport { Skola24Map } from '../../Skola24';\nimport { RSMap } from '../../RS';\nimport { ExcelMap } from '../../Excel';\nimport { structure as RSstructure } from '../../RS/types/to';\n\n\nconst core_structure = {\n groups: ['id'],\n locations: ['id'],\n teachers: ['id'],\n courses: ['id', 'events', 'groups', 'subject', 'teachers'],\n};\n\nconst excel_structure = {\n meta: [['structure']],\n courses: [],\n groups: [],\n locations: [],\n};\n\nconst RS_structure = {\n events: ['output', 'coreData'],\n};\n\nconst Admentum_structure = {\n schools: ['url', 'id', 'unit_code', 'school_code', 'school_type', 'name'],\n schedule: ['url', 'id', 'school_id', 'school_year', 'start_date', 'end_date', 'start_time', 'end_time', 'is_active', 'archived_at'],\n rooms: ['url', 'id', 'school_id', 'name', 'category', 'capacity'],\n teachers: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n principals: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n courses: ['url', 'id', 'school_id', 'schedule_id', 'name', 'subject_code', 'start_date', 'end_date', 'teachers', 'gymnasium_course'],\n schedule_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'name', 'guid', 'teachers', 'users_primary_groups', 'subjects', 'courses'],\n primary_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'grade', 'name', 'guid', 'teachers', 'start_date', 'end_date', 'start_date_display', 'end_date_display'],\n schedule_events: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start_time', 'end_time', 'rooms', 'teachers', 'schedule_groups', 'primary_groups', 'weekly_interval'],\n schedule_event_instances: ['url', 'id', 'school_id', 'start_date', 'end_date', 'schedule_event'],\n lessons: ['url', 'id', 'school_id', 'date', 'info', 'teachers', 'room', 'weekday'],\n lesson_infos: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start', 'end', 'duration', 'room', 'subject', 'teachers', 'groups', 'weekly_interval'],\n};\n\nconst IdunSoft_structure = {\n Grupp: ['ID', 'Klassnamn'],\n Lärare: ['ID', 'Namn'],\n Rum: ['ID', 'Namn'],\n Ämne: ['Ämne', 'Betygskod'],\n Lektion: ['LektionID', 'Ämne', 'Starttid', 'Sluttid', 'Lektionslängd', 'LärareID', 'GruppID', 'RumID', 'VeckodagID']\n};\n\nconst Skola24_txt_structure = null;\n\nconst Skola24_mdb_structure = {\n unit_tblroom: [ 'PK', 'ID' ],\n school_tblsubject: [ 'PK', 'ID' ],\n school_tblteacher: [ 'PK', 'ID' ],\n school_tblgroup: [ 'PK', 'ID', 'bClass' ],\n school_tblplan: [ 'PK', 'FKSubject' ],\n school_tblcourse: [ ],\n school_tblschedule: [ 'PK', 'Length', 'StartTime', 'DayOfWeek', 'FKSubject', 'CalcActualWeeks' ],\n school_tblgroup_group: [ 'FKGroup', 'FKGroupCon' ],\n school_tblplan_period: [ 'FKPlan', 'FKPeriod' ],\n school_tblplan_teacher: [ 'FKPlan', 'FKTeacher' ],\n school_tblplan_group: [ 'FKPlan', 'FKGroup' ],\n unit_tblperiod_date: [ 'FKPeriod', 'StartDate', 'EndDate' ],\n school_tblschedule_period: [ 'FKSchedule', 'FKPeriod' ],\n school_tblschedule_teacher: [ 'FKSchedule', 'FKTeacher' ],\n school_tblschedule_group: [ 'FKSchedule', 'FKGroup' ],\n school_tblschedule_room: [ 'FKSchedule', 'FKRoom' ]\n};\n\n// this is only temporary\nconst PlanDigital_structure = {\n 'Perioder': [ 'Namn', 'Tidsenhet' ],\n 'Tabell Tjänstefördelning': [ 'Gruppnamn', 'Klass', 'Kurskod', 'Sign', 'Poäng', 'Anteckningar', 'Antal', 'Ämne', 'Kursnamn' ]\n};\n\nconst SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[] = [\n 'id',\n 'group',\n 'dayid',\n 'day',\n 'starttime',\n 'length',\n 'teacher',\n 'subject',\n 'room',\n 'period',\n 'inweek',\n 'exweek',\n 'exclass',\n 'realweeks'\n];\n\nexport const maps = [\n {\n structure: Skola24_txt_structure,\n matchType: 'string',\n name: 'Skola24 (txt)',\n map: Skola24Map.TXT,\n meta: { structure: '' }\n }, {\n structure: Admentum_structure,\n name: 'Admentum',\n map: AdmentumMap,\n meta: { structure: '' }\n }, {\n structure: SchoolSoft_structure,\n name: 'SchoolSoft',\n map: SchoolSoftMap,\n meta: { structure: '' }\n }, {\n structure: PlanDigital_structure,\n name: 'Plan Digital',\n map: PlanDigitalMap,\n meta: { structure: '' }\n }, {\n structure: IdunSoft_structure,\n name: 'IdunSoft',\n map: IdunSoftMap,\n meta: { structure: '' }\n }, {\n structure: Skola24_mdb_structure,\n name: 'Skola24 (mdb)',\n map: Skola24Map.MDB,\n meta: { structure: '' }\n }, {\n structure: RS_structure,\n name: 'Royal Schedule Algorithm',\n map: RSMap,\n meta: { structure: RSstructure }\n }, {\n // structure: core_structure,\n // name: 'Royal Schedule',\n // map: CoreMap.V1,\n // meta: { structure: 'RS/core-1.0.0' }\n // }, {\n structure: core_structure,\n name: 'Royal Schedule',\n map: CoreMap,\n meta: { structure: 'RS/core-2.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V1,\n meta: { structure: 'RS/Excel-1.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V2,\n meta: { structure: 'RS/Excel-2.0.0' }\n }\n] as const;"],"mappings":"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"}
|
package/dist/identify/index.js
CHANGED
|
@@ -22,8 +22,7 @@ function identify(schedule) {
|
|
|
22
22
|
error: []
|
|
23
23
|
};
|
|
24
24
|
if (!schedule) return similarities;
|
|
25
|
-
const
|
|
26
|
-
const res = MetaStructure.safeParse(schedule);
|
|
25
|
+
const res = z.object({ meta: z.union([z.object({ structure: z.string() }), z.array(z.unknown()).transform((arr) => arr.at(0)).pipe(z.object({ structure: z.string() }))]) }).safeParse(schedule);
|
|
27
26
|
if (res.data) {
|
|
28
27
|
const determined = maps.find((x) => sameMajorStructure(x.meta.structure, res.data.meta.structure));
|
|
29
28
|
if (determined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["x","similarities: IdentifiedMaps","collections: string[]","structureKeys: string[]"],"sources":["../../src/identify/index.ts"],"sourcesContent":["import { difference, isEqual, sortBy, uniq } from 'lodash-es';\nimport type { IdentifiedMaps } from './types';\nimport { maps } from './constants';\nimport * as z from 'zod';\nimport { makeChainable } from '../common/make-chainable';\nexport type { MapInstance, MapName, IdentifiedMaps } from './types';\nexport { maps } from './constants';\n\n\nfunction keysOf (docs: unknown): string[] {\n return makeChainable(docs)\n .chain(\n x => Array.isArray(x) ? x as unknown[] : [x],\n x => x.flatMap(x => x && typeof x === 'object' ? Object.keys(x) : []),\n x => uniq(x)\n )\n .value;\n}\n\nfunction sameMajorStructure (a: string, b: string): boolean {\n const normalize = (s: string) => {\n // Matches: \"<prefix>-<major>[.<minor>[.<patch>]]\", optional leading 'v'\n const m = s.match(/^(.*?)-v?(\\d+)(?:\\.\\d+){0,2}$/i);\n return m ? `${m[1]}-${m[2]}` : s;\n };\n return normalize(a) === normalize(b);\n}\n\nexport function identify (schedule: unknown): IdentifiedMaps {\n const similarities: IdentifiedMaps = {\n none: [],\n weak: [],\n strong: [],\n error: [],\n };\n\n if (!schedule) return similarities;\n\n ////\n //// check if the schedule is a meta tagged file and thus identifiable by its structure.\n ////\n const MetaStructure = z.object({\n meta: z.union([\n z.object({\n structure: z.string()\n }),\n z.array(z.unknown())\n .transform(arr => arr.at(0))\n .pipe(z.object({\n structure: z.string()\n }))\n ])\n });\n const res = MetaStructure.safeParse(schedule);\n if (res.data) {\n // structure on the type \"RS/mapName-X.Y.Z\"\n const determined = maps.find(x => sameMajorStructure(x.meta.structure, res.data.meta.structure));\n if (determined) {\n similarities.determined = determined;\n return similarities;\n }\n }\n\n\n ////\n //// not a meta tagged file, so we check the structure.\n ////\n const collections: string[] = Array.isArray(schedule) ? keysOf(schedule) : Object.keys(schedule);\n if (!collections.length) return similarities;\n\n maps.forEach(mapping => {\n const { structure } = mapping;\n\n try {\n if ('matchType' in mapping && typeof schedule === mapping.matchType) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (!structure) {\n similarities.none.push(mapping);\n return;\n }\n\n const _collections = Array.isArray(structure) ? structure : Object.keys(structure);\n\n /*\n is shallow structure .\n */\n if (Array.isArray(schedule)) {\n\n if (!Array.isArray(structure)) {\n similarities.none.push(mapping);\n return;\n }\n\n if (isEqual(sortBy(_collections), sortBy(collections))) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (difference(sortBy(_collections), sortBy(collections)).length < _collections.length) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n return;\n }\n\n /*\n is deep structure .\n */\n\n\n /*\n every key is present in file.\n */\n if (_collections.every(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.every(key => structureKeys.includes(key));\n })) {\n similarities.strong.push(mapping);\n return;\n }\n\n /*\n some keys is present in file.\n */\n if (_collections.some(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.some(key => structureKeys.includes(key));\n })) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n } catch {\n similarities.error.push(mapping);\n }\n });\n\n return similarities;\n}\n"],"mappings":";;;;;;AASA,SAAS,OAAQ,MAAyB;AACxC,QAAO,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","names":["x","similarities: IdentifiedMaps","collections: string[]","structureKeys: string[]"],"sources":["../../src/identify/index.ts"],"sourcesContent":["import { difference, isEqual, sortBy, uniq } from 'lodash-es';\nimport type { IdentifiedMaps } from './types';\nimport { maps } from './constants';\nimport * as z from 'zod';\nimport { makeChainable } from '../common/make-chainable';\nexport type { MapInstance, MapName, IdentifiedMaps } from './types';\nexport { maps } from './constants';\n\n\nfunction keysOf (docs: unknown): string[] {\n return makeChainable(docs)\n .chain(\n x => Array.isArray(x) ? x as unknown[] : [x],\n x => x.flatMap(x => x && typeof x === 'object' ? Object.keys(x) : []),\n x => uniq(x)\n )\n .value;\n}\n\nfunction sameMajorStructure (a: string, b: string): boolean {\n const normalize = (s: string) => {\n // Matches: \"<prefix>-<major>[.<minor>[.<patch>]]\", optional leading 'v'\n const m = s.match(/^(.*?)-v?(\\d+)(?:\\.\\d+){0,2}$/i);\n return m ? `${m[1]}-${m[2]}` : s;\n };\n return normalize(a) === normalize(b);\n}\n\nexport function identify (schedule: unknown): IdentifiedMaps {\n const similarities: IdentifiedMaps = {\n none: [],\n weak: [],\n strong: [],\n error: [],\n };\n\n if (!schedule) return similarities;\n\n ////\n //// check if the schedule is a meta tagged file and thus identifiable by its structure.\n ////\n const MetaStructure = z.object({\n meta: z.union([\n z.object({\n structure: z.string()\n }),\n z.array(z.unknown())\n .transform(arr => arr.at(0))\n .pipe(z.object({\n structure: z.string()\n }))\n ])\n });\n const res = MetaStructure.safeParse(schedule);\n if (res.data) {\n // structure on the type \"RS/mapName-X.Y.Z\"\n const determined = maps.find(x => sameMajorStructure(x.meta.structure, res.data.meta.structure));\n if (determined) {\n similarities.determined = determined;\n return similarities;\n }\n }\n\n\n ////\n //// not a meta tagged file, so we check the structure.\n ////\n const collections: string[] = Array.isArray(schedule) ? keysOf(schedule) : Object.keys(schedule);\n if (!collections.length) return similarities;\n\n maps.forEach(mapping => {\n const { structure } = mapping;\n\n try {\n if ('matchType' in mapping && typeof schedule === mapping.matchType) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (!structure) {\n similarities.none.push(mapping);\n return;\n }\n\n const _collections = Array.isArray(structure) ? structure : Object.keys(structure);\n\n /*\n is shallow structure .\n */\n if (Array.isArray(schedule)) {\n\n if (!Array.isArray(structure)) {\n similarities.none.push(mapping);\n return;\n }\n\n if (isEqual(sortBy(_collections), sortBy(collections))) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (difference(sortBy(_collections), sortBy(collections)).length < _collections.length) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n return;\n }\n\n /*\n is deep structure .\n */\n\n\n /*\n every key is present in file.\n */\n if (_collections.every(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.every(key => structureKeys.includes(key));\n })) {\n similarities.strong.push(mapping);\n return;\n }\n\n /*\n some keys is present in file.\n */\n if (_collections.some(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.some(key => structureKeys.includes(key));\n })) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n } catch {\n similarities.error.push(mapping);\n }\n });\n\n return similarities;\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classes.js","names":[],"sources":["../../../src/sdui/from/classes.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n group: SduiTypes.classes\n): OutTypes.group => {\n return {\n ids: group.id\n };\n};\n"],"mappings":";AAGA,uBACE,UACmB;AACnB,QAAO,EACL,KAAK,MAAM"}
|
|
1
|
+
{"version":3,"file":"classes.js","names":[],"sources":["../../../src/sdui/from/classes.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n group: SduiTypes.classes\n): OutTypes.group => {\n return {\n ids: group.id\n };\n};\n"],"mappings":";AAGA,uBACE,UACmB;AACnB,QAAO,EACL,KAAK,MAAM,IACZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"courses.js","names":[],"sources":["../../../src/sdui/from/courses.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n course: SduiTypes.course\n): OutTypes.course => {\n return {\n ids: course.id,\n displayName: course.name,\n color: course.color,\n teachers: course.teachers.map(to => ({ to })),\n groups: course.classes .map(to => ({ to })),\n };\n};\n"],"mappings":";AAGA,uBACE,WACoB;AACpB,QAAO;EACL,KAAa,OAAO;EACpB,aAAa,OAAO;EACpB,OAAa,OAAO;EACpB,UAAa,OAAO,SAAS,KAAI,QAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"courses.js","names":[],"sources":["../../../src/sdui/from/courses.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n course: SduiTypes.course\n): OutTypes.course => {\n return {\n ids: course.id,\n displayName: course.name,\n color: course.color,\n teachers: course.teachers.map(to => ({ to })),\n groups: course.classes .map(to => ({ to })),\n };\n};\n"],"mappings":";AAGA,uBACE,WACoB;AACpB,QAAO;EACL,KAAa,OAAO;EACpB,aAAa,OAAO;EACpB,OAAa,OAAO;EACpB,UAAa,OAAO,SAAS,KAAI,QAAO,EAAE,IAAI,EAAE;EAChD,QAAa,OAAO,QAAS,KAAI,QAAO,EAAE,IAAI,EAAE;EACjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"holidays.js","names":[],"sources":["../../../src/sdui/from/holidays.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n holiday: SduiTypes.holiday\n): OutTypes.exception => {\n return {\n // ids: holiday.id\n };\n};\n"],"mappings":";AAGA,wBACE,YACuB;AACvB,QAAO"}
|
|
1
|
+
{"version":3,"file":"holidays.js","names":[],"sources":["../../../src/sdui/from/holidays.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n holiday: SduiTypes.holiday\n): OutTypes.exception => {\n return {\n // ids: holiday.id\n };\n};\n"],"mappings":";AAGA,wBACE,YACuB;AACvB,QAAO,EAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_schedules","_hours","_substitutionPlans","_classes","_teachers","_subjects","_rooms","_courses","_lessons","_holidays","_schoolYears"],"sources":["../../../src/sdui/from/index.ts"],"sourcesContent":["import _schedules from './schedules';\nimport _hours from './hours';\nimport _substitutionPlans from './substitution-plans';\nimport _classes from './classes';\nimport _teachers from './teachers';\nimport _subjects from './subjects';\nimport _rooms from './rooms';\nimport _courses from './courses';\nimport _lessons from './lessons';\nimport _holidays from './holidays';\nimport _schoolYears from './school-years';\n\nexport default {\n schedules: _schedules,\n hours: _hours,\n substitutionPlans: _substitutionPlans,\n classes: _classes,\n teachers: _teachers,\n subjects: _subjects,\n rooms: _rooms,\n courses: _courses,\n lessons: _lessons,\n holidays: _holidays,\n schoolYears: _schoolYears\n};"],"mappings":";;;;;;;;;;;;;AAYA,mBAAe;CACb,WAAmBA;CACnB,OAAmBC;CACnB,mBAAmBC;CACnB,SAAmBC;CACnB,UAAmBC;CACnB,UAAmBC;CACnB,OAAmBC;CACnB,SAAmBC;CACnB,SAAmBC;CACnB,UAAmBC;CACnB,aAAmBC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_schedules","_hours","_substitutionPlans","_classes","_teachers","_subjects","_rooms","_courses","_lessons","_holidays","_schoolYears"],"sources":["../../../src/sdui/from/index.ts"],"sourcesContent":["import _schedules from './schedules';\nimport _hours from './hours';\nimport _substitutionPlans from './substitution-plans';\nimport _classes from './classes';\nimport _teachers from './teachers';\nimport _subjects from './subjects';\nimport _rooms from './rooms';\nimport _courses from './courses';\nimport _lessons from './lessons';\nimport _holidays from './holidays';\nimport _schoolYears from './school-years';\n\nexport default {\n schedules: _schedules,\n hours: _hours,\n substitutionPlans: _substitutionPlans,\n classes: _classes,\n teachers: _teachers,\n subjects: _subjects,\n rooms: _rooms,\n courses: _courses,\n lessons: _lessons,\n holidays: _holidays,\n schoolYears: _schoolYears\n};"],"mappings":";;;;;;;;;;;;;AAYA,mBAAe;CACb,WAAmBA;CACnB,OAAmBC;CACnB,mBAAmBC;CACnB,SAAmBC;CACnB,UAAmBC;CACnB,UAAmBC;CACnB,OAAmBC;CACnB,SAAmBC;CACnB,SAAmBC;CACnB,UAAmBC;CACnB,aAAmBC;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lessons.js","names":[],"sources":["../../../src/sdui/from/lessons.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n lesson: SduiTypes.lesson\n): OutTypes.event => {\n const start = lesson.begins_at;\n const end = lesson.ends_at;\n const duration = Math.floor((new Date(end).getTime() - new Date(start).getTime()) / 60000); // in minutes\n\n return {\n ids: lesson.id,\n course: lesson.course_id,\n start: lesson.begins_at,\n end: lesson.ends_at,\n preferredDuration: duration,\n locations: lesson.rooms?.map((to, i) => ({ locations: [to], groupIndex: i })),\n teachers: lesson.teachers?.map(to => ({ to })),\n groups: lesson.classes.map(to => ({ to })),\n };\n};"],"mappings":";AAGA,uBACE,WACmB;CACnB,MAAM,QAAW,OAAO;CACxB,MAAM,MAAW,OAAO;CACxB,MAAM,WAAW,KAAK,OAAO,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"lessons.js","names":[],"sources":["../../../src/sdui/from/lessons.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n lesson: SduiTypes.lesson\n): OutTypes.event => {\n const start = lesson.begins_at;\n const end = lesson.ends_at;\n const duration = Math.floor((new Date(end).getTime() - new Date(start).getTime()) / 60000); // in minutes\n\n return {\n ids: lesson.id,\n course: lesson.course_id,\n start: lesson.begins_at,\n end: lesson.ends_at,\n preferredDuration: duration,\n locations: lesson.rooms?.map((to, i) => ({ locations: [to], groupIndex: i })),\n teachers: lesson.teachers?.map(to => ({ to })),\n groups: lesson.classes.map(to => ({ to })),\n };\n};"],"mappings":";AAGA,uBACE,WACmB;CACnB,MAAM,QAAW,OAAO;CACxB,MAAM,MAAW,OAAO;CACxB,MAAM,WAAW,KAAK,OAAO,IAAI,KAAK,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC,SAAS,IAAI,IAAM;AAE1F,QAAO;EACL,KAAmB,OAAO;EAC1B,QAAmB,OAAO;EAC1B,OAAmB,OAAO;EAC1B,KAAmB,OAAO;EAC1B,mBAAmB;EACnB,WAAmB,OAAO,OAAO,KAAK,IAAI,OAAO;GAAE,WAAW,CAAC,GAAG;GAAE,YAAY;GAAG,EAAE;EACrF,UAAmB,OAAO,UAAU,KAAI,QAAO,EAAE,IAAI,EAAE;EACvD,QAAmB,OAAO,QAAQ,KAAI,QAAO,EAAE,IAAI,EAAE;EACtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rooms.js","names":[],"sources":["../../../src/sdui/from/rooms.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n room: SduiTypes.room\n): OutTypes.location => {\n return {\n ids: room.id,\n displayName: room.name,\n };\n};\n"],"mappings":";AAGA,qBACE,SACsB;AACtB,QAAO;EACL,KAAa,KAAK;EAClB,aAAa,KAAK"}
|
|
1
|
+
{"version":3,"file":"rooms.js","names":[],"sources":["../../../src/sdui/from/rooms.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n room: SduiTypes.room\n): OutTypes.location => {\n return {\n ids: room.id,\n displayName: room.name,\n };\n};\n"],"mappings":";AAGA,qBACE,SACsB;AACtB,QAAO;EACL,KAAa,KAAK;EAClB,aAAa,KAAK;EACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","names":["_schoolYears","_classes","_teachers","_rooms","_courses","_lessons","_substitutionPlans"],"sources":["../../../src/sdui/from/schedules.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { CoreTypes } from '../../core';\nimport _classes from './classes';\nimport _courses from './courses';\nimport _lessons from './lessons';\nimport _rooms from './rooms';\nimport _schoolYears from './school-years';\nimport _substitutionPlans from './substitution-plans';\nimport _teachers from './teachers';\nimport type { InternalIdKey } from '../../core/types/common';\n\nexport namespace OutTypes {\n export type division = Pick<CoreTypes.Serialized.Division, 'start' | 'end'>;\n export type group = Omit<CoreTypes.Serialized.Group, InternalIdKey>;\n export type person = Omit<CoreTypes.Serialized.Person, InternalIdKey>;\n export type teacher = Omit<CoreTypes.Serialized.Teacher, InternalIdKey | 'person'> & { person: OutTypes.person };\n export type location = Omit<CoreTypes.Serialized.Location, InternalIdKey>;\n export type course = Omit<CoreTypes.Serialized.Course, InternalIdKey>;\n export type event = Omit<CoreTypes.Serialized.Event, InternalIdKey>;\n export type exception = Omit<CoreTypes.Serialized.Exception, InternalIdKey>;\n}\n\ntype Out = {\n divisions: OutTypes.division;\n groups: OutTypes.group[];\n teachers: OutTypes.teacher[];\n locations: OutTypes.location[];\n courses: OutTypes.course[];\n events: OutTypes.event[];\n exceptions: OutTypes.exception[];\n};\n\nexport default (schedule: SduiTypes.schedule): Out => {\n return {\n divisions: _schoolYears(schedule.schoolYear),\n groups: schedule.classes ?.map(_classes) ?? [],\n teachers: schedule.teachers?.map(_teachers) ?? [],\n locations: schedule.rooms ?.map(_rooms) ?? [],\n courses: schedule.courses ?.map(_courses) ?? [],\n events: schedule.lessons ?.map(_lessons) ?? [],\n exceptions: _substitutionPlans(schedule.substitution_plan),\n // settings: schedule.hours?.map(_hours)[0] ?? {},\n // holidays: schedule.holidays?.map(_holidays),\n // subjects: schedule.subjects?.map(_subjects),\n };\n};"],"mappings":";;;;;;;;;AAgCA,yBAAgB,aAAsC;AACpD,QAAO;EACL,WAAYA,qBAAa,SAAS;
|
|
1
|
+
{"version":3,"file":"schedules.js","names":["_schoolYears","_classes","_teachers","_rooms","_courses","_lessons","_substitutionPlans"],"sources":["../../../src/sdui/from/schedules.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { CoreTypes } from '../../core';\nimport _classes from './classes';\nimport _courses from './courses';\nimport _lessons from './lessons';\nimport _rooms from './rooms';\nimport _schoolYears from './school-years';\nimport _substitutionPlans from './substitution-plans';\nimport _teachers from './teachers';\nimport type { InternalIdKey } from '../../core/types/common';\n\nexport namespace OutTypes {\n export type division = Pick<CoreTypes.Serialized.Division, 'start' | 'end'>;\n export type group = Omit<CoreTypes.Serialized.Group, InternalIdKey>;\n export type person = Omit<CoreTypes.Serialized.Person, InternalIdKey>;\n export type teacher = Omit<CoreTypes.Serialized.Teacher, InternalIdKey | 'person'> & { person: OutTypes.person };\n export type location = Omit<CoreTypes.Serialized.Location, InternalIdKey>;\n export type course = Omit<CoreTypes.Serialized.Course, InternalIdKey>;\n export type event = Omit<CoreTypes.Serialized.Event, InternalIdKey>;\n export type exception = Omit<CoreTypes.Serialized.Exception, InternalIdKey>;\n}\n\ntype Out = {\n divisions: OutTypes.division;\n groups: OutTypes.group[];\n teachers: OutTypes.teacher[];\n locations: OutTypes.location[];\n courses: OutTypes.course[];\n events: OutTypes.event[];\n exceptions: OutTypes.exception[];\n};\n\nexport default (schedule: SduiTypes.schedule): Out => {\n return {\n divisions: _schoolYears(schedule.schoolYear),\n groups: schedule.classes ?.map(_classes) ?? [],\n teachers: schedule.teachers?.map(_teachers) ?? [],\n locations: schedule.rooms ?.map(_rooms) ?? [],\n courses: schedule.courses ?.map(_courses) ?? [],\n events: schedule.lessons ?.map(_lessons) ?? [],\n exceptions: _substitutionPlans(schedule.substitution_plan),\n // settings: schedule.hours?.map(_hours)[0] ?? {},\n // holidays: schedule.holidays?.map(_holidays),\n // subjects: schedule.subjects?.map(_subjects),\n };\n};"],"mappings":";;;;;;;;;AAgCA,yBAAgB,aAAsC;AACpD,QAAO;EACL,WAAYA,qBAAa,SAAS,WAAW;EAC7C,QAAY,SAAS,SAAU,IAAIC,gBAAS,IAAK,EAAE;EACnD,UAAY,SAAS,UAAU,IAAIC,iBAAU,IAAI,EAAE;EACnD,WAAY,SAAS,OAAU,IAAIC,cAAO,IAAO,EAAE;EACnD,SAAY,SAAS,SAAU,IAAIC,gBAAS,IAAK,EAAE;EACnD,QAAY,SAAS,SAAU,IAAIC,gBAAS,IAAK,EAAE;EACnD,YAAYC,2BAAmB,SAAS,kBAAkB;EAI3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"school-years.js","names":[],"sources":["../../../src/sdui/from/school-years.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n schoolYear: SduiTypes.schoolYear\n): OutTypes.division => {\n return {\n start: schoolYear.begins_at,\n end: schoolYear.ends_at\n };\n};\n"],"mappings":";AAGA,4BACE,eACsB;AACtB,QAAO;EACL,OAAO,WAAW;EAClB,KAAO,WAAW"}
|
|
1
|
+
{"version":3,"file":"school-years.js","names":[],"sources":["../../../src/sdui/from/school-years.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n schoolYear: SduiTypes.schoolYear\n): OutTypes.division => {\n return {\n start: schoolYear.begins_at,\n end: schoolYear.ends_at\n };\n};\n"],"mappings":";AAGA,4BACE,eACsB;AACtB,QAAO;EACL,OAAO,WAAW;EAClB,KAAO,WAAW;EACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"substitution-plans.js","names":[],"sources":["../../../src/sdui/from/substitution-plans.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n substitutionPlan?: SduiTypes.substitutionPlan\n): OutTypes.exception[] => {\n if (!substitutionPlan) return [];\n\n const {\n cancellations,\n lesson_changes,\n additionals\n } = substitutionPlan;\n\n return [\n // ...cancellations.map(\n // cancellation => ({\n // ids: cancellation.id\n // })\n // ),\n // ...lesson_changes.map(\n // lesson_change => ({\n // ids: lesson_change.id\n // })\n // ),\n // ...additionals.map(\n // additional => ({\n // ids: additional.id\n // })\n // )\n ];\n};"],"mappings":";AAGA,kCACE,qBACyB;AACzB,KAAI,CAAC,iBAAkB,QAAO;
|
|
1
|
+
{"version":3,"file":"substitution-plans.js","names":[],"sources":["../../../src/sdui/from/substitution-plans.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n substitutionPlan?: SduiTypes.substitutionPlan\n): OutTypes.exception[] => {\n if (!substitutionPlan) return [];\n\n const {\n cancellations,\n lesson_changes,\n additionals\n } = substitutionPlan;\n\n return [\n // ...cancellations.map(\n // cancellation => ({\n // ids: cancellation.id\n // })\n // ),\n // ...lesson_changes.map(\n // lesson_change => ({\n // ids: lesson_change.id\n // })\n // ),\n // ...additionals.map(\n // additional => ({\n // ids: additional.id\n // })\n // )\n ];\n};"],"mappings":";AAGA,kCACE,qBACyB;AACzB,KAAI,CAAC,iBAAkB,QAAO,EAAE;CAEhC,MAAM,EACJ,eACA,gBACA,gBACE;AAEJ,QAAO,EAgBN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teachers.js","names":[],"sources":["../../../src/sdui/from/teachers.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n teacher: SduiTypes.teacher\n): OutTypes.teacher => {\n return {\n ids: teacher.id,\n displayName: teacher.shortcut,\n person: {\n lastName: teacher.firstname,\n firstName: teacher.lastname\n }\n };\n};\n"],"mappings":";AAGA,wBACE,YACqB;AACrB,QAAO;EACL,KAAa,QAAQ;EACrB,aAAa,QAAQ;EACrB,QAAa;GACX,UAAW,QAAQ;GACnB,WAAW,QAAQ"}
|
|
1
|
+
{"version":3,"file":"teachers.js","names":[],"sources":["../../../src/sdui/from/teachers.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n teacher: SduiTypes.teacher\n): OutTypes.teacher => {\n return {\n ids: teacher.id,\n displayName: teacher.shortcut,\n person: {\n lastName: teacher.firstname,\n firstName: teacher.lastname\n }\n };\n};\n"],"mappings":";AAGA,wBACE,YACqB;AACrB,QAAO;EACL,KAAa,QAAQ;EACrB,aAAa,QAAQ;EACrB,QAAa;GACX,UAAW,QAAQ;GACnB,WAAW,QAAQ;GACpB;EACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classes.js","names":[],"sources":["../../../src/sdui/to/classes.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n group: CoreTypes.Mixed.Group,\n options: SduiTypes.options\n): SduiTypes.classes => {\n return {\n id: getVertexId(group, options),\n };\n};\n"],"mappings":";;;AAIA,uBACE,OACA,YACsB;AACtB,QAAO,EACL,IAAI,YAAY,OAAO"}
|
|
1
|
+
{"version":3,"file":"classes.js","names":[],"sources":["../../../src/sdui/to/classes.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n group: CoreTypes.Mixed.Group,\n options: SduiTypes.options\n): SduiTypes.classes => {\n return {\n id: getVertexId(group, options),\n };\n};\n"],"mappings":";;;AAIA,uBACE,OACA,YACsB;AACtB,QAAO,EACL,IAAI,YAAY,OAAO,QAAQ,EAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"courses.js","names":[],"sources":["../../../src/sdui/to/courses.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n course: CoreTypes.Mixed.Course,\n options: SduiTypes.options\n): SduiTypes.course => {\n return {\n id: getVertexId(course, options),\n name: course.displayName,\n color: course.color,\n teachers: (course.teachers ?? []).map(x => getVertexId(x.to, options)),\n classes: (course.groups ?? []).map(x => getVertexId(x.to, options)),\n };\n};"],"mappings":";;;AAIA,uBACE,QACA,YACqB;AACrB,QAAO;EACL,IAAU,YAAY,QAAQ;
|
|
1
|
+
{"version":3,"file":"courses.js","names":[],"sources":["../../../src/sdui/to/courses.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n course: CoreTypes.Mixed.Course,\n options: SduiTypes.options\n): SduiTypes.course => {\n return {\n id: getVertexId(course, options),\n name: course.displayName,\n color: course.color,\n teachers: (course.teachers ?? []).map(x => getVertexId(x.to, options)),\n classes: (course.groups ?? []).map(x => getVertexId(x.to, options)),\n };\n};"],"mappings":";;;AAIA,uBACE,QACA,YACqB;AACrB,QAAO;EACL,IAAU,YAAY,QAAQ,QAAQ;EACtC,MAAU,OAAO;EACjB,OAAU,OAAO;EACjB,WAAW,OAAO,YAAY,EAAE,EAAE,KAAI,MAAK,YAAY,EAAE,IAAI,QAAQ,CAAC;EACtE,UAAW,OAAO,UAAY,EAAE,EAAE,KAAI,MAAK,YAAY,EAAE,IAAI,QAAQ,CAAC;EACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"holidays.js","names":[],"sources":["../../../src/sdui/to/holidays.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\n\nexport default (\n exception: CoreTypes.Mixed.Exception,\n options: SduiTypes.options\n): SduiTypes.holiday => {\n return {\n id: getVertexId(exception, options),\n name: exception.description ?? '',\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n };\n};\n"],"mappings":";;;;AAKA,wBACE,WACA,YACsB;AACtB,QAAO;EACL,IAAW,YAAY,WAAW;
|
|
1
|
+
{"version":3,"file":"holidays.js","names":[],"sources":["../../../src/sdui/to/holidays.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\n\nexport default (\n exception: CoreTypes.Mixed.Exception,\n options: SduiTypes.options\n): SduiTypes.holiday => {\n return {\n id: getVertexId(exception, options),\n name: exception.description ?? '',\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n };\n};\n"],"mappings":";;;;AAKA,wBACE,WACA,YACsB;AACtB,QAAO;EACL,IAAW,YAAY,WAAW,QAAQ;EAC1C,MAAW,UAAU,eAAe;EACpC,WAAW,YAAY,UAAU,MAAM;EACvC,SAAW,YAAY,UAAU,IAAI;EACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hours.js","names":[],"sources":["../../../src/sdui/to/hours.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n settings: CoreTypes.Mixed.Settings,\n options: SduiTypes.options\n): SduiTypes.hour => {\n return {\n id: getVertexId(settings, options),\n name: '',\n time_begins_at: settings.dayStart,\n time_ends_at: settings.dayEnd,\n };\n};\n"],"mappings":";;;AAIA,qBACE,UACA,YACmB;AACnB,QAAO;EACL,IAAgB,YAAY,UAAU;
|
|
1
|
+
{"version":3,"file":"hours.js","names":[],"sources":["../../../src/sdui/to/hours.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n settings: CoreTypes.Mixed.Settings,\n options: SduiTypes.options\n): SduiTypes.hour => {\n return {\n id: getVertexId(settings, options),\n name: '',\n time_begins_at: settings.dayStart,\n time_ends_at: settings.dayEnd,\n };\n};\n"],"mappings":";;;AAIA,qBACE,UACA,YACmB;AACnB,QAAO;EACL,IAAgB,YAAY,UAAU,QAAQ;EAC9C,MAAgB;EAChB,gBAAgB,SAAS;EACzB,cAAgB,SAAS;EAC1B"}
|
package/dist/sdui/to/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lessons.js","names":[],"sources":["../../../src/sdui/to/lessons.ts"],"sourcesContent":["import { toISOString } from '../../common/functions';\nimport { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n event: CoreTypes.Mixed.Event,\n options: SduiTypes.options\n): SduiTypes.lesson => {\n const course_id = event.course ? getVertexId(event.course, options) : undefined;\n if (!course_id)\n throw new Error(`(Sdui::to::Lessons) Course is not missing for event ${ getVertexId(event, options) }`);\n\n const begins_at = toISOString(event.start);\n if (!begins_at)\n throw new Error(`(Sdui::to::Lessons) Start is not missing for event ${ getVertexId(event, options) }`);\n\n const ends_at = toISOString(event.end);\n if (!ends_at)\n throw new Error(`(Sdui::to::Lessons) End is not missing for event ${ getVertexId(event, options) }`);\n\n return {\n id: getVertexId(event, options),\n course_id,\n begins_at,\n ends_at,\n teachers: (event.teachers ?? []).map(x => getVertexId(x.to, options)),\n classes: (event.groups ?? []).map(x => getVertexId(x.to, options)),\n };\n};"],"mappings":";;;;AAKA,uBACE,OACA,YACqB;CACrB,MAAM,YAAY,MAAM,SAAS,YAAY,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"lessons.js","names":[],"sources":["../../../src/sdui/to/lessons.ts"],"sourcesContent":["import { toISOString } from '../../common/functions';\nimport { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n event: CoreTypes.Mixed.Event,\n options: SduiTypes.options\n): SduiTypes.lesson => {\n const course_id = event.course ? getVertexId(event.course, options) : undefined;\n if (!course_id)\n throw new Error(`(Sdui::to::Lessons) Course is not missing for event ${ getVertexId(event, options) }`);\n\n const begins_at = toISOString(event.start);\n if (!begins_at)\n throw new Error(`(Sdui::to::Lessons) Start is not missing for event ${ getVertexId(event, options) }`);\n\n const ends_at = toISOString(event.end);\n if (!ends_at)\n throw new Error(`(Sdui::to::Lessons) End is not missing for event ${ getVertexId(event, options) }`);\n\n return {\n id: getVertexId(event, options),\n course_id,\n begins_at,\n ends_at,\n teachers: (event.teachers ?? []).map(x => getVertexId(x.to, options)),\n classes: (event.groups ?? []).map(x => getVertexId(x.to, options)),\n };\n};"],"mappings":";;;;AAKA,uBACE,OACA,YACqB;CACrB,MAAM,YAAY,MAAM,SAAS,YAAY,MAAM,QAAQ,QAAQ,GAAG;AACtE,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,uDAAwD,YAAY,OAAO,QAAQ,GAAI;CAEzG,MAAM,YAAY,YAAY,MAAM,MAAM;AAC1C,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,sDAAuD,YAAY,OAAO,QAAQ,GAAI;CAExG,MAAM,UAAU,YAAY,MAAM,IAAI;AACtC,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,oDAAqD,YAAY,OAAO,QAAQ,GAAI;AAEtG,QAAO;EACL,IAAU,YAAY,OAAO,QAAQ;EACrC;EACA;EACA;EACA,WAAW,MAAM,YAAY,EAAE,EAAE,KAAI,MAAK,YAAY,EAAE,IAAI,QAAQ,CAAC;EACrE,UAAW,MAAM,UAAY,EAAE,EAAE,KAAI,MAAK,YAAY,EAAE,IAAI,QAAQ,CAAC;EACtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rooms.js","names":[],"sources":["../../../src/sdui/to/rooms.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n location: CoreTypes.Mixed.Location,\n options: SduiTypes.options\n): SduiTypes.room => {\n return {\n id: getVertexId(location, options),\n name: location.displayName,\n };\n};"],"mappings":";;;AAIA,qBACE,UACA,YACmB;AACnB,QAAO;EACL,IAAM,YAAY,UAAU;
|
|
1
|
+
{"version":3,"file":"rooms.js","names":[],"sources":["../../../src/sdui/to/rooms.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n location: CoreTypes.Mixed.Location,\n options: SduiTypes.options\n): SduiTypes.room => {\n return {\n id: getVertexId(location, options),\n name: location.displayName,\n };\n};"],"mappings":";;;AAIA,qBACE,UACA,YACmB;AACnB,QAAO;EACL,IAAM,YAAY,UAAU,QAAQ;EACpC,MAAM,SAAS;EAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","names":["_schoolYears","_classes","_courses","_hours","_lessons","_rooms","_substitutionPlans","_teachers"],"sources":["../../../src/sdui/to/schedules.ts"],"sourcesContent":["import type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport _classes from './classes';\nimport _courses from './courses';\nimport _hours from './hours';\nimport _lessons from './lessons';\nimport _rooms from './rooms';\nimport _schoolYears from './school-years';\nimport _substitutionPlans from './substitution-plans';\nimport _teachers from './teachers';\n\nexport default (\n schedule: CoreTypes.Mixed.Schedule,\n options: SduiTypes.options = {}\n): SduiTypes.schedule => {\n return {\n schoolYear: _schoolYears(schedule.divisions, options),\n classes: schedule.groups?.map(x => _classes(x, options)),\n courses: schedule.courses?.map(x => _courses(x, options)),\n // holidays: schedule.holidays?.map(_holidays),\n hours: [_hours(schedule.settings, options)],\n lessons: schedule.events?.map(x => _lessons(x, options)),\n rooms: schedule.locations?.map(x => _rooms(x, options)),\n // subjects: schedule.subjects?.map(_subjects),\n substitution_plan: _substitutionPlans(schedule.exceptions, options),\n teachers: schedule.teachers?.map(x => _teachers(x, options)),\n };\n};\n"],"mappings":";;;;;;;;;;AAWA,yBACE,UACA,UAA8B,
|
|
1
|
+
{"version":3,"file":"schedules.js","names":["_schoolYears","_classes","_courses","_hours","_lessons","_rooms","_substitutionPlans","_teachers"],"sources":["../../../src/sdui/to/schedules.ts"],"sourcesContent":["import type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport _classes from './classes';\nimport _courses from './courses';\nimport _hours from './hours';\nimport _lessons from './lessons';\nimport _rooms from './rooms';\nimport _schoolYears from './school-years';\nimport _substitutionPlans from './substitution-plans';\nimport _teachers from './teachers';\n\nexport default (\n schedule: CoreTypes.Mixed.Schedule,\n options: SduiTypes.options = {}\n): SduiTypes.schedule => {\n return {\n schoolYear: _schoolYears(schedule.divisions, options),\n classes: schedule.groups?.map(x => _classes(x, options)),\n courses: schedule.courses?.map(x => _courses(x, options)),\n // holidays: schedule.holidays?.map(_holidays),\n hours: [_hours(schedule.settings, options)],\n lessons: schedule.events?.map(x => _lessons(x, options)),\n rooms: schedule.locations?.map(x => _rooms(x, options)),\n // subjects: schedule.subjects?.map(_subjects),\n substitution_plan: _substitutionPlans(schedule.exceptions, options),\n teachers: schedule.teachers?.map(x => _teachers(x, options)),\n };\n};\n"],"mappings":";;;;;;;;;;AAWA,yBACE,UACA,UAA8B,EAAE,KACT;AACvB,QAAO;EACL,YAAmBA,qBAAa,SAAS,WAAW,QAAQ;EAC5D,SAAmB,SAAS,QAAQ,KAAI,MAAKC,gBAAS,GAAG,QAAQ,CAAC;EAClE,SAAmB,SAAS,SAAS,KAAI,MAAKC,gBAAS,GAAG,QAAQ,CAAC;EAEnE,OAAmB,CAACC,cAAO,SAAS,UAAU,QAAQ,CAAC;EACvD,SAAmB,SAAS,QAAQ,KAAI,MAAKC,gBAAS,GAAG,QAAQ,CAAC;EAClE,OAAmB,SAAS,WAAW,KAAI,MAAKC,cAAO,GAAG,QAAQ,CAAC;EAEnE,mBAAmBC,2BAAmB,SAAS,YAAY,QAAQ;EACnE,UAAmB,SAAS,UAAU,KAAI,MAAKC,iBAAU,GAAG,QAAQ,CAAC;EACtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"school-years.js","names":[],"sources":["../../../src/sdui/to/school-years.ts"],"sourcesContent":["import type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\nimport { getVertexId } from '../../core/util';\n\nexport default (\n division: CoreTypes.Mixed.Division,\n options: SduiTypes.options\n): SduiTypes.schoolYear => {\n const begins_at = toISOString(division.start);\n if (!begins_at)\n throw new Error(`(Sdui::to::SchoolYear) Start is not missing for division ${ getVertexId(division, options) }`);\n\n const ends_at = toISOString(division.end);\n if (!ends_at)\n throw new Error(`(Sdui::to::SchoolYear) End is not missing for division ${ getVertexId(division, options) }`);\n\n return {\n begins_at,\n ends_at\n };\n};\n"],"mappings":";;;;AAKA,4BACE,UACA,YACyB;CACzB,MAAM,YAAY,YAAY,SAAS;
|
|
1
|
+
{"version":3,"file":"school-years.js","names":[],"sources":["../../../src/sdui/to/school-years.ts"],"sourcesContent":["import type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\nimport { getVertexId } from '../../core/util';\n\nexport default (\n division: CoreTypes.Mixed.Division,\n options: SduiTypes.options\n): SduiTypes.schoolYear => {\n const begins_at = toISOString(division.start);\n if (!begins_at)\n throw new Error(`(Sdui::to::SchoolYear) Start is not missing for division ${ getVertexId(division, options) }`);\n\n const ends_at = toISOString(division.end);\n if (!ends_at)\n throw new Error(`(Sdui::to::SchoolYear) End is not missing for division ${ getVertexId(division, options) }`);\n\n return {\n begins_at,\n ends_at\n };\n};\n"],"mappings":";;;;AAKA,4BACE,UACA,YACyB;CACzB,MAAM,YAAY,YAAY,SAAS,MAAM;AAC7C,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,4DAA6D,YAAY,UAAU,QAAQ,GAAI;CAEjH,MAAM,UAAU,YAAY,SAAS,IAAI;AACzC,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,0DAA2D,YAAY,UAAU,QAAQ,GAAI;AAE/G,QAAO;EACL;EACA;EACD"}
|
|
@@ -34,13 +34,10 @@ function _mapAdditionals(exceptions, options) {
|
|
|
34
34
|
}));
|
|
35
35
|
}
|
|
36
36
|
var substitution_plans_default = (exceptions, options) => {
|
|
37
|
-
const cancellations = _mapCancellation(exceptions.filter((exception) => exception.action === "cancel"), options);
|
|
38
|
-
const lesson_changes = _mapLessonChanges(exceptions.filter((exception) => exception.action && ["substitute", "reschedule"].includes(exception.action)), options);
|
|
39
|
-
const additionals = _mapAdditionals(exceptions.filter((exception) => exception.action === "add"), options);
|
|
40
37
|
return {
|
|
41
|
-
cancellations,
|
|
42
|
-
lesson_changes,
|
|
43
|
-
additionals
|
|
38
|
+
cancellations: _mapCancellation(exceptions.filter((exception) => exception.action === "cancel"), options),
|
|
39
|
+
lesson_changes: _mapLessonChanges(exceptions.filter((exception) => exception.action && ["substitute", "reschedule"].includes(exception.action)), options),
|
|
40
|
+
additionals: _mapAdditionals(exceptions.filter((exception) => exception.action === "add"), options)
|
|
44
41
|
};
|
|
45
42
|
};
|
|
46
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"substitution-plans.js","names":[],"sources":["../../../src/sdui/to/substitution-plans.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\n\nfunction _mapCancellation (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['cancellations'] {\n return exceptions.map(exception => ({\n action: 'cancel',\n lesson_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n }));\n}\n\nfunction _mapLessonChanges (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['lesson_changes'] {\n return exceptions.map(exception => ({\n action: exception.reason ?? '',\n lesson_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n classes: [],\n teachers: [],\n rooms: [],\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n }));\n}\n\nfunction _mapAdditionals (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['additionals'] {\n return exceptions.map(exception => ({\n action: exception.reason ?? '',\n course_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n classes: [],\n teachers: [],\n rooms: [],\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n }));\n}\n\nexport default (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan => {\n const cancellations = _mapCancellation(exceptions.filter(\n exception => exception.action === 'cancel'\n ), options);\n\n const lesson_changes = _mapLessonChanges(exceptions.filter(\n exception => exception.action && ['substitute', 'reschedule'].includes(exception.action)\n ), options);\n\n const additionals = _mapAdditionals(exceptions.filter(\n exception => exception.action === 'add'\n ), options);\n\n return {\n cancellations,\n lesson_changes,\n additionals,\n };\n};\n"],"mappings":";;;;AAKA,SAAS,iBACP,YACA,SAC6C;AAC7C,QAAO,WAAW,KAAI,eAAc;EAClC,QAAW;EACX,WAAW,UAAU,UAAU,GAAG,KAAK,YAAY,UAAU,QAAQ,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"substitution-plans.js","names":[],"sources":["../../../src/sdui/to/substitution-plans.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\n\nfunction _mapCancellation (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['cancellations'] {\n return exceptions.map(exception => ({\n action: 'cancel',\n lesson_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n }));\n}\n\nfunction _mapLessonChanges (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['lesson_changes'] {\n return exceptions.map(exception => ({\n action: exception.reason ?? '',\n lesson_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n classes: [],\n teachers: [],\n rooms: [],\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n }));\n}\n\nfunction _mapAdditionals (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['additionals'] {\n return exceptions.map(exception => ({\n action: exception.reason ?? '',\n course_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n classes: [],\n teachers: [],\n rooms: [],\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n }));\n}\n\nexport default (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan => {\n const cancellations = _mapCancellation(exceptions.filter(\n exception => exception.action === 'cancel'\n ), options);\n\n const lesson_changes = _mapLessonChanges(exceptions.filter(\n exception => exception.action && ['substitute', 'reschedule'].includes(exception.action)\n ), options);\n\n const additionals = _mapAdditionals(exceptions.filter(\n exception => exception.action === 'add'\n ), options);\n\n return {\n cancellations,\n lesson_changes,\n additionals,\n };\n};\n"],"mappings":";;;;AAKA,SAAS,iBACP,YACA,SAC6C;AAC7C,QAAO,WAAW,KAAI,eAAc;EAClC,QAAW;EACX,WAAW,UAAU,UAAU,GAAG,KAAK,YAAY,UAAU,QAAQ,GAAG,IAAI,QAAQ,GAAG;EACvF,SAAW,UAAU,eAAe;EACrC,EAAE;;AAGL,SAAS,kBACP,YACA,SAC8C;AAC9C,QAAO,WAAW,KAAI,eAAc;EAClC,QAAW,UAAU,UAAU;EAC/B,WAAW,UAAU,UAAU,GAAG,KAAK,YAAY,UAAU,QAAQ,GAAG,IAAI,QAAQ,GAAG;EACvF,SAAW,UAAU,eAAe;EACpC,SAAW,EAAE;EACb,UAAW,EAAE;EACb,OAAW,EAAE;EACb,WAAW,YAAY,UAAU,MAAM;EACvC,SAAW,YAAY,UAAU,IAAI;EACtC,EAAE;;AAGL,SAAS,gBACP,YACA,SAC2C;AAC3C,QAAO,WAAW,KAAI,eAAc;EAClC,QAAW,UAAU,UAAU;EAC/B,WAAW,UAAU,UAAU,GAAG,KAAK,YAAY,UAAU,QAAQ,GAAG,IAAI,QAAQ,GAAG;EACvF,SAAW,UAAU,eAAe;EACpC,SAAW,EAAE;EACb,UAAW,EAAE;EACb,OAAW,EAAE;EACb,WAAW,YAAY,UAAU,MAAM;EACvC,SAAW,YAAY,UAAU,IAAI;EACtC,EAAE;;AAGL,kCACE,YACA,YAC+B;AAa/B,QAAO;EACL,eAboB,iBAAiB,WAAW,QAChD,cAAa,UAAU,WAAW,SACnC,EAAE,QAAQ;EAYT,gBAVqB,kBAAkB,WAAW,QAClD,cAAa,UAAU,UAAU,CAAC,cAAc,aAAa,CAAC,SAAS,UAAU,OAAO,CACzF,EAAE,QAAQ;EAST,aAPkB,gBAAgB,WAAW,QAC7C,cAAa,UAAU,WAAW,MACnC,EAAE,QAAQ;EAMV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teachers.js","names":["firstname: string | undefined","lastname: string | undefined"],"sources":["../../../src/sdui/to/teachers.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n teacher: CoreTypes.Mixed.Teacher,\n options: SduiTypes.options\n): SduiTypes.teacher => {\n let firstname: string | undefined;\n let lastname: string | undefined;\n\n if (teacher.person && !(typeof teacher.person == 'string')) {\n if ('firstName' in teacher.person) firstname = teacher.person.firstName;\n if ('lastName' in teacher.person) lastname = teacher.person.lastName;\n }\n return {\n id: getVertexId(teacher, options),\n // shortcut: teacher.displayName,\n ...firstname && { firstname },\n ...lastname && { lastname }\n };\n};\n"],"mappings":";;;AAIA,wBACE,SACA,YACsB;CACtB,IAAIA;CACJ,IAAIC;AAEJ,KAAI,QAAQ,UAAU,EAAE,OAAO,QAAQ,UAAU,WAAW;AAC1D,MAAI,eAAe,QAAQ,OAAQ,aAAY,QAAQ,OAAO;AAC9D,MAAI,cAAe,QAAQ,OAAQ,YAAY,QAAQ,OAAO;;AAEhE,QAAO;EACL,IAAI,YAAY,SAAS;
|
|
1
|
+
{"version":3,"file":"teachers.js","names":["firstname: string | undefined","lastname: string | undefined"],"sources":["../../../src/sdui/to/teachers.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n teacher: CoreTypes.Mixed.Teacher,\n options: SduiTypes.options\n): SduiTypes.teacher => {\n let firstname: string | undefined;\n let lastname: string | undefined;\n\n if (teacher.person && !(typeof teacher.person == 'string')) {\n if ('firstName' in teacher.person) firstname = teacher.person.firstName;\n if ('lastName' in teacher.person) lastname = teacher.person.lastName;\n }\n return {\n id: getVertexId(teacher, options),\n // shortcut: teacher.displayName,\n ...firstname && { firstname },\n ...lastname && { lastname }\n };\n};\n"],"mappings":";;;AAIA,wBACE,SACA,YACsB;CACtB,IAAIA;CACJ,IAAIC;AAEJ,KAAI,QAAQ,UAAU,EAAE,OAAO,QAAQ,UAAU,WAAW;AAC1D,MAAI,eAAe,QAAQ,OAAQ,aAAY,QAAQ,OAAO;AAC9D,MAAI,cAAe,QAAQ,OAAQ,YAAY,QAAQ,OAAO;;AAEhE,QAAO;EACL,IAAI,YAAY,SAAS,QAAQ;EAEjC,GAAG,aAAa,EAAE,WAAW;EAC7B,GAAG,YAAa,EAAE,UAAW;EAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_schedule"],"sources":["../../../src/vKlass/from/index.ts"],"sourcesContent":["import type { FromInterface } from '../../common/types';\nimport _schedule from './schedule';\n\nexport default {\n schedules: _schedule\n} satisfies FromInterface;\n"],"mappings":";;;AAGA,mBAAe,EACb,WAAWA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_schedule"],"sources":["../../../src/vKlass/from/index.ts"],"sourcesContent":["import type { FromInterface } from '../../common/types';\nimport _schedule from './schedule';\n\nexport default {\n schedules: _schedule\n} satisfies FromInterface;\n"],"mappings":";;;AAGA,mBAAe,EACb,WAAWA,kBACZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.js","names":["warnings: string[]","errors: string[]","teachers: OutTypes.teacher[]","groups: OutTypes.group[]","courses: OutTypes.course[]","teachers","x","groups"],"sources":["../../../src/vKlass/from/schedule.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { Types as VKlassTypes } from '../types';\nimport type { InternalIdKey } from '../../core/types/common';\nimport { range } from '../../common/functions';\n\nexport namespace OutTypes {\n export type teacher = Omit<CoreTypes.Serialized.Teacher, InternalIdKey>;\n export type group = Omit<CoreTypes.Serialized.Group, InternalIdKey>;\n export type course = Omit<CoreTypes.Serialized.Course, InternalIdKey>;\n}\n\ntype Out = {\n teachers: OutTypes.teacher[];\n courses: OutTypes.course [];\n groups: OutTypes.group [];\n meta: {\n errors?: string[];\n warnings?: string[];\n };\n};\n\n\nexport default function (\n src: VKlassTypes.schedule,\n options: VKlassTypes.Options\n): Out {\n\n // gather all import related warnings/errors\n const warnings: string[] = [];\n const errors: string[] = [];\n\n // the schedule period range\n const scheduleRange = {\n start: moment.utc(options.beg),\n end: moment.utc(options.end)\n };\n\n ////\n //// teachers\n ////\n const teachers: OutTypes.teacher[] = [];\n src.staff.forEach(x => {\n teachers.push({\n ids: x.ID.toString(),\n displayName: x.Firstname + ' ' + x.Lastname\n });\n });\n\n\n ////\n //// groups\n ////\n const groups: OutTypes.group[] = [];\n src.classes.forEach(x => {\n groups.push({\n ids: x.ID.toString(),\n displayName: x.Name,\n species: 'class',\n });\n });\n\n\n // build group to staff map\n const groupStaffMap = new Map<number, Set<number> >();\n src.groups_staff.forEach(x => {\n if(!groupStaffMap.has(x.groupId)) groupStaffMap.set(x.groupId, new Set());\n groupStaffMap.get(x.groupId)?.add(x.userId);\n });\n\n // build student to class map\n const studentClassMap = new Map<number, Set<number> >();\n src.classes_students.forEach(x => {\n if(!studentClassMap.has(x.userId)) studentClassMap.set(x.userId, new Set());\n studentClassMap.get(x.userId)?.add(x.classId);\n });\n\n // build group to classes map\n const groupClassesMap = new Map<number, Set<number> >();\n src.groups_students.forEach(x => {\n if (!groupClassesMap.has(x.groupId)) groupClassesMap.set(x.groupId, new Set());\n studentClassMap.get(x.userId)?.forEach(y => groupClassesMap.get(x.groupId)?.add(y));\n });\n\n\n ////\n //// courses\n ////\n const courses: OutTypes.course[] = [];\n src.groups.forEach(x => {\n // ignore courses who's period range does not overlap with the schedule period range\n const courseRange = {\n start: moment.utc(x.StartDate),\n end: moment.utc(x.EndDate)\n };\n if (!range.overlaps(scheduleRange, courseRange)) return;\n\n const teachers = [...groupStaffMap.get(x.ID) ?? []].map(x => ({ to: x.toString() }));\n const groups = [...groupClassesMap.get(x.ID) ?? []].map(x => ({ to: x.toString() }));\n\n courses.push({\n ids: x.ID.toString(),\n displayName: x.Name || x.FriendlyName,\n ...(teachers && { teachers }),\n ...(groups && { groups }),\n });\n });\n\n\n\n return { teachers, groups, courses,\n meta: {\n ...( errors.length ? { errors: errors } : { } ),\n ...( warnings.length ? { warnings: warnings } : { } )\n }\n };\n}\n"],"mappings":";;;;AAuBA,0BACE,KACA,SACK;CAGL,MAAMA,WAAqB;
|
|
1
|
+
{"version":3,"file":"schedule.js","names":["warnings: string[]","errors: string[]","teachers: OutTypes.teacher[]","groups: OutTypes.group[]","courses: OutTypes.course[]","teachers","x","groups"],"sources":["../../../src/vKlass/from/schedule.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { Types as VKlassTypes } from '../types';\nimport type { InternalIdKey } from '../../core/types/common';\nimport { range } from '../../common/functions';\n\nexport namespace OutTypes {\n export type teacher = Omit<CoreTypes.Serialized.Teacher, InternalIdKey>;\n export type group = Omit<CoreTypes.Serialized.Group, InternalIdKey>;\n export type course = Omit<CoreTypes.Serialized.Course, InternalIdKey>;\n}\n\ntype Out = {\n teachers: OutTypes.teacher[];\n courses: OutTypes.course [];\n groups: OutTypes.group [];\n meta: {\n errors?: string[];\n warnings?: string[];\n };\n};\n\n\nexport default function (\n src: VKlassTypes.schedule,\n options: VKlassTypes.Options\n): Out {\n\n // gather all import related warnings/errors\n const warnings: string[] = [];\n const errors: string[] = [];\n\n // the schedule period range\n const scheduleRange = {\n start: moment.utc(options.beg),\n end: moment.utc(options.end)\n };\n\n ////\n //// teachers\n ////\n const teachers: OutTypes.teacher[] = [];\n src.staff.forEach(x => {\n teachers.push({\n ids: x.ID.toString(),\n displayName: x.Firstname + ' ' + x.Lastname\n });\n });\n\n\n ////\n //// groups\n ////\n const groups: OutTypes.group[] = [];\n src.classes.forEach(x => {\n groups.push({\n ids: x.ID.toString(),\n displayName: x.Name,\n species: 'class',\n });\n });\n\n\n // build group to staff map\n const groupStaffMap = new Map<number, Set<number> >();\n src.groups_staff.forEach(x => {\n if(!groupStaffMap.has(x.groupId)) groupStaffMap.set(x.groupId, new Set());\n groupStaffMap.get(x.groupId)?.add(x.userId);\n });\n\n // build student to class map\n const studentClassMap = new Map<number, Set<number> >();\n src.classes_students.forEach(x => {\n if(!studentClassMap.has(x.userId)) studentClassMap.set(x.userId, new Set());\n studentClassMap.get(x.userId)?.add(x.classId);\n });\n\n // build group to classes map\n const groupClassesMap = new Map<number, Set<number> >();\n src.groups_students.forEach(x => {\n if (!groupClassesMap.has(x.groupId)) groupClassesMap.set(x.groupId, new Set());\n studentClassMap.get(x.userId)?.forEach(y => groupClassesMap.get(x.groupId)?.add(y));\n });\n\n\n ////\n //// courses\n ////\n const courses: OutTypes.course[] = [];\n src.groups.forEach(x => {\n // ignore courses who's period range does not overlap with the schedule period range\n const courseRange = {\n start: moment.utc(x.StartDate),\n end: moment.utc(x.EndDate)\n };\n if (!range.overlaps(scheduleRange, courseRange)) return;\n\n const teachers = [...groupStaffMap.get(x.ID) ?? []].map(x => ({ to: x.toString() }));\n const groups = [...groupClassesMap.get(x.ID) ?? []].map(x => ({ to: x.toString() }));\n\n courses.push({\n ids: x.ID.toString(),\n displayName: x.Name || x.FriendlyName,\n ...(teachers && { teachers }),\n ...(groups && { groups }),\n });\n });\n\n\n\n return { teachers, groups, courses,\n meta: {\n ...( errors.length ? { errors: errors } : { } ),\n ...( warnings.length ? { warnings: warnings } : { } )\n }\n };\n}\n"],"mappings":";;;;AAuBA,0BACE,KACA,SACK;CAGL,MAAMA,WAAqB,EAAE;CAC7B,MAAMC,SAAqB,EAAE;CAG7B,MAAM,gBAAgB;EACpB,OAAO,OAAO,IAAI,QAAQ,IAAI;EAC9B,KAAO,OAAO,IAAI,QAAQ,IAAI;EAC/B;CAKD,MAAMC,WAA+B,EAAE;AACvC,KAAI,MAAM,SAAQ,MAAK;AACrB,WAAS,KAAK;GACZ,KAAa,EAAE,GAAG,UAAU;GAC5B,aAAa,EAAE,YAAY,MAAM,EAAE;GACpC,CAAC;GACF;CAMF,MAAMC,SAA2B,EAAE;AACnC,KAAI,QAAQ,SAAQ,MAAK;AACvB,SAAO,KAAK;GACV,KAAa,EAAE,GAAG,UAAU;GAC5B,aAAa,EAAE;GACf,SAAa;GACd,CAAC;GACF;CAIF,MAAM,gCAAgB,IAAI,KAA2B;AACrD,KAAI,aAAa,SAAQ,MAAK;AAC5B,MAAG,CAAC,cAAc,IAAI,EAAE,QAAQ,CAAE,eAAc,IAAI,EAAE,yBAAS,IAAI,KAAK,CAAC;AACzE,gBAAc,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;GAC3C;CAGF,MAAM,kCAAkB,IAAI,KAA2B;AACvD,KAAI,iBAAiB,SAAQ,MAAK;AAChC,MAAG,CAAC,gBAAgB,IAAI,EAAE,OAAO,CAAE,iBAAgB,IAAI,EAAE,wBAAQ,IAAI,KAAK,CAAC;AAC3E,kBAAgB,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ;GAC7C;CAGF,MAAM,kCAAkB,IAAI,KAA2B;AACvD,KAAI,gBAAgB,SAAQ,MAAK;AAC/B,MAAI,CAAC,gBAAgB,IAAI,EAAE,QAAQ,CAAE,iBAAgB,IAAI,EAAE,yBAAS,IAAI,KAAK,CAAC;AAC9E,kBAAgB,IAAI,EAAE,OAAO,EAAE,SAAQ,MAAK,gBAAgB,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;GACnF;CAMF,MAAMC,UAA6B,EAAE;AACrC,KAAI,OAAO,SAAQ,MAAK;EAEtB,MAAM,cAAc;GAClB,OAAO,OAAO,IAAI,EAAE,UAAU;GAC9B,KAAO,OAAO,IAAI,EAAE,QAAQ;GAC7B;AACD,MAAI,CAAC,MAAM,SAAS,eAAe,YAAY,CAAE;EAEjD,MAAMC,aAAW,CAAC,GAAG,cAAc,IAAI,EAAE,GAAG,IAAM,EAAE,CAAC,CAAC,KAAI,SAAM,EAAE,IAAIC,IAAE,UAAU,EAAE,EAAE;EACtF,MAAMC,WAAW,CAAC,GAAG,gBAAgB,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,KAAI,SAAM,EAAE,IAAID,IAAE,UAAU,EAAE,EAAE;AAEtF,UAAQ,KAAK;GACX,KAAa,EAAE,GAAG,UAAU;GAC5B,aAAa,EAAE,QAAQ,EAAE;GACzB,GAAID,cAAY,EAAE,sBAAU;GAC5B,GAAIE,YAAY,EAAE,kBAAQ;GAC3B,CAAC;GACF;AAIF,QAAO;EAAE;EAAU;EAAQ;EACzB,MAAM;GACJ,GAAK,OAAO,SAAW,EAAY,QAAU,GAAG,EAAG;GACnD,GAAK,SAAS,SAAS,EAAY,UAAU,GAAG,EAAG;GACpD;EACF"}
|