@digabi/exam-engine-mastering 19.10.1 → 19.10.3

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.
@@ -0,0 +1,8 @@
1
+ import { Document } from 'libxmljs2';
2
+ /**
3
+ * Migrates an exam from schema version 0.4 to 0.5
4
+ *
5
+ * Combine multiple cas-forbidden sections into one section (only a single cas forbidden section is allowed)
6
+ */
7
+ export declare function migrateFrom04To05(doc: Document): void;
8
+ //# sourceMappingURL=migrateFrom04To05.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrateFrom04To05.d.ts","sourceRoot":"","sources":["../../src/migrations/migrateFrom04To05.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAW,MAAM,WAAW,CAAA;AAG7C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,QAAQ,QAwC9C"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateFrom04To05 = void 0;
4
+ const libxmljs2_1 = require("libxmljs2");
5
+ const schema_1 = require("../mastering/schema");
6
+ /**
7
+ * Migrates an exam from schema version 0.4 to 0.5
8
+ *
9
+ * Combine multiple cas-forbidden sections into one section (only a single cas forbidden section is allowed)
10
+ */
11
+ function migrateFrom04To05(doc) {
12
+ var _a, _b, _c, _d;
13
+ const casForbiddenSections = doc
14
+ .find('./e:section', schema_1.ns)
15
+ .filter(section => { var _a; return ((_a = section.attr('cas-forbidden')) === null || _a === void 0 ? void 0 : _a.value()) == 'true'; });
16
+ (_a = doc.root()) === null || _a === void 0 ? void 0 : _a.attr('exam-schema-version', '0.5');
17
+ if (casForbiddenSections.length == 0) {
18
+ return; // no cas-forbidden sections
19
+ }
20
+ const firstSection = (_b = doc.find('./e:section', schema_1.ns)) === null || _b === void 0 ? void 0 : _b.at(0);
21
+ const isFirstSectionCasForbidden = ((_c = firstSection.attr('cas-forbidden')) === null || _c === void 0 ? void 0 : _c.value()) == 'true';
22
+ if (casForbiddenSections.length == 1 && isFirstSectionCasForbidden) {
23
+ return; // only the first section is cas-forbidden
24
+ }
25
+ const firstCasForbiddenSection = casForbiddenSections[0];
26
+ let firstCasForbiddenSectionInstruction = firstCasForbiddenSection.get('./e:section-instruction', schema_1.ns);
27
+ if (!firstCasForbiddenSectionInstruction) {
28
+ firstCasForbiddenSectionInstruction = new libxmljs2_1.Element(doc, 'e:section-instruction');
29
+ firstCasForbiddenSection.addChild(firstCasForbiddenSectionInstruction);
30
+ }
31
+ // merge section-instruction and questions from other cas-forbidden sections into first
32
+ for (const section of casForbiddenSections.slice(1)) {
33
+ const sectionInstruction = (_d = section.get('./e:section-instruction', schema_1.ns)) === null || _d === void 0 ? void 0 : _d.childNodes();
34
+ if (sectionInstruction) {
35
+ for (const child of sectionInstruction) {
36
+ firstCasForbiddenSectionInstruction.addChild(child);
37
+ }
38
+ }
39
+ const questions = section.find('./e:question', schema_1.ns);
40
+ for (const question of questions) {
41
+ firstCasForbiddenSection.addChild(question);
42
+ }
43
+ section.remove();
44
+ }
45
+ // Move cas-forbidden section to be first section if that's not the case
46
+ if (!isFirstSectionCasForbidden) {
47
+ firstSection.addPrevSibling(firstCasForbiddenSection);
48
+ }
49
+ }
50
+ exports.migrateFrom04To05 = migrateFrom04To05;
51
+ //# sourceMappingURL=migrateFrom04To05.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrateFrom04To05.js","sourceRoot":"","sources":["../../src/migrations/migrateFrom04To05.ts"],"names":[],"mappings":";;;AAAA,yCAA6C;AAC7C,gDAAwC;AAExC;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,GAAa;;IAC7C,MAAM,oBAAoB,GAAG,GAAG;SAC7B,IAAI,CAAU,aAAa,EAAE,WAAE,CAAC;SAChC,MAAM,CAAC,OAAO,CAAC,EAAE,WAAC,OAAA,CAAA,MAAA,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,0CAAE,KAA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Ac,EAAE,WAAE,CAAC,CAAA;QAClD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;YAChC,wBAAwB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;SAC5C;QACD,OAAO,CAAC,MAAM,EAAE,CAAA;KACjB;IAED,wEAAwE;IACxE,IAAI,CAAC,0BAA0B,EAAE;QAC/B,YAAY,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAA;KACtD;AACH,CAAC;AAxCD,8CAwCC"}
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAiBpC,eAAO,MAAM,wBAAwB,QAAkD,CAAA;AAEvF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAe/C"}
1
+ {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAmBpC,eAAO,MAAM,wBAAwB,QAAkD,CAAA;AAEvF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAe/C"}
@@ -5,12 +5,14 @@ const compare_versions_1 = require("compare-versions");
5
5
  const migrateFrom01To02_1 = require("./migrations/migrateFrom01To02");
6
6
  const migrateFrom02To03_1 = require("./migrations/migrateFrom02To03");
7
7
  const migrateFrom03To04_1 = require("./migrations/migrateFrom03To04");
8
+ const migrateFrom04To05_1 = require("./migrations/migrateFrom04To05");
8
9
  const noop = () => { };
9
10
  const migrations = {
10
11
  '0.1': migrateFrom01To02_1.migrateFrom01To02,
11
12
  '0.2': migrateFrom02To03_1.migrateFrom02To03,
12
13
  '0.3': migrateFrom03To04_1.migrateFrom03To04,
13
- '0.4': noop
14
+ '0.4': migrateFrom04To05_1.migrateFrom04To05,
15
+ '0.5': noop
14
16
  };
15
17
  const supportedVersions = Object.keys(migrations);
16
18
  exports.currentExamSchemaVersion = supportedVersions[supportedVersions.length - 1];
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.js","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":";;;AACA,uDAA0C;AAC1C,sEAAkE;AAClE,sEAAkE;AAClE,sEAAkE;AAIlE,MAAM,IAAI,GAAc,GAAG,EAAE,GAAE,CAAC,CAAA;AAChC,MAAM,UAAU,GAA8B;IAC5C,KAAK,EAAE,qCAAiB;IACxB,KAAK,EAAE,qCAAiB;IACxB,KAAK,EAAE,qCAAiB;IACxB,KAAK,EAAE,IAAI;CACZ,CAAA;AACD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAEpC,QAAA,wBAAwB,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;AAEvF;;;;GAIG;AACH,SAAgB,WAAW,CAAC,GAAa;;IACvC,MAAM,iBAAiB,GAAG,MAAA,MAAA,GAAG,CAAC,IAAI,EAAE,0CAAE,IAAI,CAAC,qBAAqB,CAAC,0CAAE,KAAK,EAAE,CAAA;IAE1E,IAAI,iBAAiB,IAAI,IAAI,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;KAC1D;SAAM,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;QACzD,MAAM,IAAI,KAAK,CAAC,oCAAoC,iBAAiB;sFACa,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;KAClH;IAED,KAAK,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACpE,IAAI,IAAA,0BAAO,EAAC,gBAAgB,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE;YACtD,OAAO,CAAC,GA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SACb;KACF;AACH,CAAC;AAfD,kCAeC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digabi/exam-engine-mastering",
3
- "version": "19.10.1",
3
+ "version": "19.10.3",
4
4
  "main": "dist/index.js",
5
5
  "author": "Matriculation Examination Board, Finland",
6
6
  "license": "EUPL-1.1",
@@ -9,8 +9,8 @@
9
9
  "schema"
10
10
  ],
11
11
  "dependencies": {
12
- "@digabi/exam-engine-core": "19.10.1",
13
- "@digabi/exam-engine-rendering": "19.10.1",
12
+ "@digabi/exam-engine-core": "19.10.2",
13
+ "@digabi/exam-engine-rendering": "19.10.3",
14
14
  "@ffprobe-installer/ffprobe": "^2.0.0",
15
15
  "cloneable-readable": "^3.0.0",
16
16
  "compare-versions": "^6.0.0",
@@ -21,5 +21,5 @@
21
21
  "mathjax-node": "^2.1.1",
22
22
  "yazl": "^2.5.1"
23
23
  },
24
- "gitHead": "a8a8f6a5c63a550bdce41f7368ec0c64674a654f"
24
+ "gitHead": "048cb475b2352cd7b19e928d8ae0c0d3a547ca98"
25
25
  }
package/schema/exam.xsd CHANGED
@@ -73,7 +73,7 @@
73
73
 
74
74
  <xs:simpleType name="exam-schema-version">
75
75
  <xs:restriction base="xs:string">
76
- <xs:enumeration value="0.4" />
76
+ <xs:enumeration value="0.5" />
77
77
  </xs:restriction>
78
78
  </xs:simpleType>
79
79