@oslo-flanders/core 1.0.13 → 1.0.15
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.
|
@@ -13,6 +13,7 @@ export type YargsParams = {
|
|
|
13
13
|
$0: string;
|
|
14
14
|
};
|
|
15
15
|
export declare abstract class AppRunner<T extends IService, K extends IConfiguration> {
|
|
16
|
+
protected createYargsInstance(argv: string[]): any;
|
|
16
17
|
runCliSync(process: NodeJS.Process): void;
|
|
17
18
|
abstract runCli(argv: CliArgv): Promise<void>;
|
|
18
19
|
startApp(params: YargsParams, container: Container): Promise<void>;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.AppRunner = void 0;
|
|
4
7
|
const process_1 = require("process");
|
|
5
8
|
const LogUtil_1 = require("../logging/LogUtil");
|
|
6
9
|
const ServiceIdentifier_1 = require("../ServiceIdentifier");
|
|
10
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
7
11
|
class AppRunner {
|
|
12
|
+
createYargsInstance(argv) {
|
|
13
|
+
return (0, yargs_1.default)(argv)
|
|
14
|
+
.parserConfiguration({
|
|
15
|
+
'duplicate-arguments-array': false,
|
|
16
|
+
})
|
|
17
|
+
.usage('node ./bin/runner.js [args]');
|
|
18
|
+
}
|
|
8
19
|
runCliSync(process) {
|
|
9
20
|
this.runCli(process.argv).catch((error) => {
|
|
10
21
|
process_1.stderr.write(error.message);
|
|
@@ -16,11 +27,15 @@ class AppRunner {
|
|
|
16
27
|
const configuration = container.get(ServiceIdentifier_1.ServiceIdentifier.Configuration);
|
|
17
28
|
await configuration.createFromCli(params);
|
|
18
29
|
(0, LogUtil_1.setLoggerFactory)(params);
|
|
19
|
-
container
|
|
30
|
+
container
|
|
31
|
+
.bind(ServiceIdentifier_1.ServiceIdentifier.Logger)
|
|
32
|
+
.toDynamicValue(() => (0, LogUtil_1.createLogger)())
|
|
33
|
+
.inSingletonScope();
|
|
20
34
|
const service = container.get(ServiceIdentifier_1.ServiceIdentifier.Service);
|
|
21
|
-
service
|
|
35
|
+
service
|
|
36
|
+
.init()
|
|
22
37
|
.then(() => service.run())
|
|
23
|
-
.catch(error => console.error(error));
|
|
38
|
+
.catch((error) => console.error(error));
|
|
24
39
|
}
|
|
25
40
|
}
|
|
26
41
|
exports.AppRunner = AppRunner;
|
|
@@ -11,3 +11,4 @@ export declare function getMinCount(subject: RDF.Term, store: QuadStore): string
|
|
|
11
11
|
export declare function getMaxCount(subject: RDF.Term, store: QuadStore): string | undefined;
|
|
12
12
|
export declare function createList(items: RDF.Term[], store: QuadStore, df: DataFactory): RDF.BlankNode | RDF.NamedNode;
|
|
13
13
|
export declare function findAllAttributes(subject: RDF.Term, attributeIds: RDF.Term[], store: QuadStore): RDF.Term[];
|
|
14
|
+
export declare function areStoresEqual(store1: QuadStore, store2: QuadStore): boolean;
|
package/lib/utils/storeUtils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findAllAttributes = exports.createList = exports.getMaxCount = exports.getMinCount = exports.getVocabularyUsageNote = exports.getApplicationProfileUsageNote = exports.getVocabularyDefinition = exports.getApplicationProfileDefinition = exports.getVocabularyLabel = exports.getApplicationProfileLabel = void 0;
|
|
3
|
+
exports.areStoresEqual = exports.findAllAttributes = exports.createList = exports.getMaxCount = exports.getMinCount = exports.getVocabularyUsageNote = exports.getApplicationProfileUsageNote = exports.getVocabularyDefinition = exports.getApplicationProfileDefinition = exports.getVocabularyLabel = exports.getApplicationProfileLabel = void 0;
|
|
4
4
|
const namespaces_1 = require("./namespaces");
|
|
5
5
|
function getApplicationProfileLabel(subject, store, language = null) {
|
|
6
6
|
var _a, _b, _c;
|
|
@@ -128,4 +128,26 @@ function findAllAttributes(subject, attributeIds, store) {
|
|
|
128
128
|
return attributeIds;
|
|
129
129
|
}
|
|
130
130
|
exports.findAllAttributes = findAllAttributes;
|
|
131
|
+
function areStoresEqual(store1, store2) {
|
|
132
|
+
var _a, _b, _c, _d;
|
|
133
|
+
const quads1 = store1.findQuads(null, null, null, null);
|
|
134
|
+
const quads2 = store2.findQuads(null, null, null, null);
|
|
135
|
+
// Quick check: different sizes means not equal
|
|
136
|
+
// Second check allows store2 to have more quads than store1 if it has all quads of store1 plus more
|
|
137
|
+
if (quads1.length !== quads2.length) {
|
|
138
|
+
console.log(`[QUadStore]: Store1 has a length of ${quads1.length} whilst Store2 has a length of ${quads2.length}.`);
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
// Check if every quad in store1 exists in store2
|
|
142
|
+
// If there is a variation in quads, we know something is up
|
|
143
|
+
for (const quad1 of quads1) {
|
|
144
|
+
const matchingQuad = store2.findQuad(quad1.subject, quad1.predicate, quad1.object, quad1.graph);
|
|
145
|
+
if (!matchingQuad) {
|
|
146
|
+
console.log(`[QUadStore]: Quad not found in store2: ${(_a = quad1.subject) === null || _a === void 0 ? void 0 : _a.value} ${(_b = quad1.predicate) === null || _b === void 0 ? void 0 : _b.value} ${(_c = quad1.object) === null || _c === void 0 ? void 0 : _c.value} ${(_d = quad1.graph) === null || _d === void 0 ? void 0 : _d.value}`);
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
exports.areStoresEqual = areStoresEqual;
|
|
131
153
|
//# sourceMappingURL=storeUtils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslo-flanders/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
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",
|