diff --git a/.changeset/selfish-goats-sleep.md b/.changeset/selfish-goats-sleep.md
new file mode 100644
index 00000000..4ef1b686
--- /dev/null
+++ b/.changeset/selfish-goats-sleep.md
@@ -0,0 +1,5 @@
+---
+"@zazuko/trifid-entity-renderer": minor
+---
+
+Replace the use of `rdf-ext` with `@zazuko/env`
diff --git a/package-lock.json b/package-lock.json
index 60dab105..df43bd97 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3235,19 +3235,19 @@
}
},
"node_modules/@lit-labs/ssr": {
- "version": "3.1.6",
- "resolved": "https://registry.npmjs.org/@lit-labs/ssr/-/ssr-3.1.6.tgz",
- "integrity": "sha512-mBULGxNZ4u5PT0im6M46Zu3meg7jRuoLbX/mOuIuVoXlWs1bF7jxQGwYORLdd87zm9M+PGhnXMPGf71IBaAn1w==",
+ "version": "3.1.8",
+ "resolved": "https://registry.npmjs.org/@lit-labs/ssr/-/ssr-3.1.8.tgz",
+ "integrity": "sha512-3++/wRaue1GuFTZKDNhvnBIIUBJcKjnv+YeVWjQNETH/qcoTApmS88rzZvJENri84Vq+JonfF7dDTtHtenDU2A==",
"dependencies": {
- "@lit-labs/ssr-client": "^1.1.0",
- "@lit-labs/ssr-dom-shim": "^1.1.0",
- "@lit/reactive-element": "^1.6.0",
+ "@lit-labs/ssr-client": "^1.1.4-pre.0",
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0",
+ "@lit/reactive-element": "^2.0.0",
"@parse5/tools": "^0.3.0",
"@types/node": "^16.0.0",
"enhanced-resolve": "^5.10.0",
- "lit": "^2.7.0",
- "lit-element": "^3.3.0",
- "lit-html": "^2.7.0",
+ "lit": "^3.0.0",
+ "lit-element": "^4.0.0",
+ "lit-html": "^3.0.0",
"node-fetch": "^3.2.8",
"parse5": "^7.1.1"
},
@@ -3256,25 +3256,97 @@
}
},
"node_modules/@lit-labs/ssr-client": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/@lit-labs/ssr-client/-/ssr-client-1.1.3.tgz",
- "integrity": "sha512-JIvpvfCEJGTIKH1L/kZYN68jiXuTBbHI6JG3H4HQI0Ko/8Z0qtlSP9G35IVDzNdMt+xVE4WYKsY9Vk6N2S55kQ==",
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/@lit-labs/ssr-client/-/ssr-client-1.1.4.tgz",
+ "integrity": "sha512-LJUi1/Run6iLTfE3QlX0aGzuTBWOmvBQet2ushSgc8iE1X5bWFLii2QhpMb9rw3or3OrUmXjEEI/AzWaehbMAg==",
"dependencies": {
- "@lit/reactive-element": "^1.0.0",
- "lit": "^2.8.0",
- "lit-html": "^2.8.0"
+ "@lit/reactive-element": "^2.0.0",
+ "lit": "^3.0.0",
+ "lit-html": "^3.0.0"
+ }
+ },
+ "node_modules/@lit-labs/ssr-client/node_modules/@lit/reactive-element": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.0.tgz",
+ "integrity": "sha512-wn+2+uDcs62ROBmVAwssO4x5xue/uKD3MGGZOXL2sMxReTRIT0JXKyMXeu7gh0aJ4IJNEIG/3aOnUaQvM7BMzQ==",
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0"
+ }
+ },
+ "node_modules/@lit-labs/ssr-client/node_modules/lit": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/lit/-/lit-3.0.0.tgz",
+ "integrity": "sha512-nQ0teRzU1Kdj++VdmttS2WvIen8M79wChJ6guRKIIym2M3Ansg3Adj9O6yuQh2IpjxiUXlNuS81WKlQ4iL3BmA==",
+ "dependencies": {
+ "@lit/reactive-element": "^2.0.0",
+ "lit-element": "^4.0.0",
+ "lit-html": "^3.0.0"
+ }
+ },
+ "node_modules/@lit-labs/ssr-client/node_modules/lit-element": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.0.0.tgz",
+ "integrity": "sha512-N6+f7XgusURHl69DUZU6sTBGlIN+9Ixfs3ykkNDfgfTkDYGGOWwHAYBhDqVswnFGyWgQYR2KiSpu4J76Kccs/A==",
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0",
+ "@lit/reactive-element": "^2.0.0",
+ "lit-html": "^3.0.0"
+ }
+ },
+ "node_modules/@lit-labs/ssr-client/node_modules/lit-html": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.0.0.tgz",
+ "integrity": "sha512-DNJIE8dNY0dQF2Gs0sdMNUppMQT2/CvV4OVnSdg7BXAsGqkVwsE5bqQ04POfkYH5dBIuGnJYdFz5fYYyNnOxiA==",
+ "dependencies": {
+ "@types/trusted-types": "^2.0.2"
}
},
"node_modules/@lit-labs/ssr-dom-shim": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.1.tgz",
- "integrity": "sha512-kXOeFbfCm4fFf2A3WwVEeQj55tMZa8c8/f9AKHMobQMkzNUfUj+antR3fRPaZJawsa1aZiP/Da3ndpZrwEe4rQ=="
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.2.tgz",
+ "integrity": "sha512-jnOD+/+dSrfTWYfSXBXlo5l5f0q1UuJo3tkbMDCYA2lKUYq79jaxqtGEvnRoh049nt1vdo1+45RinipU6FGY2g=="
+ },
+ "node_modules/@lit-labs/ssr/node_modules/@lit/reactive-element": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.0.tgz",
+ "integrity": "sha512-wn+2+uDcs62ROBmVAwssO4x5xue/uKD3MGGZOXL2sMxReTRIT0JXKyMXeu7gh0aJ4IJNEIG/3aOnUaQvM7BMzQ==",
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0"
+ }
},
"node_modules/@lit-labs/ssr/node_modules/@types/node": {
"version": "16.18.52",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.52.tgz",
"integrity": "sha512-sm2aph6cRSsTMFYFgI+RpPLunXO9ClJkpizUVdT7KmGeyfQ14xnjTMT/f3MHcfKqevXqGT6BgVFzW8wcEoDUtA=="
},
+ "node_modules/@lit-labs/ssr/node_modules/lit": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/lit/-/lit-3.0.0.tgz",
+ "integrity": "sha512-nQ0teRzU1Kdj++VdmttS2WvIen8M79wChJ6guRKIIym2M3Ansg3Adj9O6yuQh2IpjxiUXlNuS81WKlQ4iL3BmA==",
+ "dependencies": {
+ "@lit/reactive-element": "^2.0.0",
+ "lit-element": "^4.0.0",
+ "lit-html": "^3.0.0"
+ }
+ },
+ "node_modules/@lit-labs/ssr/node_modules/lit-element": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.0.0.tgz",
+ "integrity": "sha512-N6+f7XgusURHl69DUZU6sTBGlIN+9Ixfs3ykkNDfgfTkDYGGOWwHAYBhDqVswnFGyWgQYR2KiSpu4J76Kccs/A==",
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0",
+ "@lit/reactive-element": "^2.0.0",
+ "lit-html": "^3.0.0"
+ }
+ },
+ "node_modules/@lit-labs/ssr/node_modules/lit-html": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.0.0.tgz",
+ "integrity": "sha512-DNJIE8dNY0dQF2Gs0sdMNUppMQT2/CvV4OVnSdg7BXAsGqkVwsE5bqQ04POfkYH5dBIuGnJYdFz5fYYyNnOxiA==",
+ "dependencies": {
+ "@types/trusted-types": "^2.0.2"
+ }
+ },
"node_modules/@lit/reactive-element": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.6.3.tgz",
@@ -4348,6 +4420,16 @@
"integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==",
"dev": true
},
+ "node_modules/@types/rdf-dataset-ext": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/@types/rdf-dataset-ext/-/rdf-dataset-ext-1.0.6.tgz",
+ "integrity": "sha512-gSKGOXk4z4AQcK+dnb4SUbtXC1sLbYraOueqJ2luHvA//sSC4IfeyjVH9/rXi3tnfyEtNA037WSR8Og4ROfAlA==",
+ "peer": true,
+ "dependencies": {
+ "@types/readable-stream": "*",
+ "rdf-js": "^4.0.2"
+ }
+ },
"node_modules/@types/rdfjs__data-model": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@types/rdfjs__data-model/-/rdfjs__data-model-2.0.4.tgz",
@@ -4463,6 +4545,15 @@
"@rdfjs/types": "*"
}
},
+ "node_modules/@types/rdfjs__traverser": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/@types/rdfjs__traverser/-/rdfjs__traverser-0.1.4.tgz",
+ "integrity": "sha512-bjIl9UwA931xm8hWJWrUpodO9UCii6ypVJpULi7befJpaeOyhEkVuZVOlci+oLPX828jzcd/8E4HxSwHZIXuNA==",
+ "peer": true,
+ "dependencies": {
+ "@rdfjs/types": "*"
+ }
+ },
"node_modules/@types/readable-stream": {
"version": "2.3.15",
"resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-2.3.15.tgz",
@@ -4841,18 +4932,43 @@
"integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ=="
},
"node_modules/@zazuko/env": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/@zazuko/env/-/env-1.3.1.tgz",
- "integrity": "sha512-MCN96GaFiqe8/yfY5QhbO0MYcL7ASMSD7AsQiMzaIid7yQeRAWBv3C/6yrinB5xMJ/A/CSHmIM1Osea1KPudfw==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@zazuko/env/-/env-1.9.0.tgz",
+ "integrity": "sha512-2aZeNY3R7f0enBy5FY+um8rRuBsYkTxOWtAp7uKt0nw9hbF0CVsw0G1BRbrUYnZ2oWZk4STTJGZZyUQytxjZ2w==",
"dependencies": {
+ "@rdfjs/dataset": "^2.0.1",
"@rdfjs/environment": "^0.1.2",
+ "@rdfjs/traverser": "^0.1.2",
"@tpluscode/rdf-ns-builders": "^4.1.0",
- "clownface": "^2.0.0"
+ "clownface": "^2.0.1",
+ "get-stream": "^8.0.1",
+ "rdf-dataset-ext": "^1.1.0"
},
"peerDependencies": {
"@types/clownface": "^2.0.0",
+ "@types/rdf-dataset-ext": "^1",
"@types/rdfjs__environment": "^0.1.7",
- "@types/rdfjs__formats-common": "^3.1.0"
+ "@types/rdfjs__formats-common": "^3.1.0",
+ "@types/rdfjs__traverser": "^0.1.3"
+ }
+ },
+ "node_modules/@zazuko/env/node_modules/@rdfjs/dataset": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/@rdfjs/dataset/-/dataset-2.0.1.tgz",
+ "integrity": "sha512-hDIaXpUmU/ZdofX/BMFDAchkhN/AjmP5dMCOuVL2VCqWuFjeQxd2KV84E4+7S2Biw8tjEFhPBeQZP7KW+ARV7Q==",
+ "bin": {
+ "rdfjs-dataset-test": "bin/test.js"
+ }
+ },
+ "node_modules/@zazuko/env/node_modules/get-stream": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz",
+ "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==",
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@zazuko/formats-lazy": {
@@ -4887,9 +5003,9 @@
}
},
"node_modules/@zazuko/prefixes": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/@zazuko/prefixes/-/prefixes-2.0.0.tgz",
- "integrity": "sha512-WicT6lMnWFaaxudoBhccRzUOxrej0Tk5jwn9oGj308MP2Dlsqh8f6EEJdGu+nXYp3M1NLLokXbtZpTvtDM11PQ=="
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@zazuko/prefixes/-/prefixes-2.1.0.tgz",
+ "integrity": "sha512-dm0/YBNzuwJUm8cXoF3Dn9DfQetnRDaOJ8NdlgLY645OaUddCzUAAYcanm+xZmEo1SWX+/Tp3jbScwCaN2b/aQ=="
},
"node_modules/@zazuko/rdf-entity-webcomponent": {
"version": "0.7.7",
@@ -7014,9 +7130,9 @@
}
},
"node_modules/clownface": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/clownface/-/clownface-2.0.0.tgz",
- "integrity": "sha512-wnSOFWAvqrz9qZ+urzgEmQfvdnWsMt1+jZH/5LBJt+pLdjDwjlR80AMzzPBL+4ZF+yCK4cCLPGTg+d/uq3OIbg==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/clownface/-/clownface-2.0.1.tgz",
+ "integrity": "sha512-8RVfn/LZEl7BTDhIEIamz13Bhm5YahA1qiJigMb0HYGaiKnsVV0PpLBz0kzqyAI0+IzOlYbCLMFOAc1dkQfwgQ==",
"dependencies": {
"@rdfjs/environment": "^0.1.2"
}
@@ -7447,9 +7563,9 @@
"dev": true
},
"node_modules/cypress": {
- "version": "13.2.0",
- "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.2.0.tgz",
- "integrity": "sha512-AvDQxBydE771GTq0TR4ZUBvv9m9ffXuB/ueEtpDF/6gOcvFR96amgwSJP16Yhqw6VhmwqspT5nAGzoxxB+D89g==",
+ "version": "13.3.2",
+ "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.2.tgz",
+ "integrity": "sha512-ArLmZObcLC+xxCp7zJZZbhby9FUf5CueLej9dUM4+5j37FTS4iMSgHxQLDu01PydFUvDXcNoIVRCYrHHxD7Ybg==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@@ -18754,9 +18870,9 @@
}
},
"node_modules/start-server-and-test": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-2.0.0.tgz",
- "integrity": "sha512-UqKLw0mJbfrsG1jcRLTUlvuRi9sjNuUiDOLI42r7R5fA9dsFoywAy9DoLXNYys9B886E4RCKb+qM1Gzu96h7DQ==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-2.0.1.tgz",
+ "integrity": "sha512-8PFo4DLLLCDMuS51/BEEtE1m9CAXw1LNVtZSS1PzkYQh6Qf9JUwM4huYeSoUumaaoAyuwYBwCa9OsrcpMqcOdQ==",
"dev": true,
"dependencies": {
"arg": "^5.0.2",
@@ -18774,7 +18890,7 @@
"start-test": "src/bin/start.js"
},
"engines": {
- "node": ">=6"
+ "node": ">=16"
}
},
"node_modules/start-server-and-test/node_modules/execa": {
@@ -20785,25 +20901,33 @@
"version": "0.5.1",
"license": "MIT",
"dependencies": {
- "@lit-labs/ssr": "^3.1.6",
+ "@lit-labs/ssr": "^3.1.8",
"@rdfjs/formats-common": "^3.1.0",
"@rdfjs/to-ntriples": "^2.0.0",
- "@zazuko/env": "^1.3.1",
+ "@zazuko/env": "^1.9.0",
+ "@zazuko/prefixes": "^2.1.0",
"@zazuko/rdf-entity-webcomponent": "^0.7.7",
"express": "^4.18.2",
"hijackresponse": "^5.0.0",
- "lit": "^2.8.0",
+ "lit": "^3.0.0",
"p-queue": "^7.4.1",
- "rdf-ext": "^2.3.0",
"sparql-http-client": "^2.4.2",
"trifid-core": "^2.6.3"
},
"devDependencies": {
- "cypress": "^13.2.0",
- "start-server-and-test": "^2.0.0",
+ "cypress": "^13.3.2",
+ "start-server-and-test": "^2.0.1",
"trifid-handler-fetch": "^2.0.1"
}
},
+ "packages/entity-renderer/node_modules/@lit/reactive-element": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.0.tgz",
+ "integrity": "sha512-wn+2+uDcs62ROBmVAwssO4x5xue/uKD3MGGZOXL2sMxReTRIT0JXKyMXeu7gh0aJ4IJNEIG/3aOnUaQvM7BMzQ==",
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0"
+ }
+ },
"packages/entity-renderer/node_modules/hijackresponse": {
"version": "5.0.0",
"license": "ISC",
@@ -20811,6 +20935,34 @@
"node": ">=8.0.0"
}
},
+ "packages/entity-renderer/node_modules/lit": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/lit/-/lit-3.0.0.tgz",
+ "integrity": "sha512-nQ0teRzU1Kdj++VdmttS2WvIen8M79wChJ6guRKIIym2M3Ansg3Adj9O6yuQh2IpjxiUXlNuS81WKlQ4iL3BmA==",
+ "dependencies": {
+ "@lit/reactive-element": "^2.0.0",
+ "lit-element": "^4.0.0",
+ "lit-html": "^3.0.0"
+ }
+ },
+ "packages/entity-renderer/node_modules/lit-element": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.0.0.tgz",
+ "integrity": "sha512-N6+f7XgusURHl69DUZU6sTBGlIN+9Ixfs3ykkNDfgfTkDYGGOWwHAYBhDqVswnFGyWgQYR2KiSpu4J76Kccs/A==",
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0",
+ "@lit/reactive-element": "^2.0.0",
+ "lit-html": "^3.0.0"
+ }
+ },
+ "packages/entity-renderer/node_modules/lit-html": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.0.0.tgz",
+ "integrity": "sha512-DNJIE8dNY0dQF2Gs0sdMNUppMQT2/CvV4OVnSdg7BXAsGqkVwsE5bqQ04POfkYH5dBIuGnJYdFz5fYYyNnOxiA==",
+ "dependencies": {
+ "@types/trusted-types": "^2.0.2"
+ }
+ },
"packages/graph-explorer": {
"name": "trifid-plugin-graph-explorer",
"version": "1.0.2",
diff --git a/packages/entity-renderer/cypress.config.mjs b/packages/entity-renderer/cypress.config.mjs
index 569ec963..21606923 100644
--- a/packages/entity-renderer/cypress.config.mjs
+++ b/packages/entity-renderer/cypress.config.mjs
@@ -1,3 +1,4 @@
+// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from 'cypress'
export default defineConfig({
@@ -6,6 +7,6 @@ export default defineConfig({
chromeWebSecurity: false,
e2e: {
baseUrl: 'http://localhost:3000',
- experimentalStudio: true
- }
+ experimentalStudio: true,
+ },
})
diff --git a/packages/entity-renderer/cypress/support/e2e.js b/packages/entity-renderer/cypress/support/e2e.js
index 9fe00ed7..b6ca3466 100644
--- a/packages/entity-renderer/cypress/support/e2e.js
+++ b/packages/entity-renderer/cypress/support/e2e.js
@@ -14,7 +14,7 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
-import "./commands.js";
+import './commands.js'
// Alternatively you can use CommonJS syntax:
// require('./commands')
diff --git a/packages/entity-renderer/env.js b/packages/entity-renderer/env.js
deleted file mode 100644
index 0f23cb06..00000000
--- a/packages/entity-renderer/env.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import { create } from "@zazuko/env";
-import DatasetFactory from "rdf-ext/DatasetFactory.js";
-
-export default create(DatasetFactory);
diff --git a/packages/entity-renderer/examples/config/trifid.yaml b/packages/entity-renderer/examples/config/trifid.yaml
index ae880b4e..3c5d6cd2 100644
--- a/packages/entity-renderer/examples/config/trifid.yaml
+++ b/packages/entity-renderer/examples/config/trifid.yaml
@@ -2,17 +2,16 @@ server:
logLevel: debug
middlewares:
-
entity-renderer:
paths: /
module: file:../../index.js
config:
path: file:../../views/render.hbs
-# labelLoader:
-# endpointUrl: https://ld.zazuko.com/query
-# chunkSize: 30
-# concurrency: 2
-# timeout: 1000
+ # labelLoader:
+ # endpointUrl: https://ld.zazuko.com/query
+ # chunkSize: 30
+ # concurrency: 2
+ # timeout: 1000
entity-host-web-page:
module: trifid-core/middlewares/view.js
diff --git a/packages/entity-renderer/examples/run-instance.js b/packages/entity-renderer/examples/run-instance.js
index 9a013d88..fc0376b4 100644
--- a/packages/entity-renderer/examples/run-instance.js
+++ b/packages/entity-renderer/examples/run-instance.js
@@ -2,29 +2,29 @@
/* eslint-disable no-console */
-import { join } from "path";
-import express from "express";
+import { join } from 'path'
+import express from 'express'
-import trifid from "trifid-core";
+import trifid from 'trifid-core'
-async function createTrifidInstance(filePath) {
- const configFile = join(process.cwd(), filePath);
+async function createTrifidInstance (filePath) {
+ const configFile = join(process.cwd(), filePath)
const config = {
extends: [configFile],
server: {
listener: {},
},
- };
- return await trifid(config);
+ }
+ return await trifid(config)
}
-const test = await createTrifidInstance("examples/config/trifid.yaml");
+const test = await createTrifidInstance('examples/config/trifid.yaml')
-const app = express(); // The main app
-const PORT = 3000;
+const app = express() // The main app
+const PORT = 3000
-app.use("/", test.server);
+app.use('/', test.server)
app.listen(PORT, function (err) {
- if (err) console.log(err);
- console.log("Server listening on PORT", PORT);
-});
+ if (err) console.log(err)
+ console.log('Server listening on PORT', PORT)
+})
diff --git a/packages/entity-renderer/index.js b/packages/entity-renderer/index.js
index a16d6069..7f70d4ca 100644
--- a/packages/entity-renderer/index.js
+++ b/packages/entity-renderer/index.js
@@ -1,97 +1,97 @@
-import { dirname } from "path";
-import { fileURLToPath } from "url";
-import { parsers } from "@rdfjs/formats-common";
-import hijackResponse from "hijackresponse";
+import { dirname } from 'path'
+import { fileURLToPath } from 'url'
+import { parsers } from '@rdfjs/formats-common'
+import hijackResponse from 'hijackresponse'
-import rdf from "./env.js";
-import { createEntityRenderer } from "./renderer/entity.js";
-import { createMetadataProvider } from "./renderer/metadata.js";
+import rdf from '@zazuko/env'
+import { createEntityRenderer } from './renderer/entity.js'
+import { createMetadataProvider } from './renderer/metadata.js'
-const currentDir = dirname(fileURLToPath(import.meta.url));
+const currentDir = dirname(fileURLToPath(import.meta.url))
const getAcceptHeader = (req) => {
- const queryStringValue = req.query.format;
+ const queryStringValue = req.query.format
const supportedQueryStringValues = {
- ttl: "text/turtle",
- jsonld: "application/ld+json",
- xml: "application/rdf+xml",
- nt: "application/n-triples",
- };
+ ttl: 'text/turtle',
+ jsonld: 'application/ld+json',
+ xml: 'application/rdf+xml',
+ nt: 'application/n-triples',
+ }
if (
Object.hasOwnProperty.call(supportedQueryStringValues, queryStringValue)
) {
- return supportedQueryStringValues[queryStringValue];
+ return supportedQueryStringValues[queryStringValue]
}
- return req.headers.accept;
-};
+ return req.headers.accept
+}
const factory = async (trifid) => {
- const { render, logger, config } = trifid;
- const entityRenderer = createEntityRenderer({ options: config, logger });
- const metadataProvider = createMetadataProvider({ options: config });
+ const { render, logger, config } = trifid
+ const entityRenderer = createEntityRenderer({ options: config, logger })
+ const metadataProvider = createMetadataProvider({ options: config })
- const { path, ignorePaths } = config;
- const entityTemplatePath = path || `${currentDir}/views/render.hbs`;
+ const { path, ignorePaths } = config
+ const entityTemplatePath = path || `${currentDir}/views/render.hbs`
// if `ignorePaths` is not provided or invalid, we configure some defaults values
- let ignoredPaths = ignorePaths;
+ let ignoredPaths = ignorePaths
if (!ignorePaths || !Array.isArray(ignorePaths)) {
- ignoredPaths = ["/query"];
+ ignoredPaths = ['/query']
}
return async (req, res, next) => {
// check if it is a path that needs to be ignored (check of type is already done at the load of the middleware)
if (ignoredPaths.includes(req.path)) {
- return next();
+ return next()
}
// update "Accept" HTTP header depending on the requested type
- req.headers.accept = getAcceptHeader(req);
+ req.headers.accept = getAcceptHeader(req)
// only take care of the rendering if HTML is requested
- const accepts = req.accepts(["text/plain", "json", "html"]);
- if (accepts !== "html") {
- return next();
+ const accepts = req.accepts(['text/plain', 'json', 'html'])
+ if (accepts !== 'html') {
+ return next()
}
- req.headers.accept = "application/n-quads";
+ req.headers.accept = 'application/n-quads'
- const { readable, writable } = await hijackResponse(res, next);
+ const { readable, writable } = await hijackResponse(res, next)
- const contentType = res.getHeader("Content-Type");
+ const contentType = res.getHeader('Content-Type')
if (!contentType) {
- return readable.pipe(writable);
+ return readable.pipe(writable)
}
- const mimeType = contentType.toLowerCase().split(";")[0].trim();
+ const mimeType = contentType.toLowerCase().split(';')[0].trim()
const hijackFormats = [
- "application/ld+json",
- "application/trig",
- "application/n-quads",
- "application/n-triples",
- "text/n3",
- "text/turtle",
- "application/rdf+xml",
- ];
+ 'application/ld+json',
+ 'application/trig',
+ 'application/n-quads',
+ 'application/n-triples',
+ 'text/n3',
+ 'text/turtle',
+ 'application/rdf+xml',
+ ]
if (!hijackFormats.includes(mimeType)) {
- return readable.pipe(writable);
+ return readable.pipe(writable)
}
- const quadStream = parsers.import(mimeType, readable);
- const dataset = await rdf.dataset().import(quadStream);
+ const quadStream = parsers.import(mimeType, readable)
+ const dataset = await rdf.dataset().import(quadStream)
- let contentToForward;
+ let contentToForward
try {
const { entityHtml, entityLabel, entityUrl } = await entityRenderer(
req,
res,
{ dataset },
- );
- const metadata = await metadataProvider(req, { dataset });
+ )
+ const metadata = await metadataProvider(req, { dataset })
contentToForward = await render(entityTemplatePath, {
dataset: entityHtml,
locals: res.locals,
@@ -99,16 +99,16 @@ const factory = async (trifid) => {
entityUrl,
metadata,
config,
- });
- res.setHeader("Content-Type", "text/html");
+ })
+ res.setHeader('Content-Type', 'text/html')
} catch (e) {
- logger.error(e);
- return readable.pipe(writable);
+ logger.error(e)
+ return readable.pipe(writable)
}
- writable.write(contentToForward);
- writable.end();
- };
-};
+ writable.write(contentToForward)
+ writable.end()
+ }
+}
-export default factory;
+export default factory
diff --git a/packages/entity-renderer/package.json b/packages/entity-renderer/package.json
index ed2417bc..9653df44 100644
--- a/packages/entity-renderer/package.json
+++ b/packages/entity-renderer/package.json
@@ -24,27 +24,26 @@
},
"homepage": "https://github.com/zazuko/trifid#readme",
"dependencies": {
- "@lit-labs/ssr": "^3.1.6",
+ "@lit-labs/ssr": "^3.1.8",
"@rdfjs/formats-common": "^3.1.0",
"@rdfjs/to-ntriples": "^2.0.0",
- "@zazuko/env": "^1.3.1",
+ "@zazuko/env": "^1.9.0",
+ "@zazuko/prefixes": "^2.1.0",
"@zazuko/rdf-entity-webcomponent": "^0.7.7",
"express": "^4.18.2",
"hijackresponse": "^5.0.0",
- "lit": "^2.8.0",
+ "lit": "^3.0.0",
"p-queue": "^7.4.1",
- "rdf-ext": "^2.3.0",
"sparql-http-client": "^2.4.2",
"trifid-core": "^2.6.3"
},
"devDependencies": {
- "cypress": "^13.2.0",
- "start-server-and-test": "^2.0.0",
+ "cypress": "^13.3.2",
+ "start-server-and-test": "^2.0.1",
"trifid-handler-fetch": "^2.0.1"
},
"files": [
"index.js",
- "env.js",
"renderer",
"views"
],
diff --git a/packages/entity-renderer/renderer/common/shrink.js b/packages/entity-renderer/renderer/common/shrink.js
deleted file mode 100644
index 6b747f4c..00000000
--- a/packages/entity-renderer/renderer/common/shrink.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import { splitIfVocab } from "@zazuko/rdf-entity-webcomponent/src/builder/utils.js";
-
-function shrink(urlStr) {
- const { vocab, value } = splitIfVocab(urlStr);
- return vocab ? `${vocab}:${value}` : `${value}`;
-}
-
-export { shrink };
diff --git a/packages/entity-renderer/renderer/entity.js b/packages/entity-renderer/renderer/entity.js
index 4d5a674c..dc9d4ca7 100644
--- a/packages/entity-renderer/renderer/entity.js
+++ b/packages/entity-renderer/renderer/entity.js
@@ -1,10 +1,10 @@
-import { render as renderWebComponent } from "@lit-labs/ssr";
-import { DEFAULT_LABEL_PROPERTIES } from "@zazuko/rdf-entity-webcomponent/src/builder/entityBuilder.js";
-import { getLabel } from "@zazuko/rdf-entity-webcomponent/src/builder/labels.js";
-import { ns } from "@zazuko/rdf-entity-webcomponent/src/namespaces.js";
-import rdf from "../env.js";
-import { LabelLoader } from "./labels/labelLoader.js";
-import { TrifidResourceDescription } from "./web-component/TrifidResourceDescription.js";
+import { render as renderWebComponent } from '@lit-labs/ssr'
+import { DEFAULT_LABEL_PROPERTIES } from '@zazuko/rdf-entity-webcomponent/src/builder/entityBuilder.js'
+import { getLabel } from '@zazuko/rdf-entity-webcomponent/src/builder/labels.js'
+import { ns } from '@zazuko/rdf-entity-webcomponent/src/namespaces.js'
+import rdf from '@zazuko/env'
+import { LabelLoader } from './labels/labelLoader.js'
+import { TrifidResourceDescription } from './web-component/TrifidResourceDescription.js'
const DEFAULTS = {
compactMode: true,
@@ -12,24 +12,24 @@ const DEFAULTS = {
simplifiedMode: false,
showImages: true,
labelProperties: DEFAULT_LABEL_PROPERTIES,
- preferredLanguages: ["en", "fr", "de", "it"],
- highlightLanguage: "en",
+ preferredLanguages: ['en', 'fr', 'de', 'it'],
+ highlightLanguage: 'en',
embedBlankNodes: true,
embedNamedNodes: false,
embedLists: true,
debug: false,
maxLevel: 3,
-};
+}
const toBoolean = (val) => {
- if (val === "false") {
- return false;
+ if (val === 'false') {
+ return false
}
- if (val === "true") {
- return true;
+ if (val === 'true') {
+ return true
}
- return undefined;
-};
+ return undefined
+}
/**
* Render HTML.
@@ -40,113 +40,113 @@ const toBoolean = (val) => {
*/
const createEntityRenderer = ({ options = {}, logger }) => {
return async (req, res, { dataset }) => {
- const rendererConfig = { ...DEFAULTS, ...options };
+ const rendererConfig = { ...DEFAULTS, ...options }
// Honor parameters in the request
if (req.query.technicalCues !== undefined) {
- rendererConfig.technicalCues = toBoolean(req.query.technicalCues);
+ rendererConfig.technicalCues = toBoolean(req.query.technicalCues)
}
if (req.query.embedNamedNodes !== undefined) {
- rendererConfig.embedNamedNodes = toBoolean(req.query.embedNamedNodes);
+ rendererConfig.embedNamedNodes = toBoolean(req.query.embedNamedNodes)
}
if (req.query.embedBlankNodes !== undefined) {
- rendererConfig.embedBlankNodes = toBoolean(req.query.embedBlankNodes);
+ rendererConfig.embedBlankNodes = toBoolean(req.query.embedBlankNodes)
}
if (req.query.embedLists !== undefined) {
- rendererConfig.embedLists = toBoolean(req.query.embedLists);
+ rendererConfig.embedLists = toBoolean(req.query.embedLists)
}
if (req.query.maxLevel !== undefined) {
- rendererConfig.maxLevel = parseInt(req.query.maxLevel);
+ rendererConfig.maxLevel = parseInt(req.query.maxLevel)
}
if (req.query.debug !== undefined) {
- rendererConfig.debug = toBoolean(req.query.debug);
+ rendererConfig.debug = toBoolean(req.query.debug)
}
if (req.query.lang) {
rendererConfig.preferredLanguages = [
req.query.lang,
...DEFAULTS.preferredLanguages,
- ];
+ ]
}
rendererConfig.highlightLanguage =
req.query.highlightLanguage ??
res.locals.currentLanguage ??
- rendererConfig.preferredLanguages[0];
+ rendererConfig.preferredLanguages[0]
if (req.query.compactMode !== undefined) {
- rendererConfig.compactMode = toBoolean(req.query.compactMode);
+ rendererConfig.compactMode = toBoolean(req.query.compactMode)
}
if (rendererConfig.compactMode !== undefined) {
- rendererConfig.groupValuesByProperty = rendererConfig.compactMode;
- rendererConfig.groupPropertiesByValue = rendererConfig.compactMode;
+ rendererConfig.groupValuesByProperty = rendererConfig.compactMode
+ rendererConfig.groupPropertiesByValue = rendererConfig.compactMode
}
if (req.query.simplifiedMode !== undefined) {
- rendererConfig.simplifiedMode = toBoolean(req.query.simplifiedMode);
+ rendererConfig.simplifiedMode = toBoolean(req.query.simplifiedMode)
}
if (rendererConfig.simplifiedMode) {
rendererConfig.ignoreProperties = rdf.termSet([
ns.rdf.type,
...DEFAULT_LABEL_PROPERTIES,
- ]);
+ ])
}
// rendererConfig.showImages = true
- const entityRoot = res.locals?.camouflageRewriteOriginalUrl ?? req.iri;
+ const entityRoot = res.locals?.camouflageRewriteOriginalUrl ?? req.iri
- const term = rdf.namedNode(entityRoot);
- logger?.debug(`Entity root: ${entityRoot}`);
+ const term = rdf.namedNode(entityRoot)
+ logger?.debug(`Entity root: ${entityRoot}`)
// logger?.debug(
// `Effective renderer config: ${JSON.stringify(rendererConfig, null, 2)}`)
- const foundQuad = [...dataset].find((quad) => quad.subject.equals(term));
- const cf = rdf.clownface({ dataset, term: foundQuad ? term : undefined });
+ const foundQuad = [...dataset].find((quad) => quad.subject.equals(term))
+ const cf = rdf.clownface({ dataset, term: foundQuad ? term : undefined })
- rendererConfig.metadata = {};
+ rendererConfig.metadata = {}
- const externalLabels = rdf.clownface({ dataset: rdf.dataset() });
+ const externalLabels = rdf.clownface({ dataset: rdf.dataset() })
// If a labelLoader is configured, try to fetch the labels
if (options.labelLoader) {
- const endpoint = options.labelLoader.endpointUrl || "/query";
+ const endpoint = options.labelLoader.endpointUrl || '/query'
const absoluteUrl =
- res.locals.camouflageRewriteOriginalUrl || req.absoluteUrl();
- const endpointUrl = new URL(endpoint, absoluteUrl);
+ res.locals.camouflageRewriteOriginalUrl || req.absoluteUrl()
+ const endpointUrl = new URL(endpoint, absoluteUrl)
const labelLoader = new LabelLoader({
...options.labelLoader,
endpointUrl,
logger,
- });
- const quadChunks = await labelLoader.tryFetchAll(cf);
- const labelQuads = quadChunks.filter((notNull) => notNull).flat();
+ })
+ const quadChunks = await labelLoader.tryFetchAll(cf)
+ const labelQuads = quadChunks.filter((notNull) => notNull).flat()
logger?.debug(
`Got ${labelQuads.length} new labels from endpointUrl:${endpointUrl}`,
- );
- externalLabels.dataset.addAll(labelQuads);
+ )
+ externalLabels.dataset.addAll(labelQuads)
}
- rendererConfig.externalLabels = externalLabels;
+ rendererConfig.externalLabels = externalLabels
- const resourceWebComponent = TrifidResourceDescription(cf, rendererConfig);
- const stringIterator = renderWebComponent(resourceWebComponent);
- const entityHtml = Array.from(stringIterator).join("");
+ const resourceWebComponent = TrifidResourceDescription(cf, rendererConfig)
+ const stringIterator = renderWebComponent(resourceWebComponent)
+ const entityHtml = Array.from(stringIterator).join('')
- const entityLabel = cf.term ? getLabel(cf, rendererConfig)?.value : "";
- const entityUrl = cf.term?.value;
- logger?.debug(`Label for term: ${cf.term?.value}: ${entityLabel}`);
+ const entityLabel = cf.term ? getLabel(cf, rendererConfig)?.value : ''
+ const entityUrl = cf.term?.value
+ logger?.debug(`Label for term: ${cf.term?.value}: ${entityLabel}`)
return {
entityHtml,
entityLabel,
entityUrl,
- };
- };
-};
+ }
+ }
+}
-export { createEntityRenderer };
+export { createEntityRenderer }
diff --git a/packages/entity-renderer/renderer/labels/labelLoader.js b/packages/entity-renderer/renderer/labels/labelLoader.js
index 41b5a136..119a68be 100644
--- a/packages/entity-renderer/renderer/labels/labelLoader.js
+++ b/packages/entity-renderer/renderer/labels/labelLoader.js
@@ -1,8 +1,8 @@
-import { ns } from "@zazuko/rdf-entity-webcomponent/src/namespaces.js";
+import { ns } from '@zazuko/rdf-entity-webcomponent/src/namespaces.js'
// eslint-disable-next-line import/no-unresolved
-import PQueue from "p-queue";
-import ParsingClient from "sparql-http-client/ParsingClient.js";
-import rdf from "../../env.js";
+import PQueue from 'p-queue'
+import ParsingClient from 'sparql-http-client/ParsingClient.js'
+import rdf from '@zazuko/env'
/**
* endpointUrl: From where the labels are retrieved
@@ -23,72 +23,72 @@ class LabelLoader {
timeout,
authentication,
logger,
- } = options;
+ } = options
if (!endpointUrl) {
- throw Error("requires a endpointUrl");
+ throw Error('requires a endpointUrl')
}
const clientOptions = {
endpointUrl,
- };
+ }
if (authentication?.user) {
- clientOptions.user = authentication.user;
+ clientOptions.user = authentication.user
}
if (authentication?.password) {
- clientOptions.password = authentication.password;
+ clientOptions.password = authentication.password
}
- this.client = new ParsingClient(clientOptions);
- this.labelNamespaces = labelNamespace ? [labelNamespace] : labelNamespaces;
- this.chunkSize = chunkSize || 30;
+ this.client = new ParsingClient(clientOptions)
+ this.labelNamespaces = labelNamespace ? [labelNamespace] : labelNamespaces
+ this.chunkSize = chunkSize || 30
this.queue = new PQueue({
concurrency: concurrency || 2,
timeout: timeout || 1000,
- });
- this.logger = logger;
+ })
+ this.logger = logger
}
- labelFilter(pointer, term) {
+ labelFilter (pointer, term) {
const inNamespaces = (term) => {
if (!this.labelNamespaces || this.labelNamespaces.length === 0) {
- return true;
+ return true
}
for (const current of this.labelNamespaces) {
if (term.value.startsWith(current)) {
- return true;
+ return true
}
}
- return false;
- };
+ return false
+ }
- if (term.termType === "NamedNode") {
+ if (term.termType === 'NamedNode') {
if (inNamespaces(term)) {
- const terms = pointer.node(term).out(ns.schema.name).terms;
- return terms.length === 0;
+ const terms = pointer.node(term).out(ns.schema.name).terms
+ return terms.length === 0
}
}
- return false;
+ return false
}
- getTermsWithoutLabel(pointer) {
- const result = rdf.termSet();
+ getTermsWithoutLabel (pointer) {
+ const result = rdf.termSet()
pointer.dataset.forEach((quad) => {
if (this.labelFilter(pointer, quad.subject)) {
- result.add(quad.subject);
+ result.add(quad.subject)
}
if (this.labelFilter(pointer, quad.predicate)) {
- result.add(quad.predicate);
+ result.add(quad.predicate)
}
if (this.labelFilter(pointer, quad.object)) {
- result.add(quad.object);
+ result.add(quad.object)
}
- });
- return result;
+ })
+ return result
}
- async fetchLabels(iris) {
- const uris = iris.map((x) => `<${x.value}> `).join(" ");
- this.logger?.debug(`Fetching labels for terms without label: ${uris}`);
+ async fetchLabels (iris) {
+ const uris = iris.map((x) => `<${x.value}> `).join(' ')
+ this.logger?.debug(`Fetching labels for terms without label: ${uris}`)
return await this.client.query.construct(`
PREFIX schema: