@iqb/validate-md-profile 0.3.0 → 0.4.0

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/README.md CHANGED
@@ -1,2 +1,24 @@
1
- # profiles
2
- Type definitions for metadata profiles
1
+ # Install
2
+
3
+ Metadata profiles for web applications of [IQB](https://www.iqb.hu-berlin.de) are stored in GitHub-repositories. We group metadata profiles in so-called "profile stores" to improve the handling. Every profile store resides in one GitHub repository. The entry point of the store is a config file `profile-config.json` in the root of the repo.
4
+
5
+ Best choice is to take one of the GitHub repositories of IQB as template (naming convention: `p<nn>`). You learn the parameters and files and the way to use the programming of this repo `validate-md-profile`: You see a `package.json` (nodejs-universe) and two entries:
6
+ ```json
7
+ "scripts": {
8
+ "validate": "validate-md-profile"
9
+ },
10
+ "devDependencies": {
11
+ "@iqb/validate-md-profile": "^0.4.0"
12
+ }
13
+ ```
14
+ Sure the version of the package will change...
15
+
16
+ # Validate
17
+
18
+ Calling the script will validate the `profile-config.json` in the root and all profiles listed here:
19
+ * test the syntax of all files against the JSON schema
20
+ * check whether the ids of profile entries are unique
21
+
22
+ # Generate Documentation
23
+
24
+ To support the dialog between stakeholders during the development phase, the validate-script generates one markdown file as documentation, if a `/docs`-Folder is found.
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./validate-md-profile";
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./validate-md-profile"), exports);
18
- __exportStar(require("./md-profile-schema.classes"), exports);
19
18
  //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC"}
package/package.json CHANGED
@@ -1,37 +1,22 @@
1
1
  {
2
2
  "name": "@iqb/validate-md-profile",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "author": "IQB - Institut zur Qualitätsentwicklung im Bildungswesen",
5
5
  "license": "MIT",
6
- "description": "Data interfaces for metadata profiling and values",
7
- "scripts": {
8
- "test_profile": "ts-node ./test.ts md-profile",
9
- "test_value": "ts-node ./test.ts md-values",
10
- "test_profile_config": "ts-node ./test.ts md-profile-config",
11
- "validate_profile": "ts-node src/validate-md-profile.ts json_schema/md-profile-config/test_valid/test1.json",
12
- "generate_docs": "asyncapi generate fromTemplate json_schema/asyncapi.yaml @asyncapi/html-template -o ./public --force-write && cat json_schema/add.css >> ./public/css/global.min.css",
13
- "prepare_publish": "rm -rf dist/* && tsc && cp ./json_schema/md-profile/md-profile.schema.json ./dist && cp ./json_schema/md-profile-config/md-profile-config.schema.json ./dist",
14
- "npm_publish": "npm publish --access public"
15
- },
6
+ "description": "Tooling to validate and generate documentation of metadata profile stores",
16
7
  "repository": {
17
8
  "type": "git",
18
- "url": "git+https://github.com/iqb-vocabs/profiles.git"
9
+ "url": "git+https://github.com/iqb-vocabs/validate-md-profile.git"
19
10
  },
20
11
  "bugs": {
21
- "url": "https://github.com/iqb-vocabs/profiles/issues"
12
+ "url": "https://github.com/iqb-vocabs/validate-md-profile/issues"
22
13
  },
23
- "homepage": "https://github.com/iqb-vocabs/profiles#readme",
14
+ "homepage": "https://github.com/iqb-vocabs/validate-md-profile#readme",
24
15
  "dependencies": {
25
- "ajv": "^8.12.0"
26
- },
27
- "devDependencies": {
28
- "@asyncapi/cli": "^0.58.10",
29
- "@asyncapi/html-template": "^1.0.0",
30
- "@types/node": "^20.4.4",
31
- "ts-node": "^10.9.1",
32
- "typescript": "^5.2.2"
16
+ "ajv": "^8.12.0",
17
+ "@iqb/metadata": "0.3.2"
33
18
  },
34
19
  "bin": {
35
- "validate-md-profile": "./dist/validate-md-profile.js"
20
+ "validate-md-profile": "./validate-md-profile.js"
36
21
  }
37
22
  }
@@ -0,0 +1,5 @@
1
+ import { MDProfile, MDProfileStore } from "@iqb/metadata";
2
+ export declare abstract class SchemaValidateFactory {
3
+ static validateProfile(sourceFilename: string): MDProfile | null;
4
+ static validateConfig(sourceFilename: string): MDProfileStore | null;
5
+ }
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SchemaValidateFactory = void 0;
4
+ var ajv_1 = require("ajv");
5
+ var metadata_1 = require("@iqb/metadata");
6
+ var SchemaValidateFactory = /** @class */ (function () {
7
+ function SchemaValidateFactory() {
8
+ }
9
+ SchemaValidateFactory.validateProfile = function (sourceFilename) {
10
+ var mdProfile = null;
11
+ var fs = require('fs');
12
+ var compiledSchema;
13
+ var ajv = new ajv_1.default(); // options can be passed, e.g. {allErrors: true}
14
+ try {
15
+ compiledSchema = ajv.compile(metadata_1.profileSchemaJSON);
16
+ }
17
+ catch (err) {
18
+ console.log('\x1b[0;31mERROR\x1b[0m parsing profile schema');
19
+ console.error(err);
20
+ process.exitCode = 1;
21
+ compiledSchema = null;
22
+ }
23
+ if (compiledSchema) {
24
+ if (fs.existsSync(sourceFilename)) {
25
+ var profileData = void 0;
26
+ try {
27
+ var profile_data_raw = fs.readFileSync(sourceFilename, 'utf8');
28
+ profileData = JSON.parse(profile_data_raw);
29
+ }
30
+ catch (err) {
31
+ console.log("\u001B[0;31mERROR\u001B[0m reading and parsing profile file '".concat(sourceFilename, "':"));
32
+ console.error(err);
33
+ profileData = null;
34
+ process.exitCode = 1;
35
+ }
36
+ if (profileData) {
37
+ try {
38
+ var valid = compiledSchema ? compiledSchema(profileData) : null;
39
+ if (!valid) {
40
+ console.log("\u001B[0;31mERROR\u001B[0m invalid profile file '".concat(sourceFilename, "':"));
41
+ console.error(compiledSchema ? compiledSchema.errors : 'error unknown');
42
+ profileData = null;
43
+ process.exitCode = 1;
44
+ }
45
+ }
46
+ catch (err) {
47
+ console.log("\u001B[0;31mERROR\u001B[0m invalid profile file '".concat(sourceFilename, "':"));
48
+ console.error(err);
49
+ profileData = null;
50
+ process.exitCode = 1;
51
+ }
52
+ if (profileData) {
53
+ try {
54
+ mdProfile = new metadata_1.MDProfile(profileData);
55
+ }
56
+ catch (err) {
57
+ console.log("\u001B[0;31mERROR\u001B[0m parsing profile file '".concat(sourceFilename, "':"));
58
+ console.error(err);
59
+ mdProfile = null;
60
+ process.exitCode = 1;
61
+ }
62
+ if (mdProfile) {
63
+ var doubleIds_1 = [];
64
+ var allEntryIds_1 = [];
65
+ mdProfile.groups.forEach(function (g) {
66
+ g.entries.forEach(function (e) {
67
+ if (allEntryIds_1.includes(e.id)) {
68
+ doubleIds_1.push(e.id);
69
+ }
70
+ else {
71
+ allEntryIds_1.push(e.id);
72
+ }
73
+ });
74
+ });
75
+ if (doubleIds_1.length > 0) {
76
+ console.log("\u001B[0;31mERROR\u001B[0m in profile file '".concat(sourceFilename, "': double ids ").concat(doubleIds_1.join(', ')));
77
+ mdProfile = null;
78
+ process.exitCode = 1;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+ else {
85
+ console.log("\u001B[0;31mERROR\u001B[0m profile file '".concat(sourceFilename, "' not found"));
86
+ process.exitCode = 1;
87
+ }
88
+ }
89
+ return mdProfile;
90
+ };
91
+ SchemaValidateFactory.validateConfig = function (sourceFilename) {
92
+ var mdStore = null;
93
+ var fs = require('fs');
94
+ var compiledSchema;
95
+ var ajv = new ajv_1.default(); // options can be passed, e.g. {allErrors: true}
96
+ try {
97
+ compiledSchema = ajv.compile(metadata_1.profileStoreSchemaJSON);
98
+ }
99
+ catch (err) {
100
+ console.log('\x1b[0;31mERROR\x1b[0m parsing profile config schema');
101
+ console.error(err);
102
+ process.exitCode = 1;
103
+ compiledSchema = null;
104
+ }
105
+ if (compiledSchema) {
106
+ if (fs.existsSync(sourceFilename)) {
107
+ var profileStoreData = void 0;
108
+ try {
109
+ var config_data_raw = fs.readFileSync(sourceFilename, 'utf8');
110
+ profileStoreData = JSON.parse(config_data_raw);
111
+ }
112
+ catch (err) {
113
+ console.log("\u001B[0;31mERROR\u001B[0m reading and parsing config file '".concat(sourceFilename, "':"));
114
+ console.error(err);
115
+ profileStoreData = null;
116
+ process.exitCode = 1;
117
+ }
118
+ if (profileStoreData) {
119
+ try {
120
+ var valid = compiledSchema ? compiledSchema(profileStoreData) : null;
121
+ if (!valid) {
122
+ console.log("\u001B[0;31mERROR\u001B[0m invalid config file '".concat(sourceFilename, "':"));
123
+ console.error(compiledSchema ? compiledSchema.errors : 'error unknown');
124
+ profileStoreData = null;
125
+ process.exitCode = 1;
126
+ }
127
+ }
128
+ catch (err) {
129
+ console.log("\u001B[0;31mERROR\u001B[0m invalid config file '".concat(sourceFilename, "':"));
130
+ console.error(err);
131
+ profileStoreData = null;
132
+ process.exitCode = 1;
133
+ }
134
+ if (profileStoreData) {
135
+ try {
136
+ mdStore = new metadata_1.MDProfileStore(profileStoreData);
137
+ }
138
+ catch (err) {
139
+ console.log("\u001B[0;31mERROR\u001B[0m instanciating profile store '".concat(sourceFilename, "':"));
140
+ console.error(err);
141
+ mdStore = null;
142
+ process.exitCode = 1;
143
+ }
144
+ }
145
+ }
146
+ }
147
+ else {
148
+ console.log("\u001B[0;31mERROR\u001B[0m config file '".concat(sourceFilename, "' not found"));
149
+ process.exitCode = 1;
150
+ }
151
+ }
152
+ return mdStore;
153
+ };
154
+ return SchemaValidateFactory;
155
+ }());
156
+ exports.SchemaValidateFactory = SchemaValidateFactory;
157
+ //# sourceMappingURL=schema-validate.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-validate.factory.js","sourceRoot":"","sources":["../src/schema-validate.factory.ts"],"names":[],"mappings":";;;AAAA,2BAAsB;AACtB,0CAAmG;AAEnG;IAAA;IAwIA,CAAC;IAvIiB,qCAAe,GAA7B,UAA8B,cAAsB;QAChD,IAAI,SAAS,GAAqB,IAAI,CAAC;QACvC,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,cAAc,CAAC;QACnB,IAAM,GAAG,G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+1,54 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ var schema_validate_factory_1 = require("./schema-validate.factory");
5
+ var mdTargetFolder = './docs';
6
+ var mdTargetFilename = "".concat(mdTargetFolder, "/README.md");
7
+ var configFileName = './profile-config.json';
8
+ if (process.argv[2]) {
9
+ configFileName = "./".concat(process.argv[2]);
10
+ }
11
+ var mdConfig = schema_validate_factory_1.SchemaValidateFactory.validateConfig(configFileName);
12
+ if (mdConfig) {
13
+ console.log("config file '".concat(configFileName, "' is valid: ").concat(mdConfig.title));
14
+ var allProfiles_1 = [];
15
+ mdConfig.profiles.forEach(function (p) {
16
+ var myMDProfile = schema_validate_factory_1.SchemaValidateFactory.validateProfile(p);
17
+ if (myMDProfile) {
18
+ var entryCount_1 = 0;
19
+ myMDProfile.groups.forEach(function (g) {
20
+ entryCount_1 += g.entries.length;
21
+ });
22
+ console.log("".concat(myMDProfile.groups.length, " ").concat(myMDProfile.groups.length === 1 ? 'group' : 'groups', " and ").concat(entryCount_1, " ").concat(entryCount_1 === 1 ? 'entry' : 'entries', " found in '").concat(p, "'."));
23
+ allProfiles_1.push(myMDProfile);
24
+ }
25
+ });
26
+ var fs = require('fs');
27
+ if (fs.existsSync(mdTargetFolder)) {
28
+ var mdContent_1 = "# ".concat(mdConfig.title, "\n");
29
+ mdContent_1 += "```\n".concat(mdConfig.id, "\n```\n\n");
30
+ if (mdConfig.creator)
31
+ mdContent_1 += "Autor/Organisation: ".concat(mdConfig.creator, "\n\n");
32
+ if (allProfiles_1.length > 0) {
33
+ mdContent_1 += "".concat(allProfiles_1.length, " ").concat(allProfiles_1.length === 1 ? 'Profil' : 'Profile', " definiert:\n\n");
34
+ allProfiles_1.forEach(function (p) {
35
+ mdContent_1 += "## Profil \"".concat(p.label, "\"\n");
36
+ mdContent_1 += "```\n".concat(p.id, "\n```\n\n");
37
+ p.groups.forEach(function (g) {
38
+ if (p.groups.length > 1)
39
+ mdContent_1 += "### Gruppe \"".concat(g.label, "\"\n\n");
40
+ g.entries.forEach(function (e) {
41
+ mdContent_1 += "* ".concat(e.label, " (").concat(e.id, ", ").concat(e.type, ")");
42
+ mdContent_1 += '\n';
43
+ });
44
+ });
45
+ });
46
+ }
47
+ else {
48
+ mdContent_1 += 'Keine Profile definiert.\n';
49
+ }
50
+ fs.writeFileSync(mdTargetFilename, mdContent_1, { encoding: 'utf8' });
51
+ console.log("markdown file \"".concat(mdTargetFilename, "\" generated."));
52
+ }
53
+ }
54
+ //# sourceMappingURL=validate-md-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-md-profile.js","sourceRoot":"","sources":["../src/validate-md-profile.ts"],"names":[],"mappings":";;;AACA,qEAAgE;AAGhE,IAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,IAAM,gBAAgB,GAAG,UAAG,cAAc,eAAY,CAAC;AAEvD,IAAI,cAAc,GAAG,uBAAuB,CAAC;AAC7C,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;IACjB,cAAc,GAAG,YAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAC;CAC3C;AAED,IAAM,QAAQ,GAAG,+CAAqB,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AACtE,IAAI,QAAQ,EAAE;IACV,OAAO,CAAC,GAAG,CAAC,uBAAgB,cAAc,yBAAe,QAAQ,CAAC,KAAK,CAAE,CAAC,CAAC;IAC3E,IAAI,aAAW,GAAgB,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,CAAC;QACvB,IAAM,WAAW,GAAG,+CAAqB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC7D,IAAI,WAAW,EAAE;YACb,IAAI,YAAU,GAAG,CAAC,CAAC;YACnB,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,UAAA,CAAC;gBACxB,YAAU,IAAI,CAAC,CAAC,OAAO,CAAC,MA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AC,OAAO,CAAC,OAAO,CAAC,UAAA,CAAC;wBACf,WAAS,IAAI,YAAK,CAAC,CAAC,KAAK,eAAK,CAAC,CAAC,EAAE,eAAK,CAAC,CAAC,IAAI,MAAG,CAAC;wBACjD,WAAS,IAAI,IAAI,CAAC;oBACtB,CAAC,CAAC,CAAA;gBACN,CAAC,CAAC,CAAA;YACN,CAAC,CAAC,CAAA;SACL;aAAM;YACH,WAAS,IAAI,4BAA4B,CAAC;SAC7C;QACD,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,WAAS,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,0BAAkB,gBAAgB,kBAAc,CAAC,CAAC;KACjE;CACJ"}
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./validate-md-profile";
2
- export * from "./md-profile-schema.classes";
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,8DAA4C"}
@@ -1,52 +0,0 @@
1
- {
2
- "$id": "https://w3id.org/iqb/vocabs/md-profile-config.schema.json",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
4
- "title": "Metadata Profile Store Config",
5
- "description": "Configuration file to validate a metadata profile store",
6
- "type": "object",
7
- "properties": {
8
- "id": {
9
- "type": "string",
10
- "pattern": "^[0-9a-zA-Z_]+$",
11
- "description": "Identifier for the metadata profile store as part of the uri"
12
- },
13
- "creator": {
14
- "type": "string",
15
- "description": "Creator as person or institution"
16
- },
17
- "title": {
18
- "type": "array",
19
- "items": {
20
- "type": "object",
21
- "properties": {
22
- "lang": {
23
- "type": "string",
24
- "pattern": "^[a-z]+$",
25
- "description": "Language of the value"
26
- },
27
- "value": {
28
- "type": "string",
29
- "description": "Language of the value"
30
- }
31
- },
32
- "required": ["lang", "value"]
33
- },
34
- "minItems": 1
35
- },
36
- "mdOutDir": {
37
- "type": "string",
38
- "description": "Folder where the markdown output is written to.",
39
- "default": "./docs"
40
- },
41
- "profiles": {
42
- "type": "array",
43
- "items": {
44
- "type": "string",
45
- "minLength": 1,
46
- "description": "Name of the profile json files"
47
- },
48
- "minItems": 1
49
- }
50
- },
51
- "required": ["id", "title", "creator", "profiles"]
52
- }
@@ -1,52 +0,0 @@
1
- export interface TextWithLanguage {
2
- "lang": string;
3
- "value": string;
4
- }
5
- export declare class ProfileEntryParametersVocabulary {
6
- readonly url: string;
7
- readonly allowMultipleValues: boolean;
8
- readonly maxLevel: number;
9
- readonly hideNumbering: boolean;
10
- readonly hideTitle: boolean;
11
- readonly hideDescription: boolean;
12
- readonly addTextLanguages: string[];
13
- constructor(profileEntryParameters: any);
14
- }
15
- export declare class ProfileEntryParametersText {
16
- readonly format: string;
17
- readonly textLanguages: string[];
18
- readonly pattern: string;
19
- constructor(profileEntryParameters: any);
20
- }
21
- export declare class ProfileEntryParametersNumber {
22
- readonly digits: number;
23
- readonly minValue: number | null;
24
- readonly maxValue: number | null;
25
- readonly isPeriodSeconds: boolean;
26
- constructor(profileEntryParameters: any);
27
- }
28
- export declare class ProfileEntryParametersBoolean {
29
- readonly trueLabel: string;
30
- readonly falseLabel: string;
31
- constructor(profileEntryParameters: any);
32
- }
33
- export declare class MDProfileEntry {
34
- readonly id: string;
35
- readonly label: string;
36
- readonly type: string;
37
- readonly parameters: ProfileEntryParametersNumber | ProfileEntryParametersBoolean | ProfileEntryParametersText | ProfileEntryParametersVocabulary | null;
38
- constructor(entryData: any);
39
- }
40
- export declare class MDProfileGroup {
41
- readonly label: string;
42
- readonly entries: MDProfileEntry[];
43
- constructor(groupData: any);
44
- }
45
- export declare class MDProfile {
46
- static lang: string;
47
- readonly id: string;
48
- readonly label: string;
49
- readonly groups: MDProfileGroup[];
50
- constructor(profileData: any);
51
- static getTextFromTextWithLanguage(langArray: any | null): string;
52
- }
@@ -1,122 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MDProfile = exports.MDProfileGroup = exports.MDProfileEntry = exports.ProfileEntryParametersBoolean = exports.ProfileEntryParametersNumber = exports.ProfileEntryParametersText = exports.ProfileEntryParametersVocabulary = void 0;
4
- var ProfileEntryParametersVocabulary = /** @class */ (function () {
5
- function ProfileEntryParametersVocabulary(profileEntryParameters) {
6
- this.url = profileEntryParameters['url'] || '?url';
7
- this.allowMultipleValues = profileEntryParameters['allowMultipleValues'] || false;
8
- this.maxLevel = profileEntryParameters['maxLevel'] || 0;
9
- this.hideNumbering = profileEntryParameters['hideNumbering'] || false;
10
- this.hideTitle = profileEntryParameters['hideTitle'] || false;
11
- this.hideDescription = profileEntryParameters['hideDescription'] || false;
12
- this.addTextLanguages = profileEntryParameters['addTextLanguages'] || [];
13
- }
14
- return ProfileEntryParametersVocabulary;
15
- }());
16
- exports.ProfileEntryParametersVocabulary = ProfileEntryParametersVocabulary;
17
- var ProfileEntryParametersText = /** @class */ (function () {
18
- function ProfileEntryParametersText(profileEntryParameters) {
19
- this.format = profileEntryParameters['format'] || '';
20
- this.pattern = profileEntryParameters['pattern'] || '';
21
- this.textLanguages = profileEntryParameters['textLanguages'] || [];
22
- }
23
- return ProfileEntryParametersText;
24
- }());
25
- exports.ProfileEntryParametersText = ProfileEntryParametersText;
26
- var ProfileEntryParametersNumber = /** @class */ (function () {
27
- function ProfileEntryParametersNumber(profileEntryParameters) {
28
- this.digits = profileEntryParameters['digits'] || 0;
29
- if (profileEntryParameters['minValue'] === null) {
30
- this.minValue = null;
31
- }
32
- else {
33
- this.minValue = profileEntryParameters['minValue'];
34
- }
35
- if (profileEntryParameters['maxValue'] === null) {
36
- this.maxValue = null;
37
- }
38
- else {
39
- this.maxValue = profileEntryParameters['maxValue'];
40
- }
41
- this.isPeriodSeconds = profileEntryParameters['isPeriodSeconds'] || false;
42
- }
43
- return ProfileEntryParametersNumber;
44
- }());
45
- exports.ProfileEntryParametersNumber = ProfileEntryParametersNumber;
46
- var ProfileEntryParametersBoolean = /** @class */ (function () {
47
- function ProfileEntryParametersBoolean(profileEntryParameters) {
48
- this.trueLabel = MDProfile.getTextFromTextWithLanguage(profileEntryParameters['trueLabel']);
49
- this.falseLabel = MDProfile.getTextFromTextWithLanguage(profileEntryParameters['falseLabel']);
50
- }
51
- return ProfileEntryParametersBoolean;
52
- }());
53
- exports.ProfileEntryParametersBoolean = ProfileEntryParametersBoolean;
54
- var MDProfileEntry = /** @class */ (function () {
55
- function MDProfileEntry(entryData) {
56
- this.id = entryData['id'] || '';
57
- this.label = MDProfile.getTextFromTextWithLanguage(entryData['label']);
58
- this.type = entryData['type'] || '';
59
- this.parameters = null;
60
- if (entryData['parameters']) {
61
- if (this.type === 'number') {
62
- this.parameters = new ProfileEntryParametersNumber(entryData['parameters']);
63
- }
64
- else if (this.type === 'text') {
65
- this.parameters = new ProfileEntryParametersText(entryData['parameters']);
66
- }
67
- else if (this.type === 'boolean') {
68
- this.parameters = new ProfileEntryParametersBoolean(entryData['parameters']);
69
- }
70
- else if (this.type === 'vocabulary') {
71
- this.parameters = new ProfileEntryParametersVocabulary(entryData['parameters']);
72
- }
73
- }
74
- }
75
- return MDProfileEntry;
76
- }());
77
- exports.MDProfileEntry = MDProfileEntry;
78
- var MDProfileGroup = /** @class */ (function () {
79
- function MDProfileGroup(groupData) {
80
- var _this = this;
81
- this.label = MDProfile.getTextFromTextWithLanguage(groupData['label']);
82
- this.entries = [];
83
- if (groupData['entries']) {
84
- var entryArray = groupData['entries'];
85
- entryArray.forEach(function (e) {
86
- _this.entries.push(new MDProfileEntry(e));
87
- });
88
- }
89
- }
90
- return MDProfileGroup;
91
- }());
92
- exports.MDProfileGroup = MDProfileGroup;
93
- var MDProfile = /** @class */ (function () {
94
- function MDProfile(profileData) {
95
- var _this = this;
96
- this.id = profileData['id'] || null;
97
- this.label = MDProfile.getTextFromTextWithLanguage(profileData['label']);
98
- this.groups = [];
99
- if (profileData['groups']) {
100
- var groupArray = profileData['groups'];
101
- groupArray.forEach(function (g) {
102
- _this.groups.push(new MDProfileGroup(g));
103
- });
104
- }
105
- }
106
- MDProfile.getTextFromTextWithLanguage = function (langArray) {
107
- if (langArray) {
108
- var langArrayTyped = langArray;
109
- var textEntry = langArrayTyped.find(function (t) { return t.lang === MDProfile.lang; });
110
- if (textEntry)
111
- return textEntry['value'] || '';
112
- if (langArrayTyped.length > 0) {
113
- return langArrayTyped[0]['value'] || '';
114
- }
115
- }
116
- return '';
117
- };
118
- MDProfile.lang = "de";
119
- return MDProfile;
120
- }());
121
- exports.MDProfile = MDProfile;
122
- //# sourceMappingURL=md-profile-schema.classes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"md-profile-schema.classes.js","sourceRoot":"","sources":["../src/md-profile-schema.classes.ts"],"names":[],"mappings":";;;AAIA;IASI,0CAAY,sBAA2B;QACnC,IAAI,CAAC,GAAG,GAAG,sBAAsB,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC;QACnD,IAAI,CAAC,mBAAmB,GAAG,sBAAsB,CAAC,qBAAqB,CAAC,IAAI,KAAK,CAAC;QAClF,IAAI,CAAC,QAAQ,GAAG,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,CAAC,aAAa,GAAG,sBAAsB,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC;QACtE,IAAI,CAAC,SAAS,GAAG,sBAAsB,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC;QAC9D,IAAI,CAAC,eAAe,GAAG,sBAAsB,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC;QAC1E,IAAI,CAAC,gBAAgB,GAAG,sBAAsB,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAC7E,CAAC;IACL,uCAAC;AAAD,CAAC,AAlBD,IAkBC;AAlBY,4EAAgC;AAoB7C;IAKI,oCAAY,sBAA2B;QACnC,IAAI,CAAC,MAAM,GAAG,sBAAsB,CAAC,QAAQ,CAAC,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0,0 @@
1
- {
2
- "$id": "https://w3id.org/iqb/vocabs/md-profile.json",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
4
- "title": "Metadata Profile",
5
- "description": "Data structure to manage UI components for metadata of objects",
6
- "type": "object",
7
- "properties": {
8
- "id": {
9
- "type": "string",
10
- "description": "Identifier for the metadata profile"
11
- },
12
- "label": {
13
- "$ref": "#/definitions/multi_language_text",
14
- "description": "Name of the profile"
15
- },
16
- "groups": {
17
- "type": "array",
18
- "items": {
19
- "type": "object",
20
- "properties": {
21
- "label": {
22
- "$ref": "#/definitions/multi_language_text"
23
- },
24
- "entries": {
25
- "type": "array",
26
- "items": {
27
- "$ref": "#/definitions/entry"
28
- },
29
- "minItems": 1
30
- }
31
- },
32
- "required": ["label", "entries"]
33
- },
34
- "minItems": 1
35
- }
36
- },
37
- "required": ["id", "label", "groups"],
38
- "definitions": {
39
- "multi_language_text": {
40
- "type": "array",
41
- "items": {
42
- "type": "object",
43
- "properties": {
44
- "lang": {
45
- "type": "string",
46
- "description": "ISO-language code",
47
- "pattern": "^[a-z]{2}$"
48
- },
49
- "value": {
50
- "type": "string"
51
- }
52
- },
53
- "required": ["lang", "value"]
54
- },
55
- "minItems": 1
56
- },
57
- "vocabulary": {
58
- "type": "object",
59
- "description": "Creates values of type string (one possible id), string[] (multiple ids) or id+text tuples, if text input is allowed (see md-values).",
60
- "properties": {
61
- "url": {
62
- "type": "string",
63
- "description": "URI to the JSON representation (SkoHub) of the vocabulary definition"
64
- },
65
- "allowMultipleValues": {
66
- "type": "boolean",
67
- "description": "If true, multiple values are allowed taken from the vocabulary",
68
- "default": false
69
- },
70
- "maxLevel": {
71
- "type": "integer",
72
- "description": "Maximum level taken from the hierarchical vocabulary. This is to hide lower levels. Use '0' for all levels (default).",
73
- "default": 0
74
- },
75
- "hideNumbering": {
76
- "type": "boolean",
77
- "description": "If true, the numbering of vocabulary entries is not used/showed in components.",
78
- "default": false
79
- },
80
- "hideDescription": {
81
- "type": "boolean",
82
- "description": "If true, the description of vocabulary entries is not used/showed in components.",
83
- "default": false
84
- },
85
- "hideTitle": {
86
- "type": "boolean",
87
- "description": "If true, the title of vocabulary entries is not used/showed in components.",
88
- "default": false
89
- },
90
- "addTextLanguages": {
91
- "type": "array",
92
- "items": {
93
- "type": "string",
94
- "description": "ISO-language code",
95
- "pattern": "^[a-z]{2}$"
96
- },
97
- "description": "If not empty, text can be added to the selected vocabulary entry. The given entries specify the expected language(s).",
98
- "default": []
99
- }
100
- },
101
- "required": ["url"]
102
- },
103
- "text": {
104
- "type": "object",
105
- "description": "Creates values of type string (one possible language) or multi-language texts (see md-values).",
106
- "properties": {
107
- "format": {
108
- "type": "string",
109
- "enum": ["single", "multiline", "html"],
110
- "description": "If true, more then one line of text is prepared for input. Text is wrapped and vertical scrolling is possible.",
111
- "default": "single"
112
- },
113
- "textLanguages": {
114
- "type": "array",
115
- "items": {
116
- "type": "string",
117
- "description": "ISO-language code",
118
- "pattern": "^[a-z]{2}$"
119
- },
120
- "description": "Use this property to add languages, so you provide more then one text input form field.",
121
- "default": [
122
- "de"
123
- ]
124
- },
125
- "pattern": {
126
- "type": "string",
127
- "description": "Use this regular expression to validate the input value."
128
- }
129
- }
130
- },
131
- "number": {
132
- "type": "object",
133
- "description": "Creates values of type string with number content. The decimal separator is always dot '.'.",
134
- "properties": {
135
- "digits": {
136
- "type": "integer",
137
- "description": "Number of digits. Negative values are not valid.",
138
- "minimum": 0,
139
- "default": 0
140
- },
141
- "minValue": {
142
- "type": "number",
143
- "description": "Minimal value valid for this entry."
144
- },
145
- "maxValue": {
146
- "type": "number",
147
- "description": "Maximal value valid for this entry."
148
- },
149
- "isPeriodSeconds": {
150
- "type": "boolean",
151
- "description": "If true, the (integer) value is interpreted as a number of seconds (duration, time period). This might adapt the form controls.",
152
- "default": false
153
- }
154
- }
155
- },
156
- "boolean": {
157
- "type": "object",
158
- "description": "Creates values of type string 'true' or 'false'.",
159
- "properties": {
160
- "trueLabel": {
161
- "$ref": "#/definitions/multi_language_text"
162
- },
163
- "falseLabel": {
164
- "$ref": "#/definitions/multi_language_text"
165
- }
166
- }
167
- },
168
- "entry": {
169
- "type": "object",
170
- "properties": {
171
- "id": {
172
- "type": "string",
173
- "pattern": "^[a-zA-Z][0-9a-zA-Z_]*$",
174
- "description": "Identifier for the property as part of the metadata profile"
175
- },
176
- "label": {
177
- "$ref": "#/definitions/multi_language_text",
178
- "description": "Text presented in UI components as prompt"
179
- },
180
- "type": {
181
- "type": "string",
182
- "enum": ["text", "vocabulary", "boolean", "number"]
183
- },
184
- "parameters": {
185
- "anyOf": [
186
- {
187
- "$ref": "#/definitions/vocabulary"
188
- },
189
- {
190
- "$ref": "#/definitions/text"
191
- },
192
- {
193
- "$ref": "#/definitions/number"
194
- },
195
- {
196
- "$ref": "#/definitions/boolean"
197
- }
198
- ]
199
- }
200
- },
201
- "required": ["id", "type"]
202
- }
203
- }
204
- }
@@ -1,15 +0,0 @@
1
- import { MDProfile } from "./md-profile-schema.classes";
2
- export interface ConfigData {
3
- id: string;
4
- title: {
5
- lang: string;
6
- value: string;
7
- }[];
8
- mdOutDir: string;
9
- creator: any;
10
- profiles: string[];
11
- }
12
- export declare abstract class SchemaValidateFactory {
13
- static validateProfile(sourceFilename: string, schemaFilename: string): MDProfile | null;
14
- static validateConfig(sourceFilename: string, schemaFilename: string): ConfigData | null;
15
- }
@@ -1,181 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SchemaValidateFactory = void 0;
4
- var ajv_1 = require("ajv");
5
- var md_profile_schema_classes_1 = require("./md-profile-schema.classes");
6
- var SchemaValidateFactory = /** @class */ (function () {
7
- function SchemaValidateFactory() {
8
- }
9
- SchemaValidateFactory.validateProfile = function (sourceFilename, schemaFilename) {
10
- var schema;
11
- var mdProfile = null;
12
- var fs = require('fs');
13
- if (fs.existsSync(schemaFilename)) {
14
- try {
15
- schema = fs.readFileSync(schemaFilename, 'utf8');
16
- }
17
- catch (err) {
18
- console.log("\u001B[0;31mERROR\u001B[0m reading schema '".concat(schemaFilename, "':"));
19
- console.error(err);
20
- process.exitCode = 1;
21
- schema = null;
22
- }
23
- if (schema) {
24
- var compiledSchema = void 0;
25
- var ajv = new ajv_1.default(); // options can be passed, e.g. {allErrors: true}
26
- try {
27
- compiledSchema = ajv.compile(JSON.parse(schema));
28
- }
29
- catch (err) {
30
- console.log("\u001B[0;31mERROR\u001B[0m parsing schema '".concat(schemaFilename, "':"));
31
- console.error(err);
32
- process.exitCode = 1;
33
- compiledSchema = null;
34
- }
35
- if (compiledSchema) {
36
- if (fs.existsSync(sourceFilename)) {
37
- var profileData = void 0;
38
- try {
39
- var profile_data_raw = fs.readFileSync(sourceFilename, 'utf8');
40
- profileData = JSON.parse(profile_data_raw);
41
- }
42
- catch (err) {
43
- console.log("\u001B[0;31mERROR\u001B[0m reading and parsing profile file '".concat(sourceFilename, "':"));
44
- console.error(err);
45
- profileData = null;
46
- process.exitCode = 1;
47
- }
48
- if (profileData) {
49
- try {
50
- var valid = compiledSchema ? compiledSchema(profileData) : null;
51
- if (!valid) {
52
- console.log("\u001B[0;31mERROR\u001B[0m invalid profile file '".concat(sourceFilename, "':"));
53
- console.error(compiledSchema ? compiledSchema.errors : 'error unknown');
54
- profileData = null;
55
- process.exitCode = 1;
56
- }
57
- }
58
- catch (err) {
59
- console.log("\u001B[0;31mERROR\u001B[0m invalid profile file '".concat(sourceFilename, "':"));
60
- console.error(err);
61
- profileData = null;
62
- process.exitCode = 1;
63
- }
64
- if (profileData) {
65
- try {
66
- mdProfile = new md_profile_schema_classes_1.MDProfile(profileData);
67
- }
68
- catch (err) {
69
- console.log("\u001B[0;31mERROR\u001B[0m parsing profile file '".concat(sourceFilename, "':"));
70
- console.error(err);
71
- mdProfile = null;
72
- process.exitCode = 1;
73
- }
74
- if (mdProfile) {
75
- var doubleIds_1 = [];
76
- var allEntryIds_1 = [];
77
- mdProfile.groups.forEach(function (g) {
78
- g.entries.forEach(function (e) {
79
- if (allEntryIds_1.includes(e.id)) {
80
- doubleIds_1.push(e.id);
81
- }
82
- else {
83
- allEntryIds_1.push(e.id);
84
- }
85
- });
86
- });
87
- if (doubleIds_1.length > 0) {
88
- console.log("\u001B[0;31mERROR\u001B[0m in profile file '".concat(sourceFilename, "': double ids ").concat(doubleIds_1.join(', ')));
89
- mdProfile = null;
90
- process.exitCode = 1;
91
- }
92
- }
93
- }
94
- }
95
- }
96
- else {
97
- console.log("\u001B[0;31mERROR\u001B[0m profile file '".concat(sourceFilename, "' not found"));
98
- process.exitCode = 1;
99
- }
100
- }
101
- }
102
- }
103
- else {
104
- console.log("\u001B[0;31mERROR\u001B[0m profile file '".concat(sourceFilename, "' not found"));
105
- process.exitCode = 1;
106
- }
107
- return mdProfile;
108
- };
109
- SchemaValidateFactory.validateConfig = function (sourceFilename, schemaFilename) {
110
- var schema;
111
- var mdConfig = null;
112
- var fs = require('fs');
113
- if (fs.existsSync(schemaFilename)) {
114
- try {
115
- schema = fs.readFileSync(schemaFilename, 'utf8');
116
- }
117
- catch (err) {
118
- console.log("\u001B[0;31mERROR\u001B[0m reading schema '".concat(schemaFilename, "':"));
119
- console.error(err);
120
- process.exitCode = 1;
121
- schema = null;
122
- }
123
- if (schema) {
124
- var compiledSchema = void 0;
125
- var ajv = new ajv_1.default(); // options can be passed, e.g. {allErrors: true}
126
- try {
127
- compiledSchema = ajv.compile(JSON.parse(schema));
128
- }
129
- catch (err) {
130
- console.log("\u001B[0;31mERROR\u001B[0m parsing schema '".concat(schemaFilename, "':"));
131
- console.error(err);
132
- process.exitCode = 1;
133
- compiledSchema = null;
134
- }
135
- if (compiledSchema) {
136
- if (fs.existsSync(sourceFilename)) {
137
- try {
138
- var config_data_raw = fs.readFileSync(sourceFilename, 'utf8');
139
- mdConfig = JSON.parse(config_data_raw);
140
- }
141
- catch (err) {
142
- console.log("\u001B[0;31mERROR\u001B[0m reading and parsing config file '".concat(sourceFilename, "':"));
143
- console.error(err);
144
- mdConfig = null;
145
- process.exitCode = 1;
146
- }
147
- if (mdConfig) {
148
- try {
149
- var valid = compiledSchema ? compiledSchema(mdConfig) : null;
150
- if (!valid) {
151
- console.log("\u001B[0;31mERROR\u001B[0m invalid config file '".concat(sourceFilename, "':"));
152
- console.error(compiledSchema ? compiledSchema.errors : 'error unknown');
153
- mdConfig = null;
154
- process.exitCode = 1;
155
- }
156
- }
157
- catch (err) {
158
- console.log("\u001B[0;31mERROR\u001B[0m invalid config file '".concat(sourceFilename, "':"));
159
- console.error(err);
160
- mdConfig = null;
161
- process.exitCode = 1;
162
- }
163
- }
164
- }
165
- else {
166
- console.log("\u001B[0;31mERROR\u001B[0m config file '".concat(sourceFilename, "' not found"));
167
- process.exitCode = 1;
168
- }
169
- }
170
- }
171
- }
172
- else {
173
- console.log("\u001B[0;31mERROR\u001B[0m config file '".concat(sourceFilename, "' not found"));
174
- process.exitCode = 1;
175
- }
176
- return mdConfig;
177
- };
178
- return SchemaValidateFactory;
179
- }());
180
- exports.SchemaValidateFactory = SchemaValidateFactory;
181
- //# sourceMappingURL=schema-validate.factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-validate.factory.js","sourceRoot":"","sources":["../src/schema-validate.factory.ts"],"names":[],"mappings":";;;AAAA,2BAAsB;AACtB,yEAAwD;AAaxD;IAAA;IA6JA,CAAC;IA5JiB,qCAAe,GAA7B,UAA8B,cAAsB,EAAE,cAAsB;QACxE,IAAI,MAAM,CAAC;QACX,IAAI,SAAS,GAAqB,IAAI,CAAC;QACvC,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;YAC/B,IAAI;gBACA,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;aACpD;YAAC,OAAO,GAAG,EAAE;gBACV,OAAO,CAAC,GAAG,CAAC,qDAA0C,cAAc,OAAI,CAAC,CAAC;gBAC1E,OAAO,CA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AC,CAAC;iCACxB;6BACJ;4BAAC,OAAO,GAAG,EAAE;gCACV,OAAO,CAAC,GAAG,CAAC,0DAA+C,cAAc,OAAI,CAAC,CAAC;gCAC/E,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gCACnB,QAAQ,GAAG,IAAI,CAAC;gCAChB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;6BACxB;yBACJ;qBACJ;yBAAM;wBACH,OAAO,CAAC,GAAG,CAAC,kDAAuC,cAAc,gBAAa,CAAC,CAAC;wBAChF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;qBACxB;iBACJ;aACJ;SACJ;aAAM;YACH,OAAO,CAAC,GAAG,CAAC,kDAAuC,cAAc,gBAAa,CAAC,CAAC;YAChF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;SACxB;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;IACL,4BAAC;AAAD,CAAC,AA7JD,IA6JC;AA7JqB,sDAAqB"}
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- var schema_validate_factory_1 = require("./schema-validate.factory");
5
- var configFileName = './profile-config.json';
6
- if (process.argv[2]) {
7
- configFileName = "./".concat(process.argv[2]);
8
- }
9
- var fs = require('fs');
10
- var configSchemaFilename = 'md-profile-config.schema.json';
11
- var configSchemaFullFilename = "".concat(__dirname, "/").concat(configSchemaFilename);
12
- if (!fs.existsSync(configSchemaFullFilename)) {
13
- configSchemaFullFilename = "./json_schema/md-profile-config/".concat(configSchemaFilename);
14
- }
15
- var mdConfig = schema_validate_factory_1.SchemaValidateFactory.validateConfig(configFileName, configSchemaFullFilename);
16
- if (mdConfig) {
17
- console.log("config file '".concat(configFileName, "' is valid."));
18
- var profileSchemaFilename = 'md-profile.schema.json';
19
- var profileSchemaFullFilename_1 = "".concat(__dirname, "/").concat(profileSchemaFilename);
20
- if (!fs.existsSync(profileSchemaFullFilename_1)) {
21
- profileSchemaFullFilename_1 = "./json_schema/md-profile/".concat(profileSchemaFilename);
22
- }
23
- mdConfig.profiles.forEach(function (p) {
24
- var myMDProfile = schema_validate_factory_1.SchemaValidateFactory.validateProfile(p, profileSchemaFullFilename_1);
25
- if (myMDProfile)
26
- console.log("".concat(myMDProfile.groups.length, " groups found in '").concat(p, "'."));
27
- });
28
- }
29
- //# sourceMappingURL=validate-md-profile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-md-profile.js","sourceRoot":"","sources":["../src/validate-md-profile.ts"],"names":[],"mappings":";;;AACA,qEAAgE;AAEhE,IAAI,cAAc,GAAG,uBAAuB,CAAC;AAC7C,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;IACjB,cAAc,GAAG,YAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAC;CAC3C;AAED,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAC7D,IAAI,wBAAwB,GAAG,UAAG,SAAS,cAAI,oBAAoB,CAAE,CAAC;AACtE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,wBAAwB,CAAC,EAAE;IAC1C,wBAAwB,GAAG,0CAAmC,oBAAoB,CAAE,CAAC;CACxF;AAED,IAAM,QAAQ,GAAG,+CAAqB,CAAC,cAAc,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC;AAChG,IAAI,QAAQ,EAAE;IACV,OAAO,CAAC,GAAG,CAAC,uBAAgB,cAAc,gBAAa,CAAC,CAAC;IACzD,IAAM,qBAAqB,GAAG,wBAAwB,CAAC;IACvD,IAAI,2BAAyB,GAAG,UAAG,SAAS,cAAI,qBAAqB,CAAE,CAAC;IACxE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,2BAAyB,CAAC,EAAE;QAC3C,2BAAyB,GAAG,mCAA4B,qBAAqB,CAAE,CAAC;KACnF;IACD,QAAQ,C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