diff --git a/src/app/+browse-by/browse-by-guard.ts b/src/app/+browse-by/browse-by-guard.ts index 3ba282d41c..87df5bee1d 100644 --- a/src/app/+browse-by/browse-by-guard.ts +++ b/src/app/+browse-by/browse-by-guard.ts @@ -1,5 +1,5 @@ import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; -import { Inject, Injectable } from '@angular/core'; +import { Injectable } from '@angular/core'; import { DSpaceObjectDataService } from '../core/data/dspace-object-data.service'; import { hasNoValue, hasValue } from '../shared/empty.util'; import { map } from 'rxjs/operators'; diff --git a/src/app/core/auth/auth.service.ts b/src/app/core/auth/auth.service.ts index 06906346ed..8952fab473 100644 --- a/src/app/core/auth/auth.service.ts +++ b/src/app/core/auth/auth.service.ts @@ -14,13 +14,13 @@ import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service'; import { AuthStatus } from './models/auth-status.model'; import { AuthTokenInfo, TOKENITEM } from './models/auth-token-info.model'; import { + hasNoValue, hasValue, hasValueOperator, isEmpty, isNotEmpty, isNotNull, - isNotUndefined, - hasNoValue + isNotUndefined } from '../../shared/empty.util'; import { CookieService } from '../services/cookie.service'; import { @@ -28,8 +28,8 @@ import { getAuthenticationToken, getRedirectUrl, isAuthenticated, - isTokenRefreshing, - isAuthenticatedLoaded + isAuthenticatedLoaded, + isTokenRefreshing } from './selectors'; import { AppState } from '../../app.reducer'; import { @@ -53,7 +53,7 @@ export const IMPERSONATING_COOKIE = 'dsImpersonatingEPerson'; /** * The auth service. */ -@Injectable() +@Injectable({providedIn: 'root'}) export class AuthService { /** @@ -100,7 +100,7 @@ export class AuthService { } else { throw(new Error('Invalid email or password')); } - })) + })); } @@ -153,7 +153,7 @@ export class AuthService { } else { throw(new Error('Not authenticated')); } - })) + })); } /** @@ -163,7 +163,7 @@ export class AuthService { public retrieveAuthenticatedUserByHref(userHref: string): Observable { return this.epersonService.findByHref(userHref).pipe( getAllSucceededRemoteDataPayload() - ) + ); } /** @@ -173,7 +173,7 @@ export class AuthService { public retrieveAuthenticatedUserById(userId: string): Observable { return this.epersonService.findById(userId).pipe( getAllSucceededRemoteDataPayload() - ) + ); } /** @@ -186,7 +186,7 @@ export class AuthService { hasValueOperator(), switchMap((id: string) => this.epersonService.findById(id) ), getAllSucceededRemoteDataPayload() - ) + ); } /** @@ -273,7 +273,7 @@ export class AuthService { } else { throw(new Error('auth.errors.invalid-user')); } - })) + })); } /** @@ -317,7 +317,7 @@ export class AuthService { return token.expires - (60 * 5 * 1000) < Date.now(); } }) - ) + ); } /** @@ -446,7 +446,7 @@ export class AuthService { if (hasNoValue(currentRedirectUrl)) { this.setRedirectUrl(newRedirectUrl); } - }) + }); } /** diff --git a/src/app/core/auth/server-auth.service.ts b/src/app/core/auth/server-auth.service.ts index 88a4ac406e..ea7577ff77 100644 --- a/src/app/core/auth/server-auth.service.ts +++ b/src/app/core/auth/server-auth.service.ts @@ -13,7 +13,7 @@ import { AuthTokenInfo } from './models/auth-token-info.model'; /** * The auth service. */ -@Injectable() +@Injectable({providedIn: 'root'}) export class ServerAuthService extends AuthService { /** diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts index a5b4a5ce4d..deb169c07c 100644 --- a/src/app/core/core.module.ts +++ b/src/app/core/core.module.ts @@ -101,7 +101,6 @@ import { Community } from './shared/community.model'; import { DSpaceObject } from './shared/dspace-object.model'; import { ExternalSourceEntry } from './shared/external-source-entry.model'; import { ExternalSource } from './shared/external-source.model'; -import { FileService } from './shared/file.service'; import { HALEndpointService } from './shared/hal-endpoint.service'; import { ItemType } from './shared/item-relationships/item-type.model'; import { RelationshipType } from './shared/item-relationships/relationship-type.model'; @@ -253,7 +252,6 @@ const PROVIDERS = [ WorkspaceitemDataService, WorkflowItemDataService, UploaderService, - FileService, DSpaceObjectDataService, ConfigurationDataService, DSOChangeAnalyzer, diff --git a/src/app/core/forward-client-ip/forward-client-ip.interceptor.ts b/src/app/core/forward-client-ip/forward-client-ip.interceptor.ts index 407e6e0c3d..2e2e59fa6b 100644 --- a/src/app/core/forward-client-ip/forward-client-ip.interceptor.ts +++ b/src/app/core/forward-client-ip/forward-client-ip.interceptor.ts @@ -3,7 +3,7 @@ import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { REQUEST } from '@nguniversal/express-engine/tokens'; -@Injectable() +@Injectable({providedIn: 'root'}) /** * Http Interceptor intercepting Http Requests, adding the client's IP to their X-Forwarded-For header */ diff --git a/src/app/core/locale/server-locale.service.ts b/src/app/core/locale/server-locale.service.ts index 2385840145..a588be1a0a 100644 --- a/src/app/core/locale/server-locale.service.ts +++ b/src/app/core/locale/server-locale.service.ts @@ -2,9 +2,9 @@ import { LANG_ORIGIN, LocaleService } from './locale.service'; import { Injectable } from '@angular/core'; import { combineLatest, Observable, of as observableOf } from 'rxjs'; import { map, mergeMap, take } from 'rxjs/operators'; -import { isEmpty, isNotEmpty } from 'src/app/shared/empty.util'; +import { isEmpty, isNotEmpty } from '../../shared/empty.util'; -@Injectable() +@Injectable({providedIn: 'root'}) export class ServerLocaleService extends LocaleService { /** @@ -52,7 +52,7 @@ export class ServerLocaleService extends LocaleService { } return languages; }) - ) + ); }) ); } diff --git a/src/app/core/services/browser-hard-redirect.service.ts b/src/app/core/services/browser-hard-redirect.service.ts index 4b7424bee2..5f90fb8dbd 100644 --- a/src/app/core/services/browser-hard-redirect.service.ts +++ b/src/app/core/services/browser-hard-redirect.service.ts @@ -10,7 +10,7 @@ export function locationProvider(): Location { /** * Service for performing hard redirects within the browser app module */ -@Injectable() +@Injectable({providedIn: 'root'}) export class BrowserHardRedirectService extends HardRedirectService { constructor( diff --git a/src/app/core/services/cookie.service.ts b/src/app/core/services/cookie.service.ts index aaae800a6e..b14d782c76 100644 --- a/src/app/core/services/cookie.service.ts +++ b/src/app/core/services/cookie.service.ts @@ -1,23 +1,23 @@ -import { Inject, Injectable } from '@angular/core' +import { Inject, Injectable } from '@angular/core'; -import { REQUEST } from '@nguniversal/express-engine/tokens' +import { REQUEST } from '@nguniversal/express-engine/tokens'; -import { Subject , Observable } from 'rxjs' -import { CookieAttributes } from 'js-cookie' +import { Subject , Observable } from 'rxjs'; +import { CookieAttributes } from 'js-cookie'; export interface ICookieService { - readonly cookies$: Observable<{ readonly [key: string]: any }> + readonly cookies$: Observable<{ readonly [key: string]: any }>; - getAll(): any + getAll(): any; - get(name: string): any + get(name: string): any; - set(name: string, value: any, options?: CookieAttributes): void + set(name: string, value: any, options?: CookieAttributes): void; - remove(name: string, options?: CookieAttributes): void + remove(name: string, options?: CookieAttributes): void; } -@Injectable() +@Injectable({providedIn: 'root'}) export abstract class CookieService implements ICookieService { protected readonly cookieSource = new Subject<{ readonly [key: string]: any }>(); public readonly cookies$ = this.cookieSource.asObservable(); @@ -25,13 +25,13 @@ export abstract class CookieService implements ICookieService { constructor(@Inject(REQUEST) protected req: any) { } - public abstract set(name: string, value: any, options?: CookieAttributes): void + public abstract set(name: string, value: any, options?: CookieAttributes): void; - public abstract remove(name: string, options?: CookieAttributes): void + public abstract remove(name: string, options?: CookieAttributes): void; - public abstract get(name: string): any + public abstract get(name: string): any; - public abstract getAll(): any + public abstract getAll(): any; protected updateSource() { this.cookieSource.next(this.getAll()); diff --git a/src/app/core/services/hard-redirect.service.ts b/src/app/core/services/hard-redirect.service.ts index a09521dae5..8d4db48614 100644 --- a/src/app/core/services/hard-redirect.service.ts +++ b/src/app/core/services/hard-redirect.service.ts @@ -5,7 +5,7 @@ import { URLCombiner } from '../url-combiner/url-combiner'; /** * Service to take care of hard redirects */ -@Injectable() +@Injectable({providedIn: 'root'}) export abstract class HardRedirectService { /** diff --git a/src/app/core/services/server-cookie.service.ts b/src/app/core/services/server-cookie.service.ts index 49cc738346..36d26bd490 100644 --- a/src/app/core/services/server-cookie.service.ts +++ b/src/app/core/services/server-cookie.service.ts @@ -1,29 +1,29 @@ -import { Injectable } from '@angular/core' -import { CookieAttributes } from 'js-cookie' +import { Injectable } from '@angular/core'; +import { CookieAttributes } from 'js-cookie'; import { CookieService, ICookieService } from './cookie.service'; -@Injectable() +@Injectable({providedIn: 'root'}) export class ServerCookieService extends CookieService implements ICookieService { public set(name: string, value: any, options?: CookieAttributes): void { - return + return; } public remove(name: string, options?: CookieAttributes): void { - return + return; } public get(name: string): any { try { - return JSON.parse(this.req.cookies[name]) + return JSON.parse(this.req.cookies[name]); } catch (err) { - return this.req ? this.req.cookies[name] : undefined + return this.req ? this.req.cookies[name] : undefined; } } public getAll(): any { if (this.req) { - return this.req.cookies + return this.req.cookies; } } } diff --git a/src/app/core/services/server-hard-redirect.service.ts b/src/app/core/services/server-hard-redirect.service.ts index 65b404ca6c..65f3fa4580 100644 --- a/src/app/core/services/server-hard-redirect.service.ts +++ b/src/app/core/services/server-hard-redirect.service.ts @@ -6,7 +6,7 @@ import { HardRedirectService } from './hard-redirect.service'; /** * Service for performing hard redirects within the server app module */ -@Injectable() +@Injectable({providedIn: 'root'}) export class ServerHardRedirectService extends HardRedirectService { constructor( diff --git a/src/app/core/shared/file.service.ts b/src/app/core/shared/file.service.ts index ca0a409b2d..de09c481ac 100644 --- a/src/app/core/shared/file.service.ts +++ b/src/app/core/shared/file.service.ts @@ -9,7 +9,7 @@ import { hasValue } from '../../shared/empty.util'; /** * Provides utility methods to save files on the client-side. */ -@Injectable() +@Injectable({providedIn: 'root'}) export class FileService { constructor( @Inject(NativeWindowService) protected _window: NativeWindowRef, @@ -40,5 +40,5 @@ export class FileService { const contentDisposition = res.headers.get('content-disposition') || ''; const matches = /filename="([^;]+)"/ig.exec(contentDisposition) || []; return (matches[1] || 'untitled').trim().replace(/\.[^/.]+$/, ''); - }; + } } diff --git a/src/app/shared/mocks/angulartics.service.mock.ts b/src/app/shared/mocks/angulartics.service.mock.ts index 5e21ce8c6e..50245ad23e 100644 --- a/src/app/shared/mocks/angulartics.service.mock.ts +++ b/src/app/shared/mocks/angulartics.service.mock.ts @@ -1,6 +1,7 @@ -import { Injectable } from "@angular/core"; +import { Injectable } from '@angular/core'; + /* tslint:disable:no-empty */ -@Injectable() +@Injectable({providedIn: 'root'}) export class AngularticsMock { public eventTrack(action, properties) { } public startTracking(): void {} diff --git a/src/app/statistics/statistics.service.ts b/src/app/statistics/statistics.service.ts index e964080f37..b9db55b835 100644 --- a/src/app/statistics/statistics.service.ts +++ b/src/app/statistics/statistics.service.ts @@ -11,7 +11,7 @@ import { SearchOptions } from '../shared/search/search-options.model'; /** * The statistics service */ -@Injectable() +@Injectable({providedIn: 'root'}) export class StatisticsService { constructor(