mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
chore(deps): update all dependencies (#293)
This commit is contained in:
parent
73a56d8682
commit
0476ba8069
@ -29,6 +29,7 @@ module.exports = {
|
|||||||
'@typescript-eslint/no-invalid-void-type': 'off', // breaks with default void in Asynchandler 2nd generic
|
'@typescript-eslint/no-invalid-void-type': 'off', // breaks with default void in Asynchandler 2nd generic
|
||||||
'@typescript-eslint/no-unnecessary-condition': 'off', // problems with optional parameters
|
'@typescript-eslint/no-unnecessary-condition': 'off', // problems with optional parameters
|
||||||
'@typescript-eslint/space-before-function-paren': [ 'error', 'never' ],
|
'@typescript-eslint/space-before-function-paren': [ 'error', 'never' ],
|
||||||
|
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
|
||||||
'@typescript-eslint/unbound-method': 'off',
|
'@typescript-eslint/unbound-method': 'off',
|
||||||
'@typescript-eslint/unified-signatures': 'off',
|
'@typescript-eslint/unified-signatures': 'off',
|
||||||
'class-methods-use-this': 'off', // conflicts with functions from interfaces that sometimes don't require `this`
|
'class-methods-use-this': 'off', // conflicts with functions from interfaces that sometimes don't require `this`
|
||||||
@ -44,8 +45,10 @@ module.exports = {
|
|||||||
'tsdoc/syntax': 'error',
|
'tsdoc/syntax': 'error',
|
||||||
'unicorn/catch-error-name': 'off',
|
'unicorn/catch-error-name': 'off',
|
||||||
'unicorn/import-index': 'off',
|
'unicorn/import-index': 'off',
|
||||||
|
'unicorn/import-style': 'off',
|
||||||
'unicorn/no-fn-reference-in-iterator': 'off', // this prevents some functional programming paradigms
|
'unicorn/no-fn-reference-in-iterator': 'off', // this prevents some functional programming paradigms
|
||||||
'unicorn/no-object-as-default-parameter': 'off',
|
'unicorn/no-object-as-default-parameter': 'off',
|
||||||
|
'unicorn/numeric-separators-style': 'off',
|
||||||
|
|
||||||
// Naming conventions
|
// Naming conventions
|
||||||
'@typescript-eslint/naming-convention': [
|
'@typescript-eslint/naming-convention': [
|
||||||
|
3945
package-lock.json
generated
3945
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -23,23 +23,23 @@ export class RepresentationMetadata {
|
|||||||
*
|
*
|
||||||
* `@ignored` tag is necessary for Components-Generator.js
|
* `@ignored` tag is necessary for Components-Generator.js
|
||||||
*/
|
*/
|
||||||
public constructor(identifier?: NamedNode | BlankNode | string, overrides?: { [pred: string]: MetadataOverrideValue});
|
public constructor(identifier?: NamedNode | BlankNode | string, overrides?: Record<string, MetadataOverrideValue>);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param metadata - Starts as a copy of the input metadata.
|
* @param metadata - Starts as a copy of the input metadata.
|
||||||
* @param overrides - Key/value map of extra values that need to be added to the metadata.
|
* @param overrides - Key/value map of extra values that need to be added to the metadata.
|
||||||
* Will override values that were set by the input metadata.
|
* Will override values that were set by the input metadata.
|
||||||
*/
|
*/
|
||||||
public constructor(metadata?: RepresentationMetadata, overrides?: { [pred: string]: MetadataOverrideValue});
|
public constructor(metadata?: RepresentationMetadata, overrides?: Record<string, MetadataOverrideValue>);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param overrides - Key/value map of extra values that need to be added to the metadata.
|
* @param overrides - Key/value map of extra values that need to be added to the metadata.
|
||||||
*/
|
*/
|
||||||
public constructor(overrides?: { [pred: string]: MetadataOverrideValue});
|
public constructor(overrides?: Record<string, MetadataOverrideValue>);
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
input?: NamedNode | BlankNode | string | RepresentationMetadata | { [pred: string]: MetadataOverrideValue},
|
input?: NamedNode | BlankNode | string | RepresentationMetadata | Record<string, MetadataOverrideValue>,
|
||||||
overrides?: { [pred: string]: MetadataOverrideValue},
|
overrides?: Record<string, MetadataOverrideValue>,
|
||||||
) {
|
) {
|
||||||
this.store = new Store();
|
this.store = new Store();
|
||||||
if (typeof input === 'string') {
|
if (typeof input === 'string') {
|
||||||
@ -59,7 +59,7 @@ export class RepresentationMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private setOverrides(overrides: { [pred: string]: MetadataOverrideValue}): void {
|
private setOverrides(overrides: Record<string, MetadataOverrideValue>): void {
|
||||||
for (const predicate of Object.keys(overrides)) {
|
for (const predicate of Object.keys(overrides)) {
|
||||||
const namedPredicate = toNamedNode(predicate);
|
const namedPredicate = toNamedNode(predicate);
|
||||||
this.removeAll(namedPredicate);
|
this.removeAll(namedPredicate);
|
||||||
|
@ -24,7 +24,7 @@ export class WinstonLoggerFactory implements LoggerFactory {
|
|||||||
format.label({ label }),
|
format.label({ label }),
|
||||||
format.colorize(),
|
format.colorize(),
|
||||||
format.timestamp(),
|
format.timestamp(),
|
||||||
format.printf(({ level: levelInner, message, label: labelInner, timestamp }: {[key: string]: any}): string =>
|
format.printf(({ level: levelInner, message, label: labelInner, timestamp }: Record<string, any>): string =>
|
||||||
`${timestamp} [${labelInner}] ${levelInner}: ${message}`),
|
`${timestamp} [${labelInner}] ${levelInner}: ${message}`),
|
||||||
),
|
),
|
||||||
transports: this.createTransports(),
|
transports: this.createTransports(),
|
||||||
|
@ -227,11 +227,9 @@ export class DataAccessorBasedStore implements ResourceStore {
|
|||||||
metadata.identifier = DataFactory.namedNode(identifier.path);
|
metadata.identifier = DataFactory.namedNode(identifier.path);
|
||||||
metadata.addQuads(this.metadataController.generateResourceQuads(metadata.identifier, isContainer));
|
metadata.addQuads(this.metadataController.generateResourceQuads(metadata.identifier, isContainer));
|
||||||
|
|
||||||
if (isContainer) {
|
await (isContainer ?
|
||||||
await this.accessor.writeContainer(identifier, representation.metadata);
|
this.accessor.writeContainer(identifier, representation.metadata) :
|
||||||
} else {
|
this.accessor.writeDocument(identifier, representation.data, representation.metadata));
|
||||||
await this.accessor.writeDocument(identifier, representation.data, representation.metadata);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +14,7 @@ interface DataEntry {
|
|||||||
metadata: RepresentationMetadata;
|
metadata: RepresentationMetadata;
|
||||||
}
|
}
|
||||||
interface ContainerEntry {
|
interface ContainerEntry {
|
||||||
entries: { [name: string]: CacheEntry };
|
entries: Record<string, CacheEntry>;
|
||||||
metadata: RepresentationMetadata;
|
metadata: RepresentationMetadata;
|
||||||
}
|
}
|
||||||
type CacheEntry = DataEntry | ContainerEntry;
|
type CacheEntry = DataEntry | ContainerEntry;
|
||||||
|
@ -35,11 +35,11 @@ export class ChainedConverter extends TypedRepresentationConverter {
|
|||||||
return this.converters[this.converters.length - 1];
|
return this.converters[this.converters.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getInputTypes(): Promise<{ [contentType: string]: number }> {
|
public async getInputTypes(): Promise<Record<string, number>> {
|
||||||
return this.first.getInputTypes();
|
return this.first.getInputTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getOutputTypes(): Promise<{ [contentType: string]: number }> {
|
public async getOutputTypes(): Promise<Record<string, number>> {
|
||||||
return this.last.getOutputTypes();
|
return this.last.getOutputTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ export class ChainedConverter extends TypedRepresentationConverter {
|
|||||||
checkRequest(input, inTypes, outTypes);
|
checkRequest(input, inTypes, outTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private filterTypes(typeVals: { [contentType: string]: number }): string[] {
|
private filterTypes(typeVals: Record<string, number>): string[] {
|
||||||
return Object.keys(typeVals).filter((name): boolean => typeVals[name] > 0);
|
return Object.keys(typeVals).filter((name): boolean => typeVals[name] > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,11 +13,11 @@ import { TypedRepresentationConverter } from './TypedRepresentationConverter';
|
|||||||
* Converts `internal/quads` to most major RDF serializations.
|
* Converts `internal/quads` to most major RDF serializations.
|
||||||
*/
|
*/
|
||||||
export class QuadToRdfConverter extends TypedRepresentationConverter {
|
export class QuadToRdfConverter extends TypedRepresentationConverter {
|
||||||
public async getInputTypes(): Promise<{ [contentType: string]: number }> {
|
public async getInputTypes(): Promise<Record<string, number>> {
|
||||||
return { [INTERNAL_QUADS]: 1 };
|
return { [INTERNAL_QUADS]: 1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getOutputTypes(): Promise<{ [contentType: string]: number }> {
|
public async getOutputTypes(): Promise<Record<string, number>> {
|
||||||
return rdfSerializer.getContentTypesPrioritized();
|
return rdfSerializer.getContentTypesPrioritized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,11 +14,11 @@ import { TypedRepresentationConverter } from './TypedRepresentationConverter';
|
|||||||
* Converts most major RDF serializations to `internal/quads`.
|
* Converts most major RDF serializations to `internal/quads`.
|
||||||
*/
|
*/
|
||||||
export class RdfToQuadConverter extends TypedRepresentationConverter {
|
export class RdfToQuadConverter extends TypedRepresentationConverter {
|
||||||
public async getInputTypes(): Promise<{ [contentType: string]: number }> {
|
public async getInputTypes(): Promise<Record<string, number>> {
|
||||||
return rdfParser.getContentTypesPrioritized();
|
return rdfParser.getContentTypesPrioritized();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getOutputTypes(): Promise<{ [contentType: string]: number }> {
|
public async getOutputTypes(): Promise<Record<string, number>> {
|
||||||
return { [INTERNAL_QUADS]: 1 };
|
return { [INTERNAL_QUADS]: 1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,12 +9,12 @@ export abstract class TypedRepresentationConverter extends RepresentationConvert
|
|||||||
* The priority weight goes from 0 up to 1.
|
* The priority weight goes from 0 up to 1.
|
||||||
* @returns A promise resolving to a hash mapping content type to a priority number.
|
* @returns A promise resolving to a hash mapping content type to a priority number.
|
||||||
*/
|
*/
|
||||||
public abstract getInputTypes(): Promise<{ [contentType: string]: number }>;
|
public abstract getInputTypes(): Promise<Record<string, number>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a hash of all supported output content types for this converter, mapped to a numerical priority.
|
* Get a hash of all supported output content types for this converter, mapped to a numerical priority.
|
||||||
* The priority weight goes from 0 up to 1.
|
* The priority weight goes from 0 up to 1.
|
||||||
* @returns A promise resolving to a hash mapping content type to a priority number.
|
* @returns A promise resolving to a hash mapping content type to a priority number.
|
||||||
*/
|
*/
|
||||||
public abstract getOutputTypes(): Promise<{ [contentType: string]: number }>;
|
public abstract getOutputTypes(): Promise<Record<string, number>>;
|
||||||
}
|
}
|
||||||
|
@ -68,12 +68,12 @@ export interface AcceptHeader {
|
|||||||
export interface Accept extends AcceptHeader {
|
export interface Accept extends AcceptHeader {
|
||||||
parameters: {
|
parameters: {
|
||||||
/** Media type parameters. These are the parameters that came before the q value. */
|
/** Media type parameters. These are the parameters that came before the q value. */
|
||||||
mediaType: { [key: string]: string };
|
mediaType: Record<string, string>;
|
||||||
/**
|
/**
|
||||||
* Extension parameters. These are the parameters that came after the q value.
|
* Extension parameters. These are the parameters that came after the q value.
|
||||||
* Value will be an empty string if there was none.
|
* Value will be an empty string if there was none.
|
||||||
*/
|
*/
|
||||||
extension: { [key: string]: string };
|
extension: Record<string, string>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,9 +102,9 @@ const token = /^[a-zA-Z0-9!#$%&'*+-.^_`|~]+$/u;
|
|||||||
*
|
*
|
||||||
* @returns The transformed string and a map with keys `"0"`, etc. and values the original string that was there.
|
* @returns The transformed string and a map with keys `"0"`, etc. and values the original string that was there.
|
||||||
*/
|
*/
|
||||||
export const transformQuotedStrings = (input: string): { result: string; replacements: { [id: string]: string } } => {
|
export const transformQuotedStrings = (input: string): { result: string; replacements: Record<string, string> } => {
|
||||||
let idx = 0;
|
let idx = 0;
|
||||||
const replacements: { [id: string]: string } = {};
|
const replacements: Record<string, string> = {};
|
||||||
const result = input.replace(/"(?:[^"\\]|\\.)*"/gu, (match): string => {
|
const result = input.replace(/"(?:[^"\\]|\\.)*"/gu, (match): string => {
|
||||||
// Not all characters allowed in quoted strings, see BNF above
|
// Not all characters allowed in quoted strings, see BNF above
|
||||||
if (!/^"(?:[\t !\u0023-\u005B\u005D-\u007E\u0080-\u00FF]|(?:\\[\t\u0020-\u007E\u0080-\u00FF]))*"$/u.test(match)) {
|
if (!/^"(?:[\t !\u0023-\u005B\u005D-\u007E\u0080-\u00FF]|(?:\\[\t\u0020-\u007E\u0080-\u00FF]))*"$/u.test(match)) {
|
||||||
@ -158,7 +158,7 @@ const testQValue = (qvalue: string): void => {
|
|||||||
*
|
*
|
||||||
* @returns An array of name/value objects corresponding to the parameters.
|
* @returns An array of name/value objects corresponding to the parameters.
|
||||||
*/
|
*/
|
||||||
export const parseParameters = (parameters: string[], replacements: { [id: string]: string }):
|
export const parseParameters = (parameters: string[], replacements: Record<string, string>):
|
||||||
{ name: string; value: string }[] => parameters.map((param): { name: string; value: string } => {
|
{ name: string; value: string }[] => parameters.map((param): { name: string; value: string } => {
|
||||||
const [ name, rawValue ] = param.split('=').map((str): string => str.trim());
|
const [ name, rawValue ] = param.split('=').map((str): string => str.trim());
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ export const parseParameters = (parameters: string[], replacements: { [id: strin
|
|||||||
*
|
*
|
||||||
* @returns {@link Accept} object corresponding to the header string.
|
* @returns {@link Accept} object corresponding to the header string.
|
||||||
*/
|
*/
|
||||||
const parseAcceptPart = (part: string, replacements: { [id: string]: string }): Accept => {
|
const parseAcceptPart = (part: string, replacements: Record<string, string>): Accept => {
|
||||||
const [ range, ...parameters ] = part.split(';').map((param): string => param.trim());
|
const [ range, ...parameters ] = part.split(';').map((param): string => param.trim());
|
||||||
|
|
||||||
// No reason to test differently for * since we don't check if the type exists
|
// No reason to test differently for * since we don't check if the type exists
|
||||||
@ -208,8 +208,8 @@ const parseAcceptPart = (part: string, replacements: { [id: string]: string }):
|
|||||||
}
|
}
|
||||||
|
|
||||||
let weight = 1;
|
let weight = 1;
|
||||||
const mediaTypeParams: { [key: string]: string } = {};
|
const mediaTypeParams: Record<string, string> = {};
|
||||||
const extensionParams: { [key: string]: string } = {};
|
const extensionParams: Record<string, string> = {};
|
||||||
let map = mediaTypeParams;
|
let map = mediaTypeParams;
|
||||||
const parsedParams = parseParameters(parameters, replacements);
|
const parsedParams = parseParameters(parameters, replacements);
|
||||||
parsedParams.forEach(({ name, value }): void => {
|
parsedParams.forEach(({ name, value }): void => {
|
||||||
|
@ -3,12 +3,12 @@ import type { Literal, NamedNode, Term } from 'rdf-js';
|
|||||||
import { CONTENT_TYPE } from './UriConstants';
|
import { CONTENT_TYPE } from './UriConstants';
|
||||||
|
|
||||||
// Shorthands for commonly used predicates
|
// Shorthands for commonly used predicates
|
||||||
const shorthands: { [id: string]: NamedNode } = {
|
const shorthands: Record<string, NamedNode> = {
|
||||||
contentType: DataFactory.namedNode(CONTENT_TYPE),
|
contentType: DataFactory.namedNode(CONTENT_TYPE),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Caches named node conversions
|
// Caches named node conversions
|
||||||
const termMap: { [id: string]: NamedNode } = {};
|
const termMap: Record<string, NamedNode> = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param input - Checks if this is a {@link Term}.
|
* @param input - Checks if this is a {@link Term}.
|
||||||
|
@ -20,7 +20,7 @@ import { toNamedNode } from '../../../src/util/UriUtil';
|
|||||||
import { ensureTrailingSlash } from '../../../src/util/Util';
|
import { ensureTrailingSlash } from '../../../src/util/Util';
|
||||||
|
|
||||||
class SimpleDataAccessor implements DataAccessor {
|
class SimpleDataAccessor implements DataAccessor {
|
||||||
public readonly data: { [path: string]: Representation} = {};
|
public readonly data: Record<string, Representation> = {};
|
||||||
|
|
||||||
private checkExists(identifier: ResourceIdentifier): void {
|
private checkExists(identifier: ResourceIdentifier): void {
|
||||||
if (!this.data[identifier.path]) {
|
if (!this.data[identifier.path]) {
|
||||||
|
@ -10,7 +10,7 @@ describe('An ExtensionBasedMapper', (): void => {
|
|||||||
const base = 'http://test.com/';
|
const base = 'http://test.com/';
|
||||||
const rootFilepath = 'uploads/';
|
const rootFilepath = 'uploads/';
|
||||||
const mapper = new ExtensionBasedMapper(base, rootFilepath);
|
const mapper = new ExtensionBasedMapper(base, rootFilepath);
|
||||||
let fsPromises: { [ id: string ]: jest.Mock };
|
let fsPromises: Record<string, jest.Mock>;
|
||||||
|
|
||||||
beforeEach(async(): Promise<void> => {
|
beforeEach(async(): Promise<void> => {
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
|
@ -8,20 +8,20 @@ import { TypedRepresentationConverter } from '../../../../src/storage/conversion
|
|||||||
import { CONTENT_TYPE } from '../../../../src/util/UriConstants';
|
import { CONTENT_TYPE } from '../../../../src/util/UriConstants';
|
||||||
|
|
||||||
class DummyConverter extends TypedRepresentationConverter {
|
class DummyConverter extends TypedRepresentationConverter {
|
||||||
private readonly inTypes: { [contentType: string]: number };
|
private readonly inTypes: Record<string, number>;
|
||||||
private readonly outTypes: { [contentType: string]: number };
|
private readonly outTypes: Record<string, number>;
|
||||||
|
|
||||||
public constructor(inTypes: { [contentType: string]: number }, outTypes: { [contentType: string]: number }) {
|
public constructor(inTypes: Record<string, number>, outTypes: Record<string, number>) {
|
||||||
super();
|
super();
|
||||||
this.inTypes = inTypes;
|
this.inTypes = inTypes;
|
||||||
this.outTypes = outTypes;
|
this.outTypes = outTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getInputTypes(): Promise<{ [contentType: string]: number }> {
|
public async getInputTypes(): Promise<Record<string, number>> {
|
||||||
return this.inTypes;
|
return this.inTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getOutputTypes(): Promise<{ [contentType: string]: number }> {
|
public async getOutputTypes(): Promise<Record<string, number>> {
|
||||||
return this.outTypes;
|
return this.outTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user