@lde/fastify-rdf 0.4.5 → 0.4.6
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/dist/hydra-error.d.ts.map +1 -1
- package/dist/hydra-error.js +5 -8
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydra-error.d.ts","sourceRoot":"","sources":["../src/hydra-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"hydra-error.d.ts","sourceRoot":"","sources":["../src/hydra-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,EAAE,MAAM,IAAI,CAAC;AAKxC;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,GACnB,KAAK,CAWP"}
|
package/dist/hydra-error.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { DataFactory, Store } from 'n3';
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const HYDRA_ERROR = namedNode('http://www.w3.org/ns/hydra/core#Error');
|
|
5
|
-
const HYDRA_TITLE = namedNode('http://www.w3.org/ns/hydra/core#title');
|
|
6
|
-
const HYDRA_DESCRIPTION = namedNode('http://www.w3.org/ns/hydra/core#description');
|
|
2
|
+
import { hydra, rdf } from '@tpluscode/rdf-ns-builders';
|
|
3
|
+
const { blankNode, literal } = DataFactory;
|
|
7
4
|
/**
|
|
8
5
|
* Serialize a Hydra error as compact JSON-LD without needing the `jsonld` dependency.
|
|
9
6
|
*/
|
|
@@ -24,10 +21,10 @@ export function serializeHydraErrorAsJsonLd(title, description) {
|
|
|
24
21
|
export function createHydraErrorDataset(title, description) {
|
|
25
22
|
const store = new Store();
|
|
26
23
|
const subject = blankNode();
|
|
27
|
-
store.add(DataFactory.quad(subject,
|
|
28
|
-
store.add(DataFactory.quad(subject,
|
|
24
|
+
store.add(DataFactory.quad(subject, rdf.type, hydra.Error));
|
|
25
|
+
store.add(DataFactory.quad(subject, hydra.title, literal(title)));
|
|
29
26
|
if (description !== undefined) {
|
|
30
|
-
store.add(DataFactory.quad(subject,
|
|
27
|
+
store.add(DataFactory.quad(subject, hydra.description, literal(description)));
|
|
31
28
|
}
|
|
32
29
|
return store;
|
|
33
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/fastify-rdf",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Fastify plugin for serving RDF data with content negotiation",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "git+https://github.com/ldelements/lde.git",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@fastify/accepts": "^5.0.0",
|
|
29
|
+
"@tpluscode/rdf-ns-builders": "^5.0.0",
|
|
29
30
|
"fastify-plugin": "^6.0.0",
|
|
30
31
|
"n3": "^2.0.1",
|
|
31
32
|
"rdf-parse": "^5.0.0",
|