-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
3,449 additions
and
1,777 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ coverage | |
!.eslintrc.js | ||
!test/eslintrc.js | ||
!jest.config.js | ||
|
||
components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,4 @@ | ||
#!/usr/bin/env node | ||
import yargs from 'yargs'; | ||
import { | ||
AcceptPreferenceParser, | ||
AuthenticatedLdpHandler, | ||
BasePermissionsExtractor, | ||
CompositeAsyncHandler, | ||
ExpressHttpServer, | ||
HttpRequest, | ||
PatchingStore, | ||
QuadToTurtleConverter, | ||
Representation, | ||
RepresentationConvertingStore, | ||
RuntimeConfig, | ||
Setup, | ||
SimpleAclAuthorizer, | ||
SimpleBodyParser, | ||
SimpleCredentialsExtractor, | ||
SimpleDeleteOperationHandler, | ||
SimpleExtensionAclManager, | ||
SimpleGetOperationHandler, | ||
SimplePatchOperationHandler, | ||
SimplePostOperationHandler, | ||
SimplePutOperationHandler, | ||
SimpleRequestParser, | ||
SimpleResourceStore, | ||
SimpleResponseWriter, | ||
SimpleSparqlUpdateBodyParser, | ||
SimpleSparqlUpdatePatchHandler, | ||
SimpleTargetExtractor, | ||
SingleThreadedResourceLocker, | ||
SparqlPatchPermissionsExtractor, | ||
TurtleToQuadConverter, | ||
UrlContainerManager, | ||
} from '..'; | ||
|
||
const { argv } = yargs | ||
.usage('node ./bin/server.js [args]') | ||
.options({ | ||
port: { type: 'number', alias: 'p' }, | ||
}) | ||
.help(); | ||
|
||
// This is instead of the dependency injection that still needs to be added | ||
const runtimeConfig = new RuntimeConfig(); | ||
|
||
const bodyParser = new CompositeAsyncHandler<HttpRequest, Representation | undefined>([ | ||
new SimpleSparqlUpdateBodyParser(), | ||
new SimpleBodyParser(), | ||
]); | ||
const requestParser = new SimpleRequestParser({ | ||
targetExtractor: new SimpleTargetExtractor(), | ||
preferenceParser: new AcceptPreferenceParser(), | ||
bodyParser, | ||
}); | ||
|
||
const credentialsExtractor = new SimpleCredentialsExtractor(); | ||
const permissionsExtractor = new CompositeAsyncHandler([ | ||
new BasePermissionsExtractor(), | ||
new SparqlPatchPermissionsExtractor(), | ||
]); | ||
|
||
// Will have to see how to best handle this | ||
const store = new SimpleResourceStore(runtimeConfig); | ||
const converter = new CompositeAsyncHandler([ | ||
new TurtleToQuadConverter(), | ||
new QuadToTurtleConverter(), | ||
]); | ||
const convertingStore = new RepresentationConvertingStore(store, converter); | ||
const locker = new SingleThreadedResourceLocker(); | ||
const patcher = new SimpleSparqlUpdatePatchHandler(convertingStore, locker); | ||
const patchingStore = new PatchingStore(convertingStore, patcher); | ||
|
||
const aclManager = new SimpleExtensionAclManager(); | ||
const containerManager = new UrlContainerManager(runtimeConfig); | ||
const authorizer = new SimpleAclAuthorizer(aclManager, containerManager, patchingStore); | ||
|
||
const operationHandler = new CompositeAsyncHandler([ | ||
new SimpleDeleteOperationHandler(patchingStore), | ||
new SimpleGetOperationHandler(patchingStore), | ||
new SimplePatchOperationHandler(patchingStore), | ||
new SimplePostOperationHandler(patchingStore), | ||
new SimplePutOperationHandler(patchingStore), | ||
]); | ||
|
||
const responseWriter = new SimpleResponseWriter(); | ||
|
||
const httpHandler = new AuthenticatedLdpHandler({ | ||
requestParser, | ||
credentialsExtractor, | ||
permissionsExtractor, | ||
authorizer, | ||
operationHandler, | ||
responseWriter, | ||
}); | ||
|
||
const httpServer = new ExpressHttpServer(httpHandler); | ||
|
||
const setup = new Setup(httpServer, store, aclManager, runtimeConfig); | ||
|
||
runtimeConfig.reset({ port: argv.port }); | ||
setup.setup().then((): void => { | ||
process.stdout.write(`Running at ${runtimeConfig.base}\n`); | ||
}).catch((error): void => { | ||
process.stderr.write(`${error}\n`); | ||
process.exit(1); | ||
}); | ||
import * as Path from 'path'; | ||
import { runCli } from '../src/init/CliRunner'; | ||
runCli(Path.join(__dirname, '..')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^1.0.0/components/context.jsonld", | ||
"import": [ | ||
"files-scs:config/presets/acl.json", | ||
"files-scs:config/presets/http.json", | ||
"files-scs:config/presets/ldp.json", | ||
"files-scs:config/presets/setup.json", | ||
"files-scs:config/presets/storage.json" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^1.0.0/components/context.jsonld", | ||
"@graph": [ | ||
{ | ||
"@id": "urn:solid-server:my:AclManager", | ||
"@type": "SimpleExtensionAclManager" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^1.0.0/components/context.jsonld", | ||
"@graph": [ | ||
{ | ||
"@id": "urn:solid-server:my:HttpServer", | ||
"@type": "ExpressHttpServer", | ||
"ExpressHttpServer:_handler": { | ||
"@id": "urn:solid-server:my:HttpHandler" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^1.0.0/components/context.jsonld", | ||
"@graph": [ | ||
{ | ||
"@id": "urn:solid-server:my:HttpHandler", | ||
"@type": "AuthenticatedLdpHandler", | ||
|
||
"AuthenticatedLdpHandler:_requestParser": { | ||
"@type": "SimpleRequestParser", | ||
"SimpleRequestParser:_targetExtractor": { | ||
"@type": "SimpleTargetExtractor" | ||
}, | ||
"SimpleRequestParser:_preferenceParser": { | ||
"@type": "AcceptPreferenceParser" | ||
}, | ||
"SimpleRequestParser:_bodyParser": { | ||
"@type": "CompositeAsyncHandler", | ||
"CompositeAsyncHandler:_handlers": [ | ||
{ | ||
"@type": "SimpleSparqlUpdateBodyParser" | ||
}, | ||
{ | ||
"@type": "SimpleBodyParser" | ||
} | ||
] | ||
} | ||
}, | ||
|
||
"AuthenticatedLdpHandler:_credentialsExtractor": { | ||
"@type": "SimpleCredentialsExtractor" | ||
}, | ||
|
||
"AuthenticatedLdpHandler:_permissionsExtractor": { | ||
"@type": "CompositeAsyncHandler", | ||
"CompositeAsyncHandler:_handlers": [ | ||
{ | ||
"@type": "BasePermissionsExtractor" | ||
}, | ||
{ | ||
"@type": "SparqlPatchPermissionsExtractor" | ||
} | ||
] | ||
}, | ||
|
||
"AuthenticatedLdpHandler:_authorizer": { | ||
"@type": "SimpleAclAuthorizer", | ||
"SimpleAclAuthorizer:_aclManager": { | ||
"@id": "urn:solid-server:my:AclManager" | ||
}, | ||
"SimpleAclAuthorizer:_containerManager": { | ||
"@id": "urn:solid-server:my:UrlContainerManager" | ||
}, | ||
"SimpleAclAuthorizer:_resourceStore": { | ||
"@id": "urn:solid-server:my:ResourceStore" | ||
} | ||
}, | ||
|
||
"AuthenticatedLdpHandler:_operationHandler": { | ||
"@type": "CompositeAsyncHandler", | ||
"CompositeAsyncHandler:_handlers": [ | ||
{ | ||
"@type": "SimpleDeleteOperationHandler", | ||
"SimpleDeleteOperationHandler:_store": { | ||
"@id": "urn:solid-server:my:ResourceStore" | ||
} | ||
}, | ||
{ | ||
"@type": "SimpleGetOperationHandler", | ||
"SimpleGetOperationHandler:_store": { | ||
"@id": "urn:solid-server:my:ResourceStore" | ||
} | ||
}, | ||
{ | ||
"@type": "SimplePatchOperationHandler", | ||
"SimplePatchOperationHandler:_store": { | ||
"@id": "urn:solid-server:my:ResourceStore" | ||
} | ||
}, | ||
{ | ||
"@type": "SimplePostOperationHandler", | ||
"SimplePostOperationHandler:_store": { | ||
"@id": "urn:solid-server:my:ResourceStore" | ||
} | ||
}, | ||
{ | ||
"@type": "SimplePutOperationHandler", | ||
"SimplePutOperationHandler:_store": { | ||
"@id": "urn:solid-server:my:ResourceStore" | ||
} | ||
} | ||
] | ||
}, | ||
|
||
"AuthenticatedLdpHandler:_responseWriter": { | ||
"@type": "SimpleResponseWriter" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^1.0.0/components/context.jsonld", | ||
"@graph": [ | ||
{ | ||
"@id": "urn:solid-server:my", | ||
"@type": "Setup", | ||
"Setup:_httpServer": { | ||
"@id": "urn:solid-server:my:HttpServer" | ||
}, | ||
"Setup:_store": { | ||
"@id": "urn:solid-server:my:ResourceStore" | ||
}, | ||
"Setup:_aclManager": { | ||
"@id": "urn:solid-server:my:AclManager" | ||
}, | ||
"Setup:_runtimeConfig": { | ||
"@id": "urn:solid-server:my:RuntimeConfig", | ||
"@type": "RuntimeConfig", | ||
"RuntimeConfigData:_port": 3000 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^1.0.0/components/context.jsonld", | ||
"@graph": [ | ||
{ | ||
"@id": "urn:solid-server:my:ResourceLocker", | ||
"@type": "SingleThreadedResourceLocker" | ||
}, | ||
|
||
{ | ||
"@id": "urn:solid-server:my:ResourceStore", | ||
"@type": "PatchingStore", | ||
"PatchingStore:_source": { | ||
"@id": "urn:solid-server:my:ResourceStore_Converting" | ||
}, | ||
"PatchingStore:_patcher": { | ||
"@id": "urn:solid-server:my:PatchHandler", | ||
"@type": "SimpleSparqlUpdatePatchHandler", | ||
"SimpleSparqlUpdatePatchHandler:_source": { | ||
"@id": "urn:solid-server:my:ResourceStore_Converting" | ||
}, | ||
"SimpleSparqlUpdatePatchHandler:_locker": { | ||
"@id": "urn:solid-server:my:ResourceLocker" | ||
} | ||
} | ||
}, | ||
|
||
{ | ||
"@id": "urn:solid-server:my:ResourceStore_Converting", | ||
"@type": "RepresentationConvertingStore", | ||
"RepresentationConvertingStore:_source": { | ||
"@type": "SimpleResourceStore", | ||
"SimpleResourceStore:_runtimeConfig": { | ||
"@id": "urn:solid-server:my:RuntimeConfig" | ||
} | ||
}, | ||
"RepresentationConvertingStore:_converter": { | ||
"@type": "CompositeAsyncHandler", | ||
"CompositeAsyncHandler:_handlers": [ | ||
{ | ||
"@type": "TurtleToQuadConverter" | ||
}, | ||
{ | ||
"@type": "QuadToTurtleConverter" | ||
} | ||
] | ||
} | ||
}, | ||
|
||
{ | ||
"@id": "urn:solid-server:my:UrlContainerManager", | ||
"@type": "UrlContainerManager", | ||
"UrlContainerManager:_runtimeConfig": { | ||
"@id": "urn:solid-server:my:RuntimeConfig" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.