diff --git a/bin/solid b/bin/solid index 059baef66..427aeb937 100755 --- a/bin/solid +++ b/bin/solid @@ -1,3 +1,3 @@ -#!/usr/bin/env node +#!/usr/bin/env -S node --experimental-require-module const startCli = require('./lib/cli') startCli() diff --git a/bin/solid.js b/bin/solid.js index 059baef66..427aeb937 100755 --- a/bin/solid.js +++ b/bin/solid.js @@ -1,3 +1,3 @@ -#!/usr/bin/env node +#!/usr/bin/env -S node --experimental-require-module const startCli = require('./lib/cli') startCli() diff --git a/lib/create-app.js b/lib/create-app.js index 0cc00b6bb..1a758a003 100644 --- a/lib/create-app.js +++ b/lib/create-app.js @@ -28,6 +28,11 @@ const ResourceMapper = require('./resource-mapper') const aclCheck = require('@solid/acl-check') const { version } = require('../package.json') +const acceptEvents = require('express-accept-events').default +const events = require('express-events-negotiate').default +const eventID = require('express-prep/event-id').default +const prep = require('express-prep').default + const corsSettings = cors({ methods: [ 'OPTIONS', 'HEAD', 'GET', 'PATCH', 'POST', 'PUT', 'DELETE' @@ -61,6 +66,9 @@ function createApp (argv = {}) { const app = express() + // Add PREP support + app.use(acceptEvents, events, eventID, prep) + initAppLocals(app, argv, ldp) initHeaders(app) initViews(app, configPath) diff --git a/lib/handlers/get.js b/lib/handlers/get.js index b73146ce5..422665410 100644 --- a/lib/handlers/get.js +++ b/lib/handlers/get.js @@ -17,6 +17,7 @@ const translate = require('../utils.js').translate const error = require('../http-error') const RDFs = require('../ldp').mimeTypesAsArray() +const isRdf = require('../ldp').mimeTypeIsRdf async function handler (req, res, next) { const ldp = req.app.locals.ldp @@ -110,15 +111,39 @@ async function handler (req, res, next) { } // If request accepts the content-type we found + // if (stream && negotiator.mediaType([contentType])) { + // res.setHeader('Content-Type', contentType) + // if (contentRange) { + // const headers = { 'Content-Range': contentRange, 'Accept-Ranges': 'bytes', 'Content-Length': chunksize } + // res.writeHead(206, headers) + // return stream.pipe(res) + // } else { + // return stream.pipe(res) + // } + // } + if (stream && negotiator.mediaType([contentType])) { - res.setHeader('Content-Type', contentType) + let headers = { + 'Content-Type': contentType + } if (contentRange) { - const headers = { 'Content-Range': contentRange, 'Accept-Ranges': 'bytes', 'Content-Length': chunksize } - res.writeHead(206, headers) - return stream.pipe(res) - } else { - return stream.pipe(res) + headers = { + ...headers, + 'Content-Range': contentRange, + 'Accept-Ranges': 'bytes', + 'Content-Length': chunksize + } + res.statusCode = 206 } + + if (isRdf(contentType) && !res.sendEvents({ + config: { prep: '' }, + body: stream, + isBodyStream: true, + headers + })) return + res.set(headers) + return stream.pipe(res) } // If it is not in our RDFs we can't even translate, @@ -130,6 +155,14 @@ async function handler (req, res, next) { // Translate from the contentType found to the possibleRDFType desired const data = await translate(stream, baseUri, contentType, possibleRDFType) debug(req.originalUrl + ' translating ' + contentType + ' -> ' + possibleRDFType) + const headers = { + 'Content-Type': possibleRDFType + } + if (isRdf(contentType) && !res.sendEvents({ + config: { prep: '' }, + body: data, + headers + })) return res.setHeader('Content-Type', possibleRDFType) res.send(data) return next() diff --git a/lib/handlers/notify.js b/lib/handlers/notify.js new file mode 100644 index 000000000..42ec21fa7 --- /dev/null +++ b/lib/handlers/notify.js @@ -0,0 +1,12 @@ +module.exports = handler + +function handler (req, res, next) { + res.events.prep.trigger({ + generateNotifications () { + return res.events.prep.defaultNotification({ + ...(res.method === 'POST') && { location: res.getHeader('Content-Location') } + }) + } + }) + next() +} diff --git a/lib/ldp-middleware.js b/lib/ldp-middleware.js index 07b1a82d4..cb76d341b 100644 --- a/lib/ldp-middleware.js +++ b/lib/ldp-middleware.js @@ -10,6 +10,7 @@ const del = require('./handlers/delete') const patch = require('./handlers/patch') const index = require('./handlers/index') const copy = require('./handlers/copy') +const notify = require('./handlers/notify') function LdpMiddleware (corsSettings) { const router = express.Router('/') @@ -24,9 +25,9 @@ function LdpMiddleware (corsSettings) { router.copy('/*', allow('Write'), copy) router.get('/*', index, allow('Read'), header.addPermissions, get) router.post('/*', allow('Append'), post) - router.patch('/*', allow('Append'), patch) + router.patch('/*', allow('Append'), patch, notify) router.put('/*', allow('Append'), put) - router.delete('/*', allow('Write'), del) + router.delete('/*', allow('Write'), del, notify) return router } diff --git a/package-lock.json b/package-lock.json index 731e9a292..7a875cf45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,10 @@ "cors": "^2.8.5", "debug": "^4.3.4", "express": "^4.18.3", + "express-accept-events": "^0.2.2", "express-handlebars": "^5.3.5", + "express-negotiate-events": "^0.2.1", + "express-prep": "^0.5.0", "express-session": "^1.18.0", "extend": "^3.0.2", "from2": "^2.3.0", @@ -89,7 +92,7 @@ "whatwg-url": "11.0.0" }, "engines": { - "node": ">=12.0" + "node": ">=22.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -4127,7 +4130,9 @@ "node_modules/@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", - "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==" + "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", + "optional": true, + "peer": true }, "node_modules/@graphql-typed-document-node/core": { "version": "3.2.0", @@ -4770,6 +4775,8 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz", "integrity": "sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==", + "optional": true, + "peer": true, "dependencies": { "@gar/promisify": "^1.0.1", "semver": "^7.3.5" @@ -4780,6 +4787,8 @@ "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", "integrity": "sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==", "deprecated": "This functionality has been moved to @npmcli/fs", + "optional": true, + "peer": true, "dependencies": { "mkdirp": "^1.0.4", "rimraf": "^3.0.2" @@ -4792,6 +4801,8 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "optional": true, + "peer": true, "bin": { "mkdirp": "bin/cmd.js" }, @@ -6655,6 +6666,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "devOptional": true, "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" @@ -6831,7 +6843,8 @@ "node_modules/archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==" + "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==", + "dev": true }, "node_modules/arg": { "version": "4.1.0", @@ -7713,6 +7726,8 @@ "version": "15.3.0", "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.3.0.tgz", "integrity": "sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==", + "optional": true, + "peer": true, "dependencies": { "@npmcli/fs": "^1.0.0", "@npmcli/move-file": "^1.0.1", @@ -7741,6 +7756,8 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "optional": true, + "peer": true, "dependencies": { "yallist": "^4.0.0" }, @@ -7752,6 +7769,8 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "optional": true, + "peer": true, "bin": { "mkdirp": "bin/cmd.js" }, @@ -7762,7 +7781,9 @@ "node_modules/cacache/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "optional": true, + "peer": true }, "node_modules/cached-path-relative": { "version": "1.1.0", @@ -8048,6 +8069,8 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "optional": true, + "peer": true, "engines": { "node": ">=10" } @@ -8119,6 +8142,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "devOptional": true, "engines": { "node": ">=6" } @@ -8856,6 +8880,20 @@ "node": ">=0.10.0" } }, + "node_modules/dedent": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", + "integrity": "sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==", + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, "node_modules/deep-eql": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", @@ -10573,6 +10611,46 @@ "node": ">= 0.10.0" } }, + "node_modules/express-accept-events": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/express-accept-events/-/express-accept-events-0.2.2.tgz", + "integrity": "sha512-P9hVug6sMVZAFqzYK0vc/J18/PRXyaKCEBbvVYemEJEhb68MNNffiI/KZq3iDaWlHWYR+35BxM5n1FqFqHyKHg==", + "license": "MPL-2.0", + "dependencies": { + "debug": "^4.3.5", + "no-try": "^4.0.0", + "structured-field-utils": "1.1.0-nested-sf.0", + "structured-headers": "npm:@cxres/structured-headers@2.0.0-alpha.1-nesting.0" + } + }, + "node_modules/express-accept-events/node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/express-accept-events/node_modules/structured-headers": { + "name": "@cxres/structured-headers", + "version": "2.0.0-alpha.1-nesting.0", + "resolved": "https://registry.npmjs.org/@cxres/structured-headers/-/structured-headers-2.0.0-alpha.1-nesting.0.tgz", + "integrity": "sha512-MYHRF2oS3Zvumh3swXs//GDGNe6L+sYnwplitC8Ns8CFQro+WKCidDrgk+suLq2Wm6e0ohIvEWqB8VM1mqbR8g==", + "license": "MIT", + "engines": { + "node": ">=18", + "npm": ">=6" + } + }, "node_modules/express-handlebars": { "version": "5.3.5", "resolved": "https://registry.npmjs.org/express-handlebars/-/express-handlebars-5.3.5.tgz", @@ -10586,6 +10664,123 @@ "node": ">=v10.24.1" } }, + "node_modules/express-negotiate-events": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/express-negotiate-events/-/express-negotiate-events-0.2.1.tgz", + "integrity": "sha512-ehSjuJ8MCPXKb+UsoNEWzosr9qOQPgzJng1xVi5UDSdsCCuN8YgseULxxMxwqnTMfVpceQ0F1Mpgdz+mQyRrJg==", + "license": "MPL-2.0", + "dependencies": { + "debug": "^4.3.5", + "structured-headers": "npm:@cxres/structured-headers@2.0.0-alpha.1-nesting.0" + } + }, + "node_modules/express-negotiate-events/node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/express-negotiate-events/node_modules/structured-headers": { + "name": "@cxres/structured-headers", + "version": "2.0.0-alpha.1-nesting.0", + "resolved": "https://registry.npmjs.org/@cxres/structured-headers/-/structured-headers-2.0.0-alpha.1-nesting.0.tgz", + "integrity": "sha512-MYHRF2oS3Zvumh3swXs//GDGNe6L+sYnwplitC8Ns8CFQro+WKCidDrgk+suLq2Wm6e0ohIvEWqB8VM1mqbR8g==", + "license": "MIT", + "engines": { + "node": ">=18", + "npm": ">=6" + } + }, + "node_modules/express-prep": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/express-prep/-/express-prep-0.5.0.tgz", + "integrity": "sha512-TdFsBOW4fMXxmKg4FA5ah/NRPKGx853huf27QyQj+nuKrH32ajVdiGWTQTQerU/vYdlyZzeJh4Cr5kyFge3x/g==", + "license": "MPL-2.0", + "dependencies": { + "crypto-random-string": "^5.0.0", + "debug": "^4.3.5", + "dedent": "^1.5.3", + "lodash": "^4.17.21", + "no-try": "^4.0.0", + "structured-field-utils": "1.1.0-nested-sf.0", + "structured-headers": "npm:@cxres/structured-headers@2.0.0-alpha.1-nesting.0" + }, + "peerDependencies": { + "express-accept-events": "^0.2.2", + "express-negotiate-events": "^0.2.1" + }, + "peerDependenciesMeta": { + "express-negotiate-events": { + "optional": true + } + } + }, + "node_modules/express-prep/node_modules/crypto-random-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-5.0.0.tgz", + "integrity": "sha512-KWjTXWwxFd6a94m5CdRGW/t82Tr8DoBc9dNnPCAbFI1EBweN6v1tv8y4Y1m7ndkp/nkIBRxUxAzpaBnR2k3bcQ==", + "license": "MIT", + "dependencies": { + "type-fest": "^2.12.2" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/express-prep/node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/express-prep/node_modules/structured-headers": { + "name": "@cxres/structured-headers", + "version": "2.0.0-alpha.1-nesting.0", + "resolved": "https://registry.npmjs.org/@cxres/structured-headers/-/structured-headers-2.0.0-alpha.1-nesting.0.tgz", + "integrity": "sha512-MYHRF2oS3Zvumh3swXs//GDGNe6L+sYnwplitC8Ns8CFQro+WKCidDrgk+suLq2Wm6e0ohIvEWqB8VM1mqbR8g==", + "license": "MIT", + "engines": { + "node": ">=18", + "npm": ">=6" + } + }, + "node_modules/express-prep/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/express-session": { "version": "1.18.0", "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.18.0.tgz", @@ -11174,6 +11369,8 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "optional": true, + "peer": true, "dependencies": { "minipass": "^3.0.0" }, @@ -11839,6 +12036,8 @@ "version": "3.0.8", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.8.tgz", "integrity": "sha512-aXpmwoOhRBrw6X3j0h5RloK4x1OzsxMPyxqIHyNfSe2pypkVTZFpEiRoSipPEPlMrh0HW/XsjkJ5WgnCirpNUw==", + "optional": true, + "peer": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -11850,6 +12049,8 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "optional": true, + "peer": true, "dependencies": { "yallist": "^4.0.0" }, @@ -11860,7 +12061,9 @@ "node_modules/hosted-git-info/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "optional": true, + "peer": true }, "node_modules/html-escaper": { "version": "2.0.2", @@ -12068,6 +12271,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "devOptional": true, "engines": { "node": ">=8" } @@ -12075,7 +12279,9 @@ "node_modules/infer-owner": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", - "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==" + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "optional": true, + "peer": true }, "node_modules/inflight": { "version": "1.0.6", @@ -15781,6 +15987,8 @@ "version": "3.1.6", "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz", "integrity": "sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==", + "optional": true, + "peer": true, "dependencies": { "yallist": "^4.0.0" }, @@ -15792,6 +16000,8 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "optional": true, + "peer": true, "dependencies": { "minipass": "^3.0.0" }, @@ -15803,6 +16013,8 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "optional": true, + "peer": true, "dependencies": { "minipass": "^3.0.0" }, @@ -15814,6 +16026,8 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "optional": true, + "peer": true, "dependencies": { "minipass": "^3.0.0" }, @@ -15824,12 +16038,16 @@ "node_modules/minipass/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "optional": true, + "peer": true }, "node_modules/minizlib": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "optional": true, + "peer": true, "dependencies": { "minipass": "^3.0.0", "yallist": "^4.0.0" @@ -15841,12 +16059,16 @@ "node_modules/minizlib/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "optional": true, + "peer": true }, "node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "optional": true, + "peer": true, "dependencies": { "minimist": "^1.2.6" }, @@ -16186,6 +16408,12 @@ "isarray": "0.0.1" } }, + "node_modules/no-try": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/no-try/-/no-try-4.0.0.tgz", + "integrity": "sha512-M8zkUDrlKRXhEoDRDWt/5sJEXg4xRGL8rXvHDCXLH3J8QnfJsFjztYmAyJhLEMSMNsZkewXIxn9JO+pd73R5zg==", + "license": "MIT" + }, "node_modules/nocache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/nocache/-/nocache-3.0.4.tgz", @@ -16614,6 +16842,8 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-7.0.0.tgz", "integrity": "sha512-xXxr8y5U0kl8dVkz2oK7yZjPBvqM2fwaO5l3Yg13p03v8+E3qQcD0JNhHzjL1vyGgxcKkD0cco+NLR72iuPk3g==", + "optional": true, + "peer": true, "dependencies": { "hosted-git-info": "^3.0.2", "osenv": "^0.1.5", @@ -16625,6 +16855,8 @@ "version": "5.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "optional": true, + "peer": true, "bin": { "semver": "bin/semver" } @@ -16656,7 +16888,6 @@ "version": "1.5.0", "inBundle": true, "license": "MIT", - "optional": true, "engines": { "node": ">=0.1.90" } @@ -17319,7 +17550,6 @@ "version": "0.1.13", "inBundle": true, "license": "MIT", - "optional": true, "dependencies": { "iconv-lite": "^0.6.2" } @@ -17481,7 +17711,6 @@ "version": "0.6.3", "inBundle": true, "license": "MIT", - "optional": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -18552,8 +18781,7 @@ "node_modules/npm/node_modules/safer-buffer": { "version": "2.1.2", "inBundle": true, - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/npm/node_modules/semver": { "version": "7.3.7", @@ -19290,6 +19518,8 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -19315,6 +19545,8 @@ "version": "0.1.5", "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "optional": true, + "peer": true, "dependencies": { "os-homedir": "^1.0.0", "os-tmpdir": "^1.0.0" @@ -19375,6 +19607,8 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "optional": true, + "peer": true, "dependencies": { "aggregate-error": "^3.0.0" }, @@ -20163,7 +20397,9 @@ "node_modules/promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==" + "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", + "optional": true, + "peer": true }, "node_modules/prompts": { "version": "2.4.2", @@ -20287,6 +20523,8 @@ "version": "0.11.0", "resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.11.0.tgz", "integrity": "sha512-Uu7ii+FQy4Qf82G4xu7ShHhjhGahEpCWc3x8UavY3CTcWV+ufmmCtwkr7ZKsX42jdL0kr1B5FKUeqJvAn51jzQ==", + "optional": true, + "peer": true, "bin": { "qrcode-terminal": "bin/qrcode-terminal.js" } @@ -22537,6 +22775,8 @@ "version": "8.0.1", "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", + "optional": true, + "peer": true, "dependencies": { "minipass": "^3.1.1" }, @@ -23020,6 +23260,26 @@ "optional": true, "peer": true }, + "node_modules/structured-field-utils": { + "version": "1.1.0-nested-sf.0", + "resolved": "https://registry.npmjs.org/structured-field-utils/-/structured-field-utils-1.1.0-nested-sf.0.tgz", + "integrity": "sha512-fISHrNmYK9c1PZFxQdMPG19d3uVv1lXwiW9MkKEjjU8SWkpfPWMXmYt7Pw3lt7TshOjPauO8EgTgcu85qMga9g==", + "license": "MPL-2.0", + "dependencies": { + "structured-headers": "npm:@cxres/structured-headers@2.0.0-alpha.1-nesting.0" + } + }, + "node_modules/structured-field-utils/node_modules/structured-headers": { + "name": "@cxres/structured-headers", + "version": "2.0.0-alpha.1-nesting.0", + "resolved": "https://registry.npmjs.org/@cxres/structured-headers/-/structured-headers-2.0.0-alpha.1-nesting.0.tgz", + "integrity": "sha512-MYHRF2oS3Zvumh3swXs//GDGNe6L+sYnwplitC8Ns8CFQro+WKCidDrgk+suLq2Wm6e0ohIvEWqB8VM1mqbR8g==", + "license": "MIT", + "engines": { + "node": ">=18", + "npm": ">=6" + } + }, "node_modules/structured-headers": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/structured-headers/-/structured-headers-0.4.1.tgz", @@ -23326,6 +23586,8 @@ "version": "6.2.0", "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", + "optional": true, + "peer": true, "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", @@ -23342,6 +23604,8 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -23350,6 +23614,8 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "optional": true, + "peer": true, "bin": { "mkdirp": "bin/cmd.js" }, @@ -23360,7 +23626,9 @@ "node_modules/tar/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "optional": true, + "peer": true }, "node_modules/temp": { "version": "0.8.4", @@ -24043,6 +24311,8 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "optional": true, + "peer": true, "dependencies": { "unique-slug": "^2.0.0" } @@ -24051,6 +24321,8 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "optional": true, + "peer": true, "dependencies": { "imurmurhash": "^0.1.4" } @@ -24207,6 +24479,8 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", "integrity": "sha512-M6w37eVCMMouJ9V/sdPGnC5H4uDr73/+xdq0FBLO3TFFX1+7wiUY6Es328NN+y43tmY+doUdN9g9J21vqB7iLw==", + "optional": true, + "peer": true, "dependencies": { "builtins": "^1.0.3" } @@ -24214,7 +24488,9 @@ "node_modules/validate-npm-package-name/node_modules/builtins": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", - "integrity": "sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==" + "integrity": "sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==", + "optional": true, + "peer": true }, "node_modules/validator": { "version": "13.11.0", @@ -24498,6 +24774,8 @@ "version": "2.4.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", + "optional": true, + "peer": true, "dependencies": { "graceful-fs": "^4.1.11", "imurmurhash": "^0.1.4", diff --git a/package.json b/package.json index 9349a066d..194949dcf 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,10 @@ "cors": "^2.8.5", "debug": "^4.3.4", "express": "^4.18.3", + "express-accept-events": "^0.2.2", "express-handlebars": "^5.3.5", + "express-negotiate-events": "^0.2.1", + "express-prep": "^0.5.0", "express-session": "^1.18.0", "extend": "^3.0.2", "from2": "^2.3.0", @@ -141,12 +144,12 @@ "main": "index.js", "scripts": { "build": "echo nothing to build", - "solid": "node ./bin/solid", + "solid": "node --experimental-require-module ./bin/solid", "standard": "standard \"{bin,examples,lib,test}/**/*.js\"", "validate": "node ./test/validate-turtle.js", - "nyc": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 nyc --reporter=text-summary mocha --recursive test/integration/ test/unit/", - "mocha": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --recursive test/integration/ test/unit/", - "mocha-integration": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --recursive test/integration/http-test.js", + "nyc": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 nyc --reporter=text-summary mocha -n experimental-require-module --recursive test/integration/ test/unit/", + "mocha": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha -n experimental-require-module --recursive test/integration/ test/unit/", + "mocha-integration": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha -n experimental-require-module --recursive test/integration/http-test.js", "mocha-account-creation-oidc": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --recursive test/integration/account-creation-oidc-test.js", "mocha-account-manager": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --recursive test/integration/account-manager-test.js", "mocha-account-template": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --recursive test/integration/account-template-test.js", @@ -181,6 +184,6 @@ "solid": "bin/solid" }, "engines": { - "node": ">=12.0" + "node": ">=22.0" } }