@royalschedule/maps 4.0.17 → 4.0.18
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/RS/to/input/collections.js +1 -1
- package/dist/RS/to/input/collections.js.map +1 -1
- package/dist/RS/to/input/dependencies.js +1 -1
- package/dist/RS/to/input/dependencies.js.map +1 -1
- package/dist/RS/to/input/events.js +1 -1
- package/dist/RS/to/input/events.js.map +1 -1
- package/dist/RS/to/input/groups.js +1 -1
- package/dist/RS/to/input/groups.js.map +1 -1
- package/dist/RS/to/input/individuals.js +2 -2
- package/dist/RS/to/input/individuals.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 +1 -1
- package/dist/RS/to/input/util/attach-locked-times.js.map +1 -1
- package/dist/RS/types/to.d.ts +8 -4
- package/dist/RS/types/to.js.map +1 -1
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ function fromCollections(courses, settings, options, periodsMap) {
|
|
|
37
37
|
period: getPeriodIndex(course.period, periodsMap, options),
|
|
38
38
|
_period: course.period ? getVertexId(course.period, options) : void 0
|
|
39
39
|
};
|
|
40
|
-
if (options.
|
|
40
|
+
if (options.includeEntityMeta) doc.meta = omitBy({
|
|
41
41
|
color: course.color,
|
|
42
42
|
ids: course.ids,
|
|
43
43
|
name: course.displayName
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","names":["doc: Types.collection & { overlapGroupId?: string }","x"],"sources":["../../../../src/RS/to/input/collections.ts"],"sourcesContent":["import { groupBy, omit, omitBy, values } from 'lodash-es';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport { parseEvents } from './events';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { parseGroupReferences } from './util/parse-group-references';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getVertexId } from '../../../core/util';\nimport { getPeriodIndex, idOf } from './util/util';\nimport { parseLocationReferences } from './util/parse-location-references';\nimport { parseDays } from './util/parse-days';\nimport { parseIntervals } from './util/parse-intervals';\nimport type { Types } from '../../types';\nimport { makeChainable } from '../../../common/make-chainable';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromCollections (\n courses: ConnectedTypes.course[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions,\n periodsMap: Map<string | undefined, number>,\n): (Types.collection[] | Types.collection)[] {\n const defaultInterval = getDefaultInterval(settings);\n\n const collections = courses\n .map(course => {\n const id = getVertexId(course, options);\n const intervals = course.intervals ?? defaultInterval;\n\n const doc: Types.collection & { overlapGroupId?: string } = {\n id,\n\n weight: course.weight,\n density: course.density,\n maxEventLengthVariance: course.eventDurationVariance,\n potentialCenter: course.centerOfAttraction ? parseFloat(course.centerOfAttraction.replace(':', '.')) : undefined,\n distributionKey: id,\n\n events: parseEvents (course.events, settings, options, periodsMap),\n dependencies: parseLocationReferences (course.locations, options),\n groups: parseGroupReferences ({ type: 'course', item: course }, options),\n intervals: options.oldFormat\n ? parseIntervals(intervals, undefined, settings)\n : idOf.intervalPairReference(intervals, undefined, options),\n days: parseDays (course.days, settings),\n minBreakLength: parseMinimumBreakLength (course.minBreakLength),\n lockedTimes: attachLockedTimes (course.lockedTimes, options),\n period: getPeriodIndex (course.period, periodsMap, options),\n _period: course.period ? getVertexId(course.period, options) : undefined,\n };\n\n if (options.
|
|
1
|
+
{"version":3,"file":"collections.js","names":["doc: Types.collection & { overlapGroupId?: string }","x"],"sources":["../../../../src/RS/to/input/collections.ts"],"sourcesContent":["import { groupBy, omit, omitBy, values } from 'lodash-es';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport { parseEvents } from './events';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { parseGroupReferences } from './util/parse-group-references';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getVertexId } from '../../../core/util';\nimport { getPeriodIndex, idOf } from './util/util';\nimport { parseLocationReferences } from './util/parse-location-references';\nimport { parseDays } from './util/parse-days';\nimport { parseIntervals } from './util/parse-intervals';\nimport type { Types } from '../../types';\nimport { makeChainable } from '../../../common/make-chainable';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromCollections (\n courses: ConnectedTypes.course[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions,\n periodsMap: Map<string | undefined, number>,\n): (Types.collection[] | Types.collection)[] {\n const defaultInterval = getDefaultInterval(settings);\n\n const collections = courses\n .map(course => {\n const id = getVertexId(course, options);\n const intervals = course.intervals ?? defaultInterval;\n\n const doc: Types.collection & { overlapGroupId?: string } = {\n id,\n\n weight: course.weight,\n density: course.density,\n maxEventLengthVariance: course.eventDurationVariance,\n potentialCenter: course.centerOfAttraction ? parseFloat(course.centerOfAttraction.replace(':', '.')) : undefined,\n distributionKey: id,\n\n events: parseEvents (course.events, settings, options, periodsMap),\n dependencies: parseLocationReferences (course.locations, options),\n groups: parseGroupReferences ({ type: 'course', item: course }, options),\n intervals: options.oldFormat\n ? parseIntervals(intervals, undefined, settings)\n : idOf.intervalPairReference(intervals, undefined, options),\n days: parseDays (course.days, settings),\n minBreakLength: parseMinimumBreakLength (course.minBreakLength),\n lockedTimes: attachLockedTimes (course.lockedTimes, options),\n period: getPeriodIndex (course.period, periodsMap, options),\n _period: course.period ? getVertexId(course.period, options) : undefined,\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n color: course.color,\n ids: course.ids,\n name: course.displayName,\n }, x => x == null);\n }\n\n // temporarily attach overlap group\n doc.overlapGroupId = course.overlapGroup\n ? getVertexId(course.overlapGroup, options)\n : undefined;\n\n return omitBy(doc, x => x == null) as Types.collection & { overlapGroupId?: string };\n });\n\n const overlapping = makeChainable(collections)\n .chain(\n x => x.filter(x => x.overlapGroupId != null),\n x => groupBy(x, x => x.overlapGroupId),\n x => values(x)\n .map(xs => xs.map(x => omit(x, 'overlapGroupId') as Types.collection))\n )\n .value;\n\n const plain = collections\n .filter(x => x.overlapGroupId == null)\n .map(x => {\n delete x.overlapGroupId; // remove overlapGroupId from individual collections\n return x as Types.collection;\n });\n\n return overlapping.concat(plain);\n};"],"mappings":";;;;;;;;;;;;;;AAeA,SAAgB,gBACd,SACA,UACA,SACA,YAC2C;CAC3C,MAAM,kBAAkB,mBAAmB,SAAS;CAEpD,MAAM,cAAc,QACjB,KAAI,WAAU;EACb,MAAM,KAAY,YAAY,QAAQ,QAAQ;EAC9C,MAAM,YAAY,OAAO,aAAa;EAEtC,MAAMA,MAAsD;GAC1D;GAEA,QAAwB,OAAO;GAC/B,SAAwB,OAAO;GAC/B,wBAAwB,OAAO;GAC/B,iBAAwB,OAAO,qBAAqB,WAAW,OAAO,mBAAmB,QAAQ,KAAK,IAAI,CAAC,GAAG;GAC9G,iBAAwB;GAExB,QAAc,YAA2B,OAAO,QAAQ,UAAU,SAAS,WAAW;GACtF,cAAc,wBAA2B,OAAO,WAAW,QAAQ;GACnE,QAAc,qBAA2B;IAAE,MAAM;IAAU,MAAM;IAAQ,EAAE,QAAQ;GACnF,WAAc,QAAQ,YAClB,eAAe,WAAW,QAAW,SAAS,GAC9C,KAAK,sBAAsB,WAAW,QAAW,QAAQ;GAC7D,MAAgB,UAA2B,OAAO,MAAM,SAAS;GACjE,gBAAgB,wBAA2B,OAAO,eAAe;GACjE,aAAgB,kBAA2B,OAAO,aAAa,QAAQ;GACvE,QAAgB,eAA2B,OAAO,QAAQ,YAAY,QAAQ;GAC9E,SAAgB,OAAO,SAAS,YAAY,OAAO,QAAQ,QAAQ,GAAG;GACvE;AAED,MAAI,QAAQ,kBACV,KAAI,OAAO,OAAO;GAChB,OAAO,OAAO;GACd,KAAO,OAAO;GACd,MAAO,OAAO;GACf,GAAE,MAAK,KAAK,KAAK;AAIpB,MAAI,iBAAiB,OAAO,eACxB,YAAY,OAAO,cAAc,QAAQ,GACzC;AAEJ,SAAO,OAAO,MAAK,MAAK,KAAK,KAAK;GAClC;CAEJ,MAAM,cAAc,cAAc,YAAY,CAC3C,OACC,MAAK,EAAE,QAAO,QAAKC,IAAE,kBAAkB,KAAK,GAC5C,MAAK,QAAQ,IAAG,QAAKA,IAAE,eAAe,GACtC,MAAK,OAAO,EAAE,CACX,KAAI,OAAM,GAAG,KAAI,QAAK,KAAKA,KAAG,iBAAiB,CAAqB,CAAC,CACzE,CACA;CAEH,MAAM,QAAQ,YACX,QAAO,MAAK,EAAE,kBAAkB,KAAK,CACrC,KAAI,MAAK;AACR,SAAO,EAAE;AACT,SAAO;GACP;AAEJ,QAAO,YAAY,OAAO,MAAM"}
|
|
@@ -17,7 +17,7 @@ function fromLocations(locations, settings, options) {
|
|
|
17
17
|
days: parseDays(location.days, settings),
|
|
18
18
|
lockedTimes: attachLockedTimes(location.lockedTimes, options)
|
|
19
19
|
};
|
|
20
|
-
if (options.
|
|
20
|
+
if (options.includeEntityMeta) doc.meta = omitBy({
|
|
21
21
|
ids: location.ids,
|
|
22
22
|
name: location.displayName
|
|
23
23
|
}, (x) => x == null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","names":["doc: Types.dependency"],"sources":["../../../../src/RS/to/input/dependencies.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getVertexId } from '../../../core/util';\nimport { parseDays } from './util/parse-days';\nimport type { Types } from '../../types';\n\nexport function fromLocations (\n locations: ConnectedTypes.location[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n) {\n return locations\n .filter(x => {\n const id = getVertexId(x, options);\n\n // filter location references based on partial schedule options\n const includedLocations = options.partialScheduleOptions?.includedLocations;\n if (includedLocations && !includedLocations.has(id)) return false;\n return true;\n })\n .map(location => {\n const id = getVertexId(location, options);\n\n const doc: Types.dependency = {\n id,\n minBreakLength: location.minBreakLength,\n days: parseDays (location.days, settings),\n lockedTimes: attachLockedTimes(location.lockedTimes, options)\n };\n\n if (options.
|
|
1
|
+
{"version":3,"file":"dependencies.js","names":["doc: Types.dependency"],"sources":["../../../../src/RS/to/input/dependencies.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getVertexId } from '../../../core/util';\nimport { parseDays } from './util/parse-days';\nimport type { Types } from '../../types';\n\nexport function fromLocations (\n locations: ConnectedTypes.location[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n) {\n return locations\n .filter(x => {\n const id = getVertexId(x, options);\n\n // filter location references based on partial schedule options\n const includedLocations = options.partialScheduleOptions?.includedLocations;\n if (includedLocations && !includedLocations.has(id)) return false;\n return true;\n })\n .map(location => {\n const id = getVertexId(location, options);\n\n const doc: Types.dependency = {\n id,\n minBreakLength: location.minBreakLength,\n days: parseDays (location.days, settings),\n lockedTimes: attachLockedTimes(location.lockedTimes, options)\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n ids: location.ids,\n name: location.displayName\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.dependency;\n });\n}"],"mappings":";;;;;;AAOA,SAAgB,cACd,WACA,UACA,SACA;AACA,QAAO,UACJ,QAAO,MAAK;EACX,MAAM,KAAK,YAAY,GAAG,QAAQ;EAGlC,MAAM,oBAAoB,QAAQ,wBAAwB;AAC1D,MAAI,qBAAqB,CAAC,kBAAkB,IAAI,GAAG,CAAE,QAAO;AAC5D,SAAO;GACP,CACD,KAAI,aAAY;EAGf,MAAMA,MAAwB;GAC5B,IAHS,YAAY,UAAU,QAAQ;GAIvC,gBAAgB,SAAS;GACzB,MAAgB,UAA0B,SAAS,MAAM,SAAS;GAClE,aAAgB,kBAAkB,SAAS,aAAa,QAAQ;GACjE;AAED,MAAI,QAAQ,kBACV,KAAI,OAAO,OAAO;GAChB,KAAM,SAAS;GACf,MAAM,SAAS;GAChB,GAAE,MAAK,KAAK,KAAK;AAGpB,SAAO,OAAO,MAAK,MAAK,KAAK,KAAK;GAClC"}
|
|
@@ -47,7 +47,7 @@ function parseEvents(events, settings, options, periodsMap) {
|
|
|
47
47
|
minBreakLength: parseMinimumBreakLength(event.minBreakLength)
|
|
48
48
|
};
|
|
49
49
|
if (event.fixedStart && event.start) Object.assign(doc, toDayAndStart(event.start));
|
|
50
|
-
if (options.
|
|
50
|
+
if (options.includeEntityMeta) doc.meta = omitBy({
|
|
51
51
|
name: event.displayName,
|
|
52
52
|
ids: event.ids,
|
|
53
53
|
parked: event.parked,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","names":["doc: Types.event","id"],"sources":["../../../../src/RS/to/input/events.ts"],"sourcesContent":["import moment from 'moment';\nimport { omitBy } from 'lodash-es';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport type { Types } from '../../types';\nimport { parseGroupReferences } from './util/parse-group-references';\nimport { parseLocationReferences, parseSelectedLocations } from './util/parse-location-references';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getDayIndex, getVertexId } from '../../../core/util';\nimport { getPeriodIndex, idOf } from './util/util';\nimport { parseDays } from './util/parse-days';\nimport type { DateType } from '../../../common/types';\nimport { parseIntervals } from './util/parse-intervals';\nimport { getDefaultInterval } from './intervals';\n\nexport function toDayAndStart (start: DateType) {\n return {\n start: parseFloat(moment.utc(start).format('HH.mm')),\n day: getDayIndex(start)\n };\n}\n\nexport function parseEvents (\n events: ConnectedTypes.event[] | undefined,\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions,\n periodsMap: Map<string | undefined, number>\n): Types.event[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return (events ?? [])\n .map((event): Types.event | undefined => {\n const id = getVertexId(event, options);\n const intervals = event.intervals ?? event.course?.intervals ?? defaultInterval;\n\n const duration = event.preferredDuration;\n if (!duration) throw new Error(`(RS::To::Events) Event \"${id}\" has no duration`);\n\n const forcedOverlapId = event.overlapSpecies?.species?.find(({ to }) => to == event)?.id;\n\n // if the event is linked, force duration variance to 0\n const maxLengthVariance = forcedOverlapId != null\n ? event.durationVariance ?? 0\n : 0;\n\n const doc: Types.event = {\n id: idOf.event(event, options),\n length: duration,\n maxLengthVariance: maxLengthVariance,\n weight: event.weight,\n density: event.density,\n potentialCenter: event.centerOfAttraction ? parseFloat(event.centerOfAttraction.replace(':', '.')) : undefined,\n forcedOverlapId: forcedOverlapId,\n period: getPeriodIndex (event.period, periodsMap, options),\n _period: event.period ? getVertexId(event.period, options) : undefined,\n days: parseDays (event.days, settings),\n dependencies: parseLocationReferences (event.locations, options),\n groups: parseGroupReferences ({ type: 'event', item: event }, options),\n intervals: options.oldFormat\n ? parseIntervals(intervals, undefined, settings)\n : idOf.intervalPairReference(intervals, undefined, options),\n lockedTimes: attachLockedTimes (event.lockedTimes, options),\n minBreakLength: parseMinimumBreakLength (event.minBreakLength),\n };\n\n // if the event has a fixed day and start\n if (event.fixedStart && event.start) {\n Object.assign(doc, toDayAndStart(event.start));\n }\n\n if (options.
|
|
1
|
+
{"version":3,"file":"events.js","names":["doc: Types.event","id"],"sources":["../../../../src/RS/to/input/events.ts"],"sourcesContent":["import moment from 'moment';\nimport { omitBy } from 'lodash-es';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport type { Types } from '../../types';\nimport { parseGroupReferences } from './util/parse-group-references';\nimport { parseLocationReferences, parseSelectedLocations } from './util/parse-location-references';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getDayIndex, getVertexId } from '../../../core/util';\nimport { getPeriodIndex, idOf } from './util/util';\nimport { parseDays } from './util/parse-days';\nimport type { DateType } from '../../../common/types';\nimport { parseIntervals } from './util/parse-intervals';\nimport { getDefaultInterval } from './intervals';\n\nexport function toDayAndStart (start: DateType) {\n return {\n start: parseFloat(moment.utc(start).format('HH.mm')),\n day: getDayIndex(start)\n };\n}\n\nexport function parseEvents (\n events: ConnectedTypes.event[] | undefined,\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions,\n periodsMap: Map<string | undefined, number>\n): Types.event[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return (events ?? [])\n .map((event): Types.event | undefined => {\n const id = getVertexId(event, options);\n const intervals = event.intervals ?? event.course?.intervals ?? defaultInterval;\n\n const duration = event.preferredDuration;\n if (!duration) throw new Error(`(RS::To::Events) Event \"${id}\" has no duration`);\n\n const forcedOverlapId = event.overlapSpecies?.species?.find(({ to }) => to == event)?.id;\n\n // if the event is linked, force duration variance to 0\n const maxLengthVariance = forcedOverlapId != null\n ? event.durationVariance ?? 0\n : 0;\n\n const doc: Types.event = {\n id: idOf.event(event, options),\n length: duration,\n maxLengthVariance: maxLengthVariance,\n weight: event.weight,\n density: event.density,\n potentialCenter: event.centerOfAttraction ? parseFloat(event.centerOfAttraction.replace(':', '.')) : undefined,\n forcedOverlapId: forcedOverlapId,\n period: getPeriodIndex (event.period, periodsMap, options),\n _period: event.period ? getVertexId(event.period, options) : undefined,\n days: parseDays (event.days, settings),\n dependencies: parseLocationReferences (event.locations, options),\n groups: parseGroupReferences ({ type: 'event', item: event }, options),\n intervals: options.oldFormat\n ? parseIntervals(intervals, undefined, settings)\n : idOf.intervalPairReference(intervals, undefined, options),\n lockedTimes: attachLockedTimes (event.lockedTimes, options),\n minBreakLength: parseMinimumBreakLength (event.minBreakLength),\n };\n\n // if the event has a fixed day and start\n if (event.fixedStart && event.start) {\n Object.assign(doc, toDayAndStart(event.start));\n }\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n name: event.displayName,\n ids: event.ids,\n parked: event.parked,\n visible: event.visible,\n start: event.start ? moment.utc(event.start) : undefined,\n end: event.end ? moment.utc(event.start) : undefined,\n course: event.course ? getVertexId(event.course, options) : undefined,\n inLocations: event.inLocations ? parseSelectedLocations(event, options) : undefined\n }, x => x == null);\n }\n\n ////\n //// filter events based on partialScheduleOptions\n ////\n if (options.partialScheduleOptions) {\n const { includedEvents, omittedEventsHandling } = options.partialScheduleOptions;\n if (includedEvents && !includedEvents.has(doc.id)) { // collection.id => take into account dynamic locked times too!\n\n if (omittedEventsHandling == 'ignore') return;\n\n if (omittedEventsHandling == 'freeze') {\n // must not be parked and have a start and duration to be frozen, otherwise it's ignored\n if (event.parked || !event.start || !event.duration) return;\n\n // fix day, start and end\n Object.assign(doc, toDayAndStart(event.start));\n doc.length = event.duration;\n doc.maxLengthVariance = 0;\n\n // override intervals and days to not cause conflicts\n const numDays = settings.numDays ?? 5;\n doc.days = Array.from({ length: numDays }, (_, i) => i);\n doc.intervals = Array.from({ length: numDays }, () => [{ beg: 0, end: 23.55 }]);\n\n // fix locations\n doc.dependencies = (event.inLocations ?? [])\n .filter((x): x is NonNullable<typeof x> => !!x)\n .map(x => {\n const id = getVertexId(x, options);\n\n // filter location references based on partial schedule options\n const includedLocations = options.partialScheduleOptions?.includedLocations;\n if (includedLocations && !includedLocations.has(id)) return;\n\n return [{ dependency: id }] as Types.availableDependency[];\n })\n .filter(x => x != null);\n }\n\n }\n }\n\n return omitBy(doc, x => x == null) as Types.event;\n })\n .filter((x): x is NonNullable<typeof x> => !!x);\n}"],"mappings":"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"}
|
|
@@ -27,7 +27,7 @@ function fromGroups(groups, settings, options) {
|
|
|
27
27
|
minBreakLength: parseMinimumBreakLength(group.minBreakLength),
|
|
28
28
|
...parseMaxWorkingHours(group, options)
|
|
29
29
|
};
|
|
30
|
-
if (options.
|
|
30
|
+
if (options.includeEntityMeta) doc.meta = omitBy({
|
|
31
31
|
ids: group.ids,
|
|
32
32
|
name: group.displayName
|
|
33
33
|
}, (x) => x == null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups.js","names":["doc: Types.group"],"sources":["../../../../src/RS/to/input/groups.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseDays } from './util/parse-days';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { idOf } from './util/util';\nimport { parseIntervals } from './util/parse-intervals';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromGroups (\n groups: ConnectedTypes.group[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return groups\n .filter(group => group.species == 'class')\n .map(group => {\n const intervals = group.intervals ?? defaultInterval;\n const rootInterval = group.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.group = {\n id: idOf.group(group, options),\n group_type: 'classes',\n weight: group.weight,\n minimizeGaps: true,\n minimizeDependencyAlternation: false,\n forbidOverlappingEvents: options.oldFormat ? group.forbidOverlappingEvents : undefined, // Deprecated in v3\n disableDayLengthPunishment: options.oldFormat ? group.disableDayLengthPunishment : undefined, // Deprecated in v3\n intervals: options.oldFormat\n ? parseIntervals(intervals, rootInterval, settings)\n : idOf.intervalPairReference(intervals, rootInterval, options),\n days: parseDays (group.days, settings),\n lockedTimes: attachLockedTimes (group.lockedTimes, options),\n minBreakLength: parseMinimumBreakLength (group.minBreakLength),\n\n ...parseMaxWorkingHours(group, options),\n };\n\n if (options.
|
|
1
|
+
{"version":3,"file":"groups.js","names":["doc: Types.group"],"sources":["../../../../src/RS/to/input/groups.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseDays } from './util/parse-days';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { idOf } from './util/util';\nimport { parseIntervals } from './util/parse-intervals';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromGroups (\n groups: ConnectedTypes.group[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return groups\n .filter(group => group.species == 'class')\n .map(group => {\n const intervals = group.intervals ?? defaultInterval;\n const rootInterval = group.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.group = {\n id: idOf.group(group, options),\n group_type: 'classes',\n weight: group.weight,\n minimizeGaps: true,\n minimizeDependencyAlternation: false,\n forbidOverlappingEvents: options.oldFormat ? group.forbidOverlappingEvents : undefined, // Deprecated in v3\n disableDayLengthPunishment: options.oldFormat ? group.disableDayLengthPunishment : undefined, // Deprecated in v3\n intervals: options.oldFormat\n ? parseIntervals(intervals, rootInterval, settings)\n : idOf.intervalPairReference(intervals, rootInterval, options),\n days: parseDays (group.days, settings),\n lockedTimes: attachLockedTimes (group.lockedTimes, options),\n minBreakLength: parseMinimumBreakLength (group.minBreakLength),\n\n ...parseMaxWorkingHours(group, options),\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n ids: group.ids,\n name: group.displayName,\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.group;\n });\n};\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,WACd,QACA,UACA,SACe;CACf,MAAM,kBAAkB,mBAAmB,SAAS;AAEpD,QAAO,OACJ,QAAO,UAAS,MAAM,WAAW,QAAQ,CACzC,KAAI,UAAS;EACZ,MAAM,YAAe,MAAM,aAAgB;EAC3C,MAAM,eAAe,MAAM,gBAAgB,SAAS;EAEpD,MAAMA,MAAmB;GACvB,IAA+B,KAAK,MAAM,OAAO,QAAQ;GACzD,YAA+B;GAC/B,QAA+B,MAAM;GACrC,cAA+B;GAC/B,+BAA+B;GAC/B,yBAA+B,QAAQ,YAAY,MAAM,0BAA0B;GACnF,4BAA+B,QAAQ,YAAY,MAAM,6BAA6B;GACtF,WAA+B,QAAQ,YACnC,eAAe,WAAW,cAAc,SAAS,GACjD,KAAK,sBAAsB,WAAW,cAAc,QAAQ;GAChE,MAAgB,UAA2B,MAAM,MAAM,SAAS;GAChE,aAAgB,kBAA2B,MAAM,aAAa,QAAQ;GACtE,gBAAgB,wBAA2B,MAAM,eAAe;GAEhE,GAAG,qBAAqB,OAAO,QAAQ;GACxC;AAED,MAAI,QAAQ,kBACV,KAAI,OAAO,OAAO;GAChB,KAAM,MAAM;GACZ,MAAM,MAAM;GACb,GAAE,MAAK,KAAK,KAAK;AAGpB,SAAO,OAAO,MAAK,MAAK,KAAK,KAAK;GAClC"}
|
|
@@ -10,7 +10,7 @@ function fromPersonsToIndividuals(persons, options) {
|
|
|
10
10
|
id: idOf.person(person, options),
|
|
11
11
|
group: person.group ? `groups.${getVertexId(person.group, options)}` : void 0
|
|
12
12
|
};
|
|
13
|
-
if (options.
|
|
13
|
+
if (options.includeEntityMeta) doc.meta = omitBy({
|
|
14
14
|
ids: person.ids,
|
|
15
15
|
name: person.displayName
|
|
16
16
|
}, (x) => x == null);
|
|
@@ -24,7 +24,7 @@ function fromGroupToIndividualsSet(id, reference, options) {
|
|
|
24
24
|
id,
|
|
25
25
|
individuals: [...members.difference(excluded)].map((x) => idOf.person(x, options))
|
|
26
26
|
};
|
|
27
|
-
if (options.
|
|
27
|
+
if (options.includeEntityMeta) doc.meta = omitBy({ name: reference.to.displayName + (reference.exclude?.length ? ` (excl. ${reference.exclude.map((x) => x.displayName).join(", ")})` : "") }, (x) => x == null);
|
|
28
28
|
return doc;
|
|
29
29
|
}
|
|
30
30
|
function extractUniqueIndividuals(persons, courses, events, lockedTimes, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"individuals.js","names":["doc: Types.individual","doc: Types.individualsSet","x"],"sources":["../../../../src/RS/to/input/individuals.ts"],"sourcesContent":["import { omitBy, uniqBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getVertexId } from '../../../core/util';\nimport { idOf } from './util/util';\nimport { makeChainable } from '../../../common/make-chainable';\nimport type { GroupWithExclude } from '../../../core/interfaces/vertices/util/edges';\n\n\nfunction fromPersonsToIndividuals (\n persons: ConnectedTypes.person[],\n options: Types.parsedToOptions\n): Types.individual[] {\n return persons.map(person => {\n const doc: Types.individual = {\n id: idOf.person(person, options),\n group: person.group ? `groups.${ getVertexId(person.group, options) }` : undefined,\n };\n\n if (options.
|
|
1
|
+
{"version":3,"file":"individuals.js","names":["doc: Types.individual","doc: Types.individualsSet","x"],"sources":["../../../../src/RS/to/input/individuals.ts"],"sourcesContent":["import { omitBy, uniqBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getVertexId } from '../../../core/util';\nimport { idOf } from './util/util';\nimport { makeChainable } from '../../../common/make-chainable';\nimport type { GroupWithExclude } from '../../../core/interfaces/vertices/util/edges';\n\n\nfunction fromPersonsToIndividuals (\n persons: ConnectedTypes.person[],\n options: Types.parsedToOptions\n): Types.individual[] {\n return persons.map(person => {\n const doc: Types.individual = {\n id: idOf.person(person, options),\n group: person.group ? `groups.${ getVertexId(person.group, options) }` : undefined,\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n ids: person.ids,\n name: person.displayName,\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.individual;\n });\n}\n\nfunction fromGroupToIndividualsSet (\n id: string,\n reference: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>,\n options: Types.parsedToOptions\n): Types.individualsSet {\n const members = new Set(reference.to.members?.map(x => getVertexId(x, options)));\n const excluded = new Set(reference.exclude?.map(x => getVertexId(x, options)));\n const remaining = members.difference(excluded);\n\n const doc: Types.individualsSet = {\n id: id,\n individuals: [...remaining].map(x => idOf.person(x, options)),\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n name: reference.to.displayName + (reference.exclude?.length ? ` (excl. ${ reference.exclude.map(x => x.displayName).join(', ') })` : ''),\n }, x => x == null);\n }\n\n return doc;\n}\n\n// function fromParticipantsToIndividualsSet (\n// id: string,\n// reference: PersonReference<ConnectedTypes.person>[],\n// options: OutOptions\n// ): _IndividualsSet {\n// const idKey = getIdKey(options);\n\n// const doc: _IndividualsSet = {\n// id: id,\n// individuals: reference.map(x => getVertexId(x.to, idKey))\n// };\n\n// if (options.meta) {\n// doc.meta = omitBy({\n// name: reference.map(x => x.to.displayName).join(', '),\n// }, x => x == null);\n// }\n\n// return doc;\n// }\n\nexport function extractUniqueIndividuals (\n persons: ConnectedTypes.person[],\n courses: ConnectedTypes.course[],\n events: ConnectedTypes.event[],\n lockedTimes: ConnectedTypes.lockedTime[],\n options: Types.parsedToOptions\n): (Types.individual | Types.individualsSet)[] {\n const individuals = fromPersonsToIndividuals(persons, options);\n\n const uniqueIndividualsSetsFromGroupReferences = makeChainable([...courses, ...events, ...lockedTimes])\n .chain(\n x => x\n .map((item): GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>[] | undefined => {\n if ('groups' in item) return item.groups; // we may ignore the parent groups as they are all plain group references\n if ('coalesced' in item) return item.coalesced\n ?.filter(x => x.toModel == 'groups');\n return;\n })\n .flatMap(references => (references ?? [])\n .filter(x => x.to.species != 'class' || x.exclude?.length) // if plain group reference we will use the group directly\n .map(x => ({ id: idOf.groupReference(x, options), value: x }))\n ),\n x => uniqBy(x, x => x.id)\n .map(x => fromGroupToIndividualsSet(x.id, x.value, options))\n )\n .value;\n\n ////\n //// NOT NEEDED AS WE USE THE INDIVIDUALS DIRECTLY\n ////\n // const uniqueIndividualsSetsFromParticipants = chain([...courses, ...events])\n // .map(item => {\n // if ('participants' in item) return item.participants;\n // return;\n // })\n // .filter(x => x != null)\n // .filter(x => x.length > 1) // if a single participant we will use the individual directly\n // .map(x => ({ id: idOf.participantsReference(x, options), value: x }))\n // .uniqBy(x => x.id)\n // .map(x => fromParticipantsToIndividualsSet(x.id, x.value, options))\n // .value();\n\n return individuals\n .concat(uniqueIndividualsSetsFromGroupReferences);\n // .concat(uniqueIndividualsSetsFromParticipants);\n};\n"],"mappings":";;;;;;AASA,SAAS,yBACP,SACA,SACoB;AACpB,QAAO,QAAQ,KAAI,WAAU;EAC3B,MAAMA,MAAwB;GAC5B,IAAO,KAAK,OAAO,QAAQ,QAAQ;GACnC,OAAO,OAAO,QAAQ,UAAW,YAAY,OAAO,OAAO,QAAQ,KAAM;GAC1E;AAED,MAAI,QAAQ,kBACV,KAAI,OAAO,OAAO;GAChB,KAAM,OAAO;GACb,MAAM,OAAO;GACd,GAAE,MAAK,KAAK,KAAK;AAGpB,SAAO,OAAO,MAAK,MAAK,KAAK,KAAK;GAClC;;AAGJ,SAAS,0BACP,IACA,WACA,SACsB;CACtB,MAAM,UAAY,IAAI,IAAI,UAAU,GAAG,SAAS,KAAI,MAAK,YAAY,GAAG,QAAQ,CAAC,CAAC;CAClF,MAAM,WAAY,IAAI,IAAI,UAAU,SAAS,KAAI,MAAK,YAAY,GAAG,QAAQ,CAAC,CAAC;CAG/E,MAAMC,MAA4B;EACnB;EACb,aAAa,CAAC,GAJE,QAAQ,WAAW,SAAS,CAIjB,CAAC,KAAI,MAAK,KAAK,OAAO,GAAG,QAAQ,CAAC;EAC9D;AAED,KAAI,QAAQ,kBACV,KAAI,OAAO,OAAO,EAChB,MAAM,UAAU,GAAG,eAAe,UAAU,SAAS,SAAS,WAAY,UAAU,QAAQ,KAAI,MAAK,EAAE,YAAY,CAAC,KAAK,KAAK,CAAE,KAAK,KACtI,GAAE,MAAK,KAAK,KAAK;AAGpB,QAAO;;AAwBT,SAAgB,yBACd,SACA,SACA,QACA,aACA,SAC6C;CAC7C,MAAM,cAAc,yBAAyB,SAAS,QAAQ;CAE9D,MAAM,2CAA2C,cAAc;EAAC,GAAG;EAAS,GAAG;EAAQ,GAAG;EAAY,CAAC,CACpG,OACC,MAAK,EACF,KAAK,SAAiG;AACrG,MAAI,YAAe,KAAM,QAAO,KAAK;AACrC,MAAI,eAAe,KAAM,QAAO,KAAK,WACjC,QAAO,QAAKC,IAAE,WAAW,SAAS;GAEtC,CACD,SAAQ,gBAAe,cAAc,EAAE,EACrC,QAAO,QAAKA,IAAE,GAAG,WAAW,WAAWA,IAAE,SAAS,OAAO,CACzD,KAAI,SAAM;EAAE,IAAI,KAAK,eAAeA,KAAG,QAAQ;EAAE,OAAOA;EAAG,EAAE,CAC/D,GACH,MAAK,OAAO,IAAG,QAAKA,IAAE,GAAG,CACtB,KAAI,QAAK,0BAA0BA,IAAE,IAAIA,IAAE,OAAO,QAAQ,CAAC,CAC/D,CACA;AAiBH,QAAO,YACJ,OAAO,yCAAyC"}
|
|
@@ -27,7 +27,7 @@ function fromTeachers(teachers, settings, options) {
|
|
|
27
27
|
minBreakLength: parseMinimumBreakLength(teacher.minBreakLength),
|
|
28
28
|
...parseMaxWorkingHours(teacher, options)
|
|
29
29
|
};
|
|
30
|
-
if (options.
|
|
30
|
+
if (options.includeEntityMeta) doc.meta = omitBy({
|
|
31
31
|
ids: teacher.ids,
|
|
32
32
|
name: teacher.displayName
|
|
33
33
|
}, (x) => x == null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teachers.js","names":["doc: Types.group"],"sources":["../../../../src/RS/to/input/teachers.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { parseDays } from './util/parse-days';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { idOf } from './util/util';\nimport { parseIntervals } from './util/parse-intervals';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromTeachers (\n teachers: ConnectedTypes.teacher[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return teachers\n .map(teacher => {\n const intervals = teacher.intervals ?? defaultInterval;\n const rootInterval = teacher.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.group = {\n id: idOf.teacher(teacher, options),\n group_type: 'personal',\n minimizeGaps: false,\n minimizeDependencyAlternation: true,\n forbidOverlappingEvents: options.oldFormat ? teacher.forbidOverlappingEvents : undefined, // Deprecated in v3\n disableDayLengthPunishment: options.oldFormat ? teacher.disableDayLengthPunishment : undefined, // Deprecated in v3\n weight: teacher.weight,\n intervals: options.oldFormat\n ? parseIntervals(intervals, rootInterval, settings)\n : idOf.intervalPairReference(intervals, rootInterval, options),\n days: parseDays (teacher.days, settings),\n lockedTimes: attachLockedTimes (teacher.lockedTimes, options),\n minBreakLength: parseMinimumBreakLength (teacher.minBreakLength),\n\n ...parseMaxWorkingHours(teacher, options),\n };\n\n if (options.
|
|
1
|
+
{"version":3,"file":"teachers.js","names":["doc: Types.group"],"sources":["../../../../src/RS/to/input/teachers.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { parseDays } from './util/parse-days';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { idOf } from './util/util';\nimport { parseIntervals } from './util/parse-intervals';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromTeachers (\n teachers: ConnectedTypes.teacher[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return teachers\n .map(teacher => {\n const intervals = teacher.intervals ?? defaultInterval;\n const rootInterval = teacher.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.group = {\n id: idOf.teacher(teacher, options),\n group_type: 'personal',\n minimizeGaps: false,\n minimizeDependencyAlternation: true,\n forbidOverlappingEvents: options.oldFormat ? teacher.forbidOverlappingEvents : undefined, // Deprecated in v3\n disableDayLengthPunishment: options.oldFormat ? teacher.disableDayLengthPunishment : undefined, // Deprecated in v3\n weight: teacher.weight,\n intervals: options.oldFormat\n ? parseIntervals(intervals, rootInterval, settings)\n : idOf.intervalPairReference(intervals, rootInterval, options),\n days: parseDays (teacher.days, settings),\n lockedTimes: attachLockedTimes (teacher.lockedTimes, options),\n minBreakLength: parseMinimumBreakLength (teacher.minBreakLength),\n\n ...parseMaxWorkingHours(teacher, options),\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n ids: teacher.ids,\n name: teacher.displayName,\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.group;\n });\n};\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,aACd,UACA,UACA,SACe;CACf,MAAM,kBAAkB,mBAAmB,SAAS;AAEpD,QAAO,SACJ,KAAI,YAAW;EACd,MAAM,YAAe,QAAQ,aAAgB;EAC7C,MAAM,eAAe,QAAQ,gBAAgB,SAAS;EAEtD,MAAMA,MAAmB;GACvB,IAA+B,KAAK,QAAQ,SAAS,QAAQ;GAC7D,YAA+B;GAC/B,cAA+B;GAC/B,+BAA+B;GAC/B,yBAA+B,QAAQ,YAAY,QAAQ,0BAA0B;GACrF,4BAA+B,QAAQ,YAAY,QAAQ,6BAA6B;GACxF,QAA+B,QAAQ;GACvC,WAA+B,QAAQ,YACnC,eAAe,WAAW,cAAc,SAAS,GACjD,KAAK,sBAAsB,WAAW,cAAc,QAAQ;GAChE,MAAgB,UAA2B,QAAQ,MAAM,SAAS;GAClE,aAAgB,kBAA2B,QAAQ,aAAa,QAAQ;GACxE,gBAAgB,wBAA2B,QAAQ,eAAe;GAElE,GAAG,qBAAqB,SAAS,QAAQ;GAC1C;AAED,MAAI,QAAQ,kBACV,KAAI,OAAO,OAAO;GAChB,KAAM,QAAQ;GACd,MAAM,QAAQ;GACf,GAAE,MAAK,KAAK,KAAK;AAGpB,SAAO,OAAO,MAAK,MAAK,KAAK,KAAK;GAClC"}
|
|
@@ -13,7 +13,7 @@ function attachLockedTimes(lockedTimes, options) {
|
|
|
13
13
|
start,
|
|
14
14
|
length
|
|
15
15
|
};
|
|
16
|
-
if (options.
|
|
16
|
+
if (options.includeEntityMeta) doc.meta = omitBy({
|
|
17
17
|
id: getVertexId(lockedTime, options),
|
|
18
18
|
visible: lockedTime.visible,
|
|
19
19
|
name: lockedTime.displayName
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attach-locked-times.js","names":["doc: Types.lockedTime"],"sources":["../../../../../src/RS/to/input/util/attach-locked-times.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../../types';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport { getDayIndex, getVertexId, parseDateInterval } from '../../../../core/util';\n\nexport function attachLockedTimes (\n lockedTimes: ConnectedTypes.lockedTime[] | null | undefined,\n options: Types.parsedToOptions\n): Types.lockedTime[] | undefined {\n\n return lockedTimes?.map(lockedTime => {\n const { start: startDate, end: endDate } = parseDateInterval(lockedTime, 'locked time');\n\n const length = endDate.diff(startDate, 'minutes');\n if (length < 5) throw new Error('(RS::To::LockedTimes) Length of a locked time is less than 5 min');\n\n const start = parseFloat(startDate.format('HH.mm'));\n\n const doc: Types.lockedTime = {\n day: getDayIndex(startDate),\n start: start,\n length: length,\n };\n\n if (options.
|
|
1
|
+
{"version":3,"file":"attach-locked-times.js","names":["doc: Types.lockedTime"],"sources":["../../../../../src/RS/to/input/util/attach-locked-times.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../../types';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport { getDayIndex, getVertexId, parseDateInterval } from '../../../../core/util';\n\nexport function attachLockedTimes (\n lockedTimes: ConnectedTypes.lockedTime[] | null | undefined,\n options: Types.parsedToOptions\n): Types.lockedTime[] | undefined {\n\n return lockedTimes?.map(lockedTime => {\n const { start: startDate, end: endDate } = parseDateInterval(lockedTime, 'locked time');\n\n const length = endDate.diff(startDate, 'minutes');\n if (length < 5) throw new Error('(RS::To::LockedTimes) Length of a locked time is less than 5 min');\n\n const start = parseFloat(startDate.format('HH.mm'));\n\n const doc: Types.lockedTime = {\n day: getDayIndex(startDate),\n start: start,\n length: length,\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n id: getVertexId(lockedTime, options),\n visible: lockedTime.visible,\n name: lockedTime.displayName,\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.lockedTime;\n });\n};"],"mappings":";;;;AAKA,SAAgB,kBACd,aACA,SACgC;AAEhC,QAAO,aAAa,KAAI,eAAc;EACpC,MAAM,EAAE,OAAO,WAAW,KAAK,YAAY,kBAAkB,YAAY,cAAc;EAEvF,MAAM,SAAS,QAAQ,KAAK,WAAW,UAAU;AACjD,MAAI,SAAS,EAAG,OAAM,IAAI,MAAM,mEAAmE;EAEnG,MAAM,QAAQ,WAAW,UAAU,OAAO,QAAQ,CAAC;EAEnD,MAAMA,MAAwB;GAC5B,KAAQ,YAAY,UAAU;GACtB;GACA;GACT;AAED,MAAI,QAAQ,kBACV,KAAI,OAAO,OAAO;GAChB,IAAS,YAAY,YAAY,QAAQ;GACzC,SAAS,WAAW;GACpB,MAAS,WAAW;GACrB,GAAE,MAAK,KAAK,KAAK;AAGpB,SAAO,OAAO,MAAK,MAAK,KAAK,KAAK;GAClC"}
|
package/dist/RS/types/to.d.ts
CHANGED
|
@@ -15,9 +15,13 @@ type PartialScheduleOptions<IDs extends Array<string> | Set<string>> = {
|
|
|
15
15
|
omittedEventsHandling: 'ignore' | 'freeze';
|
|
16
16
|
};
|
|
17
17
|
interface ToOptions extends BaseOptions {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
/**
|
|
19
|
+
* If enabled, each entity in the output (such as groups, dependencies, collections, events, etc.)
|
|
20
|
+
* will include a `meta` object containing details like original IDs and display names.
|
|
21
|
+
* Note: This is distinct from the root-level `meta` object in the mapped output which is always included.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
includeEntityMeta?: boolean;
|
|
21
25
|
/**
|
|
22
26
|
* If true, the output will include the full core data. This enables the resulting output file to be uploaded as a new schedule.
|
|
23
27
|
* @default false
|
|
@@ -57,7 +61,7 @@ interface ToOutput {
|
|
|
57
61
|
structure?: Structure;
|
|
58
62
|
division: Pick<Types.Deep.Division, 'displayName' | 'start' | 'end'>;
|
|
59
63
|
};
|
|
60
|
-
algorithmParameters
|
|
64
|
+
algorithmParameters: {
|
|
61
65
|
weights?: AlgorithmWeightParameters;
|
|
62
66
|
};
|
|
63
67
|
score?: [number, number, number, number];
|
package/dist/RS/types/to.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to.js","names":[],"sources":["../../../src/RS/types/to.ts"],"sourcesContent":["import type { BaseOptions } from '../../common/types';\nimport type { CoreTypes } from '../../core';\nimport type { MixedScheduleData } from '../make-connected';\nimport type { Types } from './';\nimport type { AlgorithmWeightParameters } from './algorithm-parameters';\n\n\nexport type ToInput = MixedScheduleData;\n\ntype PartialScheduleOptions<IDs extends Array<string> | Set<string>> = {\n /** @description undefined means all included */\n includedEvents?: IDs;\n /** @description undefined means all included */\n includedLocations?: IDs;\n omittedEventsHandling: 'ignore' | 'freeze';\n};\n\nexport interface ToOptions extends BaseOptions {\n meta
|
|
1
|
+
{"version":3,"file":"to.js","names":[],"sources":["../../../src/RS/types/to.ts"],"sourcesContent":["import type { BaseOptions } from '../../common/types';\nimport type { CoreTypes } from '../../core';\nimport type { MixedScheduleData } from '../make-connected';\nimport type { Types } from './';\nimport type { AlgorithmWeightParameters } from './algorithm-parameters';\n\n\nexport type ToInput = MixedScheduleData;\n\ntype PartialScheduleOptions<IDs extends Array<string> | Set<string>> = {\n /** @description undefined means all included */\n includedEvents?: IDs;\n /** @description undefined means all included */\n includedLocations?: IDs;\n omittedEventsHandling: 'ignore' | 'freeze';\n};\n\nexport interface ToOptions extends BaseOptions {\n /**\n * If enabled, each entity in the output (such as groups, dependencies, collections, events, etc.)\n * will include a `meta` object containing details like original IDs and display names.\n * Note: This is distinct from the root-level `meta` object in the mapped output which is always included.\n * @default false\n */\n includeEntityMeta?: boolean;\n\n /**\n * If true, the output will include the full core data. This enables the resulting output file to be uploaded as a new schedule.\n * @default false\n */\n appendCoreData?: boolean;\n\n /**\n * If true, the output will include current configuration of events and locked times as `output` entry.\n * @default false\n */\n appendOutput?: boolean;\n\n /**\n * @deprecated the only purpose of this backwards compatibility is to support the input-analyzer module\n *\n * If not set to true, these new features are taken into account:\n *\n * - New root level entries: `intervals` and `individuals`\n * - As the there is now a root level `intervals` the former may be references from `Collection.intervals`, `Group.intervals` etc.\n * - The `Collection.groups` and `Event.groups` supports referencing `individuals` (and `individuals sets`) in addition to `groups`\n * - The `Group.forbidOverlappingEvents` has been removed.\n * - The `Group.disableDayLengthPunishment` has been replaced by `Group.minimizeGaps`\n */\n oldFormat?: boolean;\n\n partialScheduleOptions?: PartialScheduleOptions<Array<string> | Set<string>>\n\n algorithmWeightParameters?: AlgorithmWeightParameters;\n\n /**\n * to be used before whe have migrated from \"maxNumWorkingHours\" and \"maxNumDailyWorkingHours\" to \"maximumScheduleSpan\"\n */\n useMaximumScheduleSpan?: boolean;\n}\n\nexport interface ParsedToOptions extends Omit<ToOptions, 'partialScheduleOptions'> {\n partialScheduleOptions?: PartialScheduleOptions<Set<string>>\n}\n\nexport const structure = 'RS/algorithm-5.0.2';\nexport type Structure = typeof structure;\nexport interface ToOutput {\n meta: {\n structure?: Structure;\n division: Pick<CoreTypes.Deep.Division, 'displayName' | 'start' | 'end'>;\n };\n algorithmParameters: {\n weights?: AlgorithmWeightParameters;\n };\n score?: [number, number, number, number];\n input: Types.scheduleData;\n output?: Types.configuration[];\n coreData?: Partial<CoreTypes.SerializedWithOptionalId.Schedule>;\n}"],"mappings":";AAiEA,MAAa,YAAY"}
|