madden-franchise 2.5.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FranchiseSchema.js +7 -0
- package/package.json +1 -1
- package/services/schemaGenerator.js +4 -16
package/FranchiseSchema.js
CHANGED
|
@@ -46,6 +46,7 @@ class FranchiseSchema extends EventEmitter {
|
|
|
46
46
|
this.meta = this.schema.meta;
|
|
47
47
|
this.schemas = this.schema.schemas;
|
|
48
48
|
this.schemaMap = {};
|
|
49
|
+
this.enumMap = {};
|
|
49
50
|
|
|
50
51
|
for (let i = 0; i < this.schemas.length; i++) {
|
|
51
52
|
const schema = this.schemas[i];
|
|
@@ -56,6 +57,7 @@ class FranchiseSchema extends EventEmitter {
|
|
|
56
57
|
|
|
57
58
|
if (attribute.enum) {
|
|
58
59
|
attribute.enum = new FranchiseEnum(attribute.enum);
|
|
60
|
+
this.enumMap[attribute.enum.name] = attribute.enum;
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -64,6 +66,11 @@ class FranchiseSchema extends EventEmitter {
|
|
|
64
66
|
const extraSchemas = schemaGenerator.getExtraSchemas();
|
|
65
67
|
extraSchemas.forEach((schema) => {
|
|
66
68
|
if (!this.schemaMap[schema.name]) {
|
|
69
|
+
schema.attributes.forEach((attrib) => {
|
|
70
|
+
if (attrib.enum) {
|
|
71
|
+
attrib.enum = new FranchiseEnum(this.enumMap[attrib.enum]);
|
|
72
|
+
}
|
|
73
|
+
})
|
|
67
74
|
this.schemas.unshift(schema);
|
|
68
75
|
this.schemaMap[schema.name] = schema;
|
|
69
76
|
addedExtraSchema = true;
|
package/package.json
CHANGED
|
@@ -6,7 +6,6 @@ const utilService = require('./utilService');
|
|
|
6
6
|
const FranchiseEnum = require('../FranchiseEnum');
|
|
7
7
|
const XmlParser = require('node-xml-stream-parser');
|
|
8
8
|
const EventEmitter = require('events').EventEmitter;
|
|
9
|
-
const extraSchemas = JSON.parse(JSON.stringify(require(path.join(__dirname, '../data/schemas/extra-schemas.json'))));
|
|
10
9
|
|
|
11
10
|
let schemaGenerator = {};
|
|
12
11
|
schemaGenerator.eventEmitter = new EventEmitter();
|
|
@@ -22,6 +21,7 @@ schemaGenerator.generateFromStream = (stream, showOutput, outputFile) => {
|
|
|
22
21
|
schemaGenerator.schemaMap = {};
|
|
23
22
|
schemaGenerator.schemaMeta = {};
|
|
24
23
|
schemaGenerator.enums = [];
|
|
24
|
+
const extraSchemas = schemaGenerator.getExtraSchemas();
|
|
25
25
|
|
|
26
26
|
schemaGenerator.xml = new XmlParser();
|
|
27
27
|
|
|
@@ -33,7 +33,7 @@ schemaGenerator.generateFromStream = (stream, showOutput, outputFile) => {
|
|
|
33
33
|
console.error(err);
|
|
34
34
|
throw err;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
schemaGenerator.enums.forEach((theEnum) => {
|
|
38
38
|
theEnum.setMemberLength();
|
|
39
39
|
});
|
|
@@ -159,7 +159,7 @@ schemaGenerator.generateFromStream = (stream, showOutput, outputFile) => {
|
|
|
159
159
|
function addExtraSchemas() {
|
|
160
160
|
extraSchemas.forEach((schema) => {
|
|
161
161
|
if (!schemaGenerator.schemaMap[schema.name]) {
|
|
162
|
-
schema.attributes.filter((attrib) => {
|
|
162
|
+
schema.attributes.filter((attrib) => {
|
|
163
163
|
return attrib.enum && !(attrib.enum instanceof FranchiseEnum);
|
|
164
164
|
}).forEach((attrib) => {
|
|
165
165
|
attrib.enum = getEnum(attrib.enum);
|
|
@@ -184,19 +184,7 @@ schemaGenerator.generateFromStream = (stream, showOutput, outputFile) => {
|
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
schemaGenerator.getExtraSchemas = () => {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
extraSchemas.forEach((schema) => {
|
|
190
|
-
schema.attributes.filter((attrib) => {
|
|
191
|
-
return attrib.enum && !(attrib.enum instanceof FranchiseEnum);
|
|
192
|
-
}).forEach((attrib) => {
|
|
193
|
-
attrib.enum = new FranchiseEnum(attrib.enum);
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
newSchemas.push(schema);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
return newSchemas;
|
|
187
|
+
return JSON.parse(JSON.stringify(require(path.join(__dirname, '../data/schemas/extra-schemas.json'))));
|
|
200
188
|
};
|
|
201
189
|
|
|
202
190
|
schemaGenerator.calculateInheritedSchemas = (schemaList) => {
|