@oslo-flanders/core 0.0.20-alpha.0 → 1.0.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/index.d.ts +1 -0
- package/index.js +1 -0
- package/lib/enums/DataTypes.d.ts +3 -0
- package/lib/enums/DataTypes.js +40 -0
- package/lib/utils/fetchFileOrUrl.d.ts +1 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './lib/ServiceIdentifier';
|
|
|
11
11
|
export * from './lib/enums/Scope';
|
|
12
12
|
export * from './lib/enums/PropertyTypes';
|
|
13
13
|
export * from './lib/enums/specificationType';
|
|
14
|
+
export * from './lib/enums/DataTypes';
|
|
14
15
|
export * from './lib/logging/LogLevel';
|
|
15
16
|
export * from './lib/logging/Logger';
|
|
16
17
|
export * from './lib/logging/VoidLogger';
|
package/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __exportStar(require("./lib/ServiceIdentifier"), exports);
|
|
|
27
27
|
__exportStar(require("./lib/enums/Scope"), exports);
|
|
28
28
|
__exportStar(require("./lib/enums/PropertyTypes"), exports);
|
|
29
29
|
__exportStar(require("./lib/enums/specificationType"), exports);
|
|
30
|
+
__exportStar(require("./lib/enums/DataTypes"), exports);
|
|
30
31
|
__exportStar(require("./lib/logging/LogLevel"), exports);
|
|
31
32
|
__exportStar(require("./lib/logging/Logger"), exports);
|
|
32
33
|
__exportStar(require("./lib/logging/VoidLogger"), exports);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isStandardDatatype = exports.datatypeIdentifierToHash = exports.getDataType = void 0;
|
|
4
|
+
const rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns';
|
|
5
|
+
const rdfs = 'http://www.w3.org/2000/01/rdf-schema';
|
|
6
|
+
const xsd = 'http://www.w3.org/2001/XMLSchema';
|
|
7
|
+
const DataTypes = new Map([
|
|
8
|
+
['string', `${xsd}#string`],
|
|
9
|
+
['date', `${xsd}#date`],
|
|
10
|
+
['time', `${xsd}#time`],
|
|
11
|
+
['datetime', `${xsd}#dateTime`],
|
|
12
|
+
['int', `${xsd}#int`],
|
|
13
|
+
['integer', `${xsd}#integer`],
|
|
14
|
+
['decimal', `${xsd}#decimal`],
|
|
15
|
+
['float', `${xsd}#float`],
|
|
16
|
+
['double', `${xsd}#double`],
|
|
17
|
+
['boolean', `${xsd}#boolean`],
|
|
18
|
+
['langstring', `${rdf}#langString`],
|
|
19
|
+
['literal', `${rdfs}#Literal`],
|
|
20
|
+
['year', `${xsd}#gYear`],
|
|
21
|
+
['yearmonth', `${xsd}#gYearMonth`],
|
|
22
|
+
['month', `${xsd}#gMonth`],
|
|
23
|
+
['monthday', `${xsd}#gMonthDay`],
|
|
24
|
+
['duration', `${xsd}#duration`],
|
|
25
|
+
['html', `${rdf}#HTML`],
|
|
26
|
+
['uri', `${xsd}#anyURI`],
|
|
27
|
+
]);
|
|
28
|
+
const getDataType = (key) => DataTypes.get(key.toLowerCase());
|
|
29
|
+
exports.getDataType = getDataType;
|
|
30
|
+
const datatypeIdentifierToHash = (uri) => {
|
|
31
|
+
let hash = 0;
|
|
32
|
+
for (let i = 0; i < uri.length; i++) {
|
|
33
|
+
hash = Math.trunc(Math.imul(31, hash) + uri.charCodeAt(i));
|
|
34
|
+
}
|
|
35
|
+
return hash > 0 ? hash : hash * -1;
|
|
36
|
+
};
|
|
37
|
+
exports.datatypeIdentifierToHash = datatypeIdentifierToHash;
|
|
38
|
+
const isStandardDatatype = (uri) => Array.from(DataTypes.values()).includes(uri);
|
|
39
|
+
exports.isStandardDatatype = isStandardDatatype;
|
|
40
|
+
//# sourceMappingURL=DataTypes.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslo-flanders/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
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",
|