@_linked/server 2.0.1 → 2.0.3
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/CHANGELOG.md +12 -0
- package/lib/cjs/backend.d.ts +6 -0
- package/lib/cjs/backend.js +58 -0
- package/lib/cjs/backend.js.map +1 -0
- package/lib/cjs/data/lincd-server.json +47 -0
- package/lib/cjs/index.d.ts +9 -0
- package/lib/cjs/index.js +13 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/ontologies/lincd-server.d.ts +31 -0
- package/lib/cjs/ontologies/lincd-server.js +86 -0
- package/lib/cjs/ontologies/lincd-server.js.map +1 -0
- package/lib/cjs/package.d.ts +4 -0
- package/lib/cjs/package.js +7 -0
- package/lib/cjs/package.js.map +1 -0
- package/lib/cjs/package.json +90 -0
- package/lib/cjs/shapes/LincdAPI.d.ts +41 -0
- package/lib/cjs/shapes/LincdAPI.js +124 -0
- package/lib/cjs/shapes/LincdAPI.js.map +1 -0
- package/lib/cjs/shapes/LincdServer.d.ts +79 -0
- package/lib/cjs/shapes/LincdServer.js +1339 -0
- package/lib/cjs/shapes/LincdServer.js.map +1 -0
- package/lib/cjs/shapes/LincdWebApp.d.ts +7 -0
- package/lib/cjs/shapes/LincdWebApp.js +43 -0
- package/lib/cjs/shapes/LincdWebApp.js.map +1 -0
- package/lib/cjs/shapes/filestores/LocalFileStore.d.ts +42 -0
- package/lib/cjs/shapes/filestores/LocalFileStore.js +146 -0
- package/lib/cjs/shapes/filestores/LocalFileStore.js.map +1 -0
- package/lib/cjs/shapes/quadstores/BackendAPIStore.d.ts +33 -0
- package/lib/cjs/shapes/quadstores/BackendAPIStore.js +79 -0
- package/lib/cjs/shapes/quadstores/BackendAPIStore.js.map +1 -0
- package/lib/cjs/shapes/quadstores/BackendAPIStoreProvider.d.ts +13 -0
- package/lib/cjs/shapes/quadstores/BackendAPIStoreProvider.js +30 -0
- package/lib/cjs/shapes/quadstores/BackendAPIStoreProvider.js.map +1 -0
- package/lib/cjs/types/RouteConfig.d.ts +56 -0
- package/lib/cjs/types/RouteConfig.js +3 -0
- package/lib/cjs/types/RouteConfig.js.map +1 -0
- package/lib/cjs/types.d.ts +12 -0
- package/lib/cjs/types.js +1 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/cjs/utils/Shapes.d.ts +7 -0
- package/lib/cjs/utils/Shapes.js +76 -0
- package/lib/cjs/utils/Shapes.js.map +1 -0
- package/lib/cjs/utils/accessUrl.d.ts +6 -0
- package/lib/cjs/utils/accessUrl.js +13 -0
- package/lib/cjs/utils/accessUrl.js.map +1 -0
- package/lib/esm/backend.d.ts +6 -0
- package/lib/esm/backend.js +27 -0
- package/lib/esm/backend.js.map +1 -0
- package/lib/esm/data/lincd-server.json +47 -0
- package/lib/esm/index.d.ts +9 -0
- package/lib/esm/index.js +11 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/ontologies/lincd-server.d.ts +31 -0
- package/lib/esm/ontologies/lincd-server.js +42 -0
- package/lib/esm/ontologies/lincd-server.js.map +1 -0
- package/lib/esm/package.d.ts +4 -0
- package/lib/esm/package.js +3 -0
- package/lib/esm/package.js.map +1 -0
- package/lib/esm/package.json +90 -0
- package/lib/esm/shapes/LincdAPI.d.ts +41 -0
- package/lib/esm/shapes/LincdAPI.js +113 -0
- package/lib/esm/shapes/LincdAPI.js.map +1 -0
- package/lib/esm/shapes/LincdServer.d.ts +79 -0
- package/lib/esm/shapes/LincdServer.js +1257 -0
- package/lib/esm/shapes/LincdServer.js.map +1 -0
- package/lib/esm/shapes/LincdWebApp.d.ts +7 -0
- package/lib/esm/shapes/LincdWebApp.js +40 -0
- package/lib/esm/shapes/LincdWebApp.js.map +1 -0
- package/lib/esm/shapes/filestores/LocalFileStore.d.ts +42 -0
- package/lib/esm/shapes/filestores/LocalFileStore.js +93 -0
- package/lib/esm/shapes/filestores/LocalFileStore.js.map +1 -0
- package/lib/esm/shapes/quadstores/BackendAPIStore.d.ts +33 -0
- package/lib/esm/shapes/quadstores/BackendAPIStore.js +65 -0
- package/lib/esm/shapes/quadstores/BackendAPIStore.js.map +1 -0
- package/lib/esm/shapes/quadstores/BackendAPIStoreProvider.d.ts +13 -0
- package/lib/esm/shapes/quadstores/BackendAPIStoreProvider.js +26 -0
- package/lib/esm/shapes/quadstores/BackendAPIStoreProvider.js.map +1 -0
- package/lib/esm/types/RouteConfig.d.ts +56 -0
- package/lib/esm/types/RouteConfig.js +2 -0
- package/lib/esm/types/RouteConfig.js.map +1 -0
- package/lib/esm/types.d.ts +12 -0
- package/lib/esm/types.js +1 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/esm/utils/Shapes.d.ts +7 -0
- package/lib/esm/utils/Shapes.js +59 -0
- package/lib/esm/utils/Shapes.js.map +1 -0
- package/lib/esm/utils/accessUrl.d.ts +6 -0
- package/lib/esm/utils/accessUrl.js +9 -0
- package/lib/esm/utils/accessUrl.js.map +1 -0
- package/package.json +7 -4
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getShapeIndex = exports.getShapeFromIndex = void 0;
|
|
13
|
+
exports.syncShapes = syncShapes;
|
|
14
|
+
/**
|
|
15
|
+
* Shape metadata index builder (backend-only).
|
|
16
|
+
*
|
|
17
|
+
* Types and read-only access (ShapeDetails, PropertyDetails, getShapeIndex)
|
|
18
|
+
* are in @_linked/server-utils. This module provides syncShapes() which
|
|
19
|
+
* populates the shared index at startup.
|
|
20
|
+
*/
|
|
21
|
+
const SHACL_1 = require("@_linked/core/shapes/SHACL");
|
|
22
|
+
const ShapeClass_1 = require("@_linked/core/utils/ShapeClass");
|
|
23
|
+
const ShapeIndex_1 = require("@_linked/server-utils/utils/ShapeIndex");
|
|
24
|
+
var ShapeIndex_2 = require("@_linked/server-utils/utils/ShapeIndex");
|
|
25
|
+
Object.defineProperty(exports, "getShapeFromIndex", { enumerable: true, get: function () { return ShapeIndex_2.getShapeFromIndex; } });
|
|
26
|
+
Object.defineProperty(exports, "getShapeIndex", { enumerable: true, get: function () { return ShapeIndex_2.getShapeIndex; } });
|
|
27
|
+
/**
|
|
28
|
+
* Helper: convert a PathExpr to `{id: string}` or `{id: string}[]` for the shape index.
|
|
29
|
+
*/
|
|
30
|
+
function pathToIndexValue(path) {
|
|
31
|
+
if (typeof path === 'string') {
|
|
32
|
+
return { id: path };
|
|
33
|
+
}
|
|
34
|
+
if (path && 'id' in path) {
|
|
35
|
+
return { id: path.id };
|
|
36
|
+
}
|
|
37
|
+
// Complex path (seq, alt, inv, etc.) — omit for now
|
|
38
|
+
return { id: '' };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Build the shape index from locally-registered NodeShape instances.
|
|
42
|
+
* Backend-only — populates the shared shapeIndex from @_linked/server-utils.
|
|
43
|
+
*/
|
|
44
|
+
function syncShapes() {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const allShapeClasses = (0, ShapeClass_1.getAllShapeClasses)();
|
|
47
|
+
for (let [_uri, shapeClass] of allShapeClasses) {
|
|
48
|
+
const localShape = shapeClass.shape;
|
|
49
|
+
if (!localShape)
|
|
50
|
+
continue;
|
|
51
|
+
ShapeIndex_1.shapeIndex[localShape.id] = {
|
|
52
|
+
id: localShape.id,
|
|
53
|
+
label: localShape.label,
|
|
54
|
+
description: localShape.description,
|
|
55
|
+
extends: localShape.extends ? { id: localShape.extends.id } : undefined,
|
|
56
|
+
targetClass: localShape.targetClass
|
|
57
|
+
? { id: localShape.targetClass.id }
|
|
58
|
+
: undefined,
|
|
59
|
+
properties: localShape.properties.map((p) => ({
|
|
60
|
+
id: p.id,
|
|
61
|
+
label: p.label,
|
|
62
|
+
path: pathToIndexValue(p.path),
|
|
63
|
+
valueShape: p.valueShape ? { id: p.valueShape.id } : undefined,
|
|
64
|
+
datatype: p.datatype ? { id: p.datatype.id } : undefined,
|
|
65
|
+
description: p.description,
|
|
66
|
+
maxCount: p.maxCount,
|
|
67
|
+
minCount: p.minCount,
|
|
68
|
+
nodeKind: p.nodeKind ? { id: p.nodeKind.id } : undefined,
|
|
69
|
+
name: p.name,
|
|
70
|
+
})),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
delete ShapeIndex_1.shapeIndex[(0, SHACL_1.getNodeShapeUri)('lincd', 'shape')];
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=Shapes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shapes.js","sourceRoot":"","sources":["../../../src/utils/Shapes.ts"],"names":[],"mappings":";;;;;;;;;;;;AAmCA,gCA8BC;AAjED;;;;;;GAMG;AACH,sDAAwE;AACxE,+DAAoE;AAGpE,uEAAoE;AAIpE,qEAA0F;AAAjF,+GAAA,iBAAiB,OAAA;AAAE,2GAAA,aAAa,OAAA;AAEzC;;GAEG;AACH,SAAS,gBAAgB,CAAC,IAAc;IACtC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IACD,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACzB,OAAO,EAAE,EAAE,EAAG,IAAuB,CAAC,EAAE,EA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AC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS;oBACxD,WAAW,EAAE,CAAC,CAAC,WAAW;oBAC1B,QAAQ,EAAE,CAAC,CAAC,QAAQ;oBACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;oBACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS;oBACxD,IAAI,EAAE,CAAC,CAAC,IAAI;iBACb,CAAC,CAAC;aACmB,CAAC;QAC3B,CAAC;QAED,OAAO,uBAAU,CAAC,IAAA,uBAAe,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,CAAC;CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAccessUrlLocalFileStore = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* get access url for frontend to set FileStorage
|
|
6
|
+
*
|
|
7
|
+
* @returns frontend access url
|
|
8
|
+
*/
|
|
9
|
+
const getAccessUrlLocalFileStore = () => {
|
|
10
|
+
return process.env.SITE_ROOT;
|
|
11
|
+
};
|
|
12
|
+
exports.getAccessUrlLocalFileStore = getAccessUrlLocalFileStore;
|
|
13
|
+
//# sourceMappingURL=accessUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessUrl.js","sourceRoot":"","sources":["../../../src/utils/accessUrl.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;AAC/B,CAAC,CAAC;AAFW,QAAA,0BAA0B,8BAErC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BackendProvider } from '@_linked/server-utils/utils/BackendProvider';
|
|
2
|
+
export * from './shapes/quadstores/BackendAPIStoreProvider.js';
|
|
3
|
+
export default class LincdServerBackendProvider extends BackendProvider {
|
|
4
|
+
setupBeforeControllers(): Promise<void>;
|
|
5
|
+
getShapes(): Record<string, import("@_linked/server-utils/types/ShapeDetails.js").ShapeDetails>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BackendProvider } from '@_linked/server-utils/utils/BackendProvider';
|
|
2
|
+
import { LinkedFileStorage } from '@_linked/core/utils/LinkedFileStorage';
|
|
3
|
+
import { LocalFileStore } from './shapes/filestores/LocalFileStore.js';
|
|
4
|
+
import { getShapeIndex } from './utils/Shapes.js';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import fs from 'fs/promises';
|
|
7
|
+
export * from './shapes/quadstores/BackendAPIStoreProvider.js';
|
|
8
|
+
export default class LincdServerBackendProvider extends BackendProvider {
|
|
9
|
+
async setupBeforeControllers() {
|
|
10
|
+
if (!LinkedFileStorage.getDefaultDataset()) {
|
|
11
|
+
LinkedFileStorage.setDefaultDataset(new LocalFileStore(process.env.NODE_ENV + '-filestore'));
|
|
12
|
+
}
|
|
13
|
+
let fileSystemUploadPath = path.join('data', 'filestores');
|
|
14
|
+
try {
|
|
15
|
+
await fs.access(fileSystemUploadPath);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
await fs.mkdir(path.join(fileSystemUploadPath, 'filestores'), {
|
|
19
|
+
recursive: true,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
getShapes() {
|
|
24
|
+
return getShapeIndex();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,cAAc,gDAAgD,CAAC;AAE/D,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,eAAe;IACrE,KAAK,CAAC,sBAAsB;QAC1B,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,EAAE,CAAC;YAC3C,iBAAiB,CAAC,iBAAiB,CACjC,IAAI,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC,CACxD,CAAC;QACJ,CAAC;QACD,IAAI,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC3D,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,YAAY,CAAC,EAAE;gBAC5D,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,SAAS;QACP,OAAO,aAAa,EAAE,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": {
|
|
3
|
+
"dc": "http://purl.org/dc/elements/1.1/",
|
|
4
|
+
"owl": "http://www.w3.org/2002/07/owl#",
|
|
5
|
+
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
6
|
+
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
|
7
|
+
"lincd-server": "http://lincd.org/ont/lincd-server/"
|
|
8
|
+
},
|
|
9
|
+
"@graph": [
|
|
10
|
+
{
|
|
11
|
+
"@id": "lincd-server:LincdServer",
|
|
12
|
+
"@type": "rdfs:Class",
|
|
13
|
+
"rdfs:comment": "A HTTP server for LINCD applications, running on node.js.",
|
|
14
|
+
"rdfs:isDefinedBy": {
|
|
15
|
+
"@id": "lincd-server:"
|
|
16
|
+
},
|
|
17
|
+
"rdfs:label": "LINCD Server"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"@id": "lincd-server:NodeFileStore",
|
|
21
|
+
"@type": "rdfs:Class",
|
|
22
|
+
"rdfs:comment": "Stores quads in a file in JSONLD format. Made for node.js environments.",
|
|
23
|
+
"rdfs:isDefinedBy": {
|
|
24
|
+
"@id": "lincd-server:"
|
|
25
|
+
},
|
|
26
|
+
"rdfs:label": "Node file store"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"@id": "lincd-server:BackendFileStore",
|
|
30
|
+
"@type": "rdfs:Class",
|
|
31
|
+
"rdfs:comment": "A simple quad store for frontends that are served by a LINCD Nodejs Server. Quads get loaded and updated through API calls to the backend. All quads are loaded into local memory in the frontend upon initiation of the app.",
|
|
32
|
+
"rdfs:isDefinedBy": {
|
|
33
|
+
"@id": "lincd-server:"
|
|
34
|
+
},
|
|
35
|
+
"rdfs:label": "Backend file store"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"@id": "lincd-server:BackendStore",
|
|
39
|
+
"@type": "rdfs:Class",
|
|
40
|
+
"rdfs:comment": "A base class for backend quad stores. These are quad stores for frontends that are served by a LINCD Nodejs Server. Quads get loaded and updated through API calls to the backend. All quads are loaded into local memory in the frontend upon initiation of the app.",
|
|
41
|
+
"rdfs:isDefinedBy": {
|
|
42
|
+
"@id": "lincd-server:"
|
|
43
|
+
},
|
|
44
|
+
"rdfs:label": "Backend store"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './types.js';
|
|
2
|
+
import './ontologies/lincd-server.js';
|
|
3
|
+
import './shapes/LincdServer.js';
|
|
4
|
+
import './shapes/LincdAPI.js';
|
|
5
|
+
import './shapes/quadstores/BackendAPIStore.js';
|
|
6
|
+
import './shapes/filestores/LocalFileStore.js';
|
|
7
|
+
import './shapes/LincdWebApp.js';
|
|
8
|
+
import './utils/accessUrl.js';
|
|
9
|
+
export type { RouteConfig, RoutesConfig, RoutesModule, } from '@_linked/server-utils/types/RouteConfig';
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './types.js';
|
|
2
|
+
import './ontologies/lincd-server.js';
|
|
3
|
+
//SHAPES FIRST
|
|
4
|
+
import './shapes/LincdServer.js';
|
|
5
|
+
import './shapes/LincdAPI.js';
|
|
6
|
+
import './shapes/quadstores/BackendAPIStore.js';
|
|
7
|
+
import './shapes/filestores/LocalFileStore.js';
|
|
8
|
+
import './shapes/LincdWebApp.js';
|
|
9
|
+
//THEN COMPONENTS
|
|
10
|
+
import './utils/accessUrl.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AACpB,OAAO,8BAA8B,CAAC;AAEtC,cAAc;AACd,OAAO,yBAAyB,CAAC;AACjC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,wCAAwC,CAAC;AAChD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,yBAAyB,CAAC;AAEjC,iBAAiB;AACjB,OAAO,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load the data of this ontology.
|
|
3
|
+
* In @_linked/core, loadData returns the raw JSON import — no JSONLD.parse() needed.
|
|
4
|
+
*/
|
|
5
|
+
export declare var loadData: () => Promise<any>;
|
|
6
|
+
export declare var ns: (term: string) => import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
7
|
+
export declare var _self: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
8
|
+
export declare var LincdServer: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
9
|
+
export declare var BackendFileStore: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
10
|
+
export declare var NodeFileStore: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
11
|
+
export declare var BackendStore: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
12
|
+
export declare var BackendAPIStore: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
13
|
+
export declare var LincdWebApp: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
14
|
+
export declare var ownPackage: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
15
|
+
export declare var maintainsPackage: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
16
|
+
export declare var N3FileStore: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
17
|
+
export declare var LincdAPI: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
18
|
+
export declare var hasAPI: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
19
|
+
export declare const lincdServer: {
|
|
20
|
+
LincdServer: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
21
|
+
BackendFileStore: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
22
|
+
NodeFileStore: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
23
|
+
BackendStore: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
24
|
+
N3FileStore: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
25
|
+
BackendAPIStore: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
26
|
+
LincdWebApp: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
27
|
+
ownPackage: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
28
|
+
maintainsPackage: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
29
|
+
LincdAPI: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
30
|
+
hasAPI: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
31
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createNameSpace } from '@_linked/core/utils/NameSpace';
|
|
2
|
+
import { linkedOntology } from '../package.js';
|
|
3
|
+
import * as _this from './lincd-server.js';
|
|
4
|
+
/**
|
|
5
|
+
* Load the data of this ontology.
|
|
6
|
+
* In @_linked/core, loadData returns the raw JSON import — no JSONLD.parse() needed.
|
|
7
|
+
*/
|
|
8
|
+
export var loadData = async () => {
|
|
9
|
+
//@ts-ignore
|
|
10
|
+
const data = await import('../data/lincd-server.json', {
|
|
11
|
+
with: { type: 'json' },
|
|
12
|
+
});
|
|
13
|
+
return data.default || data;
|
|
14
|
+
};
|
|
15
|
+
export var ns = createNameSpace('http://lincd.org/ont/lincd-server/');
|
|
16
|
+
export var _self = ns('');
|
|
17
|
+
export var LincdServer = ns('LincdServer');
|
|
18
|
+
export var BackendFileStore = ns('BackendFileStore');
|
|
19
|
+
export var NodeFileStore = ns('NodeFileStore');
|
|
20
|
+
export var BackendStore = ns('BackendStore');
|
|
21
|
+
export var BackendAPIStore = ns('BackendAPIStore');
|
|
22
|
+
export var LincdWebApp = ns('LincdWebApp');
|
|
23
|
+
export var ownPackage = ns('ownPackage');
|
|
24
|
+
export var maintainsPackage = ns('maintainsPackage');
|
|
25
|
+
export var N3FileStore = ns('N3FileStore');
|
|
26
|
+
export var LincdAPI = ns('LincdAPI');
|
|
27
|
+
export var hasAPI = ns('hasAPI');
|
|
28
|
+
export const lincdServer = {
|
|
29
|
+
LincdServer,
|
|
30
|
+
BackendFileStore,
|
|
31
|
+
NodeFileStore,
|
|
32
|
+
BackendStore,
|
|
33
|
+
N3FileStore,
|
|
34
|
+
BackendAPIStore,
|
|
35
|
+
LincdWebApp,
|
|
36
|
+
ownPackage,
|
|
37
|
+
maintainsPackage,
|
|
38
|
+
LincdAPI,
|
|
39
|
+
hasAPI,
|
|
40
|
+
};
|
|
41
|
+
linkedOntology(_this, ns, 'lincd-server', loadData, '../data/lincd-server.json');
|
|
42
|
+
//# sourceMappingURL=lincd-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lincd-server.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,IAAI,QAAQ,GAAG,KAAK,IAAI,EAAE;IAC/B,YAAY;IACZ,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,2BAA2B,EAAE;QACrD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;KACvB,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,CAAC,IAAI,EAAE,GAAG,eAAe,CAAC,oCAAoC,CAAC,CAAC;AAEtE,MAAM,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAE1B,MAAM,CAAC,IAAI,WAAW,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;AAC3C,MAAM,CAAC,IAAI,gBAAgB,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC;AACrD,MAAM,CAAC,IAAI,aAAa,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC;AAC/C,MAAM,CAAC,IAAI,YAAY,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC;AAC7C,MAAM,CAAC,IAAI,eAAe,GAAG,EAAE,CAAC,iBAAiB,CAAC,CAAC;AACnD,MAAM,CAAC,IAAI,WAAW,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;AAC3C,MAAM,CAAC,IAAI,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC;AACzC,MAAM,CAAC,IAAI,gBAAgB,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC;AACrD,MAAM,CAAC,IAAI,WAAW,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;AAC3C,MAAM,CAAC,IAAI,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;AACrC,MAAM,CAAC,IAAI,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,WAAW;IACX,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,WAAW;IACX,eAAe;IACf,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,QAAQ;IACR,MAAM;CACP,CAAC;AAEF,cAAc,CACZ,KAAK,EACL,EAAE,EACF,cAAc,EACd,QAAQ,EACR,2BAA2B,CAC5B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const linkedShape: {
|
|
2
|
+
<T extends typeof import("@_linked/core/shapes/Shape").Shape>(constructor: T): void;
|
|
3
|
+
<T extends typeof import("@_linked/core/shapes/Shape").Shape>(config?: import("@_linked/core/utils/Package").ShapeConfig): (constructor: T) => void;
|
|
4
|
+
}, linkedUtil: (constructor: any) => any, linkedOntology: (allFileExports: any, nameSpace: (term: string) => import("@_linked/core/utils/NodeReference").NodeReferenceValue, suggestedPrefixAndFileName: string, loadDataFunction?: () => Promise<any>, dataSource?: string | string[]) => void, packageExports: any, packageName: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,CAAC,MAAM,EACX,WAAW,EACX,UAAU,EACV,cAAc,EACd,cAAc,EACd,WAAW,GACZ,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@_linked/server",
|
|
3
|
+
"description": "HTTP server & utilities for LINCD applications, running on node.js.",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "René Verheij",
|
|
6
|
+
"url": "https://github.com/flyon",
|
|
7
|
+
"email": "rpwverheij@gmail.com"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": ""
|
|
12
|
+
},
|
|
13
|
+
"version": "2.0.3",
|
|
14
|
+
"linkedPackage": true,
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"start": "npm exec linked dev",
|
|
18
|
+
"build": "rimraf ./lib && yarn build-esm && yarn build-cjs && yarn copy-to-lib && yarn dual-package",
|
|
19
|
+
"build-esm": "echo \"compiling ESM\" && rimraf ./lib/esm && yarn tsc -p tsconfig-esm.json",
|
|
20
|
+
"build-cjs": "echo \"compiling CJS\" && rimraf ./lib/cjs && yarn tsc -p tsconfig-cjs.json",
|
|
21
|
+
"copy-to-lib": "echo 'copying CSS + JSON assets to lib folder' && yarn copyfiles -u 1 'src/**/*.css' 'src/**/*.json' lib/esm && yarn copyfiles -u 1 'src/**/*.css' 'src/**/*.json' lib/cjs",
|
|
22
|
+
"dual-package": "echo 'adding package.json to each lib folder for dual output support' && yarn tsconfig-to-dual-package ./tsconfig-cjs.json ./tsconfig-esm.json"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"lincd",
|
|
26
|
+
"server",
|
|
27
|
+
"nodejs",
|
|
28
|
+
"express",
|
|
29
|
+
"linked data",
|
|
30
|
+
"interoperable",
|
|
31
|
+
"semantic web",
|
|
32
|
+
"web3"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@_linked/cli": "^1.2",
|
|
36
|
+
"@_linked/core": "^2.2.1",
|
|
37
|
+
"@_linked/server-utils": "~1.0",
|
|
38
|
+
"adm-zip": "^0.5.16",
|
|
39
|
+
"archiver": "^7.0.1",
|
|
40
|
+
"autoprefixer": "^10.4.18",
|
|
41
|
+
"body-parser": "^1.20.2",
|
|
42
|
+
"chalk": "4.1.2",
|
|
43
|
+
"compression": "^1.7.4",
|
|
44
|
+
"cors": "^2.8.5",
|
|
45
|
+
"cron": "^4.3.4",
|
|
46
|
+
"express": "^4.18.3",
|
|
47
|
+
"fetch-cookie": "^3.1.0",
|
|
48
|
+
"is-object": "^1.0.2",
|
|
49
|
+
"lincd-sioc": "~1.0",
|
|
50
|
+
"n3": "^1.17.2",
|
|
51
|
+
"node-addon-api": "^8.2.2",
|
|
52
|
+
"node-hook": "^1.0.0",
|
|
53
|
+
"open": "^8.4.0",
|
|
54
|
+
"proper-lockfile": "^4.1.2",
|
|
55
|
+
"react": "^18.2",
|
|
56
|
+
"react-dom": "^18.2",
|
|
57
|
+
"react-error-boundary": "^4.0.13",
|
|
58
|
+
"react-router-dom": "^6.22.3",
|
|
59
|
+
"rimraf": "^5.0.5",
|
|
60
|
+
"sharp": "^0.34.4",
|
|
61
|
+
"tough-cookie": "^6.0.0",
|
|
62
|
+
"tsconfig-to-dual-package": "^1.2.0",
|
|
63
|
+
"typescript": "^5.7.3",
|
|
64
|
+
"webpack": "^5.90.3",
|
|
65
|
+
"webpack-dev-middleware": "^7.0.0",
|
|
66
|
+
"webpack-hot-middleware": "^2.26.1",
|
|
67
|
+
"zip-a-folder": "^3.1.8"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@changesets/changelog-github": "^0.5.2",
|
|
71
|
+
"@changesets/cli": "^2.29.8",
|
|
72
|
+
"@types/node": "^20.12.7",
|
|
73
|
+
"@types/react-dom": "^18.0.6",
|
|
74
|
+
"copyfiles": "^2.4.1",
|
|
75
|
+
"cross-env": "^7.0.3",
|
|
76
|
+
"prettier": "3.2.5",
|
|
77
|
+
"typescript-plugin-css-modules": "^5.1.0"
|
|
78
|
+
},
|
|
79
|
+
"typesVersions": {
|
|
80
|
+
"*": {
|
|
81
|
+
"*": [
|
|
82
|
+
"lib/esm/*"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"access": "public"
|
|
88
|
+
},
|
|
89
|
+
"type": "module"
|
|
90
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Shape } from '@_linked/core/shapes/Shape';
|
|
2
|
+
import { ShapeDetails } from '../utils/Shapes.js';
|
|
3
|
+
export type ShapeSummary = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description: string;
|
|
7
|
+
target: {
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
10
|
+
extends?: {
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
numInstances: number;
|
|
14
|
+
};
|
|
15
|
+
export declare class LincdAPI extends Shape {
|
|
16
|
+
static targetClass: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
17
|
+
process(request: any, response: any, httpMethod: 'get' | 'post' | 'put' | 'delete'): Promise<void>;
|
|
18
|
+
get_shape_details({ shapes, }: {
|
|
19
|
+
shapes: string[];
|
|
20
|
+
}): Record<string, ShapeDetails>;
|
|
21
|
+
get_all_shapes(): Promise<{
|
|
22
|
+
shapes: Record<string, ShapeDetails>;
|
|
23
|
+
defaultGraph: string;
|
|
24
|
+
}>;
|
|
25
|
+
post_select({ query }: {
|
|
26
|
+
query: any;
|
|
27
|
+
}): Promise<unknown>;
|
|
28
|
+
post_create({ query }: {
|
|
29
|
+
query: any;
|
|
30
|
+
}): Promise<unknown>;
|
|
31
|
+
post_update({ query }: {
|
|
32
|
+
query: any;
|
|
33
|
+
}): Promise<unknown>;
|
|
34
|
+
post_delete({ query }: {
|
|
35
|
+
query: any;
|
|
36
|
+
}): Promise<import("@_linked/core/queries/DeleteQuery.js").DeleteResponse>;
|
|
37
|
+
post_select_raw({ query }: {
|
|
38
|
+
query: any;
|
|
39
|
+
}): Promise<void | import("@_linked/core/sparql/resultMapping.js").SparqlJsonResults>;
|
|
40
|
+
private checkRawQuerySupport;
|
|
41
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Shape } from '@_linked/core/shapes/Shape';
|
|
8
|
+
import { linkedShape } from '../package.js';
|
|
9
|
+
import { lincdServer } from '../ontologies/lincd-server.js';
|
|
10
|
+
import { JSONParser } from '@_linked/server-utils/utils/JSONParser';
|
|
11
|
+
import { LinkedStorage } from '@_linked/core/utils/LinkedStorage';
|
|
12
|
+
import { JSONWriter } from '@_linked/server-utils/utils/JSONWriter';
|
|
13
|
+
import { cached } from '@_linked/core/utils/cached';
|
|
14
|
+
import { getShapeIndex } from '../utils/Shapes.js';
|
|
15
|
+
const cacheTime = process.env.NODE_ENV === 'development' ? 0 : Infinity;
|
|
16
|
+
let LincdAPI = class LincdAPI extends Shape {
|
|
17
|
+
async process(request, response, httpMethod) {
|
|
18
|
+
let { method, action } = request.params;
|
|
19
|
+
const body = JSONParser.parseObject(request.body);
|
|
20
|
+
//replace - with _ in action names
|
|
21
|
+
let localMethod = httpMethod + '_' + method.replace(/-/g, '_');
|
|
22
|
+
if (typeof this[localMethod] !== 'function') {
|
|
23
|
+
throw new Error('Unknown method: ' + localMethod);
|
|
24
|
+
}
|
|
25
|
+
//TODO: access rights, check if the current user is allowed to execute this method
|
|
26
|
+
try {
|
|
27
|
+
const result = await this[localMethod](body, request, response);
|
|
28
|
+
if (typeof result !== 'undefined' || !response.headersSent) {
|
|
29
|
+
const jsonObject = JSONWriter.toJsObject(result);
|
|
30
|
+
response.json(jsonObject);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error(`Error while processing ${localMethod}:`, error);
|
|
35
|
+
if (!response.headersSent) {
|
|
36
|
+
const message = error instanceof Error ? error.message : 'Unknown server error';
|
|
37
|
+
response.status(500).json({ error: message });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
get_shape_details({ shapes, }) {
|
|
42
|
+
return cached(() => {
|
|
43
|
+
const shapeIndex = getShapeIndex();
|
|
44
|
+
const filteredShapeIndex = {};
|
|
45
|
+
for (const shapeId of shapes) {
|
|
46
|
+
if (shapeIndex[shapeId]) {
|
|
47
|
+
filteredShapeIndex[shapeId] = shapeIndex[shapeId];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return filteredShapeIndex;
|
|
51
|
+
}, [shapes], cacheTime);
|
|
52
|
+
}
|
|
53
|
+
get_all_shapes() {
|
|
54
|
+
return cached(async () => {
|
|
55
|
+
var _a;
|
|
56
|
+
const shapeIndex = getShapeIndex();
|
|
57
|
+
const typesWithInstances = new Map();
|
|
58
|
+
this.checkRawQuerySupport();
|
|
59
|
+
await LinkedStorage.getDefaultDataset()
|
|
60
|
+
.rawQuery(`SELECT (COUNT(?s) AS ?count) ?type WHERE { ?s a ?type } GROUP BY ?type`)
|
|
61
|
+
.then((results) => {
|
|
62
|
+
if (!results)
|
|
63
|
+
return;
|
|
64
|
+
results.results.bindings.forEach((binding) => {
|
|
65
|
+
if (binding.type && binding.type.value) {
|
|
66
|
+
typesWithInstances.set(binding.type.value, parseInt(binding.count.value));
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
})
|
|
70
|
+
.catch(console.error);
|
|
71
|
+
const shapesWithInstances = {};
|
|
72
|
+
for (const shapeId in shapeIndex) {
|
|
73
|
+
const shape = shapeIndex[shapeId];
|
|
74
|
+
shapesWithInstances[shapeId] = {
|
|
75
|
+
...shape,
|
|
76
|
+
numInstances: typesWithInstances.get((_a = shape.targetClass) === null || _a === void 0 ? void 0 : _a.id) || 0,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
shapes: shapesWithInstances,
|
|
81
|
+
defaultGraph: process.env.DATA_ROOT,
|
|
82
|
+
};
|
|
83
|
+
}, [], cacheTime);
|
|
84
|
+
}
|
|
85
|
+
post_select({ query }) {
|
|
86
|
+
return LinkedStorage.selectQuery(query);
|
|
87
|
+
}
|
|
88
|
+
post_create({ query }) {
|
|
89
|
+
return LinkedStorage.createQuery(query);
|
|
90
|
+
}
|
|
91
|
+
post_update({ query }) {
|
|
92
|
+
return LinkedStorage.updateQuery(query);
|
|
93
|
+
}
|
|
94
|
+
post_delete({ query }) {
|
|
95
|
+
return LinkedStorage.deleteQuery(query);
|
|
96
|
+
}
|
|
97
|
+
post_select_raw({ query }) {
|
|
98
|
+
this.checkRawQuerySupport();
|
|
99
|
+
return LinkedStorage.getDefaultDataset().rawQuery(query);
|
|
100
|
+
}
|
|
101
|
+
checkRawQuerySupport() {
|
|
102
|
+
if (!LinkedStorage.getDefaultDataset().rawQuery) {
|
|
103
|
+
throw new Error(`Default store (${Object.getPrototypeOf(LinkedStorage.getDefaultDataset()).constructor
|
|
104
|
+
.name}) does not support raw SPARQL queries`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
LincdAPI.targetClass = lincdServer.LincdAPI;
|
|
109
|
+
LincdAPI = __decorate([
|
|
110
|
+
linkedShape
|
|
111
|
+
], LincdAPI);
|
|
112
|
+
export { LincdAPI };
|
|
113
|
+
//# sourceMappingURL=LincdAPI.js.map
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