mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
Merge branch 'main' into versions/4.0.0
This commit is contained in:
@@ -38,7 +38,7 @@ export class PatchOperationHandler extends OperationHandler {
|
||||
throw new BadRequestHttpError('PATCH requests require the Content-Type header to be set');
|
||||
}
|
||||
// A more efficient approach would be to have the server return metadata indicating if a resource was new
|
||||
// See https://github.com/solid/community-server/issues/632
|
||||
// See https://github.com/CommunitySolidServer/CommunitySolidServer/issues/632
|
||||
// RFC7231, §4.3.4: If the target resource does not have a current representation and the
|
||||
// PUT successfully creates one, then the origin server MUST inform the
|
||||
// user agent by sending a 201 (Created) response.
|
||||
|
||||
@@ -37,7 +37,7 @@ export class PutOperationHandler extends OperationHandler {
|
||||
throw new BadRequestHttpError('PUT requests require the Content-Type header to be set');
|
||||
}
|
||||
// A more efficient approach would be to have the server return metadata indicating if a resource was new
|
||||
// See https://github.com/solid/community-server/issues/632
|
||||
// See https://github.com/CommunitySolidServer/CommunitySolidServer/issues/632
|
||||
const exists = await this.store.hasResource(operation.target);
|
||||
await this.store.setRepresentation(operation.target, operation.body, operation.conditions);
|
||||
if (exists) {
|
||||
|
||||
@@ -209,7 +209,7 @@ export class IdentityProviderFactory implements ProviderFactory {
|
||||
private configureClaims(config: Configuration): void {
|
||||
// Returns the id_token
|
||||
// See https://solid.github.io/authentication-panel/solid-oidc/#tokens-id
|
||||
// Some fields are still missing, see https://github.com/solid/community-server/issues/1154#issuecomment-1040233385
|
||||
// Some fields are still missing, see https://github.com/CommunitySolidServer/CommunitySolidServer/issues/1154#issuecomment-1040233385
|
||||
config.findAccount = async(ctx: KoaContextWithOIDC, sub: string): Promise<Account> => ({
|
||||
accountId: sub,
|
||||
async claims(): Promise<{ sub: string; [key: string]: any }> {
|
||||
|
||||
@@ -96,7 +96,7 @@ export class LockingResourceStore implements AtomicResourceStore {
|
||||
// Note that we can't just return the result of `withReadLock` since that promise only
|
||||
// resolves when the stream is finished, while we want `lockedRepresentationRun` to resolve
|
||||
// once we have the Representation.
|
||||
// See https://github.com/solid/community-server/pull/536#discussion_r562467957
|
||||
// See https://github.com/CommunitySolidServer/CommunitySolidServer/pull/536#discussion_r562467957
|
||||
return new Promise((resolve, reject): void => {
|
||||
let representation: Representation;
|
||||
// Make the resource time out to ensure that the lock is always released eventually.
|
||||
|
||||
@@ -125,7 +125,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
}
|
||||
const { name, parent } = this.getRelatedNames(identifier);
|
||||
|
||||
const triples = await arrayifyStream(data) as Quad[];
|
||||
const triples = await arrayifyStream<Quad>(data);
|
||||
const def = defaultGraph();
|
||||
if (triples.some((triple): boolean => !def.equals(triple.graph))) {
|
||||
throw new NotImplementedHttpError('Only triples in the default graph are supported.');
|
||||
|
||||
@@ -34,7 +34,7 @@ export class ValidatingDataAccessor extends PassthroughDataAccessor {
|
||||
public async writeContainer(identifier: ResourceIdentifier, metadata: RepresentationMetadata): Promise<void> {
|
||||
// A container's data mainly resides in its metadata,
|
||||
// of which we can't calculate the disk size of at this point in the code.
|
||||
// Extra info can be found here: https://github.com/solid/community-server/pull/973#discussion_r723376888
|
||||
// Extra info can be found here: https://github.com/CommunitySolidServer/CommunitySolidServer/pull/973#discussion_r723376888
|
||||
return this.accessor.writeContainer(identifier, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ type ConversionPath = {
|
||||
* Most of these decrease computation time at the cost of more memory.
|
||||
* - The algorithm could start on both ends of a possible path and work towards the middle.
|
||||
* - When creating a path, store the list of unused converters instead of checking every step.
|
||||
* - Caching: https://github.com/solid/community-server/issues/832
|
||||
* - Caching: https://github.com/CommunitySolidServer/CommunitySolidServer/issues/832
|
||||
* - Making sure each intermediate type is only used once.
|
||||
* - The TypedRepresentationConverter interface could potentially be updated
|
||||
* so paths only differing in intermediate types can be combined.
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function fetchDataset(url: string): Promise<Representation> {
|
||||
return (async(): Promise<Representation> => {
|
||||
try {
|
||||
const quadStream = (await rdfDereferencer.dereference(url)).quads as Readable;
|
||||
const quadArray = await arrayifyStream(quadStream) as Quad[];
|
||||
const quadArray = await arrayifyStream<Quad>(quadStream);
|
||||
return new BasicRepresentation(quadArray, { path: url }, INTERNAL_QUADS, false);
|
||||
} catch {
|
||||
throw new BadRequestHttpError(`Could not parse resource at URL (${url})!`);
|
||||
|
||||
@@ -32,7 +32,7 @@ export function isGuarded<T extends NodeJS.EventEmitter>(stream: T): stream is G
|
||||
*
|
||||
* It is important that this listener always remains attached for edge cases where an error listener gets removed
|
||||
* and the number of error listeners is checked immediately afterwards.
|
||||
* See https://github.com/solid/community-server/pull/462#issuecomment-758013492 .
|
||||
* See https://github.com/CommunitySolidServer/CommunitySolidServer/pull/462#issuecomment-758013492 .
|
||||
*/
|
||||
function guardingErrorListener(this: Guarded, error: Error): void {
|
||||
// Only fall back to this if no new listeners are attached since guarding started.
|
||||
|
||||
@@ -22,7 +22,7 @@ const logger = getLoggerFor('StreamUtil');
|
||||
* @returns The joined string.
|
||||
*/
|
||||
export async function readableToString(stream: Readable): Promise<string> {
|
||||
return (await arrayifyStream(stream)).join('');
|
||||
return (await arrayifyStream<string>(stream)).join('');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user