@royalschedule/maps 4.1.1-beta.0 → 4.1.2

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.
Files changed (30) hide show
  1. package/dist/Additio/to/index.d.ts +2 -2
  2. package/dist/Excel/index.d.ts +2 -0
  3. package/dist/Excel/v1/index.d.ts +3 -3
  4. package/dist/Excel/v2/index.d.ts +5 -3
  5. package/dist/RS/from/schedules.js +7 -4
  6. package/dist/RS/from/schedules.js.map +1 -1
  7. package/dist/RS/to/input/teachers.js +1 -1
  8. package/dist/RS/to/input/teachers.js.map +1 -1
  9. package/dist/RS/to/input/util/util.js +43 -1
  10. package/dist/RS/to/input/util/util.js.map +1 -1
  11. package/dist/SchoolSoft/api/index.d.ts +5 -5
  12. package/dist/SchoolSoft/file/to/index.d.ts +2 -2
  13. package/dist/Skola24/txt/to/schedules.js +1 -1
  14. package/dist/Skola24/txt/to/schedules.js.map +1 -1
  15. package/dist/core/interfaces/other/companies.d.ts +1 -0
  16. package/dist/core/interfaces/other/companies.js.map +1 -1
  17. package/dist/core/interfaces/vertices/conversations.d.ts +32 -0
  18. package/dist/core/interfaces/vertices/courses.d.ts +1 -1
  19. package/dist/core/interfaces/vertices/division-settings.d.ts +1 -0
  20. package/dist/core/interfaces/vertices/events.d.ts +3 -0
  21. package/dist/core/interfaces/vertices/index.d.ts +15 -1
  22. package/dist/core/interfaces/vertices/messages.d.ts +21 -0
  23. package/dist/core/interfaces/vertices/periods.d.ts +1 -0
  24. package/dist/core/interfaces/vertices/syllabuses.d.ts +2 -0
  25. package/dist/core/interfaces/vertices/util/vertex.d.ts +1 -1
  26. package/dist/core/interfaces/vertices/vertex-query.d.ts +7 -1
  27. package/dist/core/interfaces/vertices/vertex-query.js +8 -0
  28. package/dist/core/interfaces/vertices/vertex-query.js.map +1 -1
  29. package/dist/core/types/index.d.ts +5 -0
  30. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  import { Types } from "../../core/types/index.js";
2
2
  import { Types as Types$1 } from "../types/index.js";
3
- import * as xlsx0 from "xlsx";
3
+ import * as xlsx1 from "xlsx";
4
4
 
5
5
  //#region src/Additio/to/index.d.ts
6
6
  declare class export_default {
@@ -14,7 +14,7 @@ declare class export_default {
14
14
  courses: Types.Mixed.Course[];
15
15
  events: Types.Mixed.Event[];
16
16
  lockedTimes: Types.Mixed.LockedTime[];
17
- }, _options?: Types$1.options) => xlsx0.WorkBook;
17
+ }, _options?: Types$1.options) => xlsx1.WorkBook;
18
18
  }
19
19
  //#endregion
20
20
  export { export_default };
@@ -278,9 +278,11 @@ declare class ExcelMap {
278
278
  createdAt?: string | undefined;
279
279
  updatedAt?: string | undefined;
280
280
  lastModifiedBy?: string | undefined;
281
+ color?: string | null | undefined;
281
282
  schoolType: string;
282
283
  subjectCode?: string | undefined;
283
284
  subjectName: string;
285
+ icon?: string | null | undefined;
284
286
  subjectDesignation?: string | undefined;
285
287
  courseCode?: string | undefined;
286
288
  courseName?: string | undefined;
@@ -6,7 +6,7 @@ import { MaximumScheduleSpan } from "../../core/interfaces/vertices/properties/m
6
6
  import { PlannedScheduledDuration } from "../../core/interfaces/vertices/properties/planned-scheduled-duration.js";
7
7
  import { MinBreakLength } from "../../core/interfaces/vertices/properties/min-break-length.js";
8
8
  import { Types } from "./types/index.js";
9
- import * as moment3 from "moment";
9
+ import * as moment5 from "moment";
10
10
 
11
11
  //#region src/Excel/v1/index.d.ts
12
12
  declare class Map {
@@ -201,8 +201,8 @@ declare class Map {
201
201
  course?: string | undefined;
202
202
  linkedEventsSet?: string | undefined;
203
203
  period?: string | undefined;
204
- start?: (moment3.Moment | string) | undefined;
205
- end?: (moment3.Moment | string) | undefined;
204
+ start?: (moment5.Moment | string) | undefined;
205
+ end?: (moment5.Moment | string) | undefined;
206
206
  belongsTo?: string | undefined;
207
207
  potentialCenter?: string | undefined;
208
208
  type?: string | undefined;
@@ -6,7 +6,7 @@ import { MaximumScheduleSpan } from "../../core/interfaces/vertices/properties/m
6
6
  import { PlannedScheduledDuration } from "../../core/interfaces/vertices/properties/planned-scheduled-duration.js";
7
7
  import { MinBreakLength } from "../../core/interfaces/vertices/properties/min-break-length.js";
8
8
  import { Types } from "./types/index.js";
9
- import * as moment1 from "moment";
9
+ import * as moment7 from "moment";
10
10
 
11
11
  //#region src/Excel/v2/index.d.ts
12
12
  declare class Map {
@@ -197,8 +197,8 @@ declare class Map {
197
197
  createdAt?: string | undefined;
198
198
  updatedAt?: string | undefined;
199
199
  lastModifiedBy?: string | undefined;
200
- start?: (moment1.Moment | string) | undefined;
201
- end?: (moment1.Moment | string) | undefined;
200
+ start?: (moment7.Moment | string) | undefined;
201
+ end?: (moment7.Moment | string) | undefined;
202
202
  potentialCenter?: string | undefined;
203
203
  type?: string | undefined;
204
204
  tags?: Tag[] | undefined;
@@ -275,9 +275,11 @@ declare class Map {
275
275
  createdAt?: string | undefined;
276
276
  updatedAt?: string | undefined;
277
277
  lastModifiedBy?: string | undefined;
278
+ color?: string | null | undefined;
278
279
  schoolType: string;
279
280
  subjectCode?: string | undefined;
280
281
  subjectName: string;
282
+ icon?: string | null | undefined;
281
283
  subjectDesignation?: string | undefined;
282
284
  courseCode?: string | undefined;
283
285
  courseName?: string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { getVertexId } from "../../core/util.js";
2
- import { COLLECTION_ID } from "../to/input/util/util.js";
2
+ import { fromId } from "../to/input/util/util.js";
3
3
  import moment from "moment";
4
4
 
5
5
  //#region src/RS/from/schedules.ts
@@ -12,9 +12,12 @@ function schedules(input, options = {}) {
12
12
  if (!eventConfigurations) throw new Error("Missing `output.events` in input.");
13
13
  const eventsToUpdate = new Set(schedule.events?.map((x) => getVertexId(x, options)));
14
14
  eventConfigurations.forEach(({ id: collectionAndId,...placement }) => {
15
- const collection = collectionAndId.split(".")[0] == COLLECTION_ID.events ? "events" : "lockedTimes";
16
- const id = collectionAndId.split(".")[1];
17
- const event = schedule[collection]?.find((x) => getVertexId(x, options) == id);
15
+ const { collection, entityId: id } = fromId.aggregate(collectionAndId);
16
+ const event = (() => {
17
+ if (collection == "events") return schedule.events?.find((x) => getVertexId(x, options) == id);
18
+ if (collection == "lockedTimes") return schedule.lockedTimes?.find((x) => getVertexId(x, options) == id);
19
+ throw new Error(`Unknown collection "${collection}" in id "${collectionAndId}"`);
20
+ })();
18
21
  if (!event) {
19
22
  warnings.push(`Could not find ${id} (${collectionAndId}) in ${collection} collection.`);
20
23
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["warnings: string[]"],"sources":["../../../src/RS/from/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport type { Types } from '../types';\nimport { COLLECTION_ID } from '../to/input/util/util';\nimport { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\n\nexport function schedules (\n input: Partial<Types.toOutput>,\n options: Pick<Types.toOptions, 'idKey'> = {}\n): Partial<CoreTypes.SerializedWithOptionalId.Schedule> {\n // set default idKey if not provided\n if (!options.idKey) options.idKey = 'id';\n\n const warnings: string[] = [];\n\n const schedule = input.coreData;\n const eventConfigurations = input.output?.at(0)?.events;\n\n if (!schedule ) throw new Error('Missing `coreData` in input.');\n if (!eventConfigurations) throw new Error('Missing `output.events` in input.');\n\n // check on later to ensure that all events are updated\n const eventsToUpdate = new Set(schedule.events?.map(x => getVertexId(x, options)));\n\n eventConfigurations.forEach(({ id: collectionAndId, ...placement }) => {\n // locate the corresponding event/locked time\n const collection = collectionAndId.split('.')[0] == COLLECTION_ID.events ? 'events' : 'lockedTimes';\n const id = collectionAndId.split('.')[1];\n const event = schedule[collection]?.find(x => getVertexId(x, options) == id);\n\n if (!event) {\n warnings.push(`Could not find ${id} (${collectionAndId}) in ${collection} collection.`);\n return;\n }\n\n event.parked = false;\n event.start = moment.utc('1970-01-05T00:00').add(placement.day, 'days').add(placement.start, 'minutes').toISOString();\n event.end = moment.utc('1970-01-05T00:00').add(placement.day, 'days').add(placement.end, 'minutes').toISOString();\n event.duration = placement.end - placement.start;\n\n if (collection == 'events') {\n (event as CoreTypes.Serialized.Event).inLocations = placement.dependencies?.filter(Boolean) ?? [];\n\n // remove from events to be updates\n eventsToUpdate.delete(id);\n }\n });\n\n // check if there are events that were not updated\n if (eventsToUpdate.size) {\n warnings.push(`The following events were not updated: ${[...eventsToUpdate].join(', ')}`);\n }\n\n\n return Object.assign(schedule, {\n meta: {\n ...warnings.length && { warnings: warnings }\n }\n });\n};"],"mappings":";;;;;AAMA,SAAgB,UACd,OACA,UAA0C,IACY;AAEtD,KAAI,CAAC,QAAQ,MAAO,SAAQ,QAAQ;CAEpC,MAAMA,WAAqB;CAE3B,MAAM,WAAsB,MAAM;CAClC,MAAM,sBAAsB,MAAM,QAAQ,GAAG,IAAI;AAEjD,KAAI,CAAC,SAAqB,OAAM,IAAI,MAAM;AAC1C,KAAI,CAAC,oBAAqB,OAAM,IAAI,MAAM;CAG1C,MAAM,iBAAiB,IAAI,IAAI,SAAS,QAAQ,KAAI,MAAK,YAAY,GAAG;AAExE,qBAAoB,SAAS,EAAE,IAAI,gBAAiB,GAAG,gBAAgB;EAErE,MAAM,aAAa,gBAAgB,MAAM,KAAK,MAAM,cAAc,SAAS,WAAW;EACtF,MAAM,KAAa,gBAAgB,MAAM,KAAK;EAC9C,MAAM,QAAQ,SAAS,aAAa,MAAK,MAAK,YAAY,GAAG,YAAY;AAEzE,MAAI,CAAC,OAAO;AACV,YAAS,KAAK,kBAAkB,GAAG,IAAI,gBAAgB,OAAO,WAAW;AACzE;;AAGF,QAAM,SAAW;AACjB,QAAM,QAAW,OAAO,IAAI,oBAAoB,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,OAAO,WAAW;AAC3G,QAAM,MAAW,OAAO,IAAI,oBAAoB,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAO,WAAW;AAC3G,QAAM,WAAW,UAAU,MAAM,UAAU;AAE3C,MAAI,cAAc,UAAU;AAC1B,GAAC,MAAqC,cAAc,UAAU,cAAc,OAAO,YAAY;AAG/F,kBAAe,OAAO;;;AAK1B,KAAI,eAAe,KACjB,UAAS,KAAK,0CAA0C,CAAC,GAAG,gBAAgB,KAAK;AAInF,QAAO,OAAO,OAAO,UAAU,EAC7B,MAAM,EACJ,GAAG,SAAS,UAAU,EAAY"}
1
+ {"version":3,"file":"schedules.js","names":["warnings: string[]"],"sources":["../../../src/RS/from/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport type { Types } from '../types';\nimport { fromId } from '../to/input/util/util';\nimport { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\n\nexport function schedules (\n input: Partial<Types.toOutput>,\n options: Pick<Types.toOptions, 'idKey'> = {}\n): Partial<CoreTypes.SerializedWithOptionalId.Schedule> {\n // set default idKey if not provided\n if (!options.idKey) options.idKey = 'id';\n\n const warnings: string[] = [];\n\n const schedule = input.coreData;\n const eventConfigurations = input.output?.at(0)?.events;\n\n if (!schedule ) throw new Error('Missing `coreData` in input.');\n if (!eventConfigurations) throw new Error('Missing `output.events` in input.');\n\n // check on later to ensure that all events are updated\n const eventsToUpdate = new Set(schedule.events?.map(x => getVertexId(x, options)));\n\n eventConfigurations.forEach(({ id: collectionAndId, ...placement }) => {\n // locate the corresponding event/locked time\n const { collection, entityId: id } = fromId.aggregate(collectionAndId);\n const event = (() => {\n if (collection == 'events') {\n return schedule.events?.find(x => getVertexId(x, options) == id);\n }\n if (collection == 'lockedTimes') {\n return schedule.lockedTimes?.find(x => getVertexId(x, options) == id);\n }\n throw new Error(`Unknown collection \"${collection}\" in id \"${collectionAndId}\"`);\n })();\n\n\n if (!event) {\n warnings.push(`Could not find ${id} (${collectionAndId}) in ${collection} collection.`);\n return;\n }\n\n event.parked = false;\n event.start = moment.utc('1970-01-05T00:00').add(placement.day, 'days').add(placement.start, 'minutes').toISOString();\n event.end = moment.utc('1970-01-05T00:00').add(placement.day, 'days').add(placement.end, 'minutes').toISOString();\n event.duration = placement.end - placement.start;\n\n if (collection == 'events') {\n (event as CoreTypes.Serialized.Event).inLocations = placement.dependencies?.filter(Boolean) ?? [];\n\n // remove from events to be updates\n eventsToUpdate.delete(id);\n }\n });\n\n // check if there are events that were not updated\n if (eventsToUpdate.size) {\n warnings.push(`The following events were not updated: ${[...eventsToUpdate].join(', ')}`);\n }\n\n\n return Object.assign(schedule, {\n meta: {\n ...warnings.length && { warnings: warnings }\n }\n });\n};"],"mappings":";;;;;AAMA,SAAgB,UACd,OACA,UAA0C,IACY;AAEtD,KAAI,CAAC,QAAQ,MAAO,SAAQ,QAAQ;CAEpC,MAAMA,WAAqB;CAE3B,MAAM,WAAsB,MAAM;CAClC,MAAM,sBAAsB,MAAM,QAAQ,GAAG,IAAI;AAEjD,KAAI,CAAC,SAAqB,OAAM,IAAI,MAAM;AAC1C,KAAI,CAAC,oBAAqB,OAAM,IAAI,MAAM;CAG1C,MAAM,iBAAiB,IAAI,IAAI,SAAS,QAAQ,KAAI,MAAK,YAAY,GAAG;AAExE,qBAAoB,SAAS,EAAE,IAAI,gBAAiB,GAAG,gBAAgB;EAErE,MAAM,EAAE,YAAY,UAAU,OAAO,OAAO,UAAU;EACtD,MAAM,eAAe;AACnB,OAAI,cAAc,SAChB,QAAO,SAAS,QAAQ,MAAK,MAAK,YAAY,GAAG,YAAY;AAE/D,OAAI,cAAc,cAChB,QAAO,SAAS,aAAa,MAAK,MAAK,YAAY,GAAG,YAAY;AAEpE,SAAM,IAAI,MAAM,uBAAuB,WAAW,WAAW,gBAAgB;;AAI/E,MAAI,CAAC,OAAO;AACV,YAAS,KAAK,kBAAkB,GAAG,IAAI,gBAAgB,OAAO,WAAW;AACzE;;AAGF,QAAM,SAAW;AACjB,QAAM,QAAW,OAAO,IAAI,oBAAoB,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,OAAO,WAAW;AAC3G,QAAM,MAAW,OAAO,IAAI,oBAAoB,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAO,WAAW;AAC3G,QAAM,WAAW,UAAU,MAAM,UAAU;AAE3C,MAAI,cAAc,UAAU;AAC1B,GAAC,MAAqC,cAAc,UAAU,cAAc,OAAO,YAAY;AAG/F,kBAAe,OAAO;;;AAK1B,KAAI,eAAe,KACjB,UAAS,KAAK,0CAA0C,CAAC,GAAG,gBAAgB,KAAK;AAInF,QAAO,OAAO,OAAO,UAAU,EAC7B,MAAM,EACJ,GAAG,SAAS,UAAU,EAAY"}
@@ -13,7 +13,7 @@ function fromTeachers(teachers, settings, options) {
13
13
  const doc = {
14
14
  id: idOf.teacher(teacher, options),
15
15
  group_type: "personal",
16
- minimizeGaps: false,
16
+ minimizeGaps: settings.minimizeTeacherGaps,
17
17
  minimizeDependencyAlternation: true,
18
18
  weight: teacher.weight,
19
19
  intervals: idOf.intervalPairReference(intervals, rootInterval, options),
@@ -1 +1 @@
1
- {"version":3,"file":"teachers.js","names":["doc: Types.Entities.Group"],"sources":["../../../../src/RS/to/input/teachers.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { parseDayIndices } from './util/parse-days';\nimport { idOf } from './util/util';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromTeachers (\n teachers: ConnectedTypes.teacher[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.Entities.Group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return teachers\n .map(teacher => {\n const intervals = teacher.intervals ?? defaultInterval;\n const rootInterval = teacher.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.Entities.Group = {\n id: idOf.teacher(teacher, options),\n group_type: 'personal',\n minimizeGaps: false,\n minimizeDependencyAlternation: true,\n weight: teacher.weight,\n intervals: idOf.intervalPairReference(intervals, rootInterval, options),\n days: parseDayIndices(teacher.days, settings),\n blockedTimes: teacher.lockedTimes?.map(x => idOf.lockedTime(x, options)),\n minBreakDuration: teacher.minBreakLength,\n ...parseMaxWorkingHours(teacher),\n };\n\n if (options.includeEntityMeta) {\n doc.name = teacher.displayName;\n }\n\n return omitBy(doc, x => x == null) as Types.Entities.Group;\n });\n};\n"],"mappings":";;;;;;;AAQA,SAAgB,aACd,UACA,UACA,SACwB;CACxB,MAAM,kBAAkB,mBAAmB;AAE3C,QAAO,SACJ,KAAI,YAAW;EACd,MAAM,YAAe,QAAQ,aAAgB;EAC7C,MAAM,eAAe,QAAQ,gBAAgB,SAAS;EAEtD,MAAMA,MAA4B;GAChC,IAA+B,KAAK,QAAQ,SAAS;GACrD,YAA+B;GAC/B,cAA+B;GAC/B,+BAA+B;GAC/B,QAA+B,QAAQ;GACvC,WAA+B,KAAK,sBAAsB,WAAW,cAAc;GACnF,MAA+B,gBAAgB,QAAQ,MAAM;GAC7D,cAA+B,QAAQ,aAAa,KAAI,MAAK,KAAK,WAAW,GAAG;GAChF,kBAA+B,QAAQ;GACvC,GAAG,qBAAqB;;AAG1B,MAAI,QAAQ,kBACV,KAAI,OAAO,QAAQ;AAGrB,SAAO,OAAO,MAAK,MAAK,KAAK"}
1
+ {"version":3,"file":"teachers.js","names":["doc: Types.Entities.Group"],"sources":["../../../../src/RS/to/input/teachers.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { parseDayIndices } from './util/parse-days';\nimport { idOf } from './util/util';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromTeachers (\n teachers: ConnectedTypes.teacher[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.Entities.Group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return teachers\n .map(teacher => {\n const intervals = teacher.intervals ?? defaultInterval;\n const rootInterval = teacher.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.Entities.Group = {\n id: idOf.teacher(teacher, options),\n group_type: 'personal',\n minimizeGaps: settings.minimizeTeacherGaps,\n minimizeDependencyAlternation: true,\n weight: teacher.weight,\n intervals: idOf.intervalPairReference(intervals, rootInterval, options),\n days: parseDayIndices(teacher.days, settings),\n blockedTimes: teacher.lockedTimes?.map(x => idOf.lockedTime(x, options)),\n minBreakDuration: teacher.minBreakLength,\n ...parseMaxWorkingHours(teacher),\n };\n\n if (options.includeEntityMeta) {\n doc.name = teacher.displayName;\n }\n\n return omitBy(doc, x => x == null) as Types.Entities.Group;\n });\n};\n"],"mappings":";;;;;;;AAQA,SAAgB,aACd,UACA,UACA,SACwB;CACxB,MAAM,kBAAkB,mBAAmB;AAE3C,QAAO,SACJ,KAAI,YAAW;EACd,MAAM,YAAe,QAAQ,aAAgB;EAC7C,MAAM,eAAe,QAAQ,gBAAgB,SAAS;EAEtD,MAAMA,MAA4B;GAChC,IAA+B,KAAK,QAAQ,SAAS;GACrD,YAA+B;GAC/B,cAA+B,SAAS;GACxC,+BAA+B;GAC/B,QAA+B,QAAQ;GACvC,WAA+B,KAAK,sBAAsB,WAAW,cAAc;GACnF,MAA+B,gBAAgB,QAAQ,MAAM;GAC7D,cAA+B,QAAQ,aAAa,KAAI,MAAK,KAAK,WAAW,GAAG;GAChF,kBAA+B,QAAQ;GACvC,GAAG,qBAAqB;;AAG1B,MAAI,QAAQ,kBACV,KAAI,OAAO,QAAQ;AAGrB,SAAO,OAAO,MAAK,MAAK,KAAK"}
@@ -18,6 +18,21 @@ const COLLECTION_ID = {
18
18
  events: "events",
19
19
  lockedTimes: "lockedtimes"
20
20
  };
21
+ const COLLECTION_BY_ID = Object.fromEntries(Object.entries(COLLECTION_ID).map(([collection, id]) => [id, collection]));
22
+ function parseAggregateId(aggregateId, expectedCollection) {
23
+ const indexOfDot = aggregateId.indexOf(".");
24
+ if (indexOfDot == -1) throw new Error(`(RS::To::fromId) Missing collection separator in aggregate id "${aggregateId}"`);
25
+ const collectionId = aggregateId.substring(0, indexOfDot).toLowerCase();
26
+ const entityId = aggregateId.substring(indexOfDot + 1);
27
+ if (!entityId) throw new Error(`(RS::To::fromId) Missing entity id in aggregate id "${aggregateId}"`);
28
+ const collection = COLLECTION_BY_ID[collectionId];
29
+ if (!collection) throw new Error(`(RS::To::fromId) Unknown collection id "${collectionId}" in aggregate id "${aggregateId}"`);
30
+ if (expectedCollection && collection != expectedCollection) throw new Error(`(RS::To::fromId) Expected collection "${expectedCollection}" but got "${collection}" in aggregate id "${aggregateId}"`);
31
+ return {
32
+ collection,
33
+ entityId
34
+ };
35
+ }
21
36
  let idOf;
22
37
  (function(_idOf) {
23
38
  function person(person$1, options) {
@@ -53,7 +68,34 @@ let idOf;
53
68
  }
54
69
  _idOf.intervalPairReference = intervalPairReference;
55
70
  })(idOf || (idOf = {}));
71
+ let fromId;
72
+ (function(_fromId) {
73
+ function aggregate(aggregateId) {
74
+ return parseAggregateId(aggregateId);
75
+ }
76
+ _fromId.aggregate = aggregate;
77
+ function person(aggregateId) {
78
+ return parseAggregateId(aggregateId, "persons").entityId;
79
+ }
80
+ _fromId.person = person;
81
+ function group(aggregateId) {
82
+ return parseAggregateId(aggregateId, "groups").entityId;
83
+ }
84
+ _fromId.group = group;
85
+ function teacher(aggregateId) {
86
+ return parseAggregateId(aggregateId, "teachers").entityId;
87
+ }
88
+ _fromId.teacher = teacher;
89
+ function event(aggregateId) {
90
+ return parseAggregateId(aggregateId, "events").entityId;
91
+ }
92
+ _fromId.event = event;
93
+ function lockedTime(aggregateId) {
94
+ return parseAggregateId(aggregateId, "lockedTimes").entityId;
95
+ }
96
+ _fromId.lockedTime = lockedTime;
97
+ })(fromId || (fromId = {}));
56
98
 
57
99
  //#endregion
58
- export { COLLECTION_ID, idOf, min2hrs, toTimeFloat };
100
+ export { COLLECTION_ID, fromId, idOf, min2hrs, toTimeFloat };
59
101
  //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","names":["person","group","teacher","event","lockedTime"],"sources":["../../../../../src/RS/to/input/util/util.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport type { Collection } from '../../../../core/types/common';\nimport { getVertexId } from '../../../../core/util';\nimport type { GroupWithExclude } from '../../../../core/interfaces/vertices/util/edges';\nimport type { Interval } from '../../../../core/interfaces';\n\nexport function min2hrs (min: number | undefined | null) {\n if (min == null) return;\n return min / 60;\n}\n\n/**\n * Converts a time string in the format \"HH:MM\" to a float representation, e.g., \"12:30\" becomes 12.3.\n */\nexport function toTimeFloat (str: string) {\n return parseFloat(str.replace(':', '.'));\n}\n\nexport function getPeriodIndex (\n period: ConnectedTypes.period | string | undefined | null,\n periodsMap: Map<string | undefined, number>,\n options: Types.parsedToOptions\n): number | undefined {\n // if no periods exist, return undefined\n if (periodsMap.size == 0) return;\n\n // if no period is given, return undefined\n if (!period) return;\n\n const id = getVertexId(period, options);\n const periodIndex = periodsMap.get(id);\n if (periodIndex === undefined) {\n throw new Error(`(RS::To::getPeriodIndex) Period \"${id}\" is not in periodsMap`);\n }\n return periodIndex;\n}\n\nexport const COLLECTION_ID = {\n persons: 'persons',\n groups: 'groups',\n teachers: 'teachers',\n events: 'events',\n lockedTimes: 'lockedtimes',\n} satisfies Partial<Record<Collection, string>>;\n\n/**\n * returns a combined id for the vertex or edge by combining the type(s) and id(s).\n */\nexport namespace idOf {\n /** `persons.id` */\n export function person (\n person: ConnectedTypes.person | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.persons}.${ getVertexId(person, options) }`;\n }\n\n /** `groups.id` */\n export function group (\n group: ConnectedTypes.group,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group, options) }`;\n }\n\n /** `teachers.id` */\n export function teacher (\n teacher: ConnectedTypes.teacher,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.teachers}.${ getVertexId(teacher, options) }`;\n }\n\n /** `events.id` */\n export function event (\n event: ConnectedTypes.event,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.events}.${ getVertexId(event, options) }`;\n }\n\n /** `lockedtimes.id` */\n export function lockedTime (\n lockedTime: ConnectedTypes.lockedTime,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.lockedTimes}.${ getVertexId(lockedTime, options) }`;\n }\n\n /** `groups.id<.exclude.id1.id2...>` */\n export function groupReference (\n group: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group.to, options) }`\n + (group.exclude?.length\n ? '.exclude.' + group.exclude\n .map(x => getVertexId(x, options))\n .sort()\n .join('.')\n : '');\n }\n\n /** `<rootIntervalsId&>JSON.stringify(intervals)>` */\n export function intervalPairReference (\n interval: Interval[] | undefined,\n rootInterval: ConnectedTypes.rootInterval | undefined,\n options: Types.parsedToOptions\n ): string {\n // replace null with undefined\n if (interval === null) interval = undefined;\n if (rootInterval === null) rootInterval = undefined;\n\n // replace empty intervals with undefined\n if (interval && interval.length == 0) interval = undefined;\n\n const out = (rootInterval ? getVertexId(rootInterval, options) + '&' : '') + JSON.stringify(interval);\n return out;\n }\n}\n"],"mappings":";;;AAOA,SAAgB,QAAS,KAAgC;AACvD,KAAI,OAAO,KAAM;AACjB,QAAO,MAAM;;;;;AAMf,SAAgB,YAAa,KAAa;AACxC,QAAO,WAAW,IAAI,QAAQ,KAAK;;AAsBrC,MAAa,gBAAgB;CAC3B,SAAa;CACb,QAAa;CACb,UAAa;CACb,QAAa;CACb,aAAa;;;;CAQN,SAAS,OACd,UACA,SACQ;AACR,SAAO,GAAG,cAAc,QAAQ,GAAI,YAAYA,UAAQ;;;CAInD,SAAS,MACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYC,SAAO;;;CAIjD,SAAS,QACd,WACA,SACQ;AACR,SAAO,GAAG,cAAc,SAAS,GAAI,YAAYC,WAAS;;;CAIrD,SAAS,MACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYC,SAAO;;;CAIjD,SAAS,WACd,cACA,SACQ;AACR,SAAO,GAAG,cAAc,YAAY,GAAI,YAAYC,cAAY;;;CAI3D,SAAS,eACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYH,QAAM,IAAI,cACpDA,QAAM,SAAS,SACd,cAAcA,QAAM,QACnB,KAAI,MAAK,YAAY,GAAG,UACxB,OACA,KAAK,OACN;;;CAID,SAAS,sBACd,UACA,cACA,SACQ;AAER,MAAI,aAAiB,KAAM,YAAe;AAC1C,MAAI,iBAAiB,KAAM,gBAAe;AAG1C,MAAI,YAAY,SAAS,UAAU,EAAG,YAAW;EAEjD,MAAM,OAAO,eAAe,YAAY,cAAc,WAAW,MAAM,MAAM,KAAK,UAAU;AAC5F,SAAO"}
1
+ {"version":3,"file":"util.js","names":["person","group","teacher","event","lockedTime"],"sources":["../../../../../src/RS/to/input/util/util.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport type { Collection } from '../../../../core/types/common';\nimport { getVertexId } from '../../../../core/util';\nimport type { GroupWithExclude } from '../../../../core/interfaces/vertices/util/edges';\nimport type { Interval } from '../../../../core/interfaces';\n\nexport function min2hrs (min: number | undefined | null) {\n if (min == null) return;\n return min / 60;\n}\n\n/**\n * Converts a time string in the format \"HH:MM\" to a float representation, e.g., \"12:30\" becomes 12.3.\n */\nexport function toTimeFloat (str: string) {\n return parseFloat(str.replace(':', '.'));\n}\n\nexport function getPeriodIndex (\n period: ConnectedTypes.period | string | undefined | null,\n periodsMap: Map<string | undefined, number>,\n options: Types.parsedToOptions\n): number | undefined {\n // if no periods exist, return undefined\n if (periodsMap.size == 0) return;\n\n // if no period is given, return undefined\n if (!period) return;\n\n const id = getVertexId(period, options);\n const periodIndex = periodsMap.get(id);\n if (periodIndex === undefined) {\n throw new Error(`(RS::To::getPeriodIndex) Period \"${id}\" is not in periodsMap`);\n }\n return periodIndex;\n}\n\nexport const COLLECTION_ID = {\n persons: 'persons' as const,\n groups: 'groups' as const,\n teachers: 'teachers' as const,\n events: 'events' as const,\n lockedTimes: 'lockedtimes' as const,\n} satisfies Partial<Record<Collection, string>>;\n\n/**\n * a type generic that inverses a record type, i.e., { a: 'x', b: 'y' } becomes { x: 'a', y: 'b' }\n */\ntype InverseRecord<T extends Record<string, string>> = {\n [K in keyof T as T[K]]: K\n};\n\nconst COLLECTION_BY_ID = Object.fromEntries(Object.entries(COLLECTION_ID).map(([collection, id]) => [id, collection])) as InverseRecord<typeof COLLECTION_ID>;\n\n\nexport type AggregateCollection = keyof typeof COLLECTION_ID;\n\ntype AggregateIdParts<TCollection extends AggregateCollection = AggregateCollection> = {\n collection: TCollection\n entityId: string\n};\n\n\nfunction parseAggregateId<TCollection extends AggregateCollection = AggregateCollection> (\n aggregateId: string,\n expectedCollection?: TCollection\n): AggregateIdParts<TCollection> {\n const indexOfDot = aggregateId.indexOf('.');\n if (indexOfDot == -1) {\n throw new Error(`(RS::To::fromId) Missing collection separator in aggregate id \"${aggregateId}\"`);\n }\n\n const collectionId = aggregateId.substring(0, indexOfDot).toLowerCase() as keyof typeof COLLECTION_BY_ID;\n const entityId = aggregateId.substring(indexOfDot + 1);\n\n if (!entityId) {\n throw new Error(`(RS::To::fromId) Missing entity id in aggregate id \"${aggregateId}\"`);\n }\n\n const collection = COLLECTION_BY_ID[collectionId];\n if (!collection) {\n throw new Error(`(RS::To::fromId) Unknown collection id \"${collectionId}\" in aggregate id \"${aggregateId}\"`);\n }\n\n if (expectedCollection && collection != expectedCollection) {\n throw new Error(`(RS::To::fromId) Expected collection \"${expectedCollection}\" but got \"${collection}\" in aggregate id \"${aggregateId}\"`);\n }\n\n return {\n collection: collection as TCollection,\n entityId,\n };\n}\n\n/**\n * returns a combined id for the vertex or edge by combining the type(s) and id(s).\n */\nexport namespace idOf {\n /** `persons.id` */\n export function person (\n person: ConnectedTypes.person | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.persons}.${ getVertexId(person, options) }`;\n }\n\n /** `groups.id` */\n export function group (\n group: ConnectedTypes.group | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group, options) }`;\n }\n\n /** `teachers.id` */\n export function teacher (\n teacher: ConnectedTypes.teacher | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.teachers}.${ getVertexId(teacher, options) }`;\n }\n\n /** `events.id` */\n export function event (\n event: ConnectedTypes.event | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.events}.${ getVertexId(event, options) }`;\n }\n\n /** `lockedtimes.id` */\n export function lockedTime (\n lockedTime: ConnectedTypes.lockedTime | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.lockedTimes}.${ getVertexId(lockedTime, options) }`;\n }\n\n /** `groups.id<.exclude.id1.id2...>` */\n export function groupReference (\n group: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group.to, options) }`\n + (group.exclude?.length\n ? '.exclude.' + group.exclude\n .map(x => getVertexId(x, options))\n .sort()\n .join('.')\n : '');\n }\n\n /** `<rootIntervalsId&>JSON.stringify(intervals)>` */\n export function intervalPairReference (\n interval: Interval[] | undefined,\n rootInterval: ConnectedTypes.rootInterval | undefined,\n options: Types.parsedToOptions\n ): string {\n // replace null with undefined\n if (interval === null) interval = undefined;\n if (rootInterval === null) rootInterval = undefined;\n\n // replace empty intervals with undefined\n if (interval && interval.length == 0) interval = undefined;\n\n const out = (rootInterval ? getVertexId(rootInterval, options) + '&' : '') + JSON.stringify(interval);\n return out;\n }\n}\n\nexport namespace fromId {\n export function aggregate (aggregateId: string): AggregateIdParts {\n return parseAggregateId(aggregateId);\n }\n\n /** `persons.id` -> `id` */\n export function person (aggregateId: string): string {\n return parseAggregateId(aggregateId, 'persons').entityId;\n }\n\n /** `groups.id` -> `id` */\n export function group (aggregateId: string): string {\n return parseAggregateId(aggregateId, 'groups').entityId;\n }\n\n /** `teachers.id` -> `id` */\n export function teacher (aggregateId: string): string {\n return parseAggregateId(aggregateId, 'teachers').entityId;\n }\n\n /** `events.id` -> `id` */\n export function event (aggregateId: string): string {\n return parseAggregateId(aggregateId, 'events').entityId;\n }\n\n /** `lockedtimes.id` -> `id` */\n export function lockedTime (aggregateId: string): string {\n return parseAggregateId(aggregateId, 'lockedTimes').entityId;\n }\n}\n"],"mappings":";;;AAOA,SAAgB,QAAS,KAAgC;AACvD,KAAI,OAAO,KAAM;AACjB,QAAO,MAAM;;;;;AAMf,SAAgB,YAAa,KAAa;AACxC,QAAO,WAAW,IAAI,QAAQ,KAAK;;AAsBrC,MAAa,gBAAgB;CAC3B,SAAa;CACb,QAAa;CACb,UAAa;CACb,QAAa;CACb,aAAa;;AAUf,MAAM,mBAAmB,OAAO,YAAY,OAAO,QAAQ,eAAe,KAAK,CAAC,YAAY,QAAQ,CAAC,IAAI;AAWzG,SAAS,iBACP,aACA,oBAC+B;CAC/B,MAAM,aAAa,YAAY,QAAQ;AACvC,KAAI,cAAc,GAChB,OAAM,IAAI,MAAM,kEAAkE,YAAY;CAGhG,MAAM,eAAe,YAAY,UAAU,GAAG,YAAY;CAC1D,MAAM,WAAW,YAAY,UAAU,aAAa;AAEpD,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,uDAAuD,YAAY;CAGrF,MAAM,aAAa,iBAAiB;AACpC,KAAI,CAAC,WACH,OAAM,IAAI,MAAM,2CAA2C,aAAa,qBAAqB,YAAY;AAG3G,KAAI,sBAAsB,cAAc,mBACtC,OAAM,IAAI,MAAM,yCAAyC,mBAAmB,aAAa,WAAW,qBAAqB,YAAY;AAGvI,QAAO;EACO;EACZ;;;;;CASK,SAAS,OACd,UACA,SACQ;AACR,SAAO,GAAG,cAAc,QAAQ,GAAI,YAAYA,UAAQ;;;CAInD,SAAS,MACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYC,SAAO;;;CAIjD,SAAS,QACd,WACA,SACQ;AACR,SAAO,GAAG,cAAc,SAAS,GAAI,YAAYC,WAAS;;;CAIrD,SAAS,MACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYC,SAAO;;;CAIjD,SAAS,WACd,cACA,SACQ;AACR,SAAO,GAAG,cAAc,YAAY,GAAI,YAAYC,cAAY;;;CAI3D,SAAS,eACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYH,QAAM,IAAI,cACpDA,QAAM,SAAS,SACd,cAAcA,QAAM,QACnB,KAAI,MAAK,YAAY,GAAG,UACxB,OACA,KAAK,OACN;;;CAID,SAAS,sBACd,UACA,cACA,SACQ;AAER,MAAI,aAAiB,KAAM,YAAe;AAC1C,MAAI,iBAAiB,KAAM,gBAAe;AAG1C,MAAI,YAAY,SAAS,UAAU,EAAG,YAAW;EAEjD,MAAM,OAAO,eAAe,YAAY,cAAc,WAAW,MAAM,MAAM,KAAK,UAAU;AAC5F,SAAO;;;;;;CAKF,SAAS,UAAW,aAAuC;AAChE,SAAO,iBAAiB;;;CAInB,SAAS,OAAQ,aAA6B;AACnD,SAAO,iBAAiB,aAAa,WAAW;;;CAI3C,SAAS,MAAO,aAA6B;AAClD,SAAO,iBAAiB,aAAa,UAAU;;;CAI1C,SAAS,QAAS,aAA6B;AACpD,SAAO,iBAAiB,aAAa,YAAY;;;CAI5C,SAAS,MAAO,aAA6B;AAClD,SAAO,iBAAiB,aAAa,UAAU;;;CAI1C,SAAS,WAAY,aAA6B;AACvD,SAAO,iBAAiB,aAAa,eAAe"}
@@ -7,7 +7,7 @@ import { PlannedScheduledDuration } from "../../core/interfaces/vertices/propert
7
7
  import { MinBreakLength } from "../../core/interfaces/vertices/properties/min-break-length.js";
8
8
  import { Schedule } from "./types/schedule.js";
9
9
  import { Types } from "./types/index.js";
10
- import * as moment5 from "moment";
10
+ import * as moment1 from "moment";
11
11
 
12
12
  //#region src/SchoolSoft/api/index.d.ts
13
13
  declare class Map {
@@ -286,8 +286,8 @@ declare class Map {
286
286
  createdAt?: string | undefined;
287
287
  updatedAt?: string | undefined;
288
288
  lastModifiedBy?: string | undefined;
289
- start?: (moment5.Moment | string) | undefined;
290
- end?: (moment5.Moment | string) | undefined;
289
+ start?: (moment1.Moment | string) | undefined;
290
+ end?: (moment1.Moment | string) | undefined;
291
291
  potentialCenter?: string | undefined;
292
292
  type?: string | undefined;
293
293
  tags?: Tag[] | undefined;
@@ -341,8 +341,8 @@ declare class Map {
341
341
  createdAt?: string | undefined;
342
342
  updatedAt?: string | undefined;
343
343
  lastModifiedBy?: string | undefined;
344
- start?: (moment5.Moment | string) | undefined;
345
- end?: (moment5.Moment | string) | undefined;
344
+ start?: (moment1.Moment | string) | undefined;
345
+ end?: (moment1.Moment | string) | undefined;
346
346
  potentialCenter?: string | undefined;
347
347
  type?: string | undefined;
348
348
  tags?: Tag[] | undefined;
@@ -1,12 +1,12 @@
1
1
  import { BaseOptions } from "../../../common/types.js";
2
2
  import { Types } from "../../../core/types/index.js";
3
- import * as xlsx1 from "xlsx";
3
+ import * as xlsx0 from "xlsx";
4
4
 
5
5
  //#region src/SchoolSoft/file/to/index.d.ts
6
6
  declare class export_default {
7
7
  static schedules: (schedule: Types.Mixed.Schedule & {
8
8
  division?: Types.Mixed.Division;
9
- }, options?: BaseOptions) => xlsx1.WorkBook;
9
+ }, options?: BaseOptions) => xlsx0.WorkBook;
10
10
  }
11
11
  //#endregion
12
12
  export { export_default };
@@ -181,7 +181,7 @@ var schedules_default = (data, options = {}) => {
181
181
  "Week (7109)": "",
182
182
  "ActualWeeks (7167)": period?.ranges?.map((range) => `${moment.utc(range.start).week()}-${moment.utc(range.end).week()}`).join(",")
183
183
  };
184
- }) ?? [];
184
+ }).filter(Boolean) ?? [];
185
185
  csv += `${papaOptions.newline}Lesson (7100)${papaOptions.newline}[Rows]${papaOptions.newline}`;
186
186
  if (e.length) csv += Papa.unparse(e, papaOptions);
187
187
  else csv += [
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["t","teachers","g","groups","locations"],"sources":["../../../../src/Skola24/txt/to/schedules.ts"],"sourcesContent":["import Papa from 'papaparse';\nimport moment from 'moment';\nimport { isString } from 'lodash-es';\nimport type { CoreTypes } from '../../../core';\nimport type { BaseOptions } from '../../../common/types';\nimport { getVertexId } from '../../../core/util';\nimport { isMongooseObjectId } from '../../../common/functions';\n\nconst papaOptions = {\n quotes: false, //or array of booleans\n quoteChar: '\"',\n escapeChar: '\"',\n delimiter: '\\t',\n header: true,\n newline: '\\r\\n',\n skipEmptyLines: false, //other option is 'greedy', meaning skip delimiters, quotes, and whitespace.\n // columns: null //or array of strings\n} as Papa.UnparseConfig;\n\nconst uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\nexport default (\n data: CoreTypes.Mixed.Schedule,\n options: BaseOptions = {}\n): string => {\n const { locations, teachers, groups, persons, events, courses, periods, syllabuses, divisions } = data;\n const { start, /* end, */ displayName } = divisions ?? data as unknown as CoreTypes.Mixed.Division;\n\n const startYear = moment.utc(start).year();\n const startMonth = moment.utc(start).month();\n\n // Set cvs to the source section\n let csv = `[Source]${papaOptions.newline}ApplicationVerMajor=4${papaOptions.newline}ApplicationVerMinor=0${papaOptions.newline}DatabaseRevNo=527${papaOptions.newline}CurrentNovaschemDatabase=${papaOptions.newline}User=${papaOptions.newline}`;\n csv += `SchoolID=RS${papaOptions.newline}School=${displayName}${papaOptions.newline}County=RS${papaOptions.newline}`;\n csv += `BaseYear=${startYear}${papaOptions.newline}OffsetYear=0${papaOptions.newline}OffsetMonth=${startMonth}${papaOptions.newline}CreationDate=${moment().format('YYYY-MM-DD')}${papaOptions.newline}${papaOptions.newline}`;\n // add destination section to csv\n csv += `[Destination]${papaOptions.newline}Application=${papaOptions.newline}ApplicationID=${papaOptions.newline}${papaOptions.newline}`;\n\n // add database options to csv\n csv += `[DatabaseOptions]${papaOptions.newline}Update=TRUE${papaOptions.newline}AddNew=TRUE${papaOptions.newline}${papaOptions.newline}`;\n\n // start tables section\n csv += `[Tables]${papaOptions.newline}${papaOptions.newline}`;\n\n // append teachers to csv\n const t = teachers?.map(teacher => {\n return {\n 'Teacher (6001)': teacher.signature,\n 'GUID (5800)': (teacher.ids && uuid.test(teacher.ids)) ? `{${teacher.ids}}` : '',\n 'Category (6002)': '',\n 'Title (6006)': '',\n 'Phone (6033)': '',\n 'EvaluationNumber (6014)': '',\n ... 'person' in teacher && typeof teacher.person == 'object'\n ? {\n 'PersonalCode (6028)': 'SSN' in teacher.person ? (teacher.person?.SSN?.value ?? '') : '',\n 'LastName (6003)': 'lastName' in teacher.person ? (teacher.person?.lastName ?? '') : '',\n 'FirstName (6004)': 'firstName' in teacher.person ? (teacher.person?.firstName ?? '') : '',\n 'EMail (6034)': 'emails' in teacher.person ? (teacher.person?.emails?.[0]?.value ?? '') : '',\n }\n : null\n };\n }) ?? [];\n csv += `${papaOptions.newline}Teacher (6000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (t.length) {\n csv += Papa.unparse(t, papaOptions);\n } else {\n csv += ['Teacher (6001)', 'GUID (5800)', 'Category (6002)', 'PersonalCode (6028)', 'LastName (6003)', 'Title (6006)', 'FirstName (6004)', 'Phone (6033)', 'EMail (6034)', 'EvaluationNumber (6014)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append students to csv\n const s = persons?.filter(person => {\n return person.type != 'Teacher';\n }).map(person => {\n return {\n 'Student (7201)': person.SSN?.value,\n 'GUID (5800)': (person.ids && uuid.test(person.ids)) ? `{${person.ids}}` : '',\n 'Category (7305)': '',\n 'LastName (7202)': person.lastName ?? '',\n 'FirstName (7211)': person.firstName ?? '',\n 'EMail (7215)': person.emails?.[0]?.value ?? ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}Student (7200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (s.length) {\n csv += Papa.unparse(s, papaOptions);\n } else {\n csv += ['Student (7201)', 'GUID (5800)', 'Category (7305)', 'LastName (7202)', 'FirstName (7211)', 'EMail (7215)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // create a map of students.id to students.SSN\n const studentMap = new Map(persons?.filter(x => x.type != 'Teacher').map(x => [getVertexId(x, options), x.SSN?.value ?? '']));\n\n // append groups to csv\n const g = groups?.map(group => {\n return {\n 'Group (6201)': group.displayName!,\n 'GUID (5800)': (group.ids && uuid.test(group.ids)) ? `{${group.ids}}` : '',\n 'Class (6210)': group.species == 'class' ? 1 : 0,\n 'Teacher (6204)': '',\n 'IClass (6206)': '',\n 'Student (6205)': group.members?.map(x => getVertexId(x, options)).map(x => studentMap.get(x)).filter(Boolean).join(',')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Group (6200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (g.length) {\n csv += Papa.unparse(g, papaOptions);\n } else {\n csv += ['Group (6201)', 'GUID (5800)', 'Class (6210)', 'Teacher (6204)', 'IClass (6206)', 'Student (6205)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append locations to csv\n const l = locations?.map(location => {\n return {\n 'Room (6601)': location.displayName!,\n 'GUID (5800)': (location.ids && uuid.test(location.ids)) ? `{${location.ids}}` : '',\n 'Category (6602)': location.tags?.find(tag => tag.type == 'category')?.value ?? '',\n 'SeatingCapacity (6607)': location.maximumCapacity,\n };\n }) ?? [];\n csv += `${papaOptions.newline}Room (6600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (l.length) {\n csv += Papa.unparse(l, papaOptions);\n } else {\n csv += ['Room (6601)', 'GUID (5800)', 'Category (6602)', 'SeatingCapacity (6607)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append periods to csv\n const p = periods?.map(period => {\n return {\n 'Period (8001)': period.displayName!,\n 'GUID (5800)': (period.ids && uuid.test(period.ids)) ? `{${period.ids}}` : '',\n 'TextBelowSchedule (8002)': period.displayName!,\n 'Category (8006)': '',\n 'Calendar (8005)': period.ranges?.map(range => `${moment.utc(range.start).format('D/M')}-${moment.utc(range.end).format('D/M')}`).join(', ')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Period (8000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (p.length) {\n csv += Papa.unparse(p, papaOptions);\n } else {\n csv += ['Period (8001)', 'GUID (5800)', 'TextBelowSchedule (8002)', 'Category (8006)', 'Calendar (8005)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const courseMap = new Map(data.courses ?.map(x => [getVertexId(x, options), x]));\n const periodMap = new Map(data.periods ?.map(x => [getVertexId(x, options), x]));\n const teacherMap = new Map(data.teachers ?.map(x => [getVertexId(x, options), x]));\n const groupMap = new Map(data.groups ?.map(x => [getVertexId(x, options), x]));\n const locationMap = new Map(data.locations ?.map(x => [getVertexId(x, options), x]));\n const syllabusMap = new Map(data.syllabuses?.map(x => [getVertexId(x, options), x]));\n\n // append lessons to csv\n const e = events\n // ?.filter(x => !isNaN(Date.parse(x.start?.toString() ?? '')))\n .map((event, index) => {\n if (!event.start || !event.end) return;\n\n const courseId = event.course ? getVertexId(event.course, options) : undefined;\n const course = courseId ? courseMap.get(courseId) : undefined;\n\n // Only use deserialize period\n let period = event.period == null ? course?.period : event.period;\n if (isString(period))\n period = periodMap.get(period);\n if ((period && !('ranges' in period)))\n period = undefined;\n\n // Only use deserialize teachers\n const t = event.teachers == null ? course?.teachers : event.teachers;\n const teacherIds = t?.map(x => getVertexId(x.to, options));\n const teachers = teacherIds?.map(id => teacherMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const g = event.groups == null ? course?.groups : event.groups;\n const groupIds = g?.map(x => getVertexId(x.to, options));\n const groups = groupIds?.map(id => groupMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize locations\n const locationIds = event.inLocations?.map(x => x ? getVertexId(x, options) : null).filter(x => x != null);\n const locations = locationIds?.map(id => locationMap.get(id)).filter(Boolean) ?? [];\n const dayOfWeek = moment.utc(event.start).toDate().toLocaleDateString('sv-SE', { weekday: 'long', timeZone: 'UTC' });\n\n // Syllabus of the course\n const syllabusId = isString(course?.syllabus)\n ? course.syllabus\n : (course?.syllabus && isMongooseObjectId(course.syllabus))\n ? course.syllabus.toString()\n : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n // capitalize first letter of dayOfWeek\n const dayOfWeekCapitalized = dayOfWeek.charAt(0).toUpperCase() + dayOfWeek.slice(1);\n return {\n 'PK (7100)': index + 1,\n 'GUID (5800)': (event.ids && uuid.test(event.ids)) ? `{${event.ids}}` : '',\n 'DayOfWeek (7101)': dayOfWeekCapitalized,\n 'Starttime (7102)': moment.utc(event.start).format('HH:mm'),\n 'Length (7115)': event.duration,\n 'Course (7106)': syllabus?.courseCode,\n 'Subject (7103)': syllabus?.subjectCode ?? course?.subject ?? '',\n 'Teacher (7104)': teachers ?.map(x => x?.signature ).filter(Boolean).join(','),\n 'Group (7105)': groups ?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Room (7107)': locations?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Period (7108)': '',\n 'Week (7109)': '',\n 'ActualWeeks (7167)': period?.ranges?.map(range => `${moment.utc(range.start).week()}-${moment.utc(range.end).week()}`).join(',')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Lesson (7100)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (e.length) {\n csv += Papa.unparse(e, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append subjects to csv, is empty for now\n // csv += `Subject (6400)${options.newline}[Rows]${options.newline}`;\n // csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(options.delimiter);\n // csv += options.newline;\n\n // append syllabus to csv\n const courseSyllabuses = syllabuses?.filter(syllabus => !!syllabus.courseName).map(syllabus => {\n return {\n 'Course (7601)': syllabus.courseCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (7602)': syllabus.courseName,\n 'Subject (7603)': syllabus.subjectCode ?? '',\n 'Points (7604)': syllabus.points\n };\n }) ?? [];\n csv += `${papaOptions.newline}Course (7600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (courseSyllabuses.length) {\n csv += Papa.unparse(courseSyllabuses, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const subjectSyllabuses = syllabuses?.reduce((unique, syllabus) => {\n if (syllabus.subjectCode && !unique.seen.has(syllabus.subjectCode)) {\n unique.seen.add(syllabus.subjectCode);\n unique.result.push({\n 'Subject (6401)': syllabus.subjectCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (6403)': syllabus.subjectName,\n });\n }\n return unique;\n }, {\n seen: new Set<string>(),\n result: [] as Array<{\n 'Subject (6401)': string;\n 'GUID (5800)': string | undefined;\n 'FullText (6403)': string;\n }>\n })?.result ?? [];\n csv += `Subject (6400)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (subjectSyllabuses.length) {\n csv += Papa.unparse(subjectSyllabuses, papaOptions);\n } else {\n csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(papaOptions.delimiter);\n }\n\n const totalHoursRegex = /(\\d+) hrs/;\n const weekTimeRegex = /(\\d+) min\\/week/;\n const c = courses?.map(course => {\n // Only use deserialize teachers\n const teacherIds = course.teachers?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const teachers = teacherIds?.map(id => teacherMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const groupIds = course.groups?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const groups = groupIds?.map(id => groupMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize syllabus\n const syllabusId = isString(course?.syllabus)\n ? course.syllabus\n : (course?.syllabus && isMongooseObjectId(course.syllabus))\n ? course.syllabus.toString()\n : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n return {\n 'PK (8200)': '',\n 'GUID (5800)': course.ids,\n 'OriginalRecord (8224)': '1',\n 'CreateLesson (8227)': '1',\n 'Course (8202)': syllabus?.courseCode,\n 'Subject (8209)': syllabus?.subjectCode ?? course.subject, // Nikos ansvarig för framtida buggar\n 'Teacher (8210)': teachers?.map(teacher => teacher.signature).filter(Boolean).join(','),\n 'Group (8203)': groups?.map(group => group.displayName).filter(Boolean).join(','),\n 'TotalHours (8204)': (course.plannedDuration && totalHoursRegex.test(course.plannedDuration)) ? totalHoursRegex.exec(course.plannedDuration)![1] : '',\n 'Weektime (8208)': (course.plannedDuration && weekTimeRegex.test(course.plannedDuration)) ? weekTimeRegex.exec(course.plannedDuration)![1] : '',\n 'Blockname (8215)': '',\n 'Period (8206)': '',\n 'Week (8207)': '',\n 'NotPeriod (8212)': '',\n 'NotWeek (8213)': ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}TA (8200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (c.length) {\n csv += Papa.unparse(c, papaOptions);\n } else {\n csv += ['Course (8202)', 'GUID (5800)', 'Subject (8209)', 'Teacher (8210)', 'Group (8203)', 'TotalHours (8204)', 'Weektime (8208)', 'Blockname (8215)', 'Period (8206)', 'Week (8207)', 'NotPeriod (8212)', 'NotWeek (8213)'].join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,MAAM,WAAa,OAAO,QAAQ,KAAI,MAAK,YAAY,EAAE,IAAI,UAAU,OAAO;EAC9E,MAAME,WAAa,UAAU,KAAI,OAAM,SAAS,IAAI,KAAM,OAAO,YAAY;EAG7E,MAAM,aAAa,SAAS,QAAQ,YAChC,OAAO,WACN,QAAQ,YAAY,mBAAmB,OAAO,YAC7C,OAAO,SAAS,aAChB;EACN,MAAM,WAAW,aAAa,YAAY,IAAI,cAAc,QAAQ;AAEpE,SAAO;GACL,aAAyB;GACzB,eAAyB,OAAO;GAChC,yBAAyB;GACzB,uBAAyB;GACzB,iBAAyB,UAAU;GACnC,kBAAyB,UAAU,eAAe,OAAO;GACzD,kBAAyBF,YAAU,KAAI,YAAW,QAAQ,WAAW,OAAO,SAAS,KAAK;GAC1F,gBAAyBE,UAAQ,KAAI,UAAS,MAAM,aAAa,OAAO,SAAS,KAAK;GACtF,qBAA0B,OAAO,mBAAmB,gBAAgB,KAAK,OAAO,mBAAoB,gBAAgB,KAAK,OAAO,iBAAkB,KAAK;GACvJ,mBAA0B,OAAO,mBAAmB,cAAc,KAAK,OAAO,mBAAoB,cAAc,KAAK,OAAO,iBAAkB,KAAK;GACnJ,oBAAyB;GACzB,iBAAyB;GACzB,eAAyB;GACzB,oBAAyB;GACzB,kBAAyB;;OAEvB;AACN,QAAO,GAAG,YAAY,QAAQ,WAAW,YAAY,QAAQ,QAAQ,YAAY;AACjF,KAAI,EAAE,OACJ,QAAO,KAAK,QAAQ,GAAG;KAEvB,QAAO;EAAC;EAAiB;EAAe;EAAkB;EAAkB;EAAgB;EAAqB;EAAmB;EAAoB;EAAiB;EAAe;EAAoB;GAAkB,KAAK,YAAY;AAGjP,QAAO"}
1
+ {"version":3,"file":"schedules.js","names":["t","teachers","g","groups","locations"],"sources":["../../../../src/Skola24/txt/to/schedules.ts"],"sourcesContent":["import Papa from 'papaparse';\nimport moment from 'moment';\nimport { isString } from 'lodash-es';\nimport type { CoreTypes } from '../../../core';\nimport type { BaseOptions } from '../../../common/types';\nimport { getVertexId } from '../../../core/util';\nimport { isMongooseObjectId } from '../../../common/functions';\n\nconst papaOptions = {\n quotes: false, //or array of booleans\n quoteChar: '\"',\n escapeChar: '\"',\n delimiter: '\\t',\n header: true,\n newline: '\\r\\n',\n skipEmptyLines: false, //other option is 'greedy', meaning skip delimiters, quotes, and whitespace.\n // columns: null //or array of strings\n} as Papa.UnparseConfig;\n\nconst uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\nexport default (\n data: CoreTypes.Mixed.Schedule,\n options: BaseOptions = {}\n): string => {\n const { locations, teachers, groups, persons, events, courses, periods, syllabuses, divisions } = data;\n const { start, /* end, */ displayName } = divisions ?? data as unknown as CoreTypes.Mixed.Division;\n\n const startYear = moment.utc(start).year();\n const startMonth = moment.utc(start).month();\n\n // Set cvs to the source section\n let csv = `[Source]${papaOptions.newline}ApplicationVerMajor=4${papaOptions.newline}ApplicationVerMinor=0${papaOptions.newline}DatabaseRevNo=527${papaOptions.newline}CurrentNovaschemDatabase=${papaOptions.newline}User=${papaOptions.newline}`;\n csv += `SchoolID=RS${papaOptions.newline}School=${displayName}${papaOptions.newline}County=RS${papaOptions.newline}`;\n csv += `BaseYear=${startYear}${papaOptions.newline}OffsetYear=0${papaOptions.newline}OffsetMonth=${startMonth}${papaOptions.newline}CreationDate=${moment().format('YYYY-MM-DD')}${papaOptions.newline}${papaOptions.newline}`;\n // add destination section to csv\n csv += `[Destination]${papaOptions.newline}Application=${papaOptions.newline}ApplicationID=${papaOptions.newline}${papaOptions.newline}`;\n\n // add database options to csv\n csv += `[DatabaseOptions]${papaOptions.newline}Update=TRUE${papaOptions.newline}AddNew=TRUE${papaOptions.newline}${papaOptions.newline}`;\n\n // start tables section\n csv += `[Tables]${papaOptions.newline}${papaOptions.newline}`;\n\n // append teachers to csv\n const t = teachers?.map(teacher => {\n return {\n 'Teacher (6001)': teacher.signature,\n 'GUID (5800)': (teacher.ids && uuid.test(teacher.ids)) ? `{${teacher.ids}}` : '',\n 'Category (6002)': '',\n 'Title (6006)': '',\n 'Phone (6033)': '',\n 'EvaluationNumber (6014)': '',\n ... 'person' in teacher && typeof teacher.person == 'object'\n ? {\n 'PersonalCode (6028)': 'SSN' in teacher.person ? (teacher.person?.SSN?.value ?? '') : '',\n 'LastName (6003)': 'lastName' in teacher.person ? (teacher.person?.lastName ?? '') : '',\n 'FirstName (6004)': 'firstName' in teacher.person ? (teacher.person?.firstName ?? '') : '',\n 'EMail (6034)': 'emails' in teacher.person ? (teacher.person?.emails?.[0]?.value ?? '') : '',\n }\n : null\n };\n }) ?? [];\n csv += `${papaOptions.newline}Teacher (6000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (t.length) {\n csv += Papa.unparse(t, papaOptions);\n } else {\n csv += ['Teacher (6001)', 'GUID (5800)', 'Category (6002)', 'PersonalCode (6028)', 'LastName (6003)', 'Title (6006)', 'FirstName (6004)', 'Phone (6033)', 'EMail (6034)', 'EvaluationNumber (6014)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append students to csv\n const s = persons?.filter(person => {\n return person.type != 'Teacher';\n }).map(person => {\n return {\n 'Student (7201)': person.SSN?.value,\n 'GUID (5800)': (person.ids && uuid.test(person.ids)) ? `{${person.ids}}` : '',\n 'Category (7305)': '',\n 'LastName (7202)': person.lastName ?? '',\n 'FirstName (7211)': person.firstName ?? '',\n 'EMail (7215)': person.emails?.[0]?.value ?? ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}Student (7200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (s.length) {\n csv += Papa.unparse(s, papaOptions);\n } else {\n csv += ['Student (7201)', 'GUID (5800)', 'Category (7305)', 'LastName (7202)', 'FirstName (7211)', 'EMail (7215)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // create a map of students.id to students.SSN\n const studentMap = new Map(persons?.filter(x => x.type != 'Teacher').map(x => [getVertexId(x, options), x.SSN?.value ?? '']));\n\n // append groups to csv\n const g = groups?.map(group => {\n return {\n 'Group (6201)': group.displayName!,\n 'GUID (5800)': (group.ids && uuid.test(group.ids)) ? `{${group.ids}}` : '',\n 'Class (6210)': group.species == 'class' ? 1 : 0,\n 'Teacher (6204)': '',\n 'IClass (6206)': '',\n 'Student (6205)': group.members?.map(x => getVertexId(x, options)).map(x => studentMap.get(x)).filter(Boolean).join(',')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Group (6200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (g.length) {\n csv += Papa.unparse(g, papaOptions);\n } else {\n csv += ['Group (6201)', 'GUID (5800)', 'Class (6210)', 'Teacher (6204)', 'IClass (6206)', 'Student (6205)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append locations to csv\n const l = locations?.map(location => {\n return {\n 'Room (6601)': location.displayName!,\n 'GUID (5800)': (location.ids && uuid.test(location.ids)) ? `{${location.ids}}` : '',\n 'Category (6602)': location.tags?.find(tag => tag.type == 'category')?.value ?? '',\n 'SeatingCapacity (6607)': location.maximumCapacity,\n };\n }) ?? [];\n csv += `${papaOptions.newline}Room (6600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (l.length) {\n csv += Papa.unparse(l, papaOptions);\n } else {\n csv += ['Room (6601)', 'GUID (5800)', 'Category (6602)', 'SeatingCapacity (6607)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append periods to csv\n const p = periods?.map(period => {\n return {\n 'Period (8001)': period.displayName!,\n 'GUID (5800)': (period.ids && uuid.test(period.ids)) ? `{${period.ids}}` : '',\n 'TextBelowSchedule (8002)': period.displayName!,\n 'Category (8006)': '',\n 'Calendar (8005)': period.ranges?.map(range => `${moment.utc(range.start).format('D/M')}-${moment.utc(range.end).format('D/M')}`).join(', ')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Period (8000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (p.length) {\n csv += Papa.unparse(p, papaOptions);\n } else {\n csv += ['Period (8001)', 'GUID (5800)', 'TextBelowSchedule (8002)', 'Category (8006)', 'Calendar (8005)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const courseMap = new Map(data.courses ?.map(x => [getVertexId(x, options), x]));\n const periodMap = new Map(data.periods ?.map(x => [getVertexId(x, options), x]));\n const teacherMap = new Map(data.teachers ?.map(x => [getVertexId(x, options), x]));\n const groupMap = new Map(data.groups ?.map(x => [getVertexId(x, options), x]));\n const locationMap = new Map(data.locations ?.map(x => [getVertexId(x, options), x]));\n const syllabusMap = new Map(data.syllabuses?.map(x => [getVertexId(x, options), x]));\n\n // append lessons to csv\n const e = events\n // ?.filter(x => !isNaN(Date.parse(x.start?.toString() ?? '')))\n .map((event, index) => {\n if (!event.start || !event.end) return;\n\n const courseId = event.course ? getVertexId(event.course, options) : undefined;\n const course = courseId ? courseMap.get(courseId) : undefined;\n\n // Only use deserialize period\n let period = event.period == null ? course?.period : event.period;\n if (isString(period))\n period = periodMap.get(period);\n if ((period && !('ranges' in period)))\n period = undefined;\n\n // Only use deserialize teachers\n const t = event.teachers == null ? course?.teachers : event.teachers;\n const teacherIds = t?.map(x => getVertexId(x.to, options));\n const teachers = teacherIds?.map(id => teacherMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const g = event.groups == null ? course?.groups : event.groups;\n const groupIds = g?.map(x => getVertexId(x.to, options));\n const groups = groupIds?.map(id => groupMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize locations\n const locationIds = event.inLocations?.map(x => x ? getVertexId(x, options) : null).filter(x => x != null);\n const locations = locationIds?.map(id => locationMap.get(id)).filter(Boolean) ?? [];\n const dayOfWeek = moment.utc(event.start).toDate().toLocaleDateString('sv-SE', { weekday: 'long', timeZone: 'UTC' });\n\n // Syllabus of the course\n const syllabusId = isString(course?.syllabus)\n ? course.syllabus\n : (course?.syllabus && isMongooseObjectId(course.syllabus))\n ? course.syllabus.toString()\n : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n // capitalize first letter of dayOfWeek\n const dayOfWeekCapitalized = dayOfWeek.charAt(0).toUpperCase() + dayOfWeek.slice(1);\n return {\n 'PK (7100)': index + 1,\n 'GUID (5800)': (event.ids && uuid.test(event.ids)) ? `{${event.ids}}` : '',\n 'DayOfWeek (7101)': dayOfWeekCapitalized,\n 'Starttime (7102)': moment.utc(event.start).format('HH:mm'),\n 'Length (7115)': event.duration,\n 'Course (7106)': syllabus?.courseCode,\n 'Subject (7103)': syllabus?.subjectCode ?? course?.subject ?? '',\n 'Teacher (7104)': teachers ?.map(x => x?.signature ).filter(Boolean).join(','),\n 'Group (7105)': groups ?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Room (7107)': locations?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Period (7108)': '',\n 'Week (7109)': '',\n 'ActualWeeks (7167)': period?.ranges?.map(range => `${moment.utc(range.start).week()}-${moment.utc(range.end).week()}`).join(',')\n };\n }).filter(Boolean) ?? [];\n csv += `${papaOptions.newline}Lesson (7100)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (e.length) {\n csv += Papa.unparse(e, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append subjects to csv, is empty for now\n // csv += `Subject (6400)${options.newline}[Rows]${options.newline}`;\n // csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(options.delimiter);\n // csv += options.newline;\n\n // append syllabus to csv\n const courseSyllabuses = syllabuses?.filter(syllabus => !!syllabus.courseName).map(syllabus => {\n return {\n 'Course (7601)': syllabus.courseCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (7602)': syllabus.courseName,\n 'Subject (7603)': syllabus.subjectCode ?? '',\n 'Points (7604)': syllabus.points\n };\n }) ?? [];\n csv += `${papaOptions.newline}Course (7600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (courseSyllabuses.length) {\n csv += Papa.unparse(courseSyllabuses, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const subjectSyllabuses = syllabuses?.reduce((unique, syllabus) => {\n if (syllabus.subjectCode && !unique.seen.has(syllabus.subjectCode)) {\n unique.seen.add(syllabus.subjectCode);\n unique.result.push({\n 'Subject (6401)': syllabus.subjectCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (6403)': syllabus.subjectName,\n });\n }\n return unique;\n }, {\n seen: new Set<string>(),\n result: [] as Array<{\n 'Subject (6401)': string;\n 'GUID (5800)': string | undefined;\n 'FullText (6403)': string;\n }>\n })?.result ?? [];\n csv += `Subject (6400)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (subjectSyllabuses.length) {\n csv += Papa.unparse(subjectSyllabuses, papaOptions);\n } else {\n csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(papaOptions.delimiter);\n }\n\n const totalHoursRegex = /(\\d+) hrs/;\n const weekTimeRegex = /(\\d+) min\\/week/;\n const c = courses?.map(course => {\n // Only use deserialize teachers\n const teacherIds = course.teachers?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const teachers = teacherIds?.map(id => teacherMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const groupIds = course.groups?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const groups = groupIds?.map(id => groupMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize syllabus\n const syllabusId = isString(course?.syllabus)\n ? course.syllabus\n : (course?.syllabus && isMongooseObjectId(course.syllabus))\n ? course.syllabus.toString()\n : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n return {\n 'PK (8200)': '',\n 'GUID (5800)': course.ids,\n 'OriginalRecord (8224)': '1',\n 'CreateLesson (8227)': '1',\n 'Course (8202)': syllabus?.courseCode,\n 'Subject (8209)': syllabus?.subjectCode ?? course.subject, // Nikos ansvarig för framtida buggar\n 'Teacher (8210)': teachers?.map(teacher => teacher.signature).filter(Boolean).join(','),\n 'Group (8203)': groups?.map(group => group.displayName).filter(Boolean).join(','),\n 'TotalHours (8204)': (course.plannedDuration && totalHoursRegex.test(course.plannedDuration)) ? totalHoursRegex.exec(course.plannedDuration)![1] : '',\n 'Weektime (8208)': (course.plannedDuration && weekTimeRegex.test(course.plannedDuration)) ? weekTimeRegex.exec(course.plannedDuration)![1] : '',\n 'Blockname (8215)': '',\n 'Period (8206)': '',\n 'Week (8207)': '',\n 'NotPeriod (8212)': '',\n 'NotWeek (8213)': ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}TA (8200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (c.length) {\n csv += Papa.unparse(c, papaOptions);\n } else {\n csv += ['Course (8202)', 'GUID (5800)', 'Subject (8209)', 'Teacher (8210)', 'Group (8203)', 'TotalHours (8204)', 'Weektime (8208)', 'Blockname (8215)', 'Period (8206)', 'Week (8207)', 'NotPeriod (8212)', 'NotWeek (8213)'].join(papaOptions.delimiter);\n }\n\n return csv;\n};"],"mappings":";;;;;;;AAQA,MAAM,cAAc;CAClB,QAAgB;CAChB,WAAgB;CAChB,YAAgB;CAChB,WAAgB;CAChB,QAAgB;CAChB,SAAgB;CAChB,gBAAgB;;AAIlB,MAAM,OAAO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,YAChC,OAAO,WACN,QAAQ,YAAY,mBAAmB,OAAO,YAC7C,OAAO,SAAS,aAChB;EACN,MAAM,WAAW,aAAa,YAAY,IAAI,cAAc,QAAQ;AAEpE,SAAO;GACL,aAAyB;GACzB,eAAyB,OAAO;GAChC,yBAAyB;GACzB,uBAAyB;GACzB,iBAAyB,UAAU;GACnC,kBAAyB,UAAU,eAAe,OAAO;GACzD,kBAAyBF,YAAU,KAAI,YAAW,QAAQ,WAAW,OAAO,SAAS,KAAK;GAC1F,gBAAyBE,UAAQ,KAAI,UAAS,MAAM,aAAa,OAAO,SAAS,KAAK;GACtF,qBAA0B,OAAO,mBAAmB,gBAAgB,KAAK,OAAO,mBAAoB,gBAAgB,KAAK,OAAO,iBAAkB,KAAK;GACvJ,mBAA0B,OAAO,mBAAmB,cAAc,KAAK,OAAO,mBAAoB,cAAc,KAAK,OAAO,iBAAkB,KAAK;GACnJ,oBAAyB;GACzB,iBAAyB;GACzB,eAAyB;GACzB,oBAAyB;GACzB,kBAAyB;;OAEvB;AACN,QAAO,GAAG,YAAY,QAAQ,WAAW,YAAY,QAAQ,QAAQ,YAAY;AACjF,KAAI,EAAE,OACJ,QAAO,KAAK,QAAQ,GAAG;KAEvB,QAAO;EAAC;EAAiB;EAAe;EAAkB;EAAkB;EAAgB;EAAqB;EAAmB;EAAoB;EAAiB;EAAe;EAAoB;GAAkB,KAAK,YAAY;AAGjP,QAAO"}
@@ -84,6 +84,7 @@ type GlobalDefaultValues = {
84
84
  dayEnd: string;
85
85
  numDays: number;
86
86
  potentialCenter?: string;
87
+ minimizeTeacherGaps?: boolean;
87
88
  defaultGroupMinimumBreakLength?: number;
88
89
  defaultEventMinimumBreakLength?: number;
89
90
  defaultDependencyMinimumBreakLength?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"companies.js","names":[],"sources":["../../../../src/core/interfaces/other/companies.ts"],"sourcesContent":["import type { Partner, IntegrationTypes, OrganizationType, Theme, SamlProvider } from './etc';\nimport type { PlannedScheduledDuration } from '../vertices/properties/planned-scheduled-duration';\nimport type { MaximumScheduleSpan } from '../vertices/properties/maximum-schedule-span';\nimport type { PublicId } from '../vertices/properties';\n\n\ntype Identifier = {\n value: string;\n type: 'VAT' | 'SchoolCode' | 'MunicipalityCode' | 'SchoolSoft' | 'Sdui' | 'Edlevo' | 'Edaktus';\n country: string;\n};\n\ntype AppFeature = {\n substitutionPlanner?: {\n enabled: boolean;\n };\n statisticsModule?: {\n /**\n * Enables the whole statistics module.\n */\n enabled?: boolean;\n\n scb?: boolean;\n lunchCongestion?: boolean;\n };\n includeStepGuide?: boolean;\n};\n\nexport type Address = {\n type: string; // Type of address (e.g., home, work, etc.)\n streetAddress: string; // Street address (e.g., 123 Main St)\n addressLine2?: string; // Optional second line of the address (e.g., Apt 4B)sss\n addressLine3?: string; // Optional third line of the address\n postalCode: string; // Postal code (e.g., 12345)\n locality: string; // City or locality (e.g., New York)\n state?: string; // Optional state or province (e.g., NY)\n region?: string; // Optional region (e.g., Northeast)\n country: string; // Country (e.g., USA)\n geoCoordinates: {\n latitude: string;\n longitude: string;\n };\n};\n\nexport type TimeRosterSection = {\n start: string; // In HH:mm format\n end: string; // In HH:mm format\n id: string;\n name: string;\n};\n\nexport type PublicConfig = {\n filters: {\n groups: boolean;\n teachers: boolean;\n inLocations: boolean;\n tags: boolean;\n subjects: boolean;\n subGroups: boolean;\n };\n showTeacherWorkingHours: boolean;\n multipleSelection: boolean;\n timeFilters: {\n all: boolean;\n periods: boolean;\n };\n lockedTimes: boolean;\n};\n\nexport type AutoSyncConfig = {\n enabled: boolean;\n integration?: IntegrationTypes;\n weekdaysOnly?: boolean;\n time?: string;\n};\n\nexport const INACTIVITY_ACTIONS = {\n REFRESH: 'refresh',\n LOGOUT: 'logout',\n} as const;\nexport type InactivityAction =\n (typeof INACTIVITY_ACTIONS)[keyof typeof INACTIVITY_ACTIONS];\n\nexport type InactivitySettings = {\n /**\n * In units of minutes\n */\n time: number;\n action: InactivityAction;\n};\n\nexport type GlobalDefaultValues = {\n dayStart: string;\n dayEnd: string;\n numDays: number;\n potentialCenter?: string;\n defaultGroupMinimumBreakLength?: number;\n defaultEventMinimumBreakLength?: number;\n defaultDependencyMinimumBreakLength?: number;\n defaultPlannedScheduledDuration?: PlannedScheduledDuration;\n defaultMaximumScheduleSpan?: MaximumScheduleSpan;\n defaultEventDurationVariance?: number;\n};\n\nexport namespace Company {\n export type core = {\n readonly id: PublicId;\n associatedPartner?: Partner | null;\n createdAt?: string;\n };\n\n type optionals = {\n name?: string;\n logo?: string; // URL to the company's logo\n timezone?: string;\n environment: {\n theme?: Theme;\n organizationType?: OrganizationType;\n appFeatures?: AppFeature;\n canCreateCompanies?: boolean;\n };\n identifiers: Identifier[];\n addresses: Address[];\n constituentTypes: string[];\n samlProviders?: SamlProvider[];\n publicSettings?: PublicConfig;\n autoSync?: AutoSyncConfig;\n organization?: {\n name?: string;\n logo?: string;\n inactivitySettings?: InactivitySettings;\n constituentTypes?: string[];\n environment?: Company.complete['environment'];\n };\n inactivitySettings?: InactivitySettings;\n timeRoster?: TimeRosterSection[];\n globalDefaultValues?: GlobalDefaultValues;\n };\n\n export type complete = core & optionals;\n}\n"],"mappings":";AA4EA,MAAa,qBAAqB;CAChC,SAAS;CACT,QAAS"}
1
+ {"version":3,"file":"companies.js","names":[],"sources":["../../../../src/core/interfaces/other/companies.ts"],"sourcesContent":["import type { Partner, IntegrationTypes, OrganizationType, Theme, SamlProvider } from './etc';\nimport type { PlannedScheduledDuration } from '../vertices/properties/planned-scheduled-duration';\nimport type { MaximumScheduleSpan } from '../vertices/properties/maximum-schedule-span';\nimport type { PublicId } from '../vertices/properties';\n\n\ntype Identifier = {\n value: string;\n type: 'VAT' | 'SchoolCode' | 'MunicipalityCode' | 'SchoolSoft' | 'Sdui' | 'Edlevo' | 'Edaktus';\n country: string;\n};\n\ntype AppFeature = {\n substitutionPlanner?: {\n enabled: boolean;\n };\n statisticsModule?: {\n /**\n * Enables the whole statistics module.\n */\n enabled?: boolean;\n\n scb?: boolean;\n lunchCongestion?: boolean;\n };\n includeStepGuide?: boolean;\n};\n\nexport type Address = {\n type: string; // Type of address (e.g., home, work, etc.)\n streetAddress: string; // Street address (e.g., 123 Main St)\n addressLine2?: string; // Optional second line of the address (e.g., Apt 4B)sss\n addressLine3?: string; // Optional third line of the address\n postalCode: string; // Postal code (e.g., 12345)\n locality: string; // City or locality (e.g., New York)\n state?: string; // Optional state or province (e.g., NY)\n region?: string; // Optional region (e.g., Northeast)\n country: string; // Country (e.g., USA)\n geoCoordinates: {\n latitude: string;\n longitude: string;\n };\n};\n\nexport type TimeRosterSection = {\n start: string; // In HH:mm format\n end: string; // In HH:mm format\n id: string;\n name: string;\n};\n\nexport type PublicConfig = {\n filters: {\n groups: boolean;\n teachers: boolean;\n inLocations: boolean;\n tags: boolean;\n subjects: boolean;\n subGroups: boolean;\n };\n showTeacherWorkingHours: boolean;\n multipleSelection: boolean;\n timeFilters: {\n all: boolean;\n periods: boolean;\n };\n lockedTimes: boolean;\n};\n\nexport type AutoSyncConfig = {\n enabled: boolean;\n integration?: IntegrationTypes;\n weekdaysOnly?: boolean;\n time?: string;\n};\n\nexport const INACTIVITY_ACTIONS = {\n REFRESH: 'refresh',\n LOGOUT: 'logout',\n} as const;\nexport type InactivityAction =\n (typeof INACTIVITY_ACTIONS)[keyof typeof INACTIVITY_ACTIONS];\n\nexport type InactivitySettings = {\n /**\n * In units of minutes\n */\n time: number;\n action: InactivityAction;\n};\n\nexport type GlobalDefaultValues = {\n dayStart: string;\n dayEnd: string;\n numDays: number;\n potentialCenter?: string;\n minimizeTeacherGaps?: boolean;\n defaultGroupMinimumBreakLength?: number;\n defaultEventMinimumBreakLength?: number;\n defaultDependencyMinimumBreakLength?: number;\n defaultPlannedScheduledDuration?: PlannedScheduledDuration;\n defaultMaximumScheduleSpan?: MaximumScheduleSpan;\n defaultEventDurationVariance?: number;\n};\n\nexport namespace Company {\n export type core = {\n readonly id: PublicId;\n associatedPartner?: Partner | null;\n createdAt?: string;\n };\n\n type optionals = {\n name?: string;\n logo?: string; // URL to the company's logo\n timezone?: string;\n environment: {\n theme?: Theme;\n organizationType?: OrganizationType;\n appFeatures?: AppFeature;\n canCreateCompanies?: boolean;\n };\n identifiers: Identifier[];\n addresses: Address[];\n constituentTypes: string[];\n samlProviders?: SamlProvider[];\n publicSettings?: PublicConfig;\n autoSync?: AutoSyncConfig;\n organization?: {\n name?: string;\n logo?: string;\n inactivitySettings?: InactivitySettings;\n constituentTypes?: string[];\n environment?: Company.complete['environment'];\n };\n inactivitySettings?: InactivitySettings;\n timeRoster?: TimeRosterSection[];\n globalDefaultValues?: GlobalDefaultValues;\n };\n\n export type complete = core & optionals;\n}\n"],"mappings":";AA4EA,MAAa,qBAAqB;CAChC,SAAS;CACT,QAAS"}
@@ -0,0 +1,32 @@
1
+ import { VertexFactory } from "./util/vertex.js";
2
+ import { EdgeWrapper, Plain } from "./util/edges.js";
3
+ import { BelongsTo } from "./properties/belongs-to.js";
4
+ import { UserVertex } from "./users.js";
5
+ import { MessageVertex } from "./messages.js";
6
+
7
+ //#region src/core/interfaces/vertices/conversations.d.ts
8
+ type ConversationVertex = VertexFactory<'conversations', BelongsTo & {
9
+ user: EdgeWrapper<'single', Plain.Edge<UserVertex>>;
10
+ messages?: EdgeWrapper<'array', Plain.Edge<MessageVertex>>;
11
+ title?: string;
12
+ settings: {
13
+ model: string;
14
+ thinking: boolean;
15
+ };
16
+ tokenUsage?: {
17
+ promptTokens?: number;
18
+ completionTokens?: number;
19
+ };
20
+ active?: boolean;
21
+ stagedEdits?: {
22
+ teachers?: any[];
23
+ persons?: any[];
24
+ courses?: any[];
25
+ groups?: any[];
26
+ events?: any[];
27
+ locations?: any[];
28
+ };
29
+ }>;
30
+ //#endregion
31
+ export { ConversationVertex };
32
+ //# sourceMappingURL=conversations.d.ts.map
@@ -8,9 +8,9 @@ import { PeriodVertex } from "./periods.js";
8
8
  import { BelongsTo } from "./properties/belongs-to.js";
9
9
  import { PersonVertex } from "./persons.js";
10
10
  import { LocationVertex } from "./locations.js";
11
+ import { SyllabusVertex } from "./syllabuses.js";
11
12
  import { EventVertex } from "./events.js";
12
13
  import { OverlapGroupVertex } from "./overlap-groups.js";
13
- import { SyllabusVertex } from "./syllabuses.js";
14
14
  import { ExceptionVertex } from "./exceptions.js";
15
15
  import { GroupVertex } from "./groups.js";
16
16
  import { LockedTimeVertex } from "./locked-times.js";
@@ -25,6 +25,7 @@ type DivisionSettingsVertex = VertexFactory<'settings', BelongsTo & {
25
25
  dayEnd: string;
26
26
  discretization: number;
27
27
  potentialCenter: string;
28
+ minimizeTeacherGaps?: boolean;
28
29
  defaultEventMinimumBreakLength?: number;
29
30
  defaultGroupMinimumBreakLength?: number;
30
31
  defaultDependencyMinimumBreakLength?: number;
@@ -10,6 +10,7 @@ import { PersonVertex } from "./persons.js";
10
10
  import { LocationVertex } from "./locations.js";
11
11
  import { LinkedEventsSetVertex } from "./linked-events-sets.js";
12
12
  import { ThreadVertex } from "./threads.js";
13
+ import { SyllabusVertex } from "./syllabuses.js";
13
14
  import { OverlapGroupVertex } from "./overlap-groups.js";
14
15
  import { CourseVertex } from "./courses.js";
15
16
  import { ExceptionVertex } from "./exceptions.js";
@@ -72,6 +73,7 @@ type ScheduleEventVertex = VertexFactory<'scheduleEvents', EventProperties & {
72
73
  start?: Moment | string;
73
74
  end?: Moment | string;
74
75
  persons?: EdgeWrapper<'array', Plain.Edge<PersonVertex>>;
76
+ syllabus?: EdgeWrapper<'single', Plain.Edge<SyllabusVertex>>;
75
77
  }>;
76
78
  type CalendarEventVertex = VertexFactory<'calendarEvents', BasicSharedProperties & {
77
79
  meta: {
@@ -85,6 +87,7 @@ type CalendarEventVertex = VertexFactory<'calendarEvents', BasicSharedProperties
85
87
  start: number;
86
88
  end: number;
87
89
  exceptions?: EdgeWrapper<'array', Plain.Edge<ExceptionVertex>>;
90
+ syllabus?: EdgeWrapper<'single', Plain.Edge<SyllabusVertex>>;
88
91
  inLocations?: EdgeWrapper<'array', Plain.Edge<LocationVertex> | null>;
89
92
  participants?: EdgeWrapper<'array', Wrapped.Edge<'to', PersonVertex, {
90
93
  groupIndex?: number;
@@ -12,15 +12,17 @@ import { LocationVertex } from "./locations.js";
12
12
  import { LinkedEventsSetVertex } from "./linked-events-sets.js";
13
13
  import { UserVertex } from "./users.js";
14
14
  import { ThreadVertex } from "./threads.js";
15
+ import { SyllabusVertex } from "./syllabuses.js";
15
16
  import { CalendarEventVertex, EventVertex, ScheduleEventVertex } from "./events.js";
16
17
  import { OverlapGroupVertex } from "./overlap-groups.js";
17
- import { SyllabusVertex } from "./syllabuses.js";
18
18
  import { CourseVertex } from "./courses.js";
19
19
  import { CalendarExceptionAction, ExceptionStatus, ExceptionVertex } from "./exceptions.js";
20
20
  import { GroupVertex } from "./groups.js";
21
21
  import { LockedTimeType, LockedTimeVertex } from "./locked-times.js";
22
22
  import { TeacherVertex } from "./teachers.js";
23
23
  import { ConfigurationFilterVertex, ConfigurationRuleVertex, ConfigurationTemplateVertex, ConfigurationVertex } from "./configurations.js";
24
+ import { MessageVertex } from "./messages.js";
25
+ import { ConversationVertex } from "./conversations.js";
24
26
  import { Infer, VertexQuery, createVertexQuery } from "./vertex-query.js";
25
27
 
26
28
  //#region src/core/interfaces/vertices/index.d.ts
@@ -64,6 +66,8 @@ declare namespace Serialized {
64
66
  type Syllabus = SerializedVertexExport<SyllabusVertex>;
65
67
  type Thread = SerializedVertexExport<ThreadVertex>;
66
68
  type User = SerializedVertexExport<UserVertex>;
69
+ type Conversation = SerializedVertexExport<ConversationVertex>;
70
+ type Message = SerializedVertexExport<MessageVertex>;
67
71
  namespace Configuration {
68
72
  type Base = SerializedVertexExport<ConfigurationVertex>;
69
73
  type Filter = SerializedVertexExport<ConfigurationFilterVertex>;
@@ -94,6 +98,8 @@ declare namespace Deep {
94
98
  type Syllabus = DeepVertexExport<SyllabusVertex>;
95
99
  type Thread = DeepVertexExport<ThreadVertex>;
96
100
  type User = DeepVertexExport<UserVertex>;
101
+ type Conversation = DeepVertexExport<ConversationVertex>;
102
+ type Message = DeepVertexExport<MessageVertex>;
97
103
  namespace Configuration {
98
104
  type Base = DeepVertexExport<ConfigurationVertex>;
99
105
  type Filter = DeepVertexExport<ConfigurationFilterVertex>;
@@ -124,6 +130,8 @@ declare namespace DeepWithoutPrivateId {
124
130
  type Syllabus = DeepVertexExportOmitPrivateId<SyllabusVertex>;
125
131
  type Thread = DeepVertexExportOmitPrivateId<ThreadVertex>;
126
132
  type User = DeepVertexExportOmitPrivateId<UserVertex>;
133
+ type Conversation = DeepVertexExportOmitPrivateId<ConversationVertex>;
134
+ type Message = DeepVertexExportOmitPrivateId<MessageVertex>;
127
135
  namespace Configuration {
128
136
  type Base = DeepVertexExport<ConfigurationVertex>;
129
137
  type Filter = DeepVertexExport<ConfigurationFilterVertex>;
@@ -154,6 +162,8 @@ declare namespace Mixed {
154
162
  type Syllabus = MixedVertexExport<SyllabusVertex>;
155
163
  type Thread = MixedVertexExport<ThreadVertex>;
156
164
  type User = MixedVertexExport<UserVertex>;
165
+ type Conversation = MixedVertexExport<ConversationVertex>;
166
+ type Message = MixedVertexExport<MessageVertex>;
157
167
  namespace Configuration {
158
168
  type Base = MixedVertexExport<ConfigurationVertex>;
159
169
  type Filter = MixedVertexExport<ConfigurationFilterVertex>;
@@ -184,6 +194,8 @@ declare namespace MixedWithOptionalId {
184
194
  type Syllabus = MixedWithOptionalIdVertexExport<SyllabusVertex>;
185
195
  type Thread = MixedWithOptionalIdVertexExport<ThreadVertex>;
186
196
  type User = MixedWithOptionalIdVertexExport<UserVertex>;
197
+ type Conversation = MixedWithOptionalIdVertexExport<ConversationVertex>;
198
+ type Message = MixedWithOptionalIdVertexExport<MessageVertex>;
187
199
  namespace Configuration {
188
200
  type Base = MixedWithOptionalIdVertexExport<ConfigurationVertex>;
189
201
  type Filter = MixedWithOptionalIdVertexExport<ConfigurationFilterVertex>;
@@ -215,6 +227,8 @@ declare namespace SerializedWithOptionalId {
215
227
  export type Syllabus = MakeIdsOptional<Serialized.Syllabus>;
216
228
  export type Thread = MakeIdsOptional<Serialized.Thread>;
217
229
  export type User = MakeIdsOptional<Serialized.User>;
230
+ export type Conversation = MakeIdsOptional<Serialized.Conversation>;
231
+ export type Message = MakeIdsOptional<Serialized.Message>;
218
232
  export namespace Configuration {
219
233
  type Base = MakeIdsOptional<Serialized.Configuration.Base>;
220
234
  type Filter = MakeIdsOptional<Serialized.Configuration.Filter>;
@@ -0,0 +1,21 @@
1
+ import { VertexFactory } from "./util/vertex.js";
2
+ import { EdgeWrapper, Plain } from "./util/edges.js";
3
+ import { BelongsTo } from "./properties/belongs-to.js";
4
+ import { UserVertex } from "./users.js";
5
+ import { ConversationVertex } from "./conversations.js";
6
+
7
+ //#region src/core/interfaces/vertices/messages.d.ts
8
+ type MessageVertex = VertexFactory<'messages', BelongsTo & {
9
+ user: EdgeWrapper<'single', Plain.Edge<UserVertex>>;
10
+ conversation: EdgeWrapper<'single', Plain.Edge<ConversationVertex>>;
11
+ type: string;
12
+ content?: string;
13
+ status?: string;
14
+ name?: string;
15
+ args?: unknown;
16
+ response?: unknown;
17
+ error?: string;
18
+ }>;
19
+ //#endregion
20
+ export { MessageVertex };
21
+ //# sourceMappingURL=messages.d.ts.map
@@ -7,6 +7,7 @@ import { Moment } from "moment";
7
7
  type PeriodVertex = VertexFactory<'periods', BelongsTo & {
8
8
  ranges: Interval<string | Moment | Date>[];
9
9
  displayIndex?: number;
10
+ inline?: boolean;
10
11
  }>;
11
12
  //#endregion
12
13
  export { PeriodVertex };
@@ -6,6 +6,8 @@ type SyllabusVertex = VertexFactory<'syllabuses', BelongsTo & {
6
6
  schoolType: string;
7
7
  subjectCode?: string;
8
8
  subjectName: string;
9
+ color?: string | null;
10
+ icon?: string | null;
9
11
  subjectDesignation?: string;
10
12
  courseCode?: string;
11
13
  courseName?: string;
@@ -5,7 +5,7 @@ import { ObjectId } from "../../../../common/types.js";
5
5
  /**
6
6
  *
7
7
  */
8
- type RealCollection = 'settings' | 'divisionSettings' | 'exceptions' | 'groups' | 'teachers' | 'locations' | 'configurations' | 'courses' | 'events' | 'generations' | 'lockedTimes' | 'overlapGroups' | 'linkedEventsSets' | 'periods' | 'rootIntervals' | 'persons' | 'syllabuses' | 'divisions' | 'companies' | 'users' | 'threads';
8
+ type RealCollection = 'settings' | 'divisionSettings' | 'exceptions' | 'groups' | 'teachers' | 'locations' | 'configurations' | 'courses' | 'events' | 'generations' | 'lockedTimes' | 'overlapGroups' | 'linkedEventsSets' | 'periods' | 'rootIntervals' | 'persons' | 'syllabuses' | 'divisions' | 'companies' | 'users' | 'threads' | 'conversations' | 'messages';
9
9
  /**
10
10
  *
11
11
  */
@@ -11,9 +11,9 @@ import { LocationVertex } from "./locations.js";
11
11
  import { LinkedEventsSetVertex } from "./linked-events-sets.js";
12
12
  import { UserVertex } from "./users.js";
13
13
  import { ThreadVertex } from "./threads.js";
14
+ import { SyllabusVertex } from "./syllabuses.js";
14
15
  import { CalendarEventVertex, EventVertex, ScheduleEventVertex } from "./events.js";
15
16
  import { OverlapGroupVertex } from "./overlap-groups.js";
16
- import { SyllabusVertex } from "./syllabuses.js";
17
17
  import { CourseVertex } from "./courses.js";
18
18
  import { ExceptionVertex } from "./exceptions.js";
19
19
  import { GroupVertex } from "./groups.js";
@@ -21,6 +21,8 @@ import { LockedTimeVertex } from "./locked-times.js";
21
21
  import { TeacherVertex } from "./teachers.js";
22
22
  import { CompanyVertex } from "./companies.js";
23
23
  import { ConfigurationVertex } from "./configurations.js";
24
+ import { MessageVertex } from "./messages.js";
25
+ import { ConversationVertex } from "./conversations.js";
24
26
 
25
27
  //#region src/core/interfaces/vertices/vertex-query.d.ts
26
28
  type VertexRecord = {
@@ -48,6 +50,8 @@ type VertexRecord = {
48
50
  companies: CompanyVertex;
49
51
  users: UserVertex;
50
52
  threads: ThreadVertex;
53
+ conversations: ConversationVertex;
54
+ messages: MessageVertex;
51
55
  };
52
56
  type BaseQueryRecord<C extends keyof VertexRecord> = VertexQuery<VertexRecord[C]>;
53
57
  /**
@@ -105,6 +109,8 @@ declare namespace createVertexQuery {
105
109
  function configuration<Q extends VertexQuery<ConfigurationVertex> & AssertNoInvalidExpandKeys<ConfigurationVertex, Q>>(query: Q): VertexQuery$1<"configurations", Q>;
106
110
  function thread<Q extends VertexQuery<ThreadVertex> & AssertNoInvalidExpandKeys<ThreadVertex, Q>>(query: Q): VertexQuery$1<"threads", Q>;
107
111
  function user<Q extends VertexQuery<UserVertex> & AssertNoInvalidExpandKeys<UserVertex, Q>>(query: Q): VertexQuery$1<"users", Q>;
112
+ function conversation<Q extends VertexQuery<ConversationVertex> & AssertNoInvalidExpandKeys<ConversationVertex, Q>>(query: Q): VertexQuery$1<"conversations", Q>;
113
+ function message<Q extends VertexQuery<MessageVertex> & AssertNoInvalidExpandKeys<MessageVertex, Q>>(query: Q): VertexQuery$1<"messages", Q>;
108
114
  }
109
115
  //#endregion
110
116
  export { Infer, VertexQuery$1 as VertexQuery, createVertexQuery };
@@ -107,6 +107,14 @@ let createVertexQuery;
107
107
  return new VertexQuery("users", query);
108
108
  }
109
109
  _createVertexQuery.user = user;
110
+ function conversation(query) {
111
+ return new VertexQuery("conversations", query);
112
+ }
113
+ _createVertexQuery.conversation = conversation;
114
+ function message(query) {
115
+ return new VertexQuery("messages", query);
116
+ }
117
+ _createVertexQuery.message = message;
110
118
  })(createVertexQuery || (createVertexQuery = {}));
111
119
 
112
120
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"vertex-query.js","names":["_collection: C","_query: Q"],"sources":["../../../../src/core/interfaces/vertices/vertex-query.ts"],"sourcesContent":["import type { AssertNoInvalidExpandKeys, Collection, CustomVertexExport } from './util';\nimport type { TeacherVertex } from './teachers';\nimport type { ExceptionVertex } from './exceptions';\nimport type { EventVertex, ScheduleEventVertex, CalendarEventVertex } from './events';\nimport type { CourseVertex } from './courses';\nimport type { DivisionSettingsVertex } from './division-settings';\nimport type { DivisionVertex } from './divisions';\nimport type { GenerationVertex } from './generations';\nimport type { GroupVertex } from './groups';\nimport type { LocationVertex } from './locations';\nimport type { LockedTimeVertex } from './locked-times';\nimport type { OverlapGroupVertex } from './overlap-groups';\nimport type { LinkedEventsSetVertex } from './linked-events-sets';\nimport type { PeriodVertex } from './periods';\nimport type { PersonVertex } from './persons';\nimport type { RootIntervalVertex } from './root-intervals';\nimport type { SyllabusVertex } from './syllabuses';\nimport type { ConfigurationVertex } from './configurations';\nimport type { CompanyVertex } from './companies';\nimport type { UserVertex } from './users';\nimport type { ThreadVertex } from './threads';\nimport type { VertexQuery as Query } from './util/vertex-query';\nimport type { TypeEqual } from 'ts-expect';\nimport { expectType } from 'ts-expect';\n\n\nexport type VertexRecord = {\n divisions: DivisionVertex;\n divisionSettings: DivisionSettingsVertex;\n settings: DivisionSettingsVertex;\n teachers: TeacherVertex;\n exceptions: ExceptionVertex;\n events: EventVertex;\n scheduleEvents: ScheduleEventVertex;\n calendarEvents: CalendarEventVertex;\n courses: CourseVertex;\n generations: GenerationVertex;\n groups: GroupVertex;\n locations: LocationVertex;\n lockedTimes: LockedTimeVertex;\n overlapGroups: OverlapGroupVertex;\n linkedEventsSets: LinkedEventsSetVertex;\n periods: PeriodVertex;\n persons: PersonVertex;\n students: PersonVertex;\n rootIntervals: RootIntervalVertex;\n syllabuses: SyllabusVertex;\n configurations: ConfigurationVertex;\n companies: CompanyVertex;\n users: UserVertex;\n threads: ThreadVertex;\n};\nexport type BaseQueryRecord<C extends keyof VertexRecord> = Query<VertexRecord[C]>;\n{\n // the keys must all be a collection\n type Mismatches = keyof {\n [K in keyof VertexRecord as K extends Collection ? never : K]: true\n };\n expectType<TypeEqual<Mismatches, never>>(true);\n}\n\n/**\n * See {@link createVertexQuery}\n */\nexport class VertexQuery <\n C extends keyof VertexRecord,\n Q extends BaseQueryRecord<C> & AssertNoInvalidExpandKeys<VertexRecord[C], Q>\n> {\n constructor (\n private readonly _collection: C,\n private readonly _query: Q\n ) {}\n\n get collection () { return this._collection }\n get query () { return this._query }\n}\n\n\n/**\n * Infers the result type for a query created via createVertexQuery.\n *\n * @example\n * const personQuery = createVertexQuery('persons', { select: ['id', 'firstName'] });\n * type PersonType = Infer<typeof personQuery>;\n */\nexport type Infer<T extends VertexQuery<any, any>> = // eslint-disable-line @typescript-eslint/no-explicit-any\n T extends VertexQuery<infer C, infer Q>\n ? CustomVertexExport<VertexRecord[C], Q>\n : never;\n\n\n/**\n * Builds a typed vertex query for a given vertex type using a select/expand shape.\n *\n * Use together with Infer<T> to obtain the serialized result type.\n *\n * @typeParam Q - The select/expand query shape for that vertex.\n *\n * @example\n * const groupQuery = createVertexQuery.group({\n * select: ['id', 'displayName'],\n * expand: { members: { select: ['id'] } }\n * });\n * type GroupType = Infer<typeof groupQuery>;\n */\nexport namespace createVertexQuery {\n //\n // The following did not work: it seems we need to define Q as an completely independent type parameter (?)\n //\n // export function createVertexQuery <\n // C extends keyof VertexRecord,\n // const Q extends Query<VertexRecord[C]>\n // > (\n // collection: C,\n // query: Q\n // ) {\n // return new VertexQuery(collection, query);\n // }\n\n export function division <Q extends Query<DivisionVertex > & AssertNoInvalidExpandKeys<DivisionVertex, Q>> (query: Q) { return new VertexQuery('divisions', query) }\n export function settings <Q extends Query<DivisionSettingsVertex> & AssertNoInvalidExpandKeys<DivisionSettingsVertex, Q>> (query: Q) { return new VertexQuery('settings', query) }\n export function exception <Q extends Query<ExceptionVertex > & AssertNoInvalidExpandKeys<ExceptionVertex, Q>> (query: Q) { return new VertexQuery('exceptions', query) }\n export function event <Q extends Query<EventVertex > & AssertNoInvalidExpandKeys<EventVertex, Q>> (query: Q) { return new VertexQuery('events', query) }\n export function scheduleEvent <Q extends Query<ScheduleEventVertex > & AssertNoInvalidExpandKeys<ScheduleEventVertex, Q>> (query: Q) { return new VertexQuery('scheduleEvents', query) }\n export function calendarEvent <Q extends Query<CalendarEventVertex > & AssertNoInvalidExpandKeys<CalendarEventVertex, Q>> (query: Q) { return new VertexQuery('calendarEvents', query) }\n export function course <Q extends Query<CourseVertex > & AssertNoInvalidExpandKeys<CourseVertex, Q>> (query: Q) { return new VertexQuery('courses', query) }\n export function generation <Q extends Query<GenerationVertex > & AssertNoInvalidExpandKeys<GenerationVertex, Q>> (query: Q) { return new VertexQuery('generations', query) }\n export function location <Q extends Query<LocationVertex > & AssertNoInvalidExpandKeys<LocationVertex, Q>> (query: Q) { return new VertexQuery('locations', query) }\n export function lockedTime <Q extends Query<LockedTimeVertex > & AssertNoInvalidExpandKeys<LockedTimeVertex, Q>> (query: Q) { return new VertexQuery('lockedTimes', query) }\n export function overlapGroup <Q extends Query<OverlapGroupVertex > & AssertNoInvalidExpandKeys<OverlapGroupVertex, Q>> (query: Q) { return new VertexQuery('overlapGroups', query) }\n export function linkedEventsSet<Q extends Query<LinkedEventsSetVertex > & AssertNoInvalidExpandKeys<LinkedEventsSetVertex, Q>> (query: Q) { return new VertexQuery('linkedEventsSets', query) }\n export function period <Q extends Query<PeriodVertex > & AssertNoInvalidExpandKeys<PeriodVertex, Q>> (query: Q) { return new VertexQuery('periods', query) }\n export function person <Q extends Query<PersonVertex > & AssertNoInvalidExpandKeys<PersonVertex, Q>> (query: Q) { return new VertexQuery('persons', query) }\n export function student <Q extends Query<PersonVertex > & AssertNoInvalidExpandKeys<PersonVertex, Q>> (query: Q) { return new VertexQuery('students', query) }\n export function rootInterval <Q extends Query<RootIntervalVertex > & AssertNoInvalidExpandKeys<RootIntervalVertex, Q>> (query: Q) { return new VertexQuery('rootIntervals', query) }\n export function syllabus <Q extends Query<SyllabusVertex > & AssertNoInvalidExpandKeys<SyllabusVertex, Q>> (query: Q) { return new VertexQuery('syllabuses', query) }\n export function group <Q extends Query<GroupVertex > & AssertNoInvalidExpandKeys<GroupVertex, Q>> (query: Q) { return new VertexQuery('groups', query) }\n export function teacher <Q extends Query<TeacherVertex > & AssertNoInvalidExpandKeys<TeacherVertex, Q>> (query: Q) { return new VertexQuery('teachers', query) }\n export function configuration <Q extends Query<ConfigurationVertex > & AssertNoInvalidExpandKeys<ConfigurationVertex, Q>> (query: Q) { return new VertexQuery('configurations', query) }\n export function thread <Q extends Query<ThreadVertex > & AssertNoInvalidExpandKeys<ThreadVertex, Q>> (query: Q) { return new VertexQuery('threads', query) }\n export function user <Q extends Query<UserVertex > & AssertNoInvalidExpandKeys<UserVertex, Q>> (query: Q) { return new VertexQuery('users', query) }\n}"],"mappings":";;;AA0DE,WAAyC;;;;AAM3C,IAAa,cAAb,MAGE;CACA,YACE,AAAiBA,aACjB,AAAiBC,QACjB;EAFiB;EACA;;CAGnB,IAAI,aAAc;AAAE,SAAO,KAAK;;CAChC,IAAI,QAAc;AAAE,SAAO,KAAK;;;;;CA6CzB,SAAS,SAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,aAAoB;;;CACjL,SAAS,SAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,YAAoB;;;CACjL,SAAS,UAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,cAAoB;;;CACjL,SAAS,MAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,UAAoB;;;CACjL,SAAS,cAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,kBAAoB;;;CACjL,SAAS,cAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,kBAAoB;;;CACjL,SAAS,OAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,WAAoB;;;CACjL,SAAS,WAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,eAAoB;;;CACjL,SAAS,SAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,aAAoB;;;CACjL,SAAS,WAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,eAAoB;;;CACjL,SAAS,aAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,iBAAoB;;;CACjL,SAAS,gBAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,oBAAoB;;;CACjL,SAAS,OAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,WAAoB;;;CACjL,SAAS,OAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,WAAoB;;;CACjL,SAAS,QAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,YAAoB;;;CACjL,SAAS,aAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,iBAAoB;;;CACjL,SAAS,SAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,cAAoB;;;CACjL,SAAS,MAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,UAAoB;;;CACjL,SAAS,QAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,YAAoB;;;CACjL,SAAS,cAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,kBAAoB;;;CACjL,SAAS,OAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,WAAoB;;;CACjL,SAAS,KAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,SAAoB"}
1
+ {"version":3,"file":"vertex-query.js","names":["_collection: C","_query: Q"],"sources":["../../../../src/core/interfaces/vertices/vertex-query.ts"],"sourcesContent":["import type { AssertNoInvalidExpandKeys, Collection, CustomVertexExport } from './util';\nimport type { TeacherVertex } from './teachers';\nimport type { ExceptionVertex } from './exceptions';\nimport type { EventVertex, ScheduleEventVertex, CalendarEventVertex } from './events';\nimport type { CourseVertex } from './courses';\nimport type { DivisionSettingsVertex } from './division-settings';\nimport type { DivisionVertex } from './divisions';\nimport type { GenerationVertex } from './generations';\nimport type { GroupVertex } from './groups';\nimport type { LocationVertex } from './locations';\nimport type { LockedTimeVertex } from './locked-times';\nimport type { OverlapGroupVertex } from './overlap-groups';\nimport type { LinkedEventsSetVertex } from './linked-events-sets';\nimport type { PeriodVertex } from './periods';\nimport type { PersonVertex } from './persons';\nimport type { RootIntervalVertex } from './root-intervals';\nimport type { SyllabusVertex } from './syllabuses';\nimport type { ConfigurationVertex } from './configurations';\nimport type { CompanyVertex } from './companies';\nimport type { UserVertex } from './users';\nimport type { ThreadVertex } from './threads';\nimport type { ConversationVertex } from './conversations';\nimport type { MessageVertex } from './messages';\nimport type { VertexQuery as Query } from './util/vertex-query';\nimport type { TypeEqual } from 'ts-expect';\nimport { expectType } from 'ts-expect';\n\n\nexport type VertexRecord = {\n divisions: DivisionVertex;\n divisionSettings: DivisionSettingsVertex;\n settings: DivisionSettingsVertex;\n teachers: TeacherVertex;\n exceptions: ExceptionVertex;\n events: EventVertex;\n scheduleEvents: ScheduleEventVertex;\n calendarEvents: CalendarEventVertex;\n courses: CourseVertex;\n generations: GenerationVertex;\n groups: GroupVertex;\n locations: LocationVertex;\n lockedTimes: LockedTimeVertex;\n overlapGroups: OverlapGroupVertex;\n linkedEventsSets: LinkedEventsSetVertex;\n periods: PeriodVertex;\n persons: PersonVertex;\n students: PersonVertex;\n rootIntervals: RootIntervalVertex;\n syllabuses: SyllabusVertex;\n configurations: ConfigurationVertex;\n companies: CompanyVertex;\n users: UserVertex;\n threads: ThreadVertex;\n conversations: ConversationVertex;\n messages: MessageVertex;\n};\nexport type BaseQueryRecord<C extends keyof VertexRecord> = Query<VertexRecord[C]>;\n{\n // the keys must all be a collection\n type Mismatches = keyof {\n [K in keyof VertexRecord as K extends Collection ? never : K]: true\n };\n expectType<TypeEqual<Mismatches, never>>(true);\n}\n\n/**\n * See {@link createVertexQuery}\n */\nexport class VertexQuery <\n C extends keyof VertexRecord,\n Q extends BaseQueryRecord<C> & AssertNoInvalidExpandKeys<VertexRecord[C], Q>\n> {\n constructor (\n private readonly _collection: C,\n private readonly _query: Q\n ) {}\n\n get collection () { return this._collection }\n get query () { return this._query }\n}\n\n\n/**\n * Infers the result type for a query created via createVertexQuery.\n *\n * @example\n * const personQuery = createVertexQuery('persons', { select: ['id', 'firstName'] });\n * type PersonType = Infer<typeof personQuery>;\n */\nexport type Infer<T extends VertexQuery<any, any>> = // eslint-disable-line @typescript-eslint/no-explicit-any\n T extends VertexQuery<infer C, infer Q>\n ? CustomVertexExport<VertexRecord[C], Q>\n : never;\n\n\n/**\n * Builds a typed vertex query for a given vertex type using a select/expand shape.\n *\n * Use together with Infer<T> to obtain the serialized result type.\n *\n * @typeParam Q - The select/expand query shape for that vertex.\n *\n * @example\n * const groupQuery = createVertexQuery.group({\n * select: ['id', 'displayName'],\n * expand: { members: { select: ['id'] } }\n * });\n * type GroupType = Infer<typeof groupQuery>;\n */\nexport namespace createVertexQuery {\n //\n // The following did not work: it seems we need to define Q as an completely independent type parameter (?)\n //\n // export function createVertexQuery <\n // C extends keyof VertexRecord,\n // const Q extends Query<VertexRecord[C]>\n // > (\n // collection: C,\n // query: Q\n // ) {\n // return new VertexQuery(collection, query);\n // }\n\n export function division <Q extends Query<DivisionVertex > & AssertNoInvalidExpandKeys<DivisionVertex, Q>> (query: Q) { return new VertexQuery('divisions', query) }\n export function settings <Q extends Query<DivisionSettingsVertex> & AssertNoInvalidExpandKeys<DivisionSettingsVertex, Q>> (query: Q) { return new VertexQuery('settings', query) }\n export function exception <Q extends Query<ExceptionVertex > & AssertNoInvalidExpandKeys<ExceptionVertex, Q>> (query: Q) { return new VertexQuery('exceptions', query) }\n export function event <Q extends Query<EventVertex > & AssertNoInvalidExpandKeys<EventVertex, Q>> (query: Q) { return new VertexQuery('events', query) }\n export function scheduleEvent <Q extends Query<ScheduleEventVertex > & AssertNoInvalidExpandKeys<ScheduleEventVertex, Q>> (query: Q) { return new VertexQuery('scheduleEvents', query) }\n export function calendarEvent <Q extends Query<CalendarEventVertex > & AssertNoInvalidExpandKeys<CalendarEventVertex, Q>> (query: Q) { return new VertexQuery('calendarEvents', query) }\n export function course <Q extends Query<CourseVertex > & AssertNoInvalidExpandKeys<CourseVertex, Q>> (query: Q) { return new VertexQuery('courses', query) }\n export function generation <Q extends Query<GenerationVertex > & AssertNoInvalidExpandKeys<GenerationVertex, Q>> (query: Q) { return new VertexQuery('generations', query) }\n export function location <Q extends Query<LocationVertex > & AssertNoInvalidExpandKeys<LocationVertex, Q>> (query: Q) { return new VertexQuery('locations', query) }\n export function lockedTime <Q extends Query<LockedTimeVertex > & AssertNoInvalidExpandKeys<LockedTimeVertex, Q>> (query: Q) { return new VertexQuery('lockedTimes', query) }\n export function overlapGroup <Q extends Query<OverlapGroupVertex > & AssertNoInvalidExpandKeys<OverlapGroupVertex, Q>> (query: Q) { return new VertexQuery('overlapGroups', query) }\n export function linkedEventsSet<Q extends Query<LinkedEventsSetVertex > & AssertNoInvalidExpandKeys<LinkedEventsSetVertex, Q>> (query: Q) { return new VertexQuery('linkedEventsSets', query) }\n export function period <Q extends Query<PeriodVertex > & AssertNoInvalidExpandKeys<PeriodVertex, Q>> (query: Q) { return new VertexQuery('periods', query) }\n export function person <Q extends Query<PersonVertex > & AssertNoInvalidExpandKeys<PersonVertex, Q>> (query: Q) { return new VertexQuery('persons', query) }\n export function student <Q extends Query<PersonVertex > & AssertNoInvalidExpandKeys<PersonVertex, Q>> (query: Q) { return new VertexQuery('students', query) }\n export function rootInterval <Q extends Query<RootIntervalVertex > & AssertNoInvalidExpandKeys<RootIntervalVertex, Q>> (query: Q) { return new VertexQuery('rootIntervals', query) }\n export function syllabus <Q extends Query<SyllabusVertex > & AssertNoInvalidExpandKeys<SyllabusVertex, Q>> (query: Q) { return new VertexQuery('syllabuses', query) }\n export function group <Q extends Query<GroupVertex > & AssertNoInvalidExpandKeys<GroupVertex, Q>> (query: Q) { return new VertexQuery('groups', query) }\n export function teacher <Q extends Query<TeacherVertex > & AssertNoInvalidExpandKeys<TeacherVertex, Q>> (query: Q) { return new VertexQuery('teachers', query) }\n export function configuration <Q extends Query<ConfigurationVertex > & AssertNoInvalidExpandKeys<ConfigurationVertex, Q>> (query: Q) { return new VertexQuery('configurations', query) }\n export function thread <Q extends Query<ThreadVertex > & AssertNoInvalidExpandKeys<ThreadVertex, Q>> (query: Q) { return new VertexQuery('threads', query) }\n export function user <Q extends Query<UserVertex > & AssertNoInvalidExpandKeys<UserVertex, Q>> (query: Q) { return new VertexQuery('users', query) }\n export function conversation <Q extends Query<ConversationVertex > & AssertNoInvalidExpandKeys<ConversationVertex, Q>> (query: Q) { return new VertexQuery('conversations', query) }\n export function message <Q extends Query<Message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;AAAE,SAAO,IAAI,YAAY,cAAoB;;;CACjL,SAAS,MAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,UAAoB;;;CACjL,SAAS,QAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,YAAoB;;;CACjL,SAAS,cAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,kBAAoB;;;CACjL,SAAS,OAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,WAAoB;;;CACjL,SAAS,KAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,SAAoB;;;CACjL,SAAS,aAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,iBAAoB;;;CACjL,SAAS,QAAiH,OAAU;AAAE,SAAO,IAAI,YAAY,YAAoB"}
@@ -32,6 +32,7 @@ declare namespace Types {
32
32
  type Syllabus = Deep.Syllabus;
33
33
  type User = Deep.User;
34
34
  type Thread = Deep.Thread;
35
+ type Message = Deep.Message;
35
36
  type Schedule = Deep.Schedule;
36
37
  }
37
38
  namespace Serialized {
@@ -56,6 +57,7 @@ declare namespace Types {
56
57
  type Syllabus = Serialized.Syllabus;
57
58
  type User = Serialized.User;
58
59
  type Thread = Serialized.Thread;
60
+ type Message = Serialized.Message;
59
61
  type Schedule = Serialized.Schedule;
60
62
  }
61
63
  namespace Mixed {
@@ -80,6 +82,7 @@ declare namespace Types {
80
82
  type Syllabus = Mixed.Syllabus;
81
83
  type User = Mixed.User;
82
84
  type Thread = Mixed.Thread;
85
+ type Message = Mixed.Message;
83
86
  type Schedule = Mixed.Schedule;
84
87
  }
85
88
  namespace MixedWithoutInternalId {
@@ -104,6 +107,7 @@ declare namespace Types {
104
107
  type Syllabus = MixedWithOptionalId.Syllabus;
105
108
  type User = MixedWithOptionalId.User;
106
109
  type Thread = MixedWithOptionalId.Thread;
110
+ type Message = MixedWithOptionalId.Message;
107
111
  type Schedule = MixedWithOptionalId.Schedule;
108
112
  }
109
113
  namespace SerializedWithOptionalId {
@@ -128,6 +132,7 @@ declare namespace Types {
128
132
  type Syllabus = SerializedWithOptionalId.Syllabus;
129
133
  type User = SerializedWithOptionalId.User;
130
134
  type Thread = SerializedWithOptionalId.Thread;
135
+ type Message = SerializedWithOptionalId.Message;
131
136
  type Schedule = SerializedWithOptionalId.Schedule;
132
137
  }
133
138
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@royalschedule/maps",
3
3
  "description": "",
4
- "version": "4.1.1-beta.0",
4
+ "version": "4.1.2",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.mts",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/index.mjs",
11
- "types": "./dist/index.d.mts"
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
12
  }
13
13
  },
14
14
  "engines": {