@oslo-flanders/core 0.0.18-alpha.0 → 0.0.20-alpha.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/lib/enums/Language.d.ts +7 -0
- package/lib/enums/Language.js +12 -0
- package/lib/enums/PropertyTypes.js +1 -1
- package/lib/enums/Scope.js +1 -1
- package/lib/enums/specificationType.js +1 -1
- package/lib/interfaces/AppRunner.d.ts +1 -0
- package/lib/logging/LogUtil.js +3 -2
- package/lib/logging/Logger.js +2 -2
- package/lib/logging/VoidLogger.js +2 -2
- package/lib/logging/WinstonLogger.js +2 -2
- package/lib/store/QuadStore.d.ts +15 -0
- package/lib/store/QuadStore.js +28 -2
- package/lib/utils/anchorTag.d.ts +1 -1
- package/lib/utils/anchorTag.js +5 -3
- package/lib/utils/fetchFileOrUrl.d.ts +1 -0
- package/lib/utils/fetchFileOrUrl.js +2 -1
- package/lib/utils/storeUtils.js +9 -8
- package/lib/utils/uniqueId.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Language = void 0;
|
|
4
|
+
var Language;
|
|
5
|
+
(function (Language) {
|
|
6
|
+
Language["NL"] = "nl";
|
|
7
|
+
Language["EN"] = "en";
|
|
8
|
+
Language["FR"] = "fr";
|
|
9
|
+
Language["DE"] = "de";
|
|
10
|
+
Language["ES"] = "es";
|
|
11
|
+
})(Language = exports.Language || (exports.Language = {}));
|
|
12
|
+
//# sourceMappingURL=Language.js.map
|
|
@@ -6,5 +6,5 @@ var PropertyType;
|
|
|
6
6
|
PropertyType["DataTypeProperty"] = "http://www.w3.org/2002/07/owl#DatatypeProperty";
|
|
7
7
|
PropertyType["ObjectProperty"] = "http://www.w3.org/2002/07/owl#ObjectProperty";
|
|
8
8
|
PropertyType["Property"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property";
|
|
9
|
-
})(PropertyType
|
|
9
|
+
})(PropertyType = exports.PropertyType || (exports.PropertyType = {}));
|
|
10
10
|
//# sourceMappingURL=PropertyTypes.js.map
|
package/lib/enums/Scope.js
CHANGED
|
@@ -7,5 +7,5 @@ var Scope;
|
|
|
7
7
|
Scope["InPublicationEnvironment"] = "https://data.vlaanderen.be/id/concept/scope/InPublicationEnvironment";
|
|
8
8
|
Scope["External"] = "https://data.vlaanderen.be/id/concept/scope/External";
|
|
9
9
|
Scope["Undefined"] = "https://data.vlaanderen.be/id/concept/scope/Undefined";
|
|
10
|
-
})(Scope
|
|
10
|
+
})(Scope = exports.Scope || (exports.Scope = {}));
|
|
11
11
|
//# sourceMappingURL=Scope.js.map
|
|
@@ -5,5 +5,5 @@ var SpecificationType;
|
|
|
5
5
|
(function (SpecificationType) {
|
|
6
6
|
SpecificationType[SpecificationType["ApplicationProfile"] = 0] = "ApplicationProfile";
|
|
7
7
|
SpecificationType[SpecificationType["Vocabulary"] = 1] = "Vocabulary";
|
|
8
|
-
})(SpecificationType
|
|
8
|
+
})(SpecificationType = exports.SpecificationType || (exports.SpecificationType = {}));
|
|
9
9
|
//# sourceMappingURL=specificationType.js.map
|
package/lib/logging/LogUtil.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createLogger =
|
|
4
|
-
exports.setLoggerFactory = setLoggerFactory;
|
|
3
|
+
exports.setLoggerFactory = exports.createLogger = void 0;
|
|
5
4
|
const VoidLoggerFactory_1 = require("./VoidLoggerFactory");
|
|
6
5
|
const WinstonLoggerFactory_1 = require("./WinstonLoggerFactory");
|
|
7
6
|
let loggerFactory = new VoidLoggerFactory_1.VoidLoggerFactory();
|
|
8
7
|
function createLogger() {
|
|
9
8
|
return loggerFactory.createLogger();
|
|
10
9
|
}
|
|
10
|
+
exports.createLogger = createLogger;
|
|
11
11
|
function setLoggerFactory(params) {
|
|
12
12
|
if (!params.silent) {
|
|
13
13
|
loggerFactory = new WinstonLoggerFactory_1.WinstonLoggerFactory(params.logLevel);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
exports.setLoggerFactory = setLoggerFactory;
|
|
16
17
|
//# sourceMappingURL=LogUtil.js.map
|
package/lib/logging/Logger.js
CHANGED
|
@@ -29,8 +29,8 @@ let BaseLogger = class BaseLogger {
|
|
|
29
29
|
return this.log('silly', message);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
exports.BaseLogger = BaseLogger = __decorate([
|
|
32
|
+
BaseLogger = __decorate([
|
|
34
33
|
(0, inversify_1.injectable)()
|
|
35
34
|
], BaseLogger);
|
|
35
|
+
exports.BaseLogger = BaseLogger;
|
|
36
36
|
//# sourceMappingURL=Logger.js.map
|
|
@@ -20,9 +20,9 @@ let VoidLogger = class VoidLogger extends Logger_1.BaseLogger {
|
|
|
20
20
|
return this;
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
exports.VoidLogger = VoidLogger = __decorate([
|
|
23
|
+
VoidLogger = __decorate([
|
|
25
24
|
(0, inversify_1.injectable)(),
|
|
26
25
|
__metadata("design:paramtypes", [])
|
|
27
26
|
], VoidLogger);
|
|
27
|
+
exports.VoidLogger = VoidLogger;
|
|
28
28
|
//# sourceMappingURL=VoidLogger.js.map
|
|
@@ -23,9 +23,9 @@ let WinstonLogger = class WinstonLogger extends Logger_1.BaseLogger {
|
|
|
23
23
|
return this;
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
exports.WinstonLogger = WinstonLogger = __decorate([
|
|
26
|
+
WinstonLogger = __decorate([
|
|
28
27
|
(0, inversify_1.injectable)(),
|
|
29
28
|
__metadata("design:paramtypes", [winston_1.Logger])
|
|
30
29
|
], WinstonLogger);
|
|
30
|
+
exports.WinstonLogger = WinstonLogger;
|
|
31
31
|
//# sourceMappingURL=WinstonLogger.js.map
|
package/lib/store/QuadStore.d.ts
CHANGED
|
@@ -174,4 +174,19 @@ export declare class QuadStore {
|
|
|
174
174
|
* @returns An RDF.Term or undefined if not found
|
|
175
175
|
*/
|
|
176
176
|
getStatus(subject: RDF.Term, graph?: RDF.Term | null): RDF.NamedNode | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* Finds all the other tags.
|
|
179
|
+
* This could be any tag that is not a label, definition, usage note, scope, minCardinality, maxCardinality, parent, range, domain, status or codelist
|
|
180
|
+
* @param subject The RDF.Term to find the other tags for
|
|
181
|
+
* @param store A N3 quad store
|
|
182
|
+
* @returns An array of RDF.Literals
|
|
183
|
+
*/
|
|
184
|
+
getOtherTags(subject: RDF.Term, graph?: RDF.NamedNode | null): RDF.Quad[];
|
|
185
|
+
/**
|
|
186
|
+
* Use the other tags method from earlier and sanitize the results so the ns('any') is removed
|
|
187
|
+
* @param subject The RDF.Term to find the other tags for
|
|
188
|
+
* @param store A N3 quad store
|
|
189
|
+
* @returns An array of RDF.Literals
|
|
190
|
+
*/
|
|
191
|
+
getSanitizedOtherTags(subject: RDF.Term, graph?: RDF.NamedNode | null): RDF.Quad[];
|
|
177
192
|
}
|
package/lib/store/QuadStore.js
CHANGED
|
@@ -313,10 +313,36 @@ let QuadStore = class QuadStore {
|
|
|
313
313
|
getStatus(subject, graph = null) {
|
|
314
314
|
return (this.store.getObjects(subject, namespaces_1.ns.adms('status'), graph).shift());
|
|
315
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Finds all the other tags.
|
|
318
|
+
* This could be any tag that is not a label, definition, usage note, scope, minCardinality, maxCardinality, parent, range, domain, status or codelist
|
|
319
|
+
* @param subject The RDF.Term to find the other tags for
|
|
320
|
+
* @param store A N3 quad store
|
|
321
|
+
* @returns An array of RDF.Literals
|
|
322
|
+
*/
|
|
323
|
+
getOtherTags(subject, graph = null) {
|
|
324
|
+
const allQuads = this.store.getQuads(subject, null, null, graph);
|
|
325
|
+
// Filter quads where the predicate includes 'any' partially
|
|
326
|
+
const anyQuads = allQuads.filter((quad) => quad.predicate.value.includes(namespaces_1.ns.oslo('any').value));
|
|
327
|
+
return anyQuads;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Use the other tags method from earlier and sanitize the results so the ns('any') is removed
|
|
331
|
+
* @param subject The RDF.Term to find the other tags for
|
|
332
|
+
* @param store A N3 quad store
|
|
333
|
+
* @returns An array of RDF.Literals
|
|
334
|
+
*/
|
|
335
|
+
getSanitizedOtherTags(subject, graph = null) {
|
|
336
|
+
const quads = this.getOtherTags(subject, graph);
|
|
337
|
+
return quads.map((quad) => {
|
|
338
|
+
const sanitizedPredicate = N3.DataFactory.namedNode(quad.predicate.value.replace(`${namespaces_1.ns.oslo('any').value}:`, ''));
|
|
339
|
+
return N3.DataFactory.quad(quad.subject, sanitizedPredicate, quad.object, quad.graph);
|
|
340
|
+
});
|
|
341
|
+
}
|
|
316
342
|
};
|
|
317
|
-
|
|
318
|
-
exports.QuadStore = QuadStore = __decorate([
|
|
343
|
+
QuadStore = __decorate([
|
|
319
344
|
(0, inversify_1.injectable)(),
|
|
320
345
|
__metadata("design:paramtypes", [])
|
|
321
346
|
], QuadStore);
|
|
347
|
+
exports.QuadStore = QuadStore;
|
|
322
348
|
//# sourceMappingURL=QuadStore.js.map
|
package/lib/utils/anchorTag.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function generateAnchorTag(entityLabel
|
|
1
|
+
export declare function generateAnchorTag(entityLabel?: string, propLabel?: string): string;
|
package/lib/utils/anchorTag.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateAnchorTag =
|
|
3
|
+
exports.generateAnchorTag = void 0;
|
|
4
4
|
function generateAnchorTag(entityLabel, propLabel) {
|
|
5
|
+
if (!entityLabel)
|
|
6
|
+
return '';
|
|
5
7
|
const label = propLabel ? `${entityLabel}:${propLabel}` : entityLabel;
|
|
6
|
-
|
|
7
|
-
return anchorHref;
|
|
8
|
+
return encodeURIComponent(label.replace(/\s+/gu, ''));
|
|
8
9
|
}
|
|
10
|
+
exports.generateAnchorTag = generateAnchorTag;
|
|
9
11
|
//# sourceMappingURL=anchorTag.js.map
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchFileOrUrl =
|
|
6
|
+
exports.fetchFileOrUrl = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const promises_1 = require("fs/promises");
|
|
9
9
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
@@ -19,4 +19,5 @@ async function fetchFileOrUrl(file) {
|
|
|
19
19
|
}
|
|
20
20
|
return (0, promises_1.readFile)(file);
|
|
21
21
|
}
|
|
22
|
+
exports.fetchFileOrUrl = fetchFileOrUrl;
|
|
22
23
|
//# sourceMappingURL=fetchFileOrUrl.js.map
|
package/lib/utils/storeUtils.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getApplicationProfileLabel =
|
|
4
|
-
exports.getVocabularyLabel = getVocabularyLabel;
|
|
5
|
-
exports.getApplicationProfileDefinition = getApplicationProfileDefinition;
|
|
6
|
-
exports.getVocabularyDefinition = getVocabularyDefinition;
|
|
7
|
-
exports.getApplicationProfileUsageNote = getApplicationProfileUsageNote;
|
|
8
|
-
exports.getVocabularyUsageNote = getVocabularyUsageNote;
|
|
9
|
-
exports.getMinCount = getMinCount;
|
|
10
|
-
exports.getMaxCount = getMaxCount;
|
|
3
|
+
exports.getMaxCount = exports.getMinCount = exports.getVocabularyUsageNote = exports.getApplicationProfileUsageNote = exports.getVocabularyDefinition = exports.getApplicationProfileDefinition = exports.getVocabularyLabel = exports.getApplicationProfileLabel = void 0;
|
|
11
4
|
const namespaces_1 = require("./namespaces");
|
|
12
5
|
function getApplicationProfileLabel(subject, store, language = null) {
|
|
13
6
|
var _a, _b, _c;
|
|
@@ -23,6 +16,7 @@ function getApplicationProfileLabel(subject, store, language = null) {
|
|
|
23
16
|
}
|
|
24
17
|
return (_c = labels.find(x => x.predicate.equals(namespaces_1.ns.oslo('diagramLabel')))) === null || _c === void 0 ? void 0 : _c.object;
|
|
25
18
|
}
|
|
19
|
+
exports.getApplicationProfileLabel = getApplicationProfileLabel;
|
|
26
20
|
function getVocabularyLabel(subject, store, language = null) {
|
|
27
21
|
var _a, _b;
|
|
28
22
|
const labels = store.getLabels(subject);
|
|
@@ -33,6 +27,7 @@ function getVocabularyLabel(subject, store, language = null) {
|
|
|
33
27
|
}
|
|
34
28
|
return (_b = labels.find(x => x.predicate.equals(namespaces_1.ns.oslo('diagramLabel')))) === null || _b === void 0 ? void 0 : _b.object;
|
|
35
29
|
}
|
|
30
|
+
exports.getVocabularyLabel = getVocabularyLabel;
|
|
36
31
|
function getApplicationProfileDefinition(subject, store, language = null) {
|
|
37
32
|
var _a, _b;
|
|
38
33
|
const definitions = store.getDefinitions(subject);
|
|
@@ -48,6 +43,7 @@ function getApplicationProfileDefinition(subject, store, language = null) {
|
|
|
48
43
|
}
|
|
49
44
|
return undefined;
|
|
50
45
|
}
|
|
46
|
+
exports.getApplicationProfileDefinition = getApplicationProfileDefinition;
|
|
51
47
|
function getVocabularyDefinition(subject, store, language = null) {
|
|
52
48
|
var _a;
|
|
53
49
|
const definitions = store.getDefinitions(subject);
|
|
@@ -58,6 +54,7 @@ function getVocabularyDefinition(subject, store, language = null) {
|
|
|
58
54
|
}
|
|
59
55
|
return undefined;
|
|
60
56
|
}
|
|
57
|
+
exports.getVocabularyDefinition = getVocabularyDefinition;
|
|
61
58
|
function getApplicationProfileUsageNote(subject, store, language = null) {
|
|
62
59
|
var _a, _b;
|
|
63
60
|
const usageNotes = store.getUsageNotes(subject);
|
|
@@ -73,6 +70,7 @@ function getApplicationProfileUsageNote(subject, store, language = null) {
|
|
|
73
70
|
}
|
|
74
71
|
return undefined;
|
|
75
72
|
}
|
|
73
|
+
exports.getApplicationProfileUsageNote = getApplicationProfileUsageNote;
|
|
76
74
|
function getVocabularyUsageNote(subject, store, language = null) {
|
|
77
75
|
var _a;
|
|
78
76
|
const usageNotes = store.getUsageNotes(subject);
|
|
@@ -83,12 +81,15 @@ function getVocabularyUsageNote(subject, store, language = null) {
|
|
|
83
81
|
}
|
|
84
82
|
return undefined;
|
|
85
83
|
}
|
|
84
|
+
exports.getVocabularyUsageNote = getVocabularyUsageNote;
|
|
86
85
|
function getMinCount(subject, store) {
|
|
87
86
|
var _a;
|
|
88
87
|
return (_a = store.findObject(subject, namespaces_1.ns.shacl('minCount'))) === null || _a === void 0 ? void 0 : _a.value;
|
|
89
88
|
}
|
|
89
|
+
exports.getMinCount = getMinCount;
|
|
90
90
|
function getMaxCount(subject, store) {
|
|
91
91
|
var _a;
|
|
92
92
|
return (_a = store.findObject(subject, namespaces_1.ns.shacl('maxCount'))) === null || _a === void 0 ? void 0 : _a.value;
|
|
93
93
|
}
|
|
94
|
+
exports.getMaxCount = getMaxCount;
|
|
94
95
|
//# sourceMappingURL=storeUtils.js.map
|
package/lib/utils/uniqueId.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uniqueId =
|
|
3
|
+
exports.uniqueId = void 0;
|
|
4
4
|
const crypto_js_1 = require("crypto-js");
|
|
5
5
|
function uniqueId(guid, label, id) {
|
|
6
6
|
const object = {
|
|
@@ -10,4 +10,5 @@ function uniqueId(guid, label, id) {
|
|
|
10
10
|
};
|
|
11
11
|
return (0, crypto_js_1.SHA256)(JSON.stringify(object)).toString();
|
|
12
12
|
}
|
|
13
|
+
exports.uniqueId = uniqueId;
|
|
13
14
|
//# sourceMappingURL=uniqueId.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslo-flanders/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20-alpha.0",
|
|
4
4
|
"description": "Core interfaces and utilities",
|
|
5
5
|
"author": "Digitaal Vlaanderen <https://data.vlaanderen.be/id/organisatie/OVO002949>",
|
|
6
6
|
"homepage": "https://github.com/informatievlaanderen/OSLO-UML-Transformer/tree/main/packages/oslo-core#readme",
|