@royalschedule/maps 4.0.14 → 4.0.15

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.
@@ -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 xlsx1 from "xlsx";
3
+ import * as xlsx0 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) => xlsx1.WorkBook;
17
+ }, _options?: Types$1.options) => xlsx0.WorkBook;
18
18
  }
19
19
  //#endregion
20
20
  export { export_default };
@@ -15,55 +15,55 @@ declare class PlanDigitalMap {
15
15
  groups?: {
16
16
  exceptions?: string[] | undefined;
17
17
  lockedTimes?: string[] | undefined;
18
+ ids?: ID | undefined;
18
19
  createdAt?: DateType | undefined;
19
20
  updatedAt?: DateType | undefined;
20
21
  lastModifiedBy?: unknown;
21
- ids?: ID | undefined;
22
22
  belongsTo?: string | undefined;
23
23
  rank?: number | undefined;
24
- days?: Day[] | undefined;
25
24
  displayName?: string | undefined;
25
+ lunch?: string[] | undefined;
26
26
  intervals?: AllowedInterval[] | undefined;
27
+ days?: Day[] | undefined;
27
28
  minBreakLength?: BreakLength | undefined;
29
+ tags?: Tag[] | undefined;
28
30
  maximumScheduleSpan?: MaximumScheduleSpan | undefined;
29
31
  forbidOverlappingEvents?: boolean | undefined;
30
32
  disableDayLengthPunishment?: boolean | undefined;
31
33
  weight?: number | undefined;
34
+ rootInterval?: string | undefined;
35
+ maxNumWorkingHours?: number | boolean | undefined;
36
+ maxNumDailyWorkingHours?: number | number[] | boolean | undefined;
32
37
  species?: "class" | undefined;
33
38
  parentGroups?: string[] | undefined;
34
39
  subGroups?: string[] | undefined;
35
- lunch?: string[] | undefined;
36
40
  members?: string[] | undefined;
37
- rootInterval?: string | undefined;
38
- tags?: Tag[] | undefined;
39
- maxNumWorkingHours?: number | boolean | undefined;
40
- maxNumDailyWorkingHours?: number | number[] | boolean | undefined;
41
41
  }[];
42
42
  teachers?: {
43
43
  exceptions?: string[] | undefined;
44
44
  lockedTimes?: string[] | undefined;
45
+ ids?: ID | undefined;
45
46
  createdAt?: DateType | undefined;
46
47
  updatedAt?: DateType | undefined;
47
48
  lastModifiedBy?: unknown;
48
- ids?: ID | undefined;
49
49
  belongsTo?: string | undefined;
50
50
  rank?: number | undefined;
51
- days?: Day[] | undefined;
52
51
  displayName?: string | undefined;
52
+ lunch?: string[] | undefined;
53
53
  intervals?: AllowedInterval[] | undefined;
54
+ days?: Day[] | undefined;
54
55
  minBreakLength?: BreakLength | undefined;
56
+ tags?: Tag[] | undefined;
57
+ plannedScheduledDuration?: PlannedScheduledDuration | undefined;
55
58
  maximumScheduleSpan?: MaximumScheduleSpan | undefined;
56
59
  forbidOverlappingEvents?: boolean | undefined;
57
60
  disableDayLengthPunishment?: boolean | undefined;
58
61
  weight?: number | undefined;
59
- lunch?: string[] | undefined;
62
+ person?: string | undefined;
60
63
  rootInterval?: string | undefined;
61
- tags?: Tag[] | undefined;
64
+ signature?: string | undefined;
62
65
  maxNumWorkingHours?: number | boolean | undefined;
63
66
  maxNumDailyWorkingHours?: number | number[] | boolean | undefined;
64
- plannedScheduledDuration?: PlannedScheduledDuration | undefined;
65
- person?: string | undefined;
66
- signature?: string | undefined;
67
67
  }[];
68
68
  courses?: {
69
69
  exceptions?: string[] | undefined;
@@ -72,26 +72,26 @@ declare class PlanDigitalMap {
72
72
  locations?: AvailableLocation<string>[] | undefined;
73
73
  events?: string[] | undefined;
74
74
  lockedTimes?: string[] | undefined;
75
+ ids?: ID | undefined;
75
76
  createdAt?: DateType | undefined;
76
77
  updatedAt?: DateType | undefined;
77
78
  lastModifiedBy?: unknown;
78
- ids?: ID | undefined;
79
79
  belongsTo?: string | undefined;
80
- type?: string | undefined;
81
- days?: Day[] | undefined;
82
- weeks?: number[] | undefined;
83
80
  displayName?: string | undefined;
84
- period?: string | undefined;
85
81
  intervals?: AllowedInterval[] | undefined;
82
+ days?: Day[] | undefined;
86
83
  minBreakLength?: BreakLength | undefined;
87
- weight?: number | undefined;
88
84
  tags?: Tag[] | undefined;
89
- color?: string | undefined;
85
+ weeks?: number[] | undefined;
86
+ weight?: number | undefined;
87
+ period?: string | undefined;
90
88
  participants?: PersonReference<string>[] | undefined;
91
89
  density?: number | undefined;
92
90
  subject?: string | undefined;
91
+ color?: string | undefined;
93
92
  eventDurationVariance?: number | undefined;
94
93
  totalTime?: string | undefined;
94
+ type?: string | undefined;
95
95
  comment?: string | undefined;
96
96
  startDate?: DateType | undefined;
97
97
  endDate?: DateType | undefined;
@@ -2,7 +2,7 @@ import { Types as Types$1 } from "../../core/types/index.js";
2
2
  import { Types } from "../types/index.js";
3
3
 
4
4
  //#region src/RS/from/schedules.d.ts
5
- declare function schedules(input: Partial<Types.toOutput>, options: Pick<Types.toOptions, 'idKey'>): Partial<Types$1.serialized.schedule>;
5
+ declare function schedules(input: Partial<Types.toOutput>, options?: Pick<Types.toOptions, 'idKey'>): Partial<Types$1.serialized.schedule>;
6
6
  //#endregion
7
7
  export { schedules };
8
8
  //# sourceMappingURL=schedules.d.ts.map
@@ -3,7 +3,8 @@ import { COLLECTION_ID } from "../to/input/util/util.js";
3
3
  import moment from "moment";
4
4
 
5
5
  //#region src/RS/from/schedules.ts
6
- function schedules(input, options) {
6
+ function schedules(input, options = {}) {
7
+ if (!options.idKey) options.idKey = "id";
7
8
  const warnings = [];
8
9
  const schedule = input.coreData;
9
10
  const eventConfigurations = input.output?.at(0)?.events;
@@ -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.serialized.schedule> {\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,SACwC;CACxC,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 { 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.serialized.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,IACF;AAExC,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"}
@@ -2,6 +2,7 @@ import { CoreMap } from "../../core/index.js";
2
2
  import { parseInput } from "./input/input.js";
3
3
  import { makeConnected } from "../make-connected.js";
4
4
  import { initialConfiguration } from "./initial-configuration.js";
5
+ import { structure } from "../types/to.js";
5
6
  import { pick } from "lodash-es";
6
7
 
7
8
  //#region src/RS/to/schedules.ts
@@ -25,7 +26,7 @@ function schedules(data, _options = {}) {
25
26
  const connectedData = makeConnected(data);
26
27
  return {
27
28
  meta: {
28
- structure: "RS/algorithm-5.0.0",
29
+ structure,
29
30
  division: pick(data.division, "displayName", "start", "end")
30
31
  },
31
32
  algorithmParameters: { weights: options.algorithmWeightParameters },
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions']"],"sources":["../../../src/RS/to/schedules.ts"],"sourcesContent":["import { pick } from 'lodash-es';\nimport { parseInput } from './input/input';\nimport { makeConnected } from '../make-connected';\nimport { initialConfiguration } from './initial-configuration';\nimport type { Types } from '../types';\nimport { CoreMap } from '../../core';\n\nexport function schedules (\n data: Types.toInput,\n _options: Types.toOptions = {}\n): Types.toOutput {\n ////\n //// parse the options\n ////\n const options = ((): Types.parsedToOptions => {\n const x = _options.partialScheduleOptions;\n const partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions'] = x\n ? {\n includedEvents: x.includedEvents ? new Set(x.includedEvents) : undefined,\n includedLocations: x.includedLocations ? new Set(x.includedLocations) : undefined,\n omittedEventsHandling: x.omittedEventsHandling\n }\n : undefined;\n\n return { ..._options, partialScheduleOptions };\n })();\n\n ////\n //// for backward compatibility: add default collection to included events set\n ////\n if (options.partialScheduleOptions?.includedEvents?.size) {\n options.partialScheduleOptions.includedEvents = new Set(\n [...options.partialScheduleOptions.includedEvents]\n .map(x => {\n // should start with 'events.' or 'lockedTimes.' prefix\n if (x.startsWith('events.') || x.startsWith('lockedTimes.')) return x;\n return `events.${x}`;\n })\n );\n }\n\n\n // we will work only with connected schedule data\n const connectedData = makeConnected(data);\n\n return {\n meta: {\n structure: 'RS/algorithm-5.0.0' satisfies Types.structure,\n division: pick(data.division, 'displayName', 'start', 'end'),\n },\n algorithmParameters: {\n weights: options.algorithmWeightParameters,\n },\n input: parseInput(connectedData, options),\n ...options.appendCoreData && { coreData: CoreMap.to.schedules(data) },\n ...options.appendOutput && { output: initialConfiguration(connectedData.events, connectedData.lockedTimes, options) },\n };\n};"],"mappings":";;;;;;;AAOA,SAAgB,UACd,MACA,WAA4B,IACZ;CAIhB,MAAM,iBAAwC;EAC5C,MAAM,IAAI,SAAS;EACnB,MAAMA,yBAA0E,IAC5E;GACA,gBAAuB,EAAE,iBAAoB,IAAI,IAAI,EAAE,kBAAqB;GAC5E,mBAAuB,EAAE,oBAAoB,IAAI,IAAI,EAAE,qBAAqB;GAC5E,uBAAuB,EAAE;MAEzB;AAEJ,SAAO;GAAE,GAAG;GAAU;;;AAMxB,KAAI,QAAQ,wBAAwB,gBAAgB,KAClD,SAAQ,uBAAuB,iBAAiB,IAAI,IAClD,CAAC,GAAG,QAAQ,uBAAuB,gBAChC,KAAI,MAAK;AAER,MAAI,EAAE,WAAW,cAAc,EAAE,WAAW,gBAAiB,QAAO;AACpE,SAAO,UAAU;;CAOzB,MAAM,gBAAgB,cAAc;AAEpC,QAAO;EACL,MAAM;GACJ,WAAW;GACX,UAAW,KAAK,KAAK,UAAU,eAAe,SAAS;;EAEzD,qBAAqB,EACnB,SAAS,QAAQ;EAEnB,OAAO,WAAW,eAAe;EACjC,GAAG,QAAQ,kBAAkB,EAAE,UAAU,QAAQ,GAAG,UAAU;EAC9D,GAAG,QAAQ,gBAAkB,EAAE,QAAQ,qBAAqB,cAAc,QAAQ,cAAc,aAAa"}
1
+ {"version":3,"file":"schedules.js","names":["partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions']"],"sources":["../../../src/RS/to/schedules.ts"],"sourcesContent":["import { pick } from 'lodash-es';\nimport { parseInput } from './input/input';\nimport { makeConnected } from '../make-connected';\nimport { initialConfiguration } from './initial-configuration';\nimport type { Types } from '../types';\nimport { CoreMap } from '../../core';\nimport { structure } from '../types/to';\n\nexport function schedules (\n data: Types.toInput,\n _options: Types.toOptions = {}\n): Types.toOutput {\n ////\n //// parse the options\n ////\n const options = ((): Types.parsedToOptions => {\n const x = _options.partialScheduleOptions;\n const partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions'] = x\n ? {\n includedEvents: x.includedEvents ? new Set(x.includedEvents) : undefined,\n includedLocations: x.includedLocations ? new Set(x.includedLocations) : undefined,\n omittedEventsHandling: x.omittedEventsHandling\n }\n : undefined;\n\n return { ..._options, partialScheduleOptions };\n })();\n\n ////\n //// for backward compatibility: add default collection to included events set\n ////\n if (options.partialScheduleOptions?.includedEvents?.size) {\n options.partialScheduleOptions.includedEvents = new Set(\n [...options.partialScheduleOptions.includedEvents]\n .map(x => {\n // should start with 'events.' or 'lockedTimes.' prefix\n if (x.startsWith('events.') || x.startsWith('lockedTimes.')) return x;\n return `events.${x}`;\n })\n );\n }\n\n\n // we will work only with connected schedule data\n const connectedData = makeConnected(data);\n\n return {\n meta: {\n structure: structure,\n division: pick(data.division, 'displayName', 'start', 'end'),\n },\n algorithmParameters: {\n weights: options.algorithmWeightParameters,\n },\n input: parseInput(connectedData, options),\n ...options.appendCoreData && { coreData: CoreMap.to.schedules(data) },\n ...options.appendOutput && { output: initialConfiguration(connectedData.events, connectedData.lockedTimes, options) },\n };\n};"],"mappings":";;;;;;;;AAQA,SAAgB,UACd,MACA,WAA4B,IACZ;CAIhB,MAAM,iBAAwC;EAC5C,MAAM,IAAI,SAAS;EACnB,MAAMA,yBAA0E,IAC5E;GACA,gBAAuB,EAAE,iBAAoB,IAAI,IAAI,EAAE,kBAAqB;GAC5E,mBAAuB,EAAE,oBAAoB,IAAI,IAAI,EAAE,qBAAqB;GAC5E,uBAAuB,EAAE;MAEzB;AAEJ,SAAO;GAAE,GAAG;GAAU;;;AAMxB,KAAI,QAAQ,wBAAwB,gBAAgB,KAClD,SAAQ,uBAAuB,iBAAiB,IAAI,IAClD,CAAC,GAAG,QAAQ,uBAAuB,gBAChC,KAAI,MAAK;AAER,MAAI,EAAE,WAAW,cAAc,EAAE,WAAW,gBAAiB,QAAO;AACpE,SAAO,UAAU;;CAOzB,MAAM,gBAAgB,cAAc;AAEpC,QAAO;EACL,MAAM;GACO;GACX,UAAW,KAAK,KAAK,UAAU,eAAe,SAAS;;EAEzD,qBAAqB,EACnB,SAAS,QAAQ;EAEnB,OAAO,WAAW,eAAe;EACjC,GAAG,QAAQ,kBAAkB,EAAE,UAAU,QAAQ,GAAG,UAAU;EAC9D,GAAG,QAAQ,gBAAkB,EAAE,QAAQ,qBAAqB,cAAc,QAAQ,cAAc,aAAa"}
@@ -40,7 +40,8 @@ interface ToOptions extends BaseOptions {
40
40
  interface ParsedToOptions extends Omit<ToOptions, 'partialScheduleOptions'> {
41
41
  partialScheduleOptions?: PartialScheduleOptions<Set<string>>;
42
42
  }
43
- type Structure = 'RS/algorithm-5.0.0';
43
+ declare const structure = "RS/algorithm-5.0.1";
44
+ type Structure = typeof structure;
44
45
  interface ToOutput {
45
46
  meta: {
46
47
  structure?: Structure;
@@ -0,0 +1,6 @@
1
+ //#region src/RS/types/to.ts
2
+ const structure = "RS/algorithm-5.0.1";
3
+
4
+ //#endregion
5
+ export { structure };
6
+ //# sourceMappingURL=to.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to.js","names":[],"sources":["../../../src/RS/types/to.ts"],"sourcesContent":["import type { BaseOptions } from '../../common/types';\nimport type { CoreTypes } from '../../core';\nimport type { MixedScheduleData } from '../make-connected';\nimport type { Types } from './';\nimport type { AlgorithmWeightParameters } from './algorithm-parameters';\n\n\nexport type ToInput = MixedScheduleData;\n\ntype PartialScheduleOptions<IDs extends Array<string> | Set<string>> = {\n /** @description undefined means all included */\n includedEvents?: IDs;\n /** @description undefined means all included */\n includedLocations?: IDs;\n omittedEventsHandling: 'ignore' | 'freeze';\n};\n\nexport interface ToOptions extends BaseOptions {\n meta?: boolean;\n isPrivateId?: boolean;\n isPublicId?: boolean;\n appendCoreData?: boolean;\n appendOutput?: boolean;\n\n /**\n * @deprecated\n * If true, the mapping becomes the same as the previous version 2 one. That means:\n *\n * - New root level entries: `intervals` and `individuals`\n * - As the there is now a root level `intervals` the former may be references from `Collection.intervals`, `Group.intervals` etc.\n * - The `Collection.groups` and `Event.groups` supports referencing `individuals` (and `individuals sets`) in addition to `groups`\n * - The `Group.forbidOverlappingEvents` has been removed.\n * - The `Group.disableDayLengthPunishment` has been replaced by `Group.minimizeGaps`\n */\n oldFormat?: boolean;\n\n partialScheduleOptions?: PartialScheduleOptions<Array<string> | Set<string>>\n\n algorithmWeightParameters?: AlgorithmWeightParameters;\n\n /**\n * to be used before whe have migrated from \"maxNumWorkingHours\" and \"maxNumDailyWorkingHours\" to \"maximumScheduleSpan\"\n */\n useMaximumScheduleSpan?: boolean;\n}\n\nexport interface ParsedToOptions extends Omit<ToOptions, 'partialScheduleOptions'> {\n partialScheduleOptions?: PartialScheduleOptions<Set<string>>\n}\n\nexport const structure = 'RS/algorithm-5.0.1';\nexport type Structure = typeof structure;\nexport interface ToOutput {\n meta: {\n structure?: Structure;\n division: Pick<CoreTypes.division, 'displayName' | 'start' | 'end'>;\n };\n algorithmParameters?: {\n weights?: AlgorithmWeightParameters;\n };\n score?: [number, number, number, number];\n input: Types.scheduleData;\n output?: Types.configuration[];\n coreData?: Partial<CoreTypes.serialized.schedule>;\n}"],"mappings":";AAkDA,MAAa,YAAY"}
@@ -1,12 +1,12 @@
1
1
  import { BaseOptions } from "../../../common/types.js";
2
2
  import { Types } from "../../../core/types/index.js";
3
- import * as xlsx0 from "xlsx";
3
+ import * as xlsx1 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) => xlsx0.WorkBook;
9
+ }, options?: BaseOptions) => xlsx1.WorkBook;
10
10
  }
11
11
  //#endregion
12
12
  export { export_default };
@@ -100,7 +100,7 @@ declare const maps: readonly [{
100
100
  readonly name: "Royal Schedule Algorithm";
101
101
  readonly map: typeof RSMap;
102
102
  readonly meta: {
103
- readonly structure: "RS/algorithm-5.0.0";
103
+ readonly structure: "RS/algorithm-5.0.1";
104
104
  };
105
105
  }, {
106
106
  readonly structure: {
@@ -4,6 +4,7 @@ import { PlanDigitalMap } from "../../PlanDigital/index.js";
4
4
  import { AdmentumMap } from "../../Admentum/index.js";
5
5
  import { IdunSoftMap } from "../../IdunSoft/index.js";
6
6
  import { Skola24Map } from "../../Skola24/index.js";
7
+ import { structure } from "../../RS/types/to.js";
7
8
  import { RSMap } from "../../RS/index.js";
8
9
  import { ExcelMap } from "../../Excel/index.js";
9
10
 
@@ -289,7 +290,7 @@ const maps = [
289
290
  structure: RS_structure,
290
291
  name: "Royal Schedule Algorithm",
291
292
  map: RSMap,
292
- meta: { structure: "RS/algorithm-5.0.0" }
293
+ meta: { structure }
293
294
  },
294
295
  {
295
296
  structure: core_structure,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[]"],"sources":["../../../src/identify/constants/index.ts"],"sourcesContent":["import { CoreMap } from '../../core';\nimport type { SchoolSoftFileTypes } from '../../SchoolSoft';\nimport { SchoolSoftMap } from '../../SchoolSoft';\nimport { PlanDigitalMap } from '../../PlanDigital';\nimport { AdmentumMap } from '../../Admentum';\nimport { IdunSoftMap } from '../../IdunSoft';\nimport { Skola24Map } from '../../Skola24';\nimport { RSMap } from '../../RS';\nimport { ExcelMap } from '../../Excel';\nimport type { Types as RSTypes } from '../../RS/types';\n\n\nconst core_structure = {\n groups: ['id'],\n locations: ['id'],\n teachers: ['id'],\n courses: ['id', 'events', 'groups', 'subject', 'teachers'],\n};\n\nconst excel_structure = {\n meta: [['structure']],\n courses: [],\n groups: [],\n locations: [],\n};\n\nconst RS_structure = {\n events: ['output', 'coreData'],\n};\n\nconst Admentum_structure = {\n schools: ['url', 'id', 'unit_code', 'school_code', 'school_type', 'name'],\n schedule: ['url', 'id', 'school_id', 'school_year', 'start_date', 'end_date', 'start_time', 'end_time', 'is_active', 'archived_at'],\n rooms: ['url', 'id', 'school_id', 'name', 'category', 'capacity'],\n teachers: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n principals: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n courses: ['url', 'id', 'school_id', 'schedule_id', 'name', 'subject_code', 'start_date', 'end_date', 'teachers', 'gymnasium_course'],\n schedule_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'name', 'guid', 'teachers', 'users_primary_groups', 'subjects', 'courses'],\n primary_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'grade', 'name', 'guid', 'teachers', 'start_date', 'end_date', 'start_date_display', 'end_date_display'],\n schedule_events: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start_time', 'end_time', 'rooms', 'teachers', 'schedule_groups', 'primary_groups', 'weekly_interval'],\n schedule_event_instances: ['url', 'id', 'school_id', 'start_date', 'end_date', 'schedule_event'],\n lessons: ['url', 'id', 'school_id', 'date', 'info', 'teachers', 'room', 'weekday'],\n lesson_infos: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start', 'end', 'duration', 'room', 'subject', 'teachers', 'groups', 'weekly_interval'],\n};\n\nconst IdunSoft_structure = {\n Grupp: ['ID', 'Klassnamn'],\n Lärare: ['ID', 'Namn'],\n Rum: ['ID', 'Namn'],\n Ämne: ['Ämne', 'Betygskod'],\n Lektion: ['LektionID', 'Ämne', 'Starttid', 'Sluttid', 'Lektionslängd', 'LärareID', 'GruppID', 'RumID', 'VeckodagID']\n};\n\nconst Skola24_txt_structure = null;\n\nconst Skola24_mdb_structure = {\n unit_tblroom: [ 'PK', 'ID' ],\n school_tblsubject: [ 'PK', 'ID' ],\n school_tblteacher: [ 'PK', 'ID' ],\n school_tblgroup: [ 'PK', 'ID', 'bClass' ],\n school_tblplan: [ 'PK', 'FKSubject' ],\n school_tblcourse: [ ],\n school_tblschedule: [ 'PK', 'Length', 'StartTime', 'DayOfWeek', 'FKSubject', 'CalcActualWeeks' ],\n school_tblgroup_group: [ 'FKGroup', 'FKGroupCon' ],\n school_tblplan_period: [ 'FKPlan', 'FKPeriod' ],\n school_tblplan_teacher: [ 'FKPlan', 'FKTeacher' ],\n school_tblplan_group: [ 'FKPlan', 'FKGroup' ],\n unit_tblperiod_date: [ 'FKPeriod', 'StartDate', 'EndDate' ],\n school_tblschedule_period: [ 'FKSchedule', 'FKPeriod' ],\n school_tblschedule_teacher: [ 'FKSchedule', 'FKTeacher' ],\n school_tblschedule_group: [ 'FKSchedule', 'FKGroup' ],\n school_tblschedule_room: [ 'FKSchedule', 'FKRoom' ]\n};\n\n// this is only temporary\nconst PlanDigital_structure = {\n 'Perioder': [ 'Namn', 'Tidsenhet' ],\n 'Tabell Tjänstefördelning': [ 'Gruppnamn', 'Klass', 'Kurskod', 'Sign', 'Poäng', 'Anteckningar', 'Antal', 'Ämne', 'Kursnamn' ]\n};\n\nconst SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[] = [\n 'id',\n 'group',\n 'dayid',\n 'day',\n 'starttime',\n 'length',\n 'teacher',\n 'subject',\n 'room',\n 'period',\n 'inweek',\n 'exweek',\n 'exclass',\n 'realweeks'\n];\n\nexport const maps = [\n {\n structure: Skola24_txt_structure,\n matchType: 'string',\n name: 'Skola24 (txt)',\n map: Skola24Map.TXT,\n meta: { structure: '' }\n }, {\n structure: Admentum_structure,\n name: 'Admentum',\n map: AdmentumMap,\n meta: { structure: '' }\n }, {\n structure: SchoolSoft_structure,\n name: 'SchoolSoft',\n map: SchoolSoftMap,\n meta: { structure: '' }\n }, {\n structure: PlanDigital_structure,\n name: 'Plan Digital',\n map: PlanDigitalMap,\n meta: { structure: '' }\n }, {\n structure: IdunSoft_structure,\n name: 'IdunSoft',\n map: IdunSoftMap,\n meta: { structure: '' }\n }, {\n structure: Skola24_mdb_structure,\n name: 'Skola24 (mdb)',\n map: Skola24Map.MDB,\n meta: { structure: '' }\n }, {\n structure: RS_structure,\n name: 'Royal Schedule Algorithm',\n map: RSMap,\n meta: { structure: 'RS/algorithm-5.0.0' satisfies RSTypes.structure }\n }, {\n // structure: core_structure,\n // name: 'Royal Schedule',\n // map: CoreMap.V1,\n // meta: { structure: 'RS/core-1.0.0' }\n // }, {\n structure: core_structure,\n name: 'Royal Schedule',\n map: CoreMap,\n meta: { structure: 'RS/core-2.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V1,\n meta: { structure: 'RS/Excel-1.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: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MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW,WAAW;EACtB,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EAMD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW,SAAS;EACpB,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW,SAAS;EACpB,MAAW,EAAE,WAAW"}
1
+ {"version":3,"file":"index.js","names":["SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[]","RSstructure"],"sources":["../../../src/identify/constants/index.ts"],"sourcesContent":["import { CoreMap } from '../../core';\nimport type { SchoolSoftFileTypes } from '../../SchoolSoft';\nimport { SchoolSoftMap } from '../../SchoolSoft';\nimport { PlanDigitalMap } from '../../PlanDigital';\nimport { AdmentumMap } from '../../Admentum';\nimport { IdunSoftMap } from '../../IdunSoft';\nimport { Skola24Map } from '../../Skola24';\nimport { RSMap } from '../../RS';\nimport { ExcelMap } from '../../Excel';\nimport { structure as RSstructure } from '../../RS/types/to';\n\n\nconst core_structure = {\n groups: ['id'],\n locations: ['id'],\n teachers: ['id'],\n courses: ['id', 'events', 'groups', 'subject', 'teachers'],\n};\n\nconst excel_structure = {\n meta: [['structure']],\n courses: [],\n groups: [],\n locations: [],\n};\n\nconst RS_structure = {\n events: ['output', 'coreData'],\n};\n\nconst Admentum_structure = {\n schools: ['url', 'id', 'unit_code', 'school_code', 'school_type', 'name'],\n schedule: ['url', 'id', 'school_id', 'school_year', 'start_date', 'end_date', 'start_time', 'end_time', 'is_active', 'archived_at'],\n rooms: ['url', 'id', 'school_id', 'name', 'category', 'capacity'],\n teachers: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n principals: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n courses: ['url', 'id', 'school_id', 'schedule_id', 'name', 'subject_code', 'start_date', 'end_date', 'teachers', 'gymnasium_course'],\n schedule_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'name', 'guid', 'teachers', 'users_primary_groups', 'subjects', 'courses'],\n primary_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'grade', 'name', 'guid', 'teachers', 'start_date', 'end_date', 'start_date_display', 'end_date_display'],\n schedule_events: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start_time', 'end_time', 'rooms', 'teachers', 'schedule_groups', 'primary_groups', 'weekly_interval'],\n schedule_event_instances: ['url', 'id', 'school_id', 'start_date', 'end_date', 'schedule_event'],\n lessons: ['url', 'id', 'school_id', 'date', 'info', 'teachers', 'room', 'weekday'],\n lesson_infos: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start', 'end', 'duration', 'room', 'subject', 'teachers', 'groups', 'weekly_interval'],\n};\n\nconst IdunSoft_structure = {\n Grupp: ['ID', 'Klassnamn'],\n Lärare: ['ID', 'Namn'],\n Rum: ['ID', 'Namn'],\n Ämne: ['Ämne', 'Betygskod'],\n Lektion: ['LektionID', 'Ämne', 'Starttid', 'Sluttid', 'Lektionslängd', 'LärareID', 'GruppID', 'RumID', 'VeckodagID']\n};\n\nconst Skola24_txt_structure = null;\n\nconst Skola24_mdb_structure = {\n unit_tblroom: [ 'PK', 'ID' ],\n school_tblsubject: [ 'PK', 'ID' ],\n school_tblteacher: [ 'PK', 'ID' ],\n school_tblgroup: [ 'PK', 'ID', 'bClass' ],\n school_tblplan: [ 'PK', 'FKSubject' ],\n school_tblcourse: [ ],\n school_tblschedule: [ 'PK', 'Length', 'StartTime', 'DayOfWeek', 'FKSubject', 'CalcActualWeeks' ],\n school_tblgroup_group: [ 'FKGroup', 'FKGroupCon' ],\n school_tblplan_period: [ 'FKPlan', 'FKPeriod' ],\n school_tblplan_teacher: [ 'FKPlan', 'FKTeacher' ],\n school_tblplan_group: [ 'FKPlan', 'FKGroup' ],\n unit_tblperiod_date: [ 'FKPeriod', 'StartDate', 'EndDate' ],\n school_tblschedule_period: [ 'FKSchedule', 'FKPeriod' ],\n school_tblschedule_teacher: [ 'FKSchedule', 'FKTeacher' ],\n school_tblschedule_group: [ 'FKSchedule', 'FKGroup' ],\n school_tblschedule_room: [ 'FKSchedule', 'FKRoom' ]\n};\n\n// this is only temporary\nconst PlanDigital_structure = {\n 'Perioder': [ 'Namn', 'Tidsenhet' ],\n 'Tabell Tjänstefördelning': [ 'Gruppnamn', 'Klass', 'Kurskod', 'Sign', 'Poäng', 'Anteckningar', 'Antal', 'Ämne', 'Kursnamn' ]\n};\n\nconst SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[] = [\n 'id',\n 'group',\n 'dayid',\n 'day',\n 'starttime',\n 'length',\n 'teacher',\n 'subject',\n 'room',\n 'period',\n 'inweek',\n 'exweek',\n 'exclass',\n 'realweeks'\n];\n\nexport const maps = [\n {\n structure: Skola24_txt_structure,\n matchType: 'string',\n name: 'Skola24 (txt)',\n map: Skola24Map.TXT,\n meta: { structure: '' }\n }, {\n structure: Admentum_structure,\n name: 'Admentum',\n map: AdmentumMap,\n meta: { structure: '' }\n }, {\n structure: SchoolSoft_structure,\n name: 'SchoolSoft',\n map: SchoolSoftMap,\n meta: { structure: '' }\n }, {\n structure: PlanDigital_structure,\n name: 'Plan Digital',\n map: PlanDigitalMap,\n meta: { structure: '' }\n }, {\n structure: IdunSoft_structure,\n name: 'IdunSoft',\n map: IdunSoftMap,\n meta: { structure: '' }\n }, {\n structure: Skola24_mdb_structure,\n name: 'Skola24 (mdb)',\n map: Skola24Map.MDB,\n meta: { structure: '' }\n }, {\n structure: RS_structure,\n name: 'Royal Schedule Algorithm',\n map: RSMap,\n meta: { structure: RSstructure }\n }, {\n // structure: core_structure,\n // name: 'Royal Schedule',\n // map: CoreMap.V1,\n // meta: { structure: 'RS/core-1.0.0' }\n // }, {\n structure: core_structure,\n name: 'Royal Schedule',\n map: CoreMap,\n meta: { structure: 'RS/core-2.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V1,\n meta: { structure: 'RS/Excel-1.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V2,\n meta: { structure: 'RS/Excel-2.0.0' }\n }\n] as const;"],"mappings":";;;;;;;;;;;AAYA,MAAM,iBAAiB;CACrB,QAAW,CAAC;CACZ,WAAW,CAAC;CACZ,UAAW,CAAC;CACZ,SAAW;EAAC;EAAM;EAAU;EAAU;EAAW;;;AAGnD,MAAM,kBAAkB;CACtB,MAAW,CAAC,CAAC;CACb,SAAW;CACX,QAAW;CACX,WAAW;;AAGb,MAAM,eAAe,EACnB,QAAQ,CAAC,UAAU;AAGrB,MAAM,qBAAqB;CACzB,SAA0B;EAAC;EAAO;EAAM;EAAa;EAAe;EAAe;;CACnF,UAA0B;EAAC;EAAO;EAAM;EAAa;EAAe;EAAc;EAAY;EAAc;EAAY;EAAa;;CACrI,OAA0B;EAAC;EAAO;EAAM;EAAa;EAAQ;EAAY;;CACzE,UAA0B;EAAC;EAAO;EAAM;EAAa;EAAS;EAAc;EAAa;EAAQ;EAAyB;;CAC1H,YAA0B;EAAC;EAAO;EAAM;EAAa;EAAS;EAAc;EAAa;EAAQ;EAAyB;;CAC1H,SAA0B;EAAC;EAAO;EAAM;EAAa;EAAe;EAAQ;EAAgB;EAAc;EAAY;EAAY;;CAClI,iBAA0B;EAAC;EAAO;EAAM;EAAO;EAAa;EAAY;EAAQ;EAAQ;EAAY;EAAwB;EAAY;;CACxI,gBAA0B;EAAC;EAAO;EAAM;EAAO;EAAa;EAAY;EAAS;EAAQ;EAAQ;EAAY;EAAc;EAAY;EAAsB;;CAC7J,iBAA0B;EAAC;EAAO;EAAM;EAAO;EAAa;EAAe;EAAc;EAAY;EAAS;EAAY;EAAmB;EAAkB;;CAC/J,0BAA0B;EAAC;EAAO;EAAM;EAAa;EAAc;EAAY;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;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW,WAAW;EACtB,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAaC;;CACvB;EAMD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW,SAAS;EACpB,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW,SAAS;EACpB,MAAW,EAAE,WAAW"}
@@ -7,6 +7,13 @@ import * as z from "zod";
7
7
  function keysOf(docs) {
8
8
  return makeChainable(docs).chain((x) => Array.isArray(x) ? x : [x], (x) => x.flatMap((x$1) => x$1 && typeof x$1 === "object" ? Object.keys(x$1) : []), (x) => uniq(x)).value;
9
9
  }
10
+ function sameMajorStructure(a, b) {
11
+ const normalize = (s) => {
12
+ const m = s.match(/^(.*?)-v?(\d+)(?:\.\d+){0,2}$/i);
13
+ return m ? `${m[1]}-${m[2]}` : s;
14
+ };
15
+ return normalize(a) === normalize(b);
16
+ }
10
17
  function identify(schedule) {
11
18
  const similarities = {
12
19
  none: [],
@@ -18,7 +25,7 @@ function identify(schedule) {
18
25
  const MetaStructure = z.object({ meta: z.union([z.object({ structure: z.string() }), z.array(z.unknown()).transform((arr) => arr.at(0)).pipe(z.object({ structure: z.string() }))]) });
19
26
  const res = MetaStructure.safeParse(schedule);
20
27
  if (res.data) {
21
- const determined = maps.find((x) => x.meta.structure === res.data.meta.structure);
28
+ const determined = maps.find((x) => sameMajorStructure(x.meta.structure, res.data.meta.structure));
22
29
  if (determined) {
23
30
  similarities.determined = determined;
24
31
  return similarities;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["x","similarities: IdentifiedMaps","collections: string[]","structureKeys: string[]"],"sources":["../../src/identify/index.ts"],"sourcesContent":["import { difference, isEqual, sortBy, uniq } from 'lodash-es';\nimport type { IdentifiedMaps } from './types';\nimport { maps } from './constants';\nimport * as z from 'zod';\nimport { makeChainable } from '../common/make-chainable';\nexport type { MapInstance, MapName, IdentifiedMaps } from './types';\nexport { maps } from './constants';\n\n\nfunction keysOf (docs: unknown): string[] {\n return makeChainable(docs)\n .chain(\n x => Array.isArray(x) ? x as unknown[] : [x],\n x => x.flatMap(x => x && typeof x === 'object' ? Object.keys(x) : []),\n x => uniq(x)\n )\n .value;\n}\n\nexport function identify (schedule: unknown): IdentifiedMaps {\n const similarities: IdentifiedMaps = {\n none: [],\n weak: [],\n strong: [],\n error: [],\n };\n\n if (!schedule) return similarities;\n\n ////\n //// check if the schedule is a meta tagged file and thus identifiable by its structure.\n ////\n const MetaStructure = z.object({\n meta: z.union([\n z.object({\n structure: z.string()\n }),\n z.array(z.unknown())\n .transform(arr => arr.at(0))\n .pipe(z.object({\n structure: z.string()\n }))\n ])\n });\n const res = MetaStructure.safeParse(schedule);\n if (res.data) {\n const determined = maps.find(x => x.meta.structure === res.data.meta.structure);\n if (determined) {\n similarities.determined = determined;\n return similarities;\n }\n }\n\n\n ////\n //// not a meta tagged file, so we check the structure.\n ////\n const collections: string[] = Array.isArray(schedule) ? keysOf(schedule) : Object.keys(schedule);\n if (!collections.length) return similarities;\n\n maps.forEach(mapping => {\n const { structure } = mapping;\n\n try {\n if ('matchType' in mapping && typeof schedule === mapping.matchType) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (!structure) {\n similarities.none.push(mapping);\n return;\n }\n\n const _collections = Array.isArray(structure) ? structure : Object.keys(structure);\n\n /*\n is shallow structure .\n */\n if (Array.isArray(schedule)) {\n\n if (!Array.isArray(structure)) {\n similarities.none.push(mapping);\n return;\n }\n\n if (isEqual(sortBy(_collections), sortBy(collections))) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (difference(sortBy(_collections), sortBy(collections)).length < _collections.length) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n return;\n }\n\n /*\n is deep structure .\n */\n\n\n /*\n every key is present in file.\n */\n if (_collections.every(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.every(key => structureKeys.includes(key));\n })) {\n similarities.strong.push(mapping);\n return;\n }\n\n /*\n some keys is present in file.\n */\n if (_collections.some(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.some(key => structureKeys.includes(key));\n })) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n } catch {\n similarities.error.push(mapping);\n }\n });\n\n return similarities;\n}\n"],"mappings":";;;;;;AASA,SAAS,OAAQ,MAAyB;AACxC,QAAO,cAAc,MAClB,OACC,MAAK,MAAM,QAAQ,KAAK,IAAiB,CAAC,KAC1C,MAAK,EAAE,SAAQ,QAAKA,OAAK,OAAOA,QAAM,WAAW,OAAO,KAAKA,OAAK,MAClE,MAAK,KAAK,IAEX;;AAGL,SAAgB,SAAU,UAAmC;CAC3D,MAAMC,eAA+B;EACnC,MAAQ;EACR,MAAQ;EACR,QAAQ;EACR,OAAQ;;AAGV,KAAI,CAAC,SAAU,QAAO;CAKtB,MAAM,gBAAgB,EAAE,OAAO,EAC7B,MAAM,EAAE,MAAM,CACZ,EAAE,OAAO,EACP,WAAW,EAAE,aAEf,EAAE,MAAM,EAAE,WACP,WAAU,QAAO,IAAI,GAAG,IACxB,KAAK,EAAE,OAAO,EACb,WA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AAS;AAErC,QAAI,EAAE,cAAc,WAAY,QAAO;IACvC,MAAMA,gBAA0B,UAAU;AAE1C,WAAO,aAAa,MAAK,QAAO,cAAc,SAAS;OACrD;AACF,iBAAa,KAAK,KAAK;AACvB;;AAGF,gBAAa,KAAK,KAAK;UAChB;AACP,gBAAa,MAAM,KAAK;;;AAI5B,QAAO"}
1
+ {"version":3,"file":"index.js","names":["x","similarities: IdentifiedMaps","collections: string[]","structureKeys: string[]"],"sources":["../../src/identify/index.ts"],"sourcesContent":["import { difference, isEqual, sortBy, uniq } from 'lodash-es';\nimport type { IdentifiedMaps } from './types';\nimport { maps } from './constants';\nimport * as z from 'zod';\nimport { makeChainable } from '../common/make-chainable';\nexport type { MapInstance, MapName, IdentifiedMaps } from './types';\nexport { maps } from './constants';\n\n\nfunction keysOf (docs: unknown): string[] {\n return makeChainable(docs)\n .chain(\n x => Array.isArray(x) ? x as unknown[] : [x],\n x => x.flatMap(x => x && typeof x === 'object' ? Object.keys(x) : []),\n x => uniq(x)\n )\n .value;\n}\n\nfunction sameMajorStructure (a: string, b: string): boolean {\n const normalize = (s: string) => {\n // Matches: \"<prefix>-<major>[.<minor>[.<patch>]]\", optional leading 'v'\n const m = s.match(/^(.*?)-v?(\\d+)(?:\\.\\d+){0,2}$/i);\n return m ? `${m[1]}-${m[2]}` : s;\n };\n return normalize(a) === normalize(b);\n}\n\nexport function identify (schedule: unknown): IdentifiedMaps {\n const similarities: IdentifiedMaps = {\n none: [],\n weak: [],\n strong: [],\n error: [],\n };\n\n if (!schedule) return similarities;\n\n ////\n //// check if the schedule is a meta tagged file and thus identifiable by its structure.\n ////\n const MetaStructure = z.object({\n meta: z.union([\n z.object({\n structure: z.string()\n }),\n z.array(z.unknown())\n .transform(arr => arr.at(0))\n .pipe(z.object({\n structure: z.string()\n }))\n ])\n });\n const res = MetaStructure.safeParse(schedule);\n if (res.data) {\n // structure on the type \"RS/mapName-X.Y.Z\"\n const determined = maps.find(x => sameMajorStructure(x.meta.structure, res.data.meta.structure));\n if (determined) {\n similarities.determined = determined;\n return similarities;\n }\n }\n\n\n ////\n //// not a meta tagged file, so we check the structure.\n ////\n const collections: string[] = Array.isArray(schedule) ? keysOf(schedule) : Object.keys(schedule);\n if (!collections.length) return similarities;\n\n maps.forEach(mapping => {\n const { structure } = mapping;\n\n try {\n if ('matchType' in mapping && typeof schedule === mapping.matchType) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (!structure) {\n similarities.none.push(mapping);\n return;\n }\n\n const _collections = Array.isArray(structure) ? structure : Object.keys(structure);\n\n /*\n is shallow structure .\n */\n if (Array.isArray(schedule)) {\n\n if (!Array.isArray(structure)) {\n similarities.none.push(mapping);\n return;\n }\n\n if (isEqual(sortBy(_collections), sortBy(collections))) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (difference(sortBy(_collections), sortBy(collections)).length < _collections.length) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n return;\n }\n\n /*\n is deep structure .\n */\n\n\n /*\n every key is present in file.\n */\n if (_collections.every(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.every(key => structureKeys.includes(key));\n })) {\n similarities.strong.push(mapping);\n return;\n }\n\n /*\n some keys is present in file.\n */\n if (_collections.some(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.some(key => structureKeys.includes(key));\n })) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n } catch {\n similarities.error.push(mapping);\n }\n });\n\n return similarities;\n}\n"],"mappings":";;;;;;AASA,SAAS,OAAQ,MAAyB;AACxC,QAAO,cAA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3B,QAAI,CAAC,MAAM,QAAQ,YAAY;AAC7B,kBAAa,KAAK,KAAK;AACvB;;AAGF,QAAI,QAAQ,OAAO,eAAe,OAAO,eAAe;AACtD,kBAAa,OAAO,KAAK;AACzB;;AAGF,QAAI,WAAW,OAAO,eAAe,OAAO,cAAc,SAAS,aAAa,QAAQ;AACtF,kBAAa,KAAK,KAAK;AACvB;;AAGF,iBAAa,KAAK,KAAK;AACvB;;AAWF,OAAI,aAAa,OAAM,eAAc;AACnC,QAAI,EAAE,YAAY,OAAO,YAAY,YAAY,cAAc,UAAW,QAAO;IACjF,MAAM,eAAe,OAAO,SAAS;AAErC,QAAI,EAAE,cAAc,WAAY,QAAO;IACvC,MAAMC,gBAA0B,UAAU;AAE1C,WAAO,aAAa,OAAM,QAAO,cAAc,SAAS;OACtD;AACF,iBAAa,OAAO,KAAK;AACzB;;AAMF,OAAI,aAAa,MAAK,eAAc;AAClC,QAAI,EAAE,YAAY,OAAO,YAAY,YAAY,cAAc,UAAW,QAAO;IACjF,MAAM,eAAe,OAAO,SAAS;AAErC,QAAI,EAAE,cAAc,WAAY,QAAO;IACvC,MAAMA,gBAA0B,UAAU;AAE1C,WAAO,aAAa,MAAK,QAAO,cAAc,SAAS;OACrD;AACF,iBAAa,KAAK,KAAK;AACvB;;AAGF,gBAAa,KAAK,KAAK;UAChB;AACP,gBAAa,MAAM,KAAK;;;AAI5B,QAAO"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@royalschedule/maps",
3
3
  "description": "",
4
- "version": "4.0.14",
4
+ "version": "4.0.15",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",