@_linked/server 2.19.0 → 2.21.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/CHANGELOG.md +40 -0
- package/lib/esm/backend.js +70 -11
- package/lib/esm/backend.js.map +1 -1
- package/lib/esm/data/{lincd-server.json → server.json} +9 -9
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/ontologies/lincd-server.d.ts +4 -47
- package/lib/esm/ontologies/lincd-server.js +4 -55
- package/lib/esm/ontologies/lincd-server.js.map +1 -1
- package/lib/esm/ontologies/lincd-server.register.d.ts +5 -1
- package/lib/esm/ontologies/lincd-server.register.js +3 -14
- package/lib/esm/ontologies/lincd-server.register.js.map +1 -1
- package/lib/esm/ontologies/server.d.ts +66 -0
- package/lib/esm/ontologies/server.js +63 -0
- package/lib/esm/ontologies/server.js.map +1 -0
- package/lib/esm/ontologies/server.register.d.ts +1 -0
- package/lib/esm/ontologies/server.register.js +24 -0
- package/lib/esm/ontologies/server.register.js.map +1 -0
- package/lib/esm/shapes/LincdAPI.js +42 -13
- package/lib/esm/shapes/LincdAPI.js.map +1 -1
- package/lib/esm/shapes/LincdWebApp.js +3 -3
- package/lib/esm/shapes/LincdWebApp.js.map +1 -1
- package/lib/esm/shapes/LinkedServer.d.ts +48 -4
- package/lib/esm/shapes/LinkedServer.js +230 -88
- package/lib/esm/shapes/LinkedServer.js.map +1 -1
- package/lib/esm/shapes/filestores/LocalFileStore.d.ts +16 -0
- package/lib/esm/shapes/filestores/LocalFileStore.js +77 -8
- package/lib/esm/shapes/filestores/LocalFileStore.js.map +1 -1
- package/lib/esm/shapes/index.d.ts +1 -1
- package/lib/esm/shapes/index.js +1 -1
- package/lib/esm/shapes/index.js.map +1 -1
- package/lib/esm/utils/jsonBodyParser.js +16 -1
- package/lib/esm/utils/jsonBodyParser.js.map +1 -1
- package/lib/esm/utils/queryPlane.d.ts +58 -0
- package/lib/esm/utils/queryPlane.js +206 -0
- package/lib/esm/utils/queryPlane.js.map +1 -0
- package/lib/esm/utils/rpcExposure.d.ts +53 -0
- package/lib/esm/utils/rpcExposure.js +199 -0
- package/lib/esm/utils/rpcExposure.js.map +1 -0
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @\_linked/server
|
|
2
2
|
|
|
3
|
+
## 2.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#134](https://github.com/linked-fw/server/pull/134) [`6944752`](https://github.com/linked-fw/server/commit/6944752608eafa3ee1112da42ecafb6281684912) Thanks [@flyon](https://github.com/flyon)! - `LocalFileStore` path containment resolves symlinks: the base folder and the target (or its nearest existing ancestor, following a dangling link) go through `fs.realpath` before the comparison, so a key that reaches outside the store through a symlink is refused on every method.
|
|
8
|
+
|
|
9
|
+
`getShapes` on the default provider is not declared callable (it answers 501 in `enforce` mode); clients read the shape index through `/api/all-shapes`. `dispose` is a reserved name: the server calls it when it reloads providers, and no RPC reaches it in either `rpcExposure` mode.
|
|
10
|
+
|
|
11
|
+
- [#134](https://github.com/linked-fw/server/pull/134) [`6944752`](https://github.com/linked-fw/server/commit/6944752608eafa3ee1112da42ecafb6281684912) Thanks [@flyon](https://github.com/flyon)! - RPC exposure rules, per-call request context and generic query plane authorization. Requires `@_linked/server-utils` `^1.9.0`.
|
|
12
|
+
|
|
13
|
+
- `/call/...` dispatches provider methods by declaration. Reserved names always answer 501, also for backend-to-backend calls: `Object.prototype` members, every `BackendProvider`/`ShapeProvider` method (including subclass overrides of lifecycle hooks such as `initRequest`), `dispose`, `constructor`, `__proto__`, accessors and fields.
|
|
14
|
+
- Methods declared with `@callable('public' | 'user')` (from `@_linked/server-utils/utils/callable`) are dispatched; `'user'` answers 401 without a session. An override that does not redeclare a method keeps the strictest level declared for it up the class chain. Methods no class declares run and are logged once per method in `warn` mode, and answer 501 in `enforce` mode. Set the mode with the `server.rpcExposure` option or `LINKED_RPC_EXPOSURE`; the default is `warn`.
|
|
15
|
+
- Methods declared with `@internal()` or `declareInternal(cls, methods)` by the provider's class or a super class answer 501 over HTTP in both modes, even when also declared callable. Backend-to-backend calls still reach them.
|
|
16
|
+
- A provider class with its own `static rpc = false` is not reachable over the generic `/call/<pkg>/<method>` route.
|
|
17
|
+
- Every request runs in one http call context from the first middleware on (routers, provider middleware and error handlers included); backend-to-backend calls outside a request run as system, and lazy provider loading always does. A `{__sc}` Shape-class argument is logged in `warn` and refused (400) in `enforce`.
|
|
18
|
+
- The query endpoints (`selectQuery`/`askQuery`/`createQuery`/`updateQuery`/`deleteQuery` and `/api/select|create|update|delete|select-raw`) apply the `QueryAccess` rules and hand the store the query builder they checked. Before a mutation, one SPARQL `ASK` on the dataset it routes to looks up whether it would write or delete a node typed with a protected class; `setProtectedNodeProbe(fn)` (`utils/queryPlane`) replaces that lookup.
|
|
19
|
+
- `/uploads` and resized images are served with `X-Content-Type-Options: nosniff` and `Content-Security-Policy: sandbox`.
|
|
20
|
+
- `LocalFileStore` refuses keys that resolve outside its base folder.
|
|
21
|
+
- `registerCallRoutes(app, linkedServer)` registers the `/call` and `/api` routes; `mountUploads(app, folder)` and `enterRequestContext` are exported for the same purpose.
|
|
22
|
+
- Client-supplied names in log lines are escaped.
|
|
23
|
+
|
|
24
|
+
Behaviour changes:
|
|
25
|
+
|
|
26
|
+
- Generic-plane mutations require a signed-in user in every mode (401), and a create may not choose the ids of its new nodes (403).
|
|
27
|
+
- With protected shapes registered, a mutation on a dataset that cannot run SPARQL (`rawQuery`) is refused (403), unless the app sets its own probe.
|
|
28
|
+
- `/api/select-raw` is refused (403) in every mode unless the app registers `registerRawQueryAuthorizer`. Its JSON body is also kept as received on `request.rawBody`, which the raw authorizers get as `rawBody` to verify a signature over the exact bytes; with every raw authorizer accepting, the query runs without a session.
|
|
29
|
+
- A query body that is not a query answers 400, as does an operation that does not match the query kind (a delete sent to `selectQuery`).
|
|
30
|
+
- A query that contains a query-context reference (`{"@ctx": name}`, e.g. built with `.for(getQueryContext('user'))`) answers 400 on the query endpoints. A server-side context map is process-wide and does not identify the caller; send the node id instead.
|
|
31
|
+
- `/uploads` files are sandboxed: an HTML file opened from there runs without scripts.
|
|
32
|
+
|
|
33
|
+
## 2.20.0
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- [#132](https://github.com/linked-fw/server/pull/132) [`6db7feb`](https://github.com/linked-fw/server/commit/6db7feb0d3520f2e91732b094bc8d004056a78a9) Thanks [@flyon](https://github.com/flyon)! - The server ontology's prefix label is now `server`, matching its namespace slug (`https://linked.cm/ont/server/`), so compaction emits `server:LincdAPI` where it used to emit `lincd-server:LincdAPI`. The ontology moves to `ontologies/server` (export `server`) and `ontologies/server.register`, and its data file to `data/server.json`, whose `@context` key and prefixed names now use `server:`. The IRIs themselves are unchanged.
|
|
38
|
+
|
|
39
|
+
Deprecated, still working: the `lincd-server` prefix stays registered as an alias, so `lincd-server:X` names still expand to the same IRIs; `ontologies/lincd-server` re-exports `ontologies/server`, `ontologies/lincd-server.register` registers the ontology, and `lincdServer` is the same object as `server`. Only the published `data/lincd-server.json` path is gone, renamed to `data/server.json`.
|
|
40
|
+
|
|
41
|
+
No IRI changes, so stored data is unaffected; any data written under the older `http://lincd.org/ont/lincd-server/` IRIs is still not migrated (clear dev datasets).
|
|
42
|
+
|
|
3
43
|
## 2.19.0
|
|
4
44
|
|
|
5
45
|
### Minor Changes
|
package/lib/esm/backend.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
1
10
|
import { BackendProvider } from '@_linked/server-utils/utils/BackendProvider';
|
|
11
|
+
import { callable } from '@_linked/server-utils/utils/callable';
|
|
2
12
|
import { LinkedFileStorage } from '@_linked/core/utils/LinkedFileStorage';
|
|
3
13
|
import { LinkedStorage } from '@_linked/core/utils/LinkedStorage';
|
|
4
|
-
import { fromJSON } from '@_linked/core';
|
|
5
14
|
import { LocalFileStore } from './shapes/filestores/LocalFileStore.js';
|
|
6
15
|
import { getShapeIndex } from './utils/Shapes.js';
|
|
16
|
+
import { authorizeGenericQuery, toQueryBuilder } from './utils/queryPlane.js';
|
|
7
17
|
import path from 'path';
|
|
8
18
|
import fs from 'fs/promises';
|
|
9
19
|
export default class LincdServerBackendProvider extends BackendProvider {
|
|
@@ -21,6 +31,9 @@ export default class LincdServerBackendProvider extends BackendProvider {
|
|
|
21
31
|
});
|
|
22
32
|
}
|
|
23
33
|
}
|
|
34
|
+
// Not callable over RPC: no client calls it. Clients read the same index
|
|
35
|
+
// through LincdAPI's `/api/all-shapes` and `/api/shape-details`; backend code
|
|
36
|
+
// can still reach it with a local `Server.call`.
|
|
24
37
|
getShapes() {
|
|
25
38
|
return getShapeIndex();
|
|
26
39
|
}
|
|
@@ -40,20 +53,66 @@ export default class LincdServerBackendProvider extends BackendProvider {
|
|
|
40
53
|
// `toJSON()` and `fromJSON()` rehydrates it here into a live, closed query.
|
|
41
54
|
// `LinkedStorage` then routes it by the QUERY's shape — which is, and always was, what
|
|
42
55
|
// decides the target dataset. The store instance never participated.
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
//
|
|
57
|
+
// Every query is checked against the generic-plane rules first (session,
|
|
58
|
+
// protected shapes and nodes, registered authorizers): see utils/queryPlane.
|
|
59
|
+
// The store runs the builder that was checked. They are declared 'public'
|
|
60
|
+
// because that check, not the RPC layer, decides whether a session is
|
|
61
|
+
// required (always for mutations; for reads it follows `rpcExposure`).
|
|
62
|
+
async selectQuery(json) {
|
|
63
|
+
const query = toQueryBuilder(json);
|
|
64
|
+
await authorizeGenericQuery('select', json, query, 'selectQuery');
|
|
65
|
+
return LinkedStorage.selectQuery(query);
|
|
45
66
|
}
|
|
46
|
-
askQuery(json) {
|
|
47
|
-
|
|
67
|
+
async askQuery(json) {
|
|
68
|
+
const query = toQueryBuilder(json);
|
|
69
|
+
await authorizeGenericQuery('ask', json, query, 'askQuery');
|
|
70
|
+
return LinkedStorage.askQuery(query);
|
|
48
71
|
}
|
|
49
|
-
updateQuery(json) {
|
|
50
|
-
|
|
72
|
+
async updateQuery(json) {
|
|
73
|
+
const query = toQueryBuilder(json);
|
|
74
|
+
await authorizeGenericQuery('update', json, query, 'updateQuery');
|
|
75
|
+
return LinkedStorage.updateQuery(query);
|
|
51
76
|
}
|
|
52
|
-
createQuery(json) {
|
|
53
|
-
|
|
77
|
+
async createQuery(json) {
|
|
78
|
+
const query = toQueryBuilder(json);
|
|
79
|
+
await authorizeGenericQuery('create', json, query, 'createQuery');
|
|
80
|
+
return LinkedStorage.createQuery(query);
|
|
54
81
|
}
|
|
55
|
-
deleteQuery(json) {
|
|
56
|
-
|
|
82
|
+
async deleteQuery(json) {
|
|
83
|
+
const query = toQueryBuilder(json);
|
|
84
|
+
await authorizeGenericQuery('delete', json, query, 'deleteQuery');
|
|
85
|
+
return LinkedStorage.deleteQuery(query);
|
|
57
86
|
}
|
|
58
87
|
}
|
|
88
|
+
__decorate([
|
|
89
|
+
callable('public'),
|
|
90
|
+
__metadata("design:type", Function),
|
|
91
|
+
__metadata("design:paramtypes", [Object]),
|
|
92
|
+
__metadata("design:returntype", Promise)
|
|
93
|
+
], LincdServerBackendProvider.prototype, "selectQuery", null);
|
|
94
|
+
__decorate([
|
|
95
|
+
callable('public'),
|
|
96
|
+
__metadata("design:type", Function),
|
|
97
|
+
__metadata("design:paramtypes", [Object]),
|
|
98
|
+
__metadata("design:returntype", Promise)
|
|
99
|
+
], LincdServerBackendProvider.prototype, "askQuery", null);
|
|
100
|
+
__decorate([
|
|
101
|
+
callable('public'),
|
|
102
|
+
__metadata("design:type", Function),
|
|
103
|
+
__metadata("design:paramtypes", [Object]),
|
|
104
|
+
__metadata("design:returntype", Promise)
|
|
105
|
+
], LincdServerBackendProvider.prototype, "updateQuery", null);
|
|
106
|
+
__decorate([
|
|
107
|
+
callable('public'),
|
|
108
|
+
__metadata("design:type", Function),
|
|
109
|
+
__metadata("design:paramtypes", [Object]),
|
|
110
|
+
__metadata("design:returntype", Promise)
|
|
111
|
+
], LincdServerBackendProvider.prototype, "createQuery", null);
|
|
112
|
+
__decorate([
|
|
113
|
+
callable('public'),
|
|
114
|
+
__metadata("design:type", Function),
|
|
115
|
+
__metadata("design:paramtypes", [Object]),
|
|
116
|
+
__metadata("design:returntype", Promise)
|
|
117
|
+
], LincdServerBackendProvider.prototype, "deleteQuery", null);
|
|
59
118
|
//# sourceMappingURL=backend.js.map
|
package/lib/esm/backend.js.map
CHANGED
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,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AAO,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;CACF;AAjCO;IADL,QAAQ,CAAC,QAAQ,CAAC;;;;6DAKlB;AAGK;IADL,QAAQ,CAAC,QAAQ,CAAC;;;;0DAKlB;AAGK;IADL,QAAQ,CAAC,QAAQ,CAAC;;;;6DAKlB;AAGK;IADL,QAAQ,CAAC,QAAQ,CAAC;;;;6DAKlB;AAGK;IADL,QAAQ,CAAC,QAAQ,CAAC;;;;6DAKlB","sourcesContent":["import { BackendProvider } from '@_linked/server-utils/utils/BackendProvider';\nimport { callable } from '@_linked/server-utils/utils/callable';\nimport { LinkedFileStorage } from '@_linked/core/utils/LinkedFileStorage';\nimport { LinkedStorage } from '@_linked/core/utils/LinkedStorage';\nimport { LocalFileStore } from './shapes/filestores/LocalFileStore.js';\nimport { getShapeIndex } from './utils/Shapes.js';\nimport { authorizeGenericQuery, toQueryBuilder } from './utils/queryPlane.js';\nimport path from 'path';\nimport fs from 'fs/promises';\n\nexport default class LincdServerBackendProvider extends BackendProvider {\n async setupBeforeControllers() {\n if (!LinkedFileStorage.getDefaultStore()) {\n LinkedFileStorage.setDefaultStore(\n new LocalFileStore(process.env.NODE_ENV + '-filestore')\n );\n }\n let fileSystemUploadPath = path.join('data', 'filestores');\n try {\n await fs.access(fileSystemUploadPath);\n } catch (err) {\n await fs.mkdir(path.join(fileSystemUploadPath, 'filestores'), {\n recursive: true,\n });\n }\n }\n\n // Not callable over RPC: no client calls it. Clients read the same index\n // through LincdAPI's `/api/all-shapes` and `/api/shape-details`; backend code\n // can still reach it with a local `Server.call`.\n getShapes() {\n return getShapeIndex();\n }\n\n // ── BackendAPIStore query execution ──────────────────────────────────────\n //\n // These answer the frontend `BackendAPIStore`, which calls\n // `Server.call(packageName, {method}, json)` — the PACKAGE form, so the request\n // arrives here on the generic provider rather than through Shape resolution.\n //\n // They used to live on `BackendAPIStoreProvider`, a `ShapeProvider`, whose methods\n // took the store as a first argument and never read it. Reaching that provider meant\n // the transport had to carry a `shapeURI` and an `instanceNode`, and the server had to\n // rebuild the store with `new (providerShapeClass)({id})` — instantiating a Shape only\n // to discard it. Addressing by package removes all of that.\n //\n // A query cannot cross the wire live (core 2.10.0 contract flip), so the client ships\n // `toJSON()` and `fromJSON()` rehydrates it here into a live, closed query.\n // `LinkedStorage` then routes it by the QUERY's shape — which is, and always was, what\n // decides the target dataset. The store instance never participated.\n\n //\n // Every query is checked against the generic-plane rules first (session,\n // protected shapes and nodes, registered authorizers): see utils/queryPlane.\n // The store runs the builder that was checked. They are declared 'public'\n // because that check, not the RPC layer, decides whether a session is\n // required (always for mutations; for reads it follows `rpcExposure`).\n\n @callable('public')\n async selectQuery(json: any) {\n const query = toQueryBuilder(json);\n await authorizeGenericQuery('select', json, query, 'selectQuery');\n return LinkedStorage.selectQuery(query);\n }\n\n @callable('public')\n async askQuery(json: any) {\n const query = toQueryBuilder(json);\n await authorizeGenericQuery('ask', json, query, 'askQuery');\n return LinkedStorage.askQuery(query);\n }\n\n @callable('public')\n async updateQuery(json: any) {\n const query = toQueryBuilder(json);\n await authorizeGenericQuery('update', json, query, 'updateQuery');\n return LinkedStorage.updateQuery(query);\n }\n\n @callable('public')\n async createQuery(json: any) {\n const query = toQueryBuilder(json);\n await authorizeGenericQuery('create', json, query, 'createQuery');\n return LinkedStorage.createQuery(query);\n }\n\n @callable('public')\n async deleteQuery(json: any) {\n const query = toQueryBuilder(json);\n await authorizeGenericQuery('delete', json, query, 'deleteQuery');\n return LinkedStorage.deleteQuery(query);\n }\n}\n"]}
|
|
@@ -4,42 +4,42 @@
|
|
|
4
4
|
"owl": "http://www.w3.org/2002/07/owl#",
|
|
5
5
|
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
6
6
|
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
|
7
|
-
"
|
|
7
|
+
"server": "https://linked.cm/ont/server/"
|
|
8
8
|
},
|
|
9
9
|
"@graph": [
|
|
10
10
|
{
|
|
11
|
-
"@id": "
|
|
11
|
+
"@id": "server:LincdServer",
|
|
12
12
|
"@type": "rdfs:Class",
|
|
13
13
|
"rdfs:comment": "A HTTP server for LINCD applications, running on node.js.",
|
|
14
14
|
"rdfs:isDefinedBy": {
|
|
15
|
-
"@id": "
|
|
15
|
+
"@id": "server:"
|
|
16
16
|
},
|
|
17
17
|
"rdfs:label": "LINCD Server"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
"@id": "
|
|
20
|
+
"@id": "server:NodeFileStore",
|
|
21
21
|
"@type": "rdfs:Class",
|
|
22
22
|
"rdfs:comment": "Stores quads in a file in JSONLD format. Made for node.js environments.",
|
|
23
23
|
"rdfs:isDefinedBy": {
|
|
24
|
-
"@id": "
|
|
24
|
+
"@id": "server:"
|
|
25
25
|
},
|
|
26
26
|
"rdfs:label": "Node file store"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
"@id": "
|
|
29
|
+
"@id": "server:BackendFileStore",
|
|
30
30
|
"@type": "rdfs:Class",
|
|
31
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
32
|
"rdfs:isDefinedBy": {
|
|
33
|
-
"@id": "
|
|
33
|
+
"@id": "server:"
|
|
34
34
|
},
|
|
35
35
|
"rdfs:label": "Backend file store"
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
|
-
"@id": "
|
|
38
|
+
"@id": "server:BackendStore",
|
|
39
39
|
"@type": "rdfs:Class",
|
|
40
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
41
|
"rdfs:isDefinedBy": {
|
|
42
|
-
"@id": "
|
|
42
|
+
"@id": "server:"
|
|
43
43
|
},
|
|
44
44
|
"rdfs:label": "Backend store"
|
|
45
45
|
}
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AACpB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AACpB,OAAO,iCAAiC,CAAC;AAEzC,cAAc;AACd,OAAO,mBAAmB,CAAC;AAC3B,mFAAmF;AACnF,OAAO,wCAAwC,CAAC;AAChD,OAAO,uCAAuC,CAAC;AAE/C,iBAAiB;AACjB,OAAO,sBAAsB,CAAC;AAE9B,8EAA8E;AAC9E,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["import './types.js';\nimport './ontologies/server.register.js';\n\n//SHAPES FIRST\nimport './shapes/index.js';\n// Not shapes (plain store classes); kept so the entry's module graph is unchanged.\nimport './shapes/quadstores/BackendAPIStore.js';\nimport './shapes/filestores/LocalFileStore.js';\n\n//THEN COMPONENTS\nimport './utils/accessUrl.js';\n\n// The fatal-error contract a provider uses to refuse to let the server start.\nexport { FatalStartupError, isFatalError } from './utils/fatalError.js';\nexport type { FatalError } from './utils/fatalError.js';\n\n//TYPES — re-exported from @_linked/server-utils (canonical location)\nexport type {\n RouteConfig,\n RoutesConfig,\n RoutesModule,\n} from '@_linked/server-utils/types/RouteConfig';\n"]}
|
|
@@ -1,49 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* @deprecated import from `./server.js` instead. This module path is kept so existing
|
|
3
|
+
* `@_linked/server/ontologies/lincd-server` imports keep working; `lincdServer` is
|
|
4
|
+
* re-exported as a deprecated alias of `server`.
|
|
4
5
|
*/
|
|
5
|
-
export
|
|
6
|
-
"@context": {
|
|
7
|
-
dc: string;
|
|
8
|
-
owl: string;
|
|
9
|
-
rdf: string;
|
|
10
|
-
rdfs: string;
|
|
11
|
-
"lincd-server": string;
|
|
12
|
-
};
|
|
13
|
-
"@graph": {
|
|
14
|
-
"@id": string;
|
|
15
|
-
"@type": string;
|
|
16
|
-
"rdfs:comment": string;
|
|
17
|
-
"rdfs:isDefinedBy": {
|
|
18
|
-
"@id": string;
|
|
19
|
-
};
|
|
20
|
-
"rdfs:label": string;
|
|
21
|
-
}[];
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* The namespace of this ontology.
|
|
25
|
-
*
|
|
26
|
-
* First-party ontologies live on linked.cm: `https://linked.cm/ont/{ontologySlug}/`, and a
|
|
27
|
-
* package's own ontology takes the package's publicSlug (`@_linked/server` → `server`), the same
|
|
28
|
-
* slug its shapes use under `https://linked.cm/shape/server/`.
|
|
29
|
-
*
|
|
30
|
-
* Until this release it was `http://lincd.org/ont/lincd-server/`. No stored data is typed with
|
|
31
|
-
* these terms; the only store triples that carried them were the synced shape descriptions of
|
|
32
|
-
* `LinkedServer`, `LincdAPI` and `LincdWebApp` (`sh:targetClass`, `sh:path`), which boot sync
|
|
33
|
-
* rewrites (delete, then recreate) the next time the server starts.
|
|
34
|
-
*/
|
|
35
|
-
export declare var ns: (term: string) => import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
36
|
-
export declare var _self: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
37
|
-
export declare const lincdServer: {
|
|
38
|
-
LincdServer: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
39
|
-
BackendFileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
40
|
-
NodeFileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
41
|
-
BackendStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
42
|
-
N3FileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
43
|
-
BackendAPIStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
44
|
-
LincdWebApp: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
45
|
-
ownPackage: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
46
|
-
maintainsPackage: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
47
|
-
LincdAPI: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
48
|
-
hasAPI: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
49
|
-
};
|
|
6
|
+
export * from './server.js';
|
|
@@ -1,58 +1,7 @@
|
|
|
1
|
-
import { createNameSpace } from '@_linked/core/utils/NameSpace';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @deprecated import from `./server.js` instead. This module path is kept so existing
|
|
3
|
+
* `@_linked/server/ontologies/lincd-server` imports keep working; `lincdServer` is
|
|
4
|
+
* re-exported as a deprecated alias of `server`.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
7
|
-
//@ts-ignore
|
|
8
|
-
const data = await import('../data/lincd-server.json', {
|
|
9
|
-
with: { type: 'json' },
|
|
10
|
-
});
|
|
11
|
-
return data.default || data;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* The namespace of this ontology.
|
|
15
|
-
*
|
|
16
|
-
* First-party ontologies live on linked.cm: `https://linked.cm/ont/{ontologySlug}/`, and a
|
|
17
|
-
* package's own ontology takes the package's publicSlug (`@_linked/server` → `server`), the same
|
|
18
|
-
* slug its shapes use under `https://linked.cm/shape/server/`.
|
|
19
|
-
*
|
|
20
|
-
* Until this release it was `http://lincd.org/ont/lincd-server/`. No stored data is typed with
|
|
21
|
-
* these terms; the only store triples that carried them were the synced shape descriptions of
|
|
22
|
-
* `LinkedServer`, `LincdAPI` and `LincdWebApp` (`sh:targetClass`, `sh:path`), which boot sync
|
|
23
|
-
* rewrites (delete, then recreate) the next time the server starts.
|
|
24
|
-
*/
|
|
25
|
-
export var ns = createNameSpace('https://linked.cm/ont/server/');
|
|
26
|
-
export var _self = ns('');
|
|
27
|
-
// Terms are properties of the namespace object below, not module-scope
|
|
28
|
-
// exports. Most of these names are also SHAPE CLASS names in this package
|
|
29
|
-
// (BackendAPIStore, LincdWebApp, LincdAPI, ...). Two bindings of the same name
|
|
30
|
-
// in one bundle scope make the bundler rename one of them, and when the loser
|
|
31
|
-
// is the class, `constructor.name` becomes `BackendAPIStore2` -- which is the
|
|
32
|
-
// shape's IRI and the name `Server.call` routes on. The client then asks a
|
|
33
|
-
// backend that has no such shape, and every store round-trip answers 501.
|
|
34
|
-
const LincdServer = ns('LincdServer');
|
|
35
|
-
const BackendFileStore = ns('BackendFileStore');
|
|
36
|
-
const NodeFileStore = ns('NodeFileStore');
|
|
37
|
-
const BackendStore = ns('BackendStore');
|
|
38
|
-
const BackendAPIStore = ns('BackendAPIStore');
|
|
39
|
-
const LincdWebApp = ns('LincdWebApp');
|
|
40
|
-
const ownPackage = ns('ownPackage');
|
|
41
|
-
const maintainsPackage = ns('maintainsPackage');
|
|
42
|
-
const N3FileStore = ns('N3FileStore');
|
|
43
|
-
const LincdAPI = ns('LincdAPI');
|
|
44
|
-
const hasAPI = ns('hasAPI');
|
|
45
|
-
export const lincdServer = {
|
|
46
|
-
LincdServer,
|
|
47
|
-
BackendFileStore,
|
|
48
|
-
NodeFileStore,
|
|
49
|
-
BackendStore,
|
|
50
|
-
N3FileStore,
|
|
51
|
-
BackendAPIStore,
|
|
52
|
-
LincdWebApp,
|
|
53
|
-
ownPackage,
|
|
54
|
-
maintainsPackage,
|
|
55
|
-
LincdAPI,
|
|
56
|
-
hasAPI,
|
|
57
|
-
};
|
|
6
|
+
export * from './server.js';
|
|
58
7
|
//# sourceMappingURL=lincd-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lincd-server.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lincd-server.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,aAAa,CAAC","sourcesContent":["/**\n * @deprecated import from `./server.js` instead. This module path is kept so existing\n * `@_linked/server/ontologies/lincd-server` imports keep working; `lincdServer` is\n * re-exported as a deprecated alias of `server`.\n */\nexport * from './server.js';\n"]}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Kept out of `lincd-server.ts` because registration needs that module's whole export
|
|
5
|
-
* namespace, and a module cannot import itself once a bundler is involved: Rollup
|
|
6
|
-
* treats a static self-reference as a circular import and elides it, so the binding is
|
|
7
|
-
* undefined at runtime and the consuming app dies at boot with `_this is not
|
|
8
|
-
* defined`. `tsc` preserves it, which is why the pattern survived for as long as
|
|
9
|
-
* packages were built with `tsc` alone.
|
|
10
|
-
*
|
|
11
|
-
* From a sibling module the same import is ordinary and survives.
|
|
2
|
+
* @deprecated import `./server.register.js` instead. This module path is kept so existing
|
|
3
|
+
* `@_linked/server/ontologies/lincd-server.register` imports keep registering the ontology.
|
|
12
4
|
*/
|
|
13
|
-
import
|
|
14
|
-
import { loadData, ns } from './lincd-server.js';
|
|
15
|
-
import { linkedOntology } from '../package.js';
|
|
16
|
-
linkedOntology(terms, ns, 'lincd-server', loadData, '../data/lincd-server.json');
|
|
5
|
+
import './server.register.js';
|
|
17
6
|
//# sourceMappingURL=lincd-server.register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lincd-server.register.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-server.register.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lincd-server.register.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-server.register.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,sBAAsB,CAAC","sourcesContent":["/**\n * @deprecated import `./server.register.js` instead. This module path is kept so existing\n * `@_linked/server/ontologies/lincd-server.register` imports keep registering the ontology.\n */\nimport './server.register.js';\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
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<{
|
|
6
|
+
"@context": {
|
|
7
|
+
dc: string;
|
|
8
|
+
owl: string;
|
|
9
|
+
rdf: string;
|
|
10
|
+
rdfs: string;
|
|
11
|
+
server: string;
|
|
12
|
+
};
|
|
13
|
+
"@graph": {
|
|
14
|
+
"@id": string;
|
|
15
|
+
"@type": string;
|
|
16
|
+
"rdfs:comment": string;
|
|
17
|
+
"rdfs:isDefinedBy": {
|
|
18
|
+
"@id": string;
|
|
19
|
+
};
|
|
20
|
+
"rdfs:label": string;
|
|
21
|
+
}[];
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* The namespace of this ontology.
|
|
25
|
+
*
|
|
26
|
+
* First-party ontologies live on linked.cm: `https://linked.cm/ont/{ontologySlug}/`, and a
|
|
27
|
+
* package's own ontology takes the package's publicSlug (`@_linked/server` → `server`), the same
|
|
28
|
+
* slug its shapes use under `https://linked.cm/shape/server/`.
|
|
29
|
+
*
|
|
30
|
+
* Its prefix label is the same slug, `server` (`server:LincdAPI`). It used to be `lincd-server`,
|
|
31
|
+
* which is still registered as a deprecated alias so `lincd-server:` names keep expanding.
|
|
32
|
+
*
|
|
33
|
+
* Until an earlier release the namespace was `http://lincd.org/ont/lincd-server/`. No stored
|
|
34
|
+
* data is typed with these terms; the only store triples that carried them were the synced shape descriptions of
|
|
35
|
+
* `LinkedServer`, `LincdAPI` and `LincdWebApp` (`sh:targetClass`, `sh:path`), which boot sync
|
|
36
|
+
* rewrites (delete, then recreate) the next time the server starts.
|
|
37
|
+
*/
|
|
38
|
+
export declare var ns: (term: string) => import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
39
|
+
export declare var _self: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
40
|
+
export declare const server: {
|
|
41
|
+
LincdServer: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
42
|
+
BackendFileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
43
|
+
NodeFileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
44
|
+
BackendStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
45
|
+
N3FileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
46
|
+
BackendAPIStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
47
|
+
LincdWebApp: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
48
|
+
ownPackage: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
49
|
+
maintainsPackage: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
50
|
+
LincdAPI: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
51
|
+
hasAPI: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
52
|
+
};
|
|
53
|
+
/** @deprecated use `server` — same object, kept under its old name. */
|
|
54
|
+
export declare const lincdServer: {
|
|
55
|
+
LincdServer: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
56
|
+
BackendFileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
57
|
+
NodeFileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
58
|
+
BackendStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
59
|
+
N3FileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
60
|
+
BackendAPIStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
61
|
+
LincdWebApp: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
62
|
+
ownPackage: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
63
|
+
maintainsPackage: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
64
|
+
LincdAPI: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
65
|
+
hasAPI: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
66
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createNameSpace } from '@_linked/core/utils/NameSpace';
|
|
2
|
+
/**
|
|
3
|
+
* Load the data of this ontology.
|
|
4
|
+
* In @_linked/core, loadData returns the raw JSON import — no JSONLD.parse() needed.
|
|
5
|
+
*/
|
|
6
|
+
export var loadData = async () => {
|
|
7
|
+
//@ts-ignore
|
|
8
|
+
const data = await import('../data/server.json', {
|
|
9
|
+
with: { type: 'json' },
|
|
10
|
+
});
|
|
11
|
+
return data.default || data;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The namespace of this ontology.
|
|
15
|
+
*
|
|
16
|
+
* First-party ontologies live on linked.cm: `https://linked.cm/ont/{ontologySlug}/`, and a
|
|
17
|
+
* package's own ontology takes the package's publicSlug (`@_linked/server` → `server`), the same
|
|
18
|
+
* slug its shapes use under `https://linked.cm/shape/server/`.
|
|
19
|
+
*
|
|
20
|
+
* Its prefix label is the same slug, `server` (`server:LincdAPI`). It used to be `lincd-server`,
|
|
21
|
+
* which is still registered as a deprecated alias so `lincd-server:` names keep expanding.
|
|
22
|
+
*
|
|
23
|
+
* Until an earlier release the namespace was `http://lincd.org/ont/lincd-server/`. No stored
|
|
24
|
+
* data is typed with these terms; the only store triples that carried them were the synced shape descriptions of
|
|
25
|
+
* `LinkedServer`, `LincdAPI` and `LincdWebApp` (`sh:targetClass`, `sh:path`), which boot sync
|
|
26
|
+
* rewrites (delete, then recreate) the next time the server starts.
|
|
27
|
+
*/
|
|
28
|
+
export var ns = createNameSpace('https://linked.cm/ont/server/');
|
|
29
|
+
export var _self = ns('');
|
|
30
|
+
// Terms are properties of the namespace object below, not module-scope
|
|
31
|
+
// exports. Most of these names are also SHAPE CLASS names in this package
|
|
32
|
+
// (BackendAPIStore, LincdWebApp, LincdAPI, ...). Two bindings of the same name
|
|
33
|
+
// in one bundle scope make the bundler rename one of them, and when the loser
|
|
34
|
+
// is the class, `constructor.name` becomes `BackendAPIStore2` -- which is the
|
|
35
|
+
// shape's IRI and the name `Server.call` routes on. The client then asks a
|
|
36
|
+
// backend that has no such shape, and every store round-trip answers 501.
|
|
37
|
+
const LincdServer = ns('LincdServer');
|
|
38
|
+
const BackendFileStore = ns('BackendFileStore');
|
|
39
|
+
const NodeFileStore = ns('NodeFileStore');
|
|
40
|
+
const BackendStore = ns('BackendStore');
|
|
41
|
+
const BackendAPIStore = ns('BackendAPIStore');
|
|
42
|
+
const LincdWebApp = ns('LincdWebApp');
|
|
43
|
+
const ownPackage = ns('ownPackage');
|
|
44
|
+
const maintainsPackage = ns('maintainsPackage');
|
|
45
|
+
const N3FileStore = ns('N3FileStore');
|
|
46
|
+
const LincdAPI = ns('LincdAPI');
|
|
47
|
+
const hasAPI = ns('hasAPI');
|
|
48
|
+
export const server = {
|
|
49
|
+
LincdServer,
|
|
50
|
+
BackendFileStore,
|
|
51
|
+
NodeFileStore,
|
|
52
|
+
BackendStore,
|
|
53
|
+
N3FileStore,
|
|
54
|
+
BackendAPIStore,
|
|
55
|
+
LincdWebApp,
|
|
56
|
+
ownPackage,
|
|
57
|
+
maintainsPackage,
|
|
58
|
+
LincdAPI,
|
|
59
|
+
hasAPI,
|
|
60
|
+
};
|
|
61
|
+
/** @deprecated use `server` — same object, kept under its old name. */
|
|
62
|
+
export const lincdServer = server;
|
|
63
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/ontologies/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,IAAI,QAAQ,GAAG,KAAK,IAAI,EAAE;IAC/B,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AQ;IACR,MAAM;CACP,CAAC;AAEF,uEAAuE;AACvE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC","sourcesContent":["import { createNameSpace } from '@_linked/core/utils/NameSpace';\n\n/**\n * Load the data of this ontology.\n * In @_linked/core, loadData returns the raw JSON import — no JSONLD.parse() needed.\n */\nexport var loadData = async () => {\n //@ts-ignore\n const data = await import('../data/server.json', {\n with: { type: 'json' },\n });\n return data.default || data;\n};\n\n/**\n * The namespace of this ontology.\n *\n * First-party ontologies live on linked.cm: `https://linked.cm/ont/{ontologySlug}/`, and a\n * package's own ontology takes the package's publicSlug (`@_linked/server` → `server`), the same\n * slug its shapes use under `https://linked.cm/shape/server/`.\n *\n * Its prefix label is the same slug, `server` (`server:LincdAPI`). It used to be `lincd-server`,\n * which is still registered as a deprecated alias so `lincd-server:` names keep expanding.\n *\n * Until an earlier release the namespace was `http://lincd.org/ont/lincd-server/`. No stored\n * data is typed with these terms; the only store triples that carried them were the synced shape descriptions of\n * `LinkedServer`, `LincdAPI` and `LincdWebApp` (`sh:targetClass`, `sh:path`), which boot sync\n * rewrites (delete, then recreate) the next time the server starts.\n */\nexport var ns = createNameSpace('https://linked.cm/ont/server/');\n\nexport var _self = ns('');\n\n// Terms are properties of the namespace object below, not module-scope\n// exports. Most of these names are also SHAPE CLASS names in this package\n// (BackendAPIStore, LincdWebApp, LincdAPI, ...). Two bindings of the same name\n// in one bundle scope make the bundler rename one of them, and when the loser\n// is the class, `constructor.name` becomes `BackendAPIStore2` -- which is the\n// shape's IRI and the name `Server.call` routes on. The client then asks a\n// backend that has no such shape, and every store round-trip answers 501.\nconst LincdServer = ns('LincdServer');\nconst BackendFileStore = ns('BackendFileStore');\nconst NodeFileStore = ns('NodeFileStore');\nconst BackendStore = ns('BackendStore');\nconst BackendAPIStore = ns('BackendAPIStore');\nconst LincdWebApp = ns('LincdWebApp');\nconst ownPackage = ns('ownPackage');\nconst maintainsPackage = ns('maintainsPackage');\nconst N3FileStore = ns('N3FileStore');\nconst LincdAPI = ns('LincdAPI');\nconst hasAPI = ns('hasAPI');\n\nexport const server = {\n LincdServer,\n BackendFileStore,\n NodeFileStore,\n BackendStore,\n N3FileStore,\n BackendAPIStore,\n LincdWebApp,\n ownPackage,\n maintainsPackage,\n LincdAPI,\n hasAPI,\n};\n\n/** @deprecated use `server` — same object, kept under its old name. */\nexport const lincdServer = server;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers this ontology.
|
|
3
|
+
*
|
|
4
|
+
* Kept out of `server.ts` because registration needs that module's whole export
|
|
5
|
+
* namespace, and a module cannot import itself once a bundler is involved: Rollup
|
|
6
|
+
* treats a static self-reference as a circular import and elides it, so the binding is
|
|
7
|
+
* undefined at runtime and the consuming app dies at boot with `_this is not
|
|
8
|
+
* defined`. `tsc` preserves it, which is why the pattern survived for as long as
|
|
9
|
+
* packages were built with `tsc` alone.
|
|
10
|
+
*
|
|
11
|
+
* From a sibling module the same import is ordinary and survives.
|
|
12
|
+
*/
|
|
13
|
+
import * as terms from './server.js';
|
|
14
|
+
import { loadData, ns } from './server.js';
|
|
15
|
+
import { linkedOntology } from '../package.js';
|
|
16
|
+
import { Prefix } from '@_linked/core/utils/Prefix';
|
|
17
|
+
// Deprecated prefix label, kept so `lincd-server:X` names still expand. It is added
|
|
18
|
+
// BEFORE the registration below because Prefix keeps one prefix per namespace and the
|
|
19
|
+
// last add wins: registering `server` second makes compaction emit `server:X`.
|
|
20
|
+
Prefix.add('lincd-server', ns('').id);
|
|
21
|
+
// The prefix is also the key this ontology is registered under in the package tree,
|
|
22
|
+
// and the name of its data file: `server` → `../data/server.json`.
|
|
23
|
+
linkedOntology(terms, ns, 'server', loadData, '../data/server.json');
|
|
24
|
+
//# sourceMappingURL=server.register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.register.js","sourceRoot":"","sources":["../../../src/ontologies/server.register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,QAAQ,EAAE,EAAE,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AAElD,oFAAoF;AACpF,sFAAsF;AACtF,+EAA+E;AAC/E,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAEtC,oFAAoF;AACpF,mEAAmE;AACnE,cAAc,CAAC,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["/**\n * Registers this ontology.\n *\n * Kept out of `server.ts` because registration needs that module's whole export\n * namespace, and a module cannot import itself once a bundler is involved: Rollup\n * treats a static self-reference as a circular import and elides it, so the binding is\n * undefined at runtime and the consuming app dies at boot with `_this is not\n * defined`. `tsc` preserves it, which is why the pattern survived for as long as\n * packages were built with `tsc` alone.\n *\n * From a sibling module the same import is ordinary and survives.\n */\nimport * as terms from './server.js';\nimport {loadData, ns} from './server.js';\nimport {linkedOntology} from '../package.js';\nimport {Prefix} from '@_linked/core/utils/Prefix';\n\n// Deprecated prefix label, kept so `lincd-server:X` names still expand. It is added\n// BEFORE the registration below because Prefix keeps one prefix per namespace and the\n// last add wins: registering `server` second makes compaction emit `server:X`.\nPrefix.add('lincd-server', ns('').id);\n\n// The prefix is also the key this ontology is registered under in the package tree,\n// and the name of its data file: `server` → `../data/server.json`.\nlinkedOntology(terms, ns, 'server', loadData, '../data/server.json');\n"]}
|