@iqb/validate-md-profile 0.7.4 → 0.8.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/package.json +3 -3
- package/schema-validate.factory.d.ts +10 -3
- package/schema-validate.factory.js +201 -123
- package/schema-validate.factory.js.map +1 -1
- package/validate-md-profile.d.ts +3 -1
- package/validate-md-profile.js +129 -68
- package/validate-md-profile.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iqb/validate-md-profile",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"author": "IQB - Institut zur Qualitätsentwicklung im Bildungswesen",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Tooling to validate and generate documentation of metadata profile stores",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"homepage": "https://github.com/iqb-vocabs/validate-md-profile#readme",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"@iqbspecs/metadata-profile": "^0.9.1",
|
|
17
|
+
"ajv": "^8.12.0"
|
|
18
18
|
},
|
|
19
19
|
"bin": {
|
|
20
20
|
"validate-md-profile": "./validate-md-profile.js"
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LanguageCodedText, MDProfile } from "@iqbspecs/metadata-profile/metadata-profile.interface";
|
|
2
|
+
export interface MDProfileStore {
|
|
3
|
+
id: string;
|
|
4
|
+
publisher: string;
|
|
5
|
+
maintainer: string;
|
|
6
|
+
title: LanguageCodedText[];
|
|
7
|
+
profiles: string[];
|
|
8
|
+
}
|
|
2
9
|
export declare abstract class SchemaValidateFactory {
|
|
3
|
-
static validateProfile(sourceFilename: string): MDProfile | null
|
|
4
|
-
static validateConfig(sourceFilename: string): MDProfileStore | null
|
|
10
|
+
static validateProfile(sourceFilename: string): Promise<MDProfile | null>;
|
|
11
|
+
static validateConfig(sourceFilename: string): Promise<MDProfileStore | null>;
|
|
5
12
|
}
|
|
@@ -1,155 +1,233 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.SchemaValidateFactory = void 0;
|
|
4
40
|
var ajv_1 = require("ajv");
|
|
5
|
-
var
|
|
41
|
+
var profileSchema = "https://raw.githubusercontent.com/iqb-specifications/metadata-profile/refs/heads/main/metadata-profile.schema.json";
|
|
42
|
+
var storeSchema = "https://raw.githubusercontent.com/iqb-specifications/metadata-store/refs/heads/main/metadata-store.schema.json";
|
|
6
43
|
var SchemaValidateFactory = /** @class */ (function () {
|
|
7
44
|
function SchemaValidateFactory() {
|
|
8
45
|
}
|
|
9
46
|
SchemaValidateFactory.validateProfile = function (sourceFilename) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
+
var mdProfile, fs, compiledSchema, ajv, response, profile, profileData, profile_data_raw, valid, doubleIds_1, allEntryIds_1, entryCount_1;
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
mdProfile = null;
|
|
53
|
+
fs = require('fs');
|
|
54
|
+
ajv = new ajv_1.default() // options can be passed, e.g. {allErrors: true}
|
|
55
|
+
;
|
|
56
|
+
return [4 /*yield*/, fetch(profileSchema)];
|
|
57
|
+
case 1:
|
|
58
|
+
response = _a.sent();
|
|
59
|
+
return [4 /*yield*/, response.json()];
|
|
60
|
+
case 2:
|
|
61
|
+
profile = _a.sent();
|
|
53
62
|
try {
|
|
54
|
-
|
|
63
|
+
compiledSchema = ajv.compile(profile);
|
|
55
64
|
}
|
|
56
65
|
catch (err) {
|
|
57
|
-
console.log(
|
|
66
|
+
console.log('\x1b[0;31mERROR\x1b[0m parsing profile schema');
|
|
58
67
|
console.error(err);
|
|
59
|
-
mdProfile = null;
|
|
60
68
|
process.exitCode = 1;
|
|
69
|
+
compiledSchema = null;
|
|
61
70
|
}
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
if (compiledSchema) {
|
|
72
|
+
if (fs.existsSync(sourceFilename)) {
|
|
73
|
+
profileData = void 0;
|
|
74
|
+
try {
|
|
75
|
+
profile_data_raw = fs.readFileSync(sourceFilename, 'utf8');
|
|
76
|
+
profileData = JSON.parse(profile_data_raw);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
console.log("\u001B[0;31mERROR\u001B[0m reading and parsing profile file '".concat(sourceFilename, "':"));
|
|
80
|
+
console.error(err);
|
|
81
|
+
profileData = null;
|
|
82
|
+
process.exitCode = 1;
|
|
83
|
+
}
|
|
84
|
+
if (profileData) {
|
|
85
|
+
try {
|
|
86
|
+
valid = compiledSchema ? compiledSchema(profileData) : null;
|
|
87
|
+
if (!valid) {
|
|
88
|
+
console.log("\u001B[0;31mERROR\u001B[0m invalid profile file '".concat(sourceFilename, "':"));
|
|
89
|
+
console.error(compiledSchema ? compiledSchema.errors : 'error unknown');
|
|
90
|
+
profileData = null;
|
|
91
|
+
process.exitCode = 1;
|
|
92
|
+
}
|
|
69
93
|
}
|
|
70
|
-
|
|
71
|
-
|
|
94
|
+
catch (err) {
|
|
95
|
+
console.log("\u001B[0;31mERROR\u001B[0m invalid profile file '".concat(sourceFilename, "':"));
|
|
96
|
+
console.error(err);
|
|
97
|
+
profileData = null;
|
|
98
|
+
process.exitCode = 1;
|
|
72
99
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
100
|
+
if (profileData) {
|
|
101
|
+
try {
|
|
102
|
+
mdProfile = {
|
|
103
|
+
id: profileData.id,
|
|
104
|
+
label: profileData.label,
|
|
105
|
+
groups: profileData.groups
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
console.log("\u001B[0;31mERROR\u001B[0m parsing profile file '".concat(sourceFilename, "':"));
|
|
110
|
+
console.error(err);
|
|
111
|
+
mdProfile = null;
|
|
112
|
+
process.exitCode = 1;
|
|
113
|
+
}
|
|
114
|
+
if (mdProfile) {
|
|
115
|
+
doubleIds_1 = [];
|
|
116
|
+
allEntryIds_1 = [];
|
|
117
|
+
entryCount_1 = 0;
|
|
118
|
+
mdProfile.groups.forEach(function (g) {
|
|
119
|
+
g.entries.forEach(function (e) {
|
|
120
|
+
if (allEntryIds_1.includes(e.id)) {
|
|
121
|
+
doubleIds_1.push(e.id);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
allEntryIds_1.push(e.id);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
entryCount_1 += g.entries.length;
|
|
128
|
+
});
|
|
129
|
+
console.log("".concat(mdProfile.groups.length, " ").concat(mdProfile.groups.length === 1 ? 'group' : 'groups', " and ").concat(entryCount_1, " ").concat(entryCount_1 === 1 ? 'entry' : 'entries', " found in '").concat(sourceFilename, "'."));
|
|
130
|
+
if (doubleIds_1.length > 0) {
|
|
131
|
+
console.log("\u001B[0;31mERROR\u001B[0m in profile file '".concat(sourceFilename, "': double ids ").concat(doubleIds_1.join(', ')));
|
|
132
|
+
mdProfile = null;
|
|
133
|
+
process.exitCode = 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
console.log("\u001B[0;31mERROR\u001B[0m profile file '".concat(sourceFilename, "' not found"));
|
|
78
141
|
process.exitCode = 1;
|
|
79
142
|
}
|
|
80
143
|
}
|
|
81
|
-
|
|
144
|
+
return [2 /*return*/, mdProfile];
|
|
82
145
|
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
console.log("\u001B[0;31mERROR\u001B[0m profile file '".concat(sourceFilename, "' not found"));
|
|
86
|
-
process.exitCode = 1;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return mdProfile;
|
|
146
|
+
});
|
|
147
|
+
});
|
|
90
148
|
};
|
|
91
149
|
SchemaValidateFactory.validateConfig = function (sourceFilename) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
+
var mdStore, fs, compiledSchema, ajv, response, store, profileStoreData, config_data_raw, valid;
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
switch (_a.label) {
|
|
154
|
+
case 0:
|
|
155
|
+
mdStore = null;
|
|
156
|
+
fs = require('fs');
|
|
157
|
+
ajv = new ajv_1.default() // options can be passed, e.g. {allErrors: true}
|
|
158
|
+
;
|
|
159
|
+
return [4 /*yield*/, fetch(storeSchema)];
|
|
160
|
+
case 1:
|
|
161
|
+
response = _a.sent();
|
|
162
|
+
return [4 /*yield*/, response.json()];
|
|
163
|
+
case 2:
|
|
164
|
+
store = _a.sent();
|
|
135
165
|
try {
|
|
136
|
-
|
|
166
|
+
compiledSchema = ajv.compile(store);
|
|
137
167
|
}
|
|
138
168
|
catch (err) {
|
|
139
|
-
console.log(
|
|
169
|
+
console.log('\x1b[0;31mERROR\x1b[0m parsing profile config schema');
|
|
140
170
|
console.error(err);
|
|
141
|
-
mdStore = null;
|
|
142
171
|
process.exitCode = 1;
|
|
172
|
+
compiledSchema = null;
|
|
143
173
|
}
|
|
144
|
-
|
|
174
|
+
if (compiledSchema) {
|
|
175
|
+
if (fs.existsSync(sourceFilename)) {
|
|
176
|
+
profileStoreData = void 0;
|
|
177
|
+
try {
|
|
178
|
+
config_data_raw = fs.readFileSync(sourceFilename, 'utf8');
|
|
179
|
+
profileStoreData = JSON.parse(config_data_raw);
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
console.log("\u001B[0;31mERROR\u001B[0m reading and parsing config file '".concat(sourceFilename, "':"));
|
|
183
|
+
console.error(err);
|
|
184
|
+
profileStoreData = null;
|
|
185
|
+
process.exitCode = 1;
|
|
186
|
+
}
|
|
187
|
+
if (profileStoreData) {
|
|
188
|
+
try {
|
|
189
|
+
valid = compiledSchema ? compiledSchema(profileStoreData) : null;
|
|
190
|
+
if (!valid) {
|
|
191
|
+
console.log("\u001B[0;31mERROR\u001B[0m invalid config file '".concat(sourceFilename, "':"));
|
|
192
|
+
console.error(compiledSchema ? compiledSchema.errors : 'error unknown');
|
|
193
|
+
profileStoreData = null;
|
|
194
|
+
process.exitCode = 1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch (err) {
|
|
198
|
+
console.log("\u001B[0;31mERROR\u001B[0m invalid config file '".concat(sourceFilename, "':"));
|
|
199
|
+
console.error(err);
|
|
200
|
+
profileStoreData = null;
|
|
201
|
+
process.exitCode = 1;
|
|
202
|
+
}
|
|
203
|
+
if (profileStoreData) {
|
|
204
|
+
try {
|
|
205
|
+
mdStore = {
|
|
206
|
+
id: profileStoreData.id,
|
|
207
|
+
title: profileStoreData.title,
|
|
208
|
+
publisher: profileStoreData.publisher,
|
|
209
|
+
maintainer: profileStoreData.maintainer,
|
|
210
|
+
profiles: profileStoreData.profiles
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
console.log("\u001B[0;31mERROR\u001B[0m instanciating profile store '".concat(sourceFilename, "':"));
|
|
215
|
+
console.error(err);
|
|
216
|
+
mdStore = null;
|
|
217
|
+
process.exitCode = 1;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
console.log("\u001B[0;31mERROR\u001B[0m config file '".concat(sourceFilename, "' not found"));
|
|
224
|
+
process.exitCode = 1;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return [2 /*return*/, mdStore];
|
|
145
228
|
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
console.log("\u001B[0;31mERROR\u001B[0m config file '".concat(sourceFilename, "' not found"));
|
|
149
|
-
process.exitCode = 1;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return mdStore;
|
|
229
|
+
});
|
|
230
|
+
});
|
|
153
231
|
};
|
|
154
232
|
return SchemaValidateFactory;
|
|
155
233
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-validate.factory.js","sourceRoot":"","sources":["../src/schema-validate.factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema-validate.factory.js","sourceRoot":"","sources":["../src/schema-validate.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAsB;AAYtB,IAAM,aAAa,GAAG,oHAAoH,CAAC;AAC3I,IAAM,WAAW,GAAG,gHAAgH,CAAC;AACrI;IAAA;IA4JA,CAAC;IA3JuB,qCAAe,GAAnC,UAAoC,cAAsB;;;;;;wBAClD,SAAS,GAAqB,IAAI,CAAC;wBACjC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;wBAEnB,GAAG,GAAG,IAAI,aAAG,EAAE,CAAC,gDAAgD;wBAAjD,CAAA;wBAEJ,qBAAM,KAAK,CAAC,aAAa,CAAC,EAAA;;wBAArC,QAAQ,GAAG,SAA0B;wBAChB,qBAAM,QAAQ,CAAC,IAAI,EAAE,EAAA;;wBAA1C,OAAO,GAAc,SAAqB;wBAEhD,IAAI;4BACF,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;yBACvC;wBAAC,OAAO,GAAG,EAAE;4BACV,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;4BAC7D,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;4BACnB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;4BACrB,cAAc,GAAG,IAAI,CAAC;yBACzB;wBACD,IAAI,cAAc,EAAE;4BAChB,IAAI,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;gCAC3B,WAAW,SAAA,CAAC;gCAChB,IAAI;oCACM,gBAAgB,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;o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DAAuC,cAAc,gBAAa,CAAC,CAAC;gCAChF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;6BACxB;yBACJ;wBACD,sBAAO,OAAO,EAAC;;;;KAClB;IACL,4BAAC;AAAD,CAAC,AA5JD,IA4JC;AA5JqB,sDAAqB"}
|
package/validate-md-profile.d.ts
CHANGED
package/validate-md-profile.js
CHANGED
|
@@ -1,8 +1,49 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
13
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
14
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
15
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
16
|
+
function step(op) {
|
|
17
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
19
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
20
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
21
|
+
switch (op[0]) {
|
|
22
|
+
case 0: case 1: t = op; break;
|
|
23
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
+
default:
|
|
27
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
+
if (t[2]) _.ops.pop();
|
|
32
|
+
_.trys.pop(); continue;
|
|
33
|
+
}
|
|
34
|
+
op = body.call(thisArg, _);
|
|
35
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
3
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.profileEntryTextFormatAsText = void 0;
|
|
4
41
|
var schema_validate_factory_1 = require("./schema-validate.factory");
|
|
5
|
-
|
|
42
|
+
exports.profileEntryTextFormatAsText = {
|
|
43
|
+
"single": "Einzeilig",
|
|
44
|
+
"multiline": "Mehrzeilig",
|
|
45
|
+
"html": "Html/formatierter Text"
|
|
46
|
+
};
|
|
6
47
|
var mdTargetFolder = './docs';
|
|
7
48
|
var quartoMode = true;
|
|
8
49
|
var configFileName = './profile-config.json';
|
|
@@ -18,73 +59,93 @@ if (process.argv[3] && process.argv[3] === '-md') {
|
|
|
18
59
|
quartoMode = false;
|
|
19
60
|
}
|
|
20
61
|
var mdTargetFilename = "".concat(mdTargetFolder, "/README.").concat(quartoMode ? 'qmd' : 'md');
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
62
|
+
schema_validate_factory_1.SchemaValidateFactory.validateConfig(configFileName)
|
|
63
|
+
.then(function (mdConfig) { return __awaiter(void 0, void 0, void 0, function () {
|
|
64
|
+
var allProfiles_1, fs, mdContent_1;
|
|
65
|
+
return __generator(this, function (_a) {
|
|
66
|
+
switch (_a.label) {
|
|
67
|
+
case 0:
|
|
68
|
+
if (!mdConfig) return [3 /*break*/, 2];
|
|
69
|
+
console.log("config file '".concat(configFileName, "' is valid: ").concat(mdConfig.id));
|
|
70
|
+
allProfiles_1 = [];
|
|
71
|
+
fs = require('fs');
|
|
72
|
+
return [4 /*yield*/, Promise.all(mdConfig.profiles
|
|
73
|
+
.map(function (profile) { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
return __generator(this, function (_c) {
|
|
76
|
+
switch (_c.label) {
|
|
77
|
+
case 0:
|
|
78
|
+
_b = (_a = allProfiles_1).push;
|
|
79
|
+
return [4 /*yield*/, schema_validate_factory_1.SchemaValidateFactory.validateProfile(profile)];
|
|
80
|
+
case 1:
|
|
81
|
+
_b.apply(_a, [_c.sent()]);
|
|
82
|
+
return [2 /*return*/];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}); }))];
|
|
86
|
+
case 1:
|
|
87
|
+
_a.sent();
|
|
88
|
+
if (fs.existsSync(mdTargetFolder)) {
|
|
89
|
+
mdContent_1 = '';
|
|
90
|
+
mdContent_1 += quartoMode ? "---\ntitle: ".concat(mdConfig.title[0].value.replace(":", " -"), "\n---\n\n") : "# ".concat(mdConfig.title[0].value, "\n\n");
|
|
91
|
+
mdContent_1 += "ID of profile-store: `".concat(mdConfig.id, "`\n\n");
|
|
92
|
+
if (mdConfig.publisher)
|
|
93
|
+
mdContent_1 += "Publisher: ".concat(mdConfig.publisher, "\n\n");
|
|
94
|
+
if (mdConfig.maintainer !== "")
|
|
95
|
+
mdContent_1 += "Maintainer: ".concat(mdConfig.maintainer, "\n\n");
|
|
96
|
+
if (allProfiles_1.length > 0) {
|
|
97
|
+
mdContent_1 += "".concat(allProfiles_1.length, " ").concat(allProfiles_1.length === 1 ? 'Profil' : 'Profile', " definiert:\n\n");
|
|
98
|
+
allProfiles_1.forEach(function (p) {
|
|
99
|
+
mdContent_1 += quartoMode ? "# ".concat((p.label)[0].value, "\n\n") : "## Profil \"".concat((p.label)[0].value, "\"\n\n");
|
|
100
|
+
mdContent_1 += "ID of profile: `".concat(p.id, "`\n\n");
|
|
101
|
+
p.groups.forEach(function (g) {
|
|
102
|
+
if (p.groups.length > 1)
|
|
103
|
+
mdContent_1 += quartoMode ? "## ".concat((g.label)[0].value, "\n\n") : "### ".concat((g.label)[0].value, "\n\n");
|
|
104
|
+
mdContent_1 += '| Name/Label | Typ | Parameter | ID Profil-Eintrag |\n';
|
|
105
|
+
mdContent_1 += '| :--- | :---: | :--- | :---: |\n';
|
|
106
|
+
g.entries.forEach(function (e) {
|
|
107
|
+
mdContent_1 += "| ".concat((e.label)[0].value, " | ");
|
|
108
|
+
if (e.type === 'vocabulary' && e.parameters) {
|
|
109
|
+
var p_1 = e.parameters;
|
|
110
|
+
var levelText = p_1.maxLevel > 1 ? ', Zeige nur erste ' + p_1.maxLevel + ' Ebenen' : ', Zeige nur erste Ebene';
|
|
111
|
+
mdContent_1 += "[Vokabular](".concat(p_1.url, ") | url: '").concat(p_1.url, "', ").concat(p_1.allowMultipleValues ? 'Mehrfachauswahl' : 'Einmalauswahl').concat(p_1.maxLevel > 0 ? levelText : '').concat(p_1.hideNumbering ? ', Nummerierung unterdrückt' : '').concat(p_1.hideTitle ? ', Titel unterdrückt' : '').concat(p_1.hideDescription ? ', Beschreibung unterdrückt' : '').concat(p_1.addTextLanguages && p_1.addTextLanguages.length > 0 ? ', mit Texteingabe in Sprache(n): ' + p_1.addTextLanguages.join('/') : '');
|
|
112
|
+
}
|
|
113
|
+
else if (e.type === 'text' && e.parameters) {
|
|
114
|
+
var p_2 = e.parameters;
|
|
115
|
+
mdContent_1 += "Text | ".concat(exports.profileEntryTextFormatAsText[p_2.format], ", Sprache(n): de ").concat(p_2.pattern ? ', Gültigkeitsmuster: ' + p_2.pattern : '', " ");
|
|
116
|
+
}
|
|
117
|
+
else if (e.type === 'numbers' && e.parameters) {
|
|
118
|
+
var p_3 = e.parameters;
|
|
119
|
+
mdContent_1 += "Zahl | Kommastellen: ".concat(p_3.digits, ", Mindestwert: ").concat(p_3.minValue === null ? 'kein' : p_3.minValue, ", Maximalwert: ").concat(p_3.maxValue === null ? 'kein' : p_3.maxValue).concat(p_3.isPeriodSeconds ? ', als Sekunden' : '');
|
|
120
|
+
}
|
|
121
|
+
else if (e.type === 'boolean' && e.parameters) {
|
|
122
|
+
var p_4 = e.parameters;
|
|
123
|
+
mdContent_1 += "Ja/Nein | Text f\u00FCr WAHR: ".concat(p_4.trueLabel, ", Text f\u00FCr FALSCH: ").concat(p_4.falseLabel);
|
|
124
|
+
}
|
|
125
|
+
mdContent_1 += " | ".concat(e.id, " |\n");
|
|
126
|
+
});
|
|
127
|
+
mdContent_1 += quartoMode ? '\n: {tbl-colwidths="[15,15,55,15]"}\n\n' : '\n';
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
mdContent_1 += 'Keine Profile definiert.\n';
|
|
133
|
+
console.log('\x1b[0;33mWARNING\x1b[0m no profiles found');
|
|
134
|
+
}
|
|
135
|
+
fs.writeFileSync(mdTargetFilename, mdContent_1, { encoding: 'utf8' });
|
|
136
|
+
console.log("markdown file \"".concat(mdTargetFilename, "\" generated."));
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
console.log("\u001B[0;31mERROR\u001B[0m TargetFolder '".concat(mdTargetFolder, "' not found"));
|
|
140
|
+
process.exitCode = 1;
|
|
141
|
+
}
|
|
142
|
+
return [3 /*break*/, 3];
|
|
143
|
+
case 2:
|
|
144
|
+
console.log("\u001B[0;31mERROR\u001B[0m profile store '".concat(configFileName, "' not valid"));
|
|
145
|
+
process.exitCode = 1;
|
|
146
|
+
_a.label = 3;
|
|
147
|
+
case 3: return [2 /*return*/];
|
|
37
148
|
}
|
|
38
149
|
});
|
|
39
|
-
|
|
40
|
-
if (fs.existsSync(mdTargetFolder)) {
|
|
41
|
-
var mdContent_1 = '';
|
|
42
|
-
mdContent_1 += quartoMode ? "---\ntitle: ".concat(mdConfig.title.replace(":", " -"), "\n---\n\n") : "# ".concat(mdConfig.title, "\n\n");
|
|
43
|
-
mdContent_1 += "ID of profile-store: `".concat(mdConfig.id, "`\n\n");
|
|
44
|
-
if (mdConfig.publisher)
|
|
45
|
-
mdContent_1 += "Publisher: ".concat(mdConfig.publisher, "\n\n");
|
|
46
|
-
if (mdConfig.maintainer !== "")
|
|
47
|
-
mdContent_1 += "Maintainer: ".concat(mdConfig.maintainer, "\n\n");
|
|
48
|
-
if (allProfiles_1.length > 0) {
|
|
49
|
-
mdContent_1 += "".concat(allProfiles_1.length, " ").concat(allProfiles_1.length === 1 ? 'Profil' : 'Profile', " definiert:\n\n");
|
|
50
|
-
allProfiles_1.forEach(function (p) {
|
|
51
|
-
mdContent_1 += quartoMode ? "# ".concat(p.label, "\n\n") : "## Profil \"".concat(p.label, "\"\n\n");
|
|
52
|
-
mdContent_1 += "ID of profile: `".concat(p.id, "`\n\n");
|
|
53
|
-
p.groups.forEach(function (g) {
|
|
54
|
-
if (p.groups.length > 1)
|
|
55
|
-
mdContent_1 += quartoMode ? "## ".concat(g.label, "\n\n") : "### ".concat(g.label, "\n\n");
|
|
56
|
-
mdContent_1 += '| Name/Label | Typ | Parameter | ID Profil-Eintrag |\n';
|
|
57
|
-
mdContent_1 += '| :--- | :---: | :--- | :---: |\n';
|
|
58
|
-
g.entries.forEach(function (e) {
|
|
59
|
-
mdContent_1 += "| ".concat(e.label, " | ");
|
|
60
|
-
if (e.type === 'vocabulary' && e.parameters) {
|
|
61
|
-
var p_1 = e.parameters;
|
|
62
|
-
mdContent_1 += "[".concat(metadata_1.profileEntryTypeAsText[e.type], "](").concat(p_1.url, ") | ");
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
mdContent_1 += "".concat(metadata_1.profileEntryTypeAsText[e.type] || '?', " |");
|
|
66
|
-
}
|
|
67
|
-
mdContent_1 += e.getParametersAsText();
|
|
68
|
-
mdContent_1 += " | ".concat(e.id, " |\n");
|
|
69
|
-
});
|
|
70
|
-
mdContent_1 += quartoMode ? '\n: {tbl-colwidths="[15,15,55,15]"}\n\n' : '\n';
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
mdContent_1 += 'Keine Profile definiert.\n';
|
|
76
|
-
console.log('\x1b[0;33mWARNING\x1b[0m no profiles found');
|
|
77
|
-
}
|
|
78
|
-
fs.writeFileSync(mdTargetFilename, mdContent_1, { encoding: 'utf8' });
|
|
79
|
-
console.log("markdown file \"".concat(mdTargetFilename, "\" generated."));
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
console.log("\u001B[0;31mERROR\u001B[0m TargetFolder '".concat(mdTargetFolder, "' not found"));
|
|
83
|
-
process.exitCode = 1;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
console.log("\u001B[0;31mERROR\u001B[0m profile store '".concat(configFileName, "' not valid"));
|
|
88
|
-
process.exitCode = 1;
|
|
89
|
-
}
|
|
150
|
+
}); });
|
|
90
151
|
//# sourceMappingURL=validate-md-profile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-md-profile.js","sourceRoot":"","sources":["../src/validate-md-profile.ts"],"names":[],"mappings":"
|
|
1
|
+
{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