mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
fix circular dependency issues relating to request models
This commit is contained in:
@@ -9,7 +9,6 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model';
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
import { FindListOptions } from '../../core/data/request.models';
|
||||
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
|
||||
import { EPerson } from '../../core/eperson/models/eperson.model';
|
||||
import { PageInfo } from '../../core/shared/page-info.model';
|
||||
@@ -27,6 +26,7 @@ import { AuthorizationDataService } from '../../core/data/feature-authorization/
|
||||
import { RequestService } from '../../core/data/request.service';
|
||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../core/data/find-list-options.model';
|
||||
|
||||
describe('EPeopleRegistryComponent', () => {
|
||||
let component: EPeopleRegistryComponent;
|
||||
|
@@ -8,7 +8,6 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { buildPaginatedList, PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { FindListOptions } from '../../../core/data/request.models';
|
||||
import { EPersonDataService } from '../../../core/eperson/eperson-data.service';
|
||||
import { EPerson } from '../../../core/eperson/models/eperson.model';
|
||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
@@ -28,6 +27,7 @@ import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||
import { RequestService } from '../../../core/data/request.service';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
|
||||
describe('EPersonFormComponent', () => {
|
||||
let component: EPersonFormComponent;
|
||||
|
@@ -25,9 +25,9 @@ import {
|
||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../../core/data/request.models';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
|
||||
describe('BitstreamFormatsComponent', () => {
|
||||
let comp: BitstreamFormatsComponent;
|
||||
|
@@ -5,7 +5,6 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
||||
import { FindListOptions } from '../../../core/data/request.models';
|
||||
import { map, switchMap, take } from 'rxjs/operators';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
@@ -13,6 +12,7 @@ import { Router } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
|
||||
/**
|
||||
* This component renders a list of bitstream formats
|
||||
|
@@ -21,8 +21,8 @@ import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.u
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../../core/data/request.models';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
|
||||
describe('MetadataRegistryComponent', () => {
|
||||
let comp: MetadataRegistryComponent;
|
||||
|
@@ -25,9 +25,9 @@ import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.u
|
||||
import { VarDirective } from '../../../shared/utils/var.directive';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../../core/data/request.models';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
|
||||
describe('MetadataSchemaComponent', () => {
|
||||
let comp: MetadataSchemaComponent;
|
||||
|
@@ -20,9 +20,9 @@ import { VarDirective } from '../../shared/utils/var.directive';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../core/data/request.models';
|
||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../core/data/find-list-options.model';
|
||||
|
||||
describe('BrowseByDatePageComponent', () => {
|
||||
let comp: BrowseByDatePageComponent;
|
||||
|
@@ -20,9 +20,9 @@ import { VarDirective } from '../../shared/utils/var.directive';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../core/data/request.models';
|
||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../core/data/find-list-options.model';
|
||||
|
||||
describe('BrowseByTitlePageComponent', () => {
|
||||
let comp: BrowseByTitlePageComponent;
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { Subscription } from 'rxjs/internal/Subscription';
|
||||
import { FindListOptions } from '../core/data/request.models';
|
||||
import { hasValue } from '../shared/empty.util';
|
||||
import { CommunityListService} from './community-list-service';
|
||||
import { CollectionViewer, DataSource } from '@angular/cdk/collections';
|
||||
import { BehaviorSubject, Observable, } from 'rxjs';
|
||||
import { finalize } from 'rxjs/operators';
|
||||
import { FlatNode } from './flat-node.model';
|
||||
import { FindListOptions } from '../core/data/find-list-options.model';
|
||||
|
||||
/**
|
||||
* DataSource object needed by a CDK Tree to render its nodes.
|
||||
|
@@ -12,9 +12,9 @@ import { CollectionDataService } from '../core/data/collection-data.service';
|
||||
import { CommunityDataService } from '../core/data/community-data.service';
|
||||
import { Community } from '../core/shared/community.model';
|
||||
import { Collection } from '../core/shared/collection.model';
|
||||
import { FindListOptions } from '../core/data/request.models';
|
||||
import { PageInfo } from '../core/shared/page-info.model';
|
||||
import { FlatNode } from './flat-node.model';
|
||||
import { FindListOptions } from '../core/data/find-list-options.model';
|
||||
|
||||
describe('CommunityListService', () => {
|
||||
let store: StoreMock<AppState>;
|
||||
|
@@ -6,7 +6,6 @@ import { filter, map, switchMap } from 'rxjs/operators';
|
||||
|
||||
import { AppState } from '../app.reducer';
|
||||
import { CommunityDataService } from '../core/data/community-data.service';
|
||||
import { FindListOptions } from '../core/data/request.models';
|
||||
import { Community } from '../core/shared/community.model';
|
||||
import { Collection } from '../core/shared/collection.model';
|
||||
import { PageInfo } from '../core/shared/page-info.model';
|
||||
@@ -22,6 +21,7 @@ import { getFirstCompletedRemoteData, getFirstSucceededRemoteData } from '../cor
|
||||
import { followLink } from '../shared/utils/follow-link-config.model';
|
||||
import { FlatNode } from './flat-node.model';
|
||||
import { ShowMoreFlatNode } from './show-more-flat-node.model';
|
||||
import { FindListOptions } from '../core/data/find-list-options.model';
|
||||
|
||||
// Helper method to combine an flatten an array of observables of flatNode arrays
|
||||
export const combineAndFlatten = (obsList: Observable<FlatNode[]>[]): Observable<FlatNode[]> =>
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../core/data/request.models';
|
||||
import { CommunityListService} from '../community-list-service';
|
||||
import { CommunityListDatasource } from '../community-list-datasource';
|
||||
import { FlatTreeControl } from '@angular/cdk/tree';
|
||||
import { isEmpty } from '../../shared/empty.util';
|
||||
import { FlatNode } from '../flat-node.model';
|
||||
import { FindListOptions } from '../../core/data/find-list-options.model';
|
||||
|
||||
/**
|
||||
* A tree-structured list of nodes representing the communities, their subCommunities and collections.
|
||||
|
@@ -11,7 +11,6 @@ import { CommunityPageSubCollectionListComponent } from './community-page-sub-co
|
||||
import { Community } from '../../core/shared/community.model';
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { CollectionDataService } from '../../core/data/collection-data.service';
|
||||
import { FindListOptions } from '../../core/data/request.models';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { buildPaginatedList } from '../../core/data/paginated-list.model';
|
||||
import { PageInfo } from '../../core/shared/page-info.model';
|
||||
@@ -25,6 +24,7 @@ import { PaginationService } from '../../core/pagination/pagination.service';
|
||||
import { getMockThemeService } from '../../shared/mocks/theme-service.mock';
|
||||
import { ThemeService } from '../../shared/theme-support/theme.service';
|
||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../core/data/find-list-options.model';
|
||||
|
||||
describe('CommunityPageSubCollectionList Component', () => {
|
||||
let comp: CommunityPageSubCollectionListComponent;
|
||||
|
@@ -13,7 +13,6 @@ import { buildPaginatedList } from '../../core/data/paginated-list.model';
|
||||
import { PageInfo } from '../../core/shared/page-info.model';
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { FindListOptions } from '../../core/data/request.models';
|
||||
import { HostWindowService } from '../../shared/host-window.service';
|
||||
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
|
||||
import { CommunityDataService } from '../../core/data/community-data.service';
|
||||
@@ -25,6 +24,7 @@ import { PaginationService } from '../../core/pagination/pagination.service';
|
||||
import { getMockThemeService } from '../../shared/mocks/theme-service.mock';
|
||||
import { ThemeService } from '../../shared/theme-support/theme.service';
|
||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../core/data/find-list-options.model';
|
||||
|
||||
describe('CommunityPageSubCommunityListComponent Component', () => {
|
||||
let comp: CommunityPageSubCommunityListComponent;
|
||||
|
@@ -3,7 +3,7 @@ import { distinctUntilChanged, filter, map, mergeMap, switchMap, tap } from 'rxj
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { isNotEmpty } from '../../shared/empty.util';
|
||||
import { GetRequest, PostRequest, RestRequest, } from '../data/request.models';
|
||||
import { GetRequest, PostRequest, } from '../data/request.models';
|
||||
import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
||||
import { getFirstCompletedRemoteData } from '../shared/operators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
@@ -11,6 +11,7 @@ import { RemoteData } from '../data/remote-data';
|
||||
import { AuthStatus } from './models/auth-status.model';
|
||||
import { ShortLivedToken } from './models/short-lived-token.model';
|
||||
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||
import { RestRequest } from '../data/rest-request.model';
|
||||
|
||||
/**
|
||||
* Abstract service to send authentication requests
|
||||
|
@@ -11,9 +11,9 @@ import { Observable } from 'rxjs';
|
||||
import { map, find, switchMap } from 'rxjs/operators';
|
||||
import { select, Store } from '@ngrx/store';
|
||||
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { isAuthenticated, isAuthenticationLoading } from './selectors';
|
||||
import { AuthService, LOGIN_ROUTE } from './auth.service';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
/**
|
||||
* Prevent unauthorized activating and loading of routes
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { ResponseParsingService } from '../data/parsing.service';
|
||||
import { RestRequest } from '../data/request.models';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { RestResponse, TokenResponse } from '../cache/response.models';
|
||||
import { isNotEmpty } from '../../shared/empty.util';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { RestRequest } from '../data/rest-request.model';
|
||||
|
||||
@Injectable()
|
||||
/**
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { BrowseDefinitionDataService } from './browse-definition-data.service';
|
||||
import { FindListOptions } from '../data/request.models';
|
||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||
import { EMPTY } from 'rxjs';
|
||||
import { FindListOptions } from '../data/find-list-options.model';
|
||||
|
||||
describe(`BrowseDefinitionDataService`, () => {
|
||||
let service: BrowseDefinitionDataService;
|
||||
|
@@ -6,7 +6,6 @@ import { BrowseDefinition } from '../shared/browse-definition.model';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
@@ -15,8 +14,9 @@ import { DefaultChangeAnalyzer } from '../data/default-change-analyzer.service';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { FindListOptions } from '../data/request.models';
|
||||
import { PaginatedList } from '../data/paginated-list.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from '../data/find-list-options.model';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
|
||||
|
@@ -5,7 +5,6 @@ import { getMockRemoteDataBuildService } from '../../shared/mocks/remote-data-bu
|
||||
import { getMockRequestService } from '../../shared/mocks/request.service.mock';
|
||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service.stub';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { RequestEntry } from '../data/request.reducer';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { BrowseDefinition } from '../shared/browse-definition.model';
|
||||
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
|
||||
@@ -13,6 +12,7 @@ import { BrowseService } from './browse.service';
|
||||
import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { createPaginatedList, getFirstUsedArgumentOfSpyMethod } from '../../shared/testing/utils.test';
|
||||
import { getMockHrefOnlyDataService } from '../../shared/mocks/href-only-data.service.mock';
|
||||
import { RequestEntry } from '../data/request-entry.model';
|
||||
|
||||
describe('BrowseService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { followLink, FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||
import { FindListOptions } from '../../data/request.models';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { HALResource } from '../../shared/hal-resource.model';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
import { LinkService } from './link.service';
|
||||
import { DATA_SERVICE_FACTORY, LINK_DEFINITION_FACTORY, LINK_DEFINITION_MAP_FACTORY } from './build-decorators';
|
||||
import { isEmpty } from 'rxjs/operators';
|
||||
import { FindListOptions } from '../../data/find-list-options.model';
|
||||
|
||||
const TEST_MODEL = new ResourceType('testmodel');
|
||||
let result: any;
|
||||
|
@@ -13,11 +13,11 @@ import { RequestService } from '../../data/request.service';
|
||||
import { UnCacheableObject } from '../../shared/uncacheable-object.model';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { RequestEntry} from '../../data/request.reducer';
|
||||
import { followLink, FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { RequestEntryState } from '../../data/request-entry-state.model';
|
||||
import { RequestEntry } from '../../data/request-entry.model';
|
||||
|
||||
describe('RemoteDataBuildService', () => {
|
||||
let service: RemoteDataBuildService;
|
||||
|
@@ -11,10 +11,6 @@ import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.u
|
||||
import { FollowLinkConfig, followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
import { PaginatedList } from '../../data/paginated-list.model';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import {
|
||||
RequestEntry,
|
||||
ResponseState
|
||||
} from '../../data/request.reducer';
|
||||
import { RequestService } from '../../data/request.service';
|
||||
import { ObjectCacheService } from '../object-cache.service';
|
||||
import { LinkService } from './link.service';
|
||||
@@ -27,6 +23,8 @@ import { getUrlWithoutEmbedParams } from '../../index/index.selectors';
|
||||
import { getResourceTypeValueFor } from '../object-cache.reducer';
|
||||
import { hasSucceeded, RequestEntryState } from '../../data/request-entry-state.model';
|
||||
import { getRequestFromRequestHref, getRequestFromRequestUUID } from '../../shared/request.operators';
|
||||
import { RequestEntry } from '../../data/request-entry.model';
|
||||
import { ResponseState } from '../../data/response-state.model';
|
||||
|
||||
@Injectable()
|
||||
export class RemoteDataBuildService {
|
||||
|
@@ -7,7 +7,7 @@ import { Operation } from 'fast-json-patch';
|
||||
import { empty, of as observableOf } from 'rxjs';
|
||||
import { first } from 'rxjs/operators';
|
||||
|
||||
import { coreReducers, CoreState } from '../core.reducers';
|
||||
import { coreReducers} from '../core.reducers';
|
||||
import { RestRequestMethod } from '../data/rest-request-method';
|
||||
import { Item } from '../shared/item.model';
|
||||
import {
|
||||
@@ -24,6 +24,7 @@ import { HALLink } from '../shared/hal-link.model';
|
||||
import { storeModuleConfig } from '../../app.reducer';
|
||||
import { TestColdObservable } from 'jasmine-marbles/src/test-observables';
|
||||
import { IndexName } from '../index/index-name.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
describe('ObjectCacheService', () => {
|
||||
let service: ObjectCacheService;
|
||||
|
2
src/app/core/cache/object-cache.service.ts
vendored
2
src/app/core/cache/object-cache.service.ts
vendored
@@ -5,7 +5,7 @@ import { combineLatest as observableCombineLatest, Observable, of as observableO
|
||||
|
||||
import { distinctUntilChanged, filter, map, mergeMap, switchMap, take } from 'rxjs/operators';
|
||||
import { hasValue, isNotEmpty, isEmpty } from '../../shared/empty.util';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { coreSelector } from '../core.selectors';
|
||||
import { RestRequestMethod } from '../data/rest-request-method';
|
||||
import {
|
||||
|
@@ -8,7 +8,6 @@ import {
|
||||
EmptySSBAction,
|
||||
ServerSyncBufferActionTypes
|
||||
} from './server-sync-buffer.actions';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Action, createSelector, MemoizedSelector, select, Store } from '@ngrx/store';
|
||||
import { ServerSyncBufferEntry, ServerSyncBufferState } from './server-sync-buffer.reducer';
|
||||
import { combineLatest as observableCombineLatest, Observable, of as observableOf } from 'rxjs';
|
||||
@@ -22,6 +21,7 @@ import { environment } from '../../../environments/environment';
|
||||
import { ObjectCacheEntry } from './object-cache.reducer';
|
||||
import { Operation } from 'fast-json-patch';
|
||||
import { NoOpAction } from '../../shared/ngrx/no-op.action';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
@Injectable()
|
||||
export class ServerSyncBufferEffects {
|
||||
|
@@ -3,11 +3,12 @@ import { TestScheduler } from 'rxjs/testing';
|
||||
import { getMockRequestService } from '../../shared/mocks/request.service.mock';
|
||||
import { ConfigService } from './config.service';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { FindListOptions, GetRequest } from '../data/request.models';
|
||||
import { GetRequest } from '../data/request.models';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service.stub';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { getMockRemoteDataBuildService } from '../../shared/mocks/remote-data-build.service.mock';
|
||||
import { FindListOptions } from '../data/find-list-options.model';
|
||||
|
||||
const LINK_NAME = 'test';
|
||||
const BROWSE = 'search/findByCollection';
|
||||
|
@@ -6,7 +6,6 @@ import { ConfigObject } from './models/config.model';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { DataService } from '../data/data.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
@@ -14,6 +13,7 @@ import { DefaultChangeAnalyzer } from '../data/default-change-analyzer.service';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { getFirstCompletedRemoteData } from '../shared/operators';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
class DataServiceImpl extends DataService<ConfigObject> {
|
||||
constructor(
|
||||
|
@@ -5,7 +5,6 @@ import { RequestService } from '../data/request.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
@@ -17,6 +16,7 @@ import { SubmissionFormsModel } from './models/config-submission-forms.model';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { Observable } from 'rxjs';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
@Injectable()
|
||||
@dataService(SUBMISSION_FORMS_TYPE)
|
||||
|
@@ -7,7 +7,6 @@ import { dataService } from '../cache/builders/build-decorators';
|
||||
import { SUBMISSION_UPLOADS_TYPE } from './models/config-type';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { DefaultChangeAnalyzer } from '../data/default-change-analyzer.service';
|
||||
@@ -16,6 +15,7 @@ import { SubmissionUploadsModel } from './models/config-submission-uploads.model
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { Observable } from 'rxjs';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
/**
|
||||
* Provides methods to retrieve, from REST server, bitstream access conditions configurations applicable during the submission process.
|
||||
|
30
src/app/core/core-state.model.ts
Normal file
30
src/app/core/core-state.model.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
BitstreamFormatRegistryState
|
||||
} from '../admin/admin-registries/bitstream-formats/bitstream-format.reducers';
|
||||
import { ObjectCacheState } from './cache/object-cache.reducer';
|
||||
import { ServerSyncBufferState } from './cache/server-sync-buffer.reducer';
|
||||
import { ObjectUpdatesState } from './data/object-updates/object-updates.reducer';
|
||||
import { HistoryState } from './history/history.reducer';
|
||||
import { MetaIndexState } from './index/index.reducer';
|
||||
import { AuthState } from './auth/auth.reducer';
|
||||
import { JsonPatchOperationsState } from './json-patch/json-patch-operations.reducer';
|
||||
import { MetaTagState } from './metadata/meta-tag.reducer';
|
||||
import { RouteState } from './services/route.reducer';
|
||||
import { RequestState } from './data/request-state.model';
|
||||
|
||||
/**
|
||||
* The core sub-state in the NgRx store
|
||||
*/
|
||||
export interface CoreState {
|
||||
'bitstreamFormats': BitstreamFormatRegistryState;
|
||||
'cache/object': ObjectCacheState;
|
||||
'cache/syncbuffer': ServerSyncBufferState;
|
||||
'cache/object-updates': ObjectUpdatesState;
|
||||
'data/request': RequestState;
|
||||
'history': HistoryState;
|
||||
'index': MetaIndexState;
|
||||
'auth': AuthState;
|
||||
'json/patch': JsonPatchOperationsState;
|
||||
'metaTag': MetaTagState;
|
||||
'route': RouteState;
|
||||
}
|
@@ -42,7 +42,7 @@ import { SubmissionSectionModel } from './config/models/config-submission-sectio
|
||||
import { SubmissionUploadsModel } from './config/models/config-submission-uploads.model';
|
||||
import { SubmissionFormsConfigService } from './config/submission-forms-config.service';
|
||||
import { coreEffects } from './core.effects';
|
||||
import { coreReducers, CoreState } from './core.reducers';
|
||||
import { coreReducers} from './core.reducers';
|
||||
import { BitstreamFormatDataService } from './data/bitstream-format-data.service';
|
||||
import { CollectionDataService } from './data/collection-data.service';
|
||||
import { CommunityDataService } from './data/community-data.service';
|
||||
@@ -163,6 +163,7 @@ import { RootDataService } from './data/root-data.service';
|
||||
import { Root } from './data/root.model';
|
||||
import { SearchConfig } from './shared/search/search-filters/search-config.model';
|
||||
import { SequenceService } from './shared/sequence.service';
|
||||
import { CoreState } from './core-state.model';
|
||||
|
||||
/**
|
||||
* When not in production, endpoint responses can be mocked for testing purposes
|
||||
|
@@ -1,33 +1,19 @@
|
||||
import { ActionReducerMap, } from '@ngrx/store';
|
||||
|
||||
import { objectCacheReducer, ObjectCacheState } from './cache/object-cache.reducer';
|
||||
import { indexReducer, MetaIndexState } from './index/index.reducer';
|
||||
import { requestReducer, RequestState } from './data/request.reducer';
|
||||
import { authReducer, AuthState } from './auth/auth.reducer';
|
||||
import { jsonPatchOperationsReducer, JsonPatchOperationsState } from './json-patch/json-patch-operations.reducer';
|
||||
import { serverSyncBufferReducer, ServerSyncBufferState } from './cache/server-sync-buffer.reducer';
|
||||
import { objectUpdatesReducer, ObjectUpdatesState } from './data/object-updates/object-updates.reducer';
|
||||
import { routeReducer, RouteState } from './services/route.reducer';
|
||||
import { objectCacheReducer } from './cache/object-cache.reducer';
|
||||
import { indexReducer } from './index/index.reducer';
|
||||
import { requestReducer } from './data/request.reducer';
|
||||
import { authReducer } from './auth/auth.reducer';
|
||||
import { jsonPatchOperationsReducer } from './json-patch/json-patch-operations.reducer';
|
||||
import { serverSyncBufferReducer } from './cache/server-sync-buffer.reducer';
|
||||
import { objectUpdatesReducer } from './data/object-updates/object-updates.reducer';
|
||||
import { routeReducer } from './services/route.reducer';
|
||||
import {
|
||||
bitstreamFormatReducer,
|
||||
BitstreamFormatRegistryState
|
||||
bitstreamFormatReducer
|
||||
} from '../admin/admin-registries/bitstream-formats/bitstream-format.reducers';
|
||||
import { historyReducer, HistoryState } from './history/history.reducer';
|
||||
import { metaTagReducer, MetaTagState } from './metadata/meta-tag.reducer';
|
||||
|
||||
export interface CoreState {
|
||||
'bitstreamFormats': BitstreamFormatRegistryState;
|
||||
'cache/object': ObjectCacheState;
|
||||
'cache/syncbuffer': ServerSyncBufferState;
|
||||
'cache/object-updates': ObjectUpdatesState;
|
||||
'data/request': RequestState;
|
||||
'history': HistoryState;
|
||||
'index': MetaIndexState;
|
||||
'auth': AuthState;
|
||||
'json/patch': JsonPatchOperationsState;
|
||||
'metaTag': MetaTagState;
|
||||
'route': RouteState;
|
||||
}
|
||||
import { historyReducer } from './history/history.reducer';
|
||||
import { metaTagReducer } from './metadata/meta-tag.reducer';
|
||||
import { CoreState } from './core-state.model';
|
||||
|
||||
export const coreReducers: ActionReducerMap<CoreState> = {
|
||||
'bitstreamFormats': bitstreamFormatReducer,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { createFeatureSelector } from '@ngrx/store';
|
||||
import { CoreState } from './core.reducers';
|
||||
import { CoreState } from './core-state.model';
|
||||
|
||||
/**
|
||||
* Base selector to select the core state from the store
|
||||
|
@@ -1,8 +1,9 @@
|
||||
import { BaseResponseParsingService } from './base-response-parsing.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { GetRequest, RestRequest } from './request.models';
|
||||
import { GetRequest} from './request.models';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { CacheableObject } from '../cache/cacheable-object.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
class TestService extends BaseResponseParsingService {
|
||||
|
@@ -6,9 +6,9 @@ import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { PaginatedList, buildPaginatedList } from './paginated-list.model';
|
||||
import { getClassForType } from '../cache/builders/build-decorators';
|
||||
import { RestRequest } from './request.models';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { CacheableObject } from '../cache/cacheable-object.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
|
||||
|
@@ -9,7 +9,6 @@ import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Bitstream } from '../shared/bitstream.model';
|
||||
import { BITSTREAM } from '../shared/bitstream.resource-type';
|
||||
import { Bundle } from '../shared/bundle.model';
|
||||
@@ -20,7 +19,7 @@ import { DataService } from './data.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { buildPaginatedList, PaginatedList } from './paginated-list.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { FindListOptions, PutRequest } from './request.models';
|
||||
import { PutRequest } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { BitstreamFormatDataService } from './bitstream-format-data.service';
|
||||
import { BitstreamFormat } from '../shared/bitstream-format.model';
|
||||
@@ -29,6 +28,8 @@ import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.util
|
||||
import { PageInfo } from '../shared/page-info.model';
|
||||
import { RequestParam } from '../cache/models/request-param.model';
|
||||
import { sendRequest } from '../shared/request.operators';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
/**
|
||||
* A service to retrieve {@link Bitstream}s from the REST API
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { BitstreamFormatDataService } from './bitstream-format-data.service';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { Action, Store } from '@ngrx/store';
|
||||
@@ -17,8 +16,9 @@ import {
|
||||
BitstreamFormatsRegistrySelectAction
|
||||
} from '../../admin/admin-registries/bitstream-formats/bitstream-format.actions';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { RequestEntry } from './request-entry.model';
|
||||
|
||||
describe('BitstreamFormatDataService', () => {
|
||||
let service: BitstreamFormatDataService;
|
||||
|
@@ -13,7 +13,6 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { coreSelector } from '../core.selectors';
|
||||
import { BitstreamFormat } from '../shared/bitstream-format.model';
|
||||
import { BITSTREAM_FORMAT } from '../shared/bitstream-format.resource-type';
|
||||
@@ -25,6 +24,7 @@ import { RemoteData } from './remote-data';
|
||||
import { PostRequest, PutRequest } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { sendRequest } from '../shared/request.operators';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
const bitstreamFormatsStateSelector = createSelector(
|
||||
coreSelector,
|
||||
|
@@ -3,7 +3,6 @@ import { Store } from '@ngrx/store';
|
||||
import { compare, Operation } from 'fast-json-patch';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { ChangeAnalyzer } from './change-analyzer';
|
||||
import { getMockRequestService } from '../../shared/mocks/request.service.mock';
|
||||
@@ -13,6 +12,7 @@ import { HALLink } from '../shared/hal-link.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { createPaginatedList } from '../../shared/testing/utils.test';
|
||||
import { Bundle } from '../shared/bundle.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
class DummyChangeAnalyzer implements ChangeAnalyzer<Item> {
|
||||
diff(object1: Item, object2: Item): Operation[] {
|
||||
|
@@ -9,7 +9,6 @@ import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Bundle } from '../shared/bundle.model';
|
||||
import { BUNDLE } from '../shared/bundle.resource-type';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
@@ -18,11 +17,13 @@ import { DataService } from './data.service';
|
||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { PaginatedList } from './paginated-list.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { FindListOptions, GetRequest } from './request.models';
|
||||
import { GetRequest } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { PaginatedSearchOptions } from '../../shared/search/paginated-search-options.model';
|
||||
import { Bitstream } from '../shared/bitstream.model';
|
||||
import { RequestEntryState } from './request-entry-state.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
/**
|
||||
* A service to retrieve {@link Bundle}s from the REST API
|
||||
|
@@ -13,7 +13,6 @@ import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { RequestParam } from '../cache/models/request-param.model';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
||||
import { DSpaceSerializer } from '../dspace-rest/dspace.serializer';
|
||||
import { Collection } from '../shared/collection.model';
|
||||
@@ -29,12 +28,13 @@ import { PaginatedList } from './paginated-list.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import {
|
||||
ContentSourceRequest,
|
||||
FindListOptions,
|
||||
UpdateContentSourceRequest,
|
||||
RestRequest
|
||||
UpdateContentSourceRequest
|
||||
} from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { BitstreamDataService } from './bitstream-data.service';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
@Injectable()
|
||||
@dataService(COLLECTION)
|
||||
|
@@ -7,13 +7,11 @@ import { getMockRequestService } from '../../shared/mocks/request.service.mock';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Community } from '../shared/community.model';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { ComColDataService } from './comcol-data.service';
|
||||
import { CommunityDataService } from './community-data.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import {
|
||||
createFailedRemoteDataObject$,
|
||||
@@ -22,6 +20,8 @@ import {
|
||||
createSuccessfulRemoteDataObject
|
||||
} from '../../shared/remote-data.utils';
|
||||
import { BitstreamDataService } from './bitstream-data.service';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
const LINK_NAME = 'test';
|
||||
|
||||
|
@@ -5,7 +5,6 @@ import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { Community } from '../shared/community.model';
|
||||
import { HALLink } from '../shared/hal-link.model';
|
||||
import { DataService } from './data.service';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { PaginatedList } from './paginated-list.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
@@ -17,6 +16,7 @@ import { NoContent } from '../shared/NoContent.model';
|
||||
import { createFailedRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
export abstract class ComColDataService<T extends Community | Collection> extends DataService<T> {
|
||||
protected abstract objectCache: ObjectCacheService;
|
||||
|
@@ -8,7 +8,6 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Community } from '../shared/community.model';
|
||||
import { COMMUNITY } from '../shared/community.resource-type';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
@@ -16,11 +15,12 @@ import { ComColDataService } from './comcol-data.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { PaginatedList } from './paginated-list.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { BitstreamDataService } from './bitstream-data.service';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { isNotEmpty } from '../../shared/empty.util';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
@Injectable()
|
||||
@dataService(COMMUNITY)
|
||||
|
@@ -6,7 +6,6 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { DataService } from './data.service';
|
||||
import { RemoteData } from './remote-data';
|
||||
@@ -14,6 +13,7 @@ import { RequestService } from './request.service';
|
||||
import { ConfigurationProperty } from '../shared/configuration-property.model';
|
||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { CONFIG_PROPERTY } from '../shared/config-property.resource-type';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
class DataServiceImpl extends DataService<ConfigurationProperty> {
|
||||
|
@@ -4,8 +4,8 @@ import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { DSpaceSerializer } from '../dspace-rest/dspace.serializer';
|
||||
import { ContentSource } from '../shared/content-source.model';
|
||||
import { MetadataConfig } from '../shared/metadata-config.model';
|
||||
import { RestRequest } from './request.models';
|
||||
import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing.service';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
@Injectable()
|
||||
/**
|
||||
|
@@ -7,14 +7,13 @@ import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { SortDirection, SortOptions } from '../cache/models/sort-options.model';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { ChangeAnalyzer } from './change-analyzer';
|
||||
import { DataService } from './data.service';
|
||||
import { FindListOptions, PatchRequest } from './request.models';
|
||||
import { PatchRequest } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { getMockRequestService } from '../../shared/mocks/request.service.mock';
|
||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service.stub';
|
||||
@@ -23,6 +22,8 @@ import { getMockRemoteDataBuildService } from '../../shared/mocks/remote-data-bu
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { RequestEntryState } from './request-entry-state.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
const endpoint = 'https://rest.api/core';
|
||||
|
||||
|
@@ -22,7 +22,6 @@ import { getClassForType } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { RequestParam } from '../cache/models/request-param.model';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { DSpaceSerializer } from '../dspace-rest/dspace.serializer';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
@@ -34,7 +33,6 @@ import { RemoteData } from './remote-data';
|
||||
import {
|
||||
CreateRequest,
|
||||
GetRequest,
|
||||
FindListOptions,
|
||||
PatchRequest,
|
||||
PutRequest,
|
||||
DeleteRequest
|
||||
@@ -45,6 +43,8 @@ import { UpdateDataService } from './update-data.service';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { NoContent } from '../shared/NoContent.model';
|
||||
import { CacheableObject } from '../cache/cacheable-object.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
export abstract class DataService<T extends CacheableObject> implements UpdateDataService<T> {
|
||||
protected abstract requestService: RequestService;
|
||||
|
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { ResponseParsingService } from './parsing.service';
|
||||
import { RestRequest } from './request.models';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
@Injectable()
|
||||
export class DebugResponseParsingService implements ResponseParsingService {
|
||||
|
@@ -6,13 +6,13 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { DsoRedirectDataService } from './dso-redirect-data.service';
|
||||
import { GetRequest, IdentifierType } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
describe('DsoRedirectDataService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
|
@@ -9,7 +9,6 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { DataService } from './data.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
@@ -20,6 +19,7 @@ import { getFirstCompletedRemoteData } from '../shared/operators';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { getItemPageRoute } from '../../item-page/item-page-routing-paths';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
@Injectable()
|
||||
export class DsoRedirectDataService extends DataService<any> {
|
||||
|
@@ -3,12 +3,12 @@ import { Injectable } from '@angular/core';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { RestResponse, DSOSuccessResponse } from '../cache/response.models';
|
||||
import { RestRequest } from './request.models';
|
||||
|
||||
import { ResponseParsingService } from './parsing.service';
|
||||
import { BaseResponseParsingService } from './base-response-parsing.service';
|
||||
import { hasNoValue, hasValue } from '../../shared/empty.util';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
@Injectable()
|
||||
export class DSOResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
|
||||
|
@@ -7,7 +7,6 @@ import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { DSPACE_OBJECT } from '../shared/dspace-object.resource-type';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
@@ -15,8 +14,9 @@ import { DataService } from './data.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { RequestService } from './request.service';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { PaginatedList } from './paginated-list.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
class DataServiceImpl extends DataService<DSpaceObject> {
|
||||
|
@@ -6,7 +6,6 @@ import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { PaginatedList, buildPaginatedList } from './paginated-list.model';
|
||||
import { getClassForType } from '../cache/builders/build-decorators';
|
||||
import { RestRequest } from './request.models';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
@@ -17,6 +16,7 @@ import { RestRequestMethod } from './rest-request-method';
|
||||
import { getUrlWithoutEmbedParams, getEmbedSizeParams } from '../index/index.selectors';
|
||||
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||
import { CacheableObject } from '../cache/cacheable-object.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
|
||||
|
@@ -7,12 +7,12 @@ import {
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { getClassForType } from '../cache/builders/build-decorators';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { RestRequest } from './request.models';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { ParsedResponse } from '../cache/response.models';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { CacheableObject } from '../cache/cacheable-object.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
/**
|
||||
* ResponseParsingService able to deal with HAL Endpoints that are only needed as steps
|
||||
|
@@ -3,7 +3,6 @@ import { DataService } from './data.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
@@ -18,6 +17,7 @@ import { PaginatedList } from './paginated-list.model';
|
||||
import { ItemType } from '../shared/item-relationships/item-type.model';
|
||||
import { getRemoteDataPayload, getFirstSucceededRemoteData } from '../shared/operators';
|
||||
import { RelationshipTypeService } from './relationship-type.service';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
/**
|
||||
* Service handling all ItemType requests
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { RequestService } from './request.service';
|
||||
import { EpersonRegistrationService } from './eperson-registration.service';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { PostRequest } from './request.models';
|
||||
import { Registration } from '../shared/registration.model';
|
||||
@@ -9,6 +8,7 @@ import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-servic
|
||||
import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils';
|
||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { RequestEntry } from './request-entry.model';
|
||||
|
||||
describe('EpersonRegistrationService', () => {
|
||||
let testScheduler;
|
||||
|
@@ -4,12 +4,10 @@ import { ExternalSource } from '../shared/external-source.model';
|
||||
import { RequestService } from './request.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { Observable } from 'rxjs';
|
||||
import { distinctUntilChanged, map, switchMap, take } from 'rxjs/operators';
|
||||
import { PaginatedSearchOptions } from '../../shared/search/paginated-search-options.model';
|
||||
@@ -19,6 +17,8 @@ import { PaginatedList } from './paginated-list.model';
|
||||
import { ExternalSourceEntry } from '../shared/external-source-entry.model';
|
||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
/**
|
||||
* A service handling all external source requests
|
||||
|
@@ -3,9 +3,9 @@ import { SearchFilterConfig } from '../../shared/search/search-filter-config.mod
|
||||
import { ParsedResponse } from '../cache/response.models';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { DSpaceSerializer } from '../dspace-rest/dspace.serializer';
|
||||
import { RestRequest } from './request.models';
|
||||
import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing.service';
|
||||
import { FacetConfigResponse } from '../../shared/search/facet-config-response.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
@Injectable()
|
||||
export class FacetConfigResponseParsingService extends DspaceRestResponseParsingService {
|
||||
|
@@ -3,9 +3,9 @@ import { FacetValue } from '../../shared/search/facet-value.model';
|
||||
import { ParsedResponse } from '../cache/response.models';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { DSpaceSerializer } from '../dspace-rest/dspace.serializer';
|
||||
import { RestRequest } from './request.models';
|
||||
import { FacetValues } from '../../shared/search/facet-values.model';
|
||||
import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing.service';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
@Injectable()
|
||||
export class FacetValueResponseParsingService extends DspaceRestResponseParsingService {
|
||||
|
@@ -4,7 +4,6 @@ import { AuthService } from '../../auth/auth.service';
|
||||
import { Site } from '../../shared/site.model';
|
||||
import { EPerson } from '../../eperson/models/eperson.model';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { FindListOptions } from '../request.models';
|
||||
import { FeatureID } from './feature-id';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
import { RequestParam } from '../../cache/models/request-param.model';
|
||||
@@ -12,6 +11,7 @@ import { Authorization } from '../../shared/authorization.model';
|
||||
import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||
import { Feature } from '../../shared/feature.model';
|
||||
import { FindListOptions } from '../find-list-options.model';
|
||||
|
||||
describe('AuthorizationDataService', () => {
|
||||
let service: AuthorizationDataService;
|
||||
|
@@ -7,7 +7,6 @@ import { Authorization } from '../../shared/authorization.model';
|
||||
import { RequestService } from '../request.service';
|
||||
import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../../core.reducers';
|
||||
import { ObjectCacheService } from '../../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
@@ -15,7 +14,6 @@ import { HttpClient } from '@angular/common/http';
|
||||
import { DSOChangeAnalyzer } from '../dso-change-analyzer.service';
|
||||
import { AuthService } from '../../auth/auth.service';
|
||||
import { SiteDataService } from '../site-data.service';
|
||||
import { FindListOptions } from '../request.models';
|
||||
import { followLink, FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||
import { RemoteData } from '../remote-data';
|
||||
import { PaginatedList } from '../paginated-list.model';
|
||||
@@ -26,6 +24,8 @@ import { AuthorizationSearchParams } from './authorization-search-params';
|
||||
import { addSiteObjectUrlIfEmpty, oneAuthorizationMatchesFeature } from './authorization-utils';
|
||||
import { FeatureID } from './feature-id';
|
||||
import { getFirstCompletedRemoteData } from '../../shared/operators';
|
||||
import { CoreState } from '../../core-state.model';
|
||||
import { FindListOptions } from '../find-list-options.model';
|
||||
|
||||
/**
|
||||
* A service to retrieve {@link Authorization}s from the REST API
|
||||
|
@@ -6,12 +6,12 @@ import { Feature } from '../../shared/feature.model';
|
||||
import { RequestService } from '../request.service';
|
||||
import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../../core.reducers';
|
||||
import { ObjectCacheService } from '../../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { DSOChangeAnalyzer } from '../dso-change-analyzer.service';
|
||||
import { CoreState } from '../../core-state.model';
|
||||
|
||||
/**
|
||||
* A service to retrieve {@link Feature}s from the REST API
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ResponseParsingService } from './parsing.service';
|
||||
import { RestRequest } from './request.models';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { BaseResponseParsingService } from './base-response-parsing.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { FilteredDiscoveryQueryResponse, RestResponse } from '../cache/response.models';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
/**
|
||||
* A ResponseParsingService used to parse RawRestResponse coming from the REST API to a discovery query (string)
|
||||
|
14
src/app/core/data/find-list-options.model.ts
Normal file
14
src/app/core/data/find-list-options.model.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { SortOptions } from '../cache/models/sort-options.model';
|
||||
import { RequestParam } from '../cache/models/request-param.model';
|
||||
|
||||
/**
|
||||
* The options for a find list request
|
||||
*/
|
||||
export class FindListOptions {
|
||||
scopeID?: string;
|
||||
elementsPerPage?: number;
|
||||
currentPage?: number;
|
||||
sort?: SortOptions;
|
||||
searchParams?: RequestParam[];
|
||||
startsWith?: string;
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
import { HrefOnlyDataService } from './href-only-data.service';
|
||||
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { DataService } from './data.service';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
describe(`HrefOnlyDataService`, () => {
|
||||
let service: HrefOnlyDataService;
|
||||
|
@@ -2,7 +2,6 @@ import { DataService } from './data.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
@@ -10,7 +9,6 @@ import { HttpClient } from '@angular/common/http';
|
||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { VOCABULARY_ENTRY } from '../submission/vocabularies/models/vocabularies.resource-type';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteData } from './remote-data';
|
||||
@@ -19,6 +17,8 @@ import { PaginatedList } from './paginated-list.model';
|
||||
import { ITEM_TYPE } from '../shared/item-relationships/item-type.resource-type';
|
||||
import { LICENSE } from '../shared/license.resource-type';
|
||||
import { CacheableObject } from '../cache/cacheable-object.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
class DataServiceImpl extends DataService<any> {
|
||||
|
@@ -8,13 +8,14 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { BrowseService } from '../browse/browse.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { ExternalSourceEntry } from '../shared/external-source-entry.model';
|
||||
import { ItemDataService } from './item-data.service';
|
||||
import { DeleteRequest, FindListOptions, PostRequest } from './request.models';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { DeleteRequest, PostRequest } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { getMockRemoteDataBuildService } from '../../shared/mocks/remote-data-build.service.mock';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { RequestEntry } from './request-entry.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
describe('ItemDataService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
|
@@ -9,7 +9,6 @@ import { BrowseService } from '../browse/browse.service';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
||||
import { Collection } from '../shared/collection.model';
|
||||
import { ExternalSourceEntry } from '../shared/external-source-entry.model';
|
||||
@@ -22,7 +21,7 @@ import { DataService } from './data.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { PaginatedList } from './paginated-list.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { DeleteRequest, FindListOptions, GetRequest, PostRequest, PutRequest, RestRequest } from './request.models';
|
||||
import { DeleteRequest, GetRequest, PostRequest, PutRequest} from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { PaginatedSearchOptions } from '../../shared/search/paginated-search-options.model';
|
||||
import { Bundle } from '../shared/bundle.model';
|
||||
@@ -34,6 +33,9 @@ import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { ResponseParsingService } from './parsing.service';
|
||||
import { StatusCodeOnlyResponseParsingService } from './status-code-only-response-parsing.service';
|
||||
import { sendRequest } from '../shared/request.operators';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
@Injectable()
|
||||
@dataService(ITEM)
|
||||
|
@@ -1,12 +1,9 @@
|
||||
import { ItemTemplateDataService } from './item-template-data.service';
|
||||
import { RestRequest } from './request.models';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { BrowseService } from '../browse/browse.service';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
@@ -15,6 +12,9 @@ import { HttpClient } from '@angular/common/http';
|
||||
import { CollectionDataService } from './collection-data.service';
|
||||
import { RestRequestMethod } from './rest-request-method';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { RequestEntry } from './request-entry.model';
|
||||
|
||||
describe('ItemTemplateDataService', () => {
|
||||
let service: ItemTemplateDataService;
|
||||
|
@@ -9,7 +9,6 @@ import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
@@ -23,6 +22,7 @@ import { NoContent } from '../shared/NoContent.model';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { Operation } from 'fast-json-patch';
|
||||
import { getFirstCompletedRemoteData } from '../shared/operators';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
/**
|
||||
|
@@ -4,12 +4,12 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service.stub';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { MetadataFieldDataService } from './metadata-field-data.service';
|
||||
import { MetadataSchema } from '../metadata/metadata-schema.model';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { RequestParam } from '../cache/models/request-param.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
describe('MetadataFieldDataService', () => {
|
||||
let metadataFieldService: MetadataFieldDataService;
|
||||
|
@@ -7,7 +7,6 @@ import { RemoteData } from './remote-data';
|
||||
import { RequestService } from './request.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
@@ -16,11 +15,12 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { METADATA_FIELD } from '../metadata/metadata-field.resource-type';
|
||||
import { MetadataField } from '../metadata/metadata-field.model';
|
||||
import { MetadataSchema } from '../metadata/metadata-schema.model';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { RequestParam } from '../cache/models/request-param.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
/**
|
||||
* A service responsible for fetching/sending data from/to the REST API on the metadatafields endpoint
|
||||
|
@@ -5,7 +5,6 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { MetadataSchema } from '../metadata/metadata-schema.model';
|
||||
import { METADATA_SCHEMA } from '../metadata/metadata-schema.resource-type';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
@@ -16,6 +15,7 @@ import { Observable } from 'rxjs';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
/**
|
||||
* A service responsible for fetching/sending data from/to the REST API on the metadataschemas endpoint
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ParsedResponse } from '../cache/response.models';
|
||||
import { DSpaceSerializer } from '../dspace-rest/dspace.serializer';
|
||||
import { RestRequest } from './request.models';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { SearchObjects } from '../../shared/search/search-objects.model';
|
||||
import { MetadataMap, MetadataValue } from '../shared/metadata.models';
|
||||
import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing.service';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
@Injectable()
|
||||
export class MyDSpaceResponseParsingService extends DspaceRestResponseParsingService {
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../../core.reducers';
|
||||
import { ObjectUpdatesService } from './object-updates.service';
|
||||
import {
|
||||
DiscardObjectUpdatesAction,
|
||||
@@ -16,6 +15,7 @@ import { OBJECT_UPDATES_TRASH_PATH } from './object-updates.reducer';
|
||||
import { Relationship } from '../../shared/item-relationships/relationship.model';
|
||||
import { Injector } from '@angular/core';
|
||||
import { FieldChangeType } from './field-change-type.model';
|
||||
import { CoreState } from '../../core-state.model';
|
||||
|
||||
describe('ObjectUpdatesService', () => {
|
||||
let service: ObjectUpdatesService;
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { createSelector, MemoizedSelector, select, Store } from '@ngrx/store';
|
||||
import { CoreState } from '../../core.reducers';
|
||||
import { coreSelector } from '../../core.selectors';
|
||||
import {
|
||||
FieldState,
|
||||
@@ -35,6 +34,7 @@ import { GenericConstructor } from '../../shared/generic-constructor';
|
||||
import { Identifiable } from './identifiable.model';
|
||||
import { FieldUpdates } from './field-updates.model';
|
||||
import { FieldChangeType } from './field-change-type.model';
|
||||
import { CoreState } from '../../core-state.model';
|
||||
|
||||
function objectUpdatesStateSelector(): MemoizedSelector<CoreState, ObjectUpdatesState> {
|
||||
return createSelector(coreSelector, (state: CoreState) => state['cache/object-updates']);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { RestRequest } from './request.models';
|
||||
import { ParsedResponse } from '../cache/response.models';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
export interface ResponseParsingService {
|
||||
parse(request: RestRequest, data: RawRestResponse): ParsedResponse;
|
||||
|
@@ -3,7 +3,6 @@ import { DataService } from '../data.service';
|
||||
import { RequestService } from '../request.service';
|
||||
import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../../core.reducers';
|
||||
import { ObjectCacheService } from '../../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
@@ -18,6 +17,7 @@ import { PaginatedList } from '../paginated-list.model';
|
||||
import { Bitstream } from '../../shared/bitstream.model';
|
||||
import { RemoteData } from '../remote-data';
|
||||
import { BitstreamDataService } from '../bitstream-data.service';
|
||||
import { CoreState } from '../../core-state.model';
|
||||
|
||||
@Injectable()
|
||||
@dataService(PROCESS)
|
||||
|
@@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { DataService } from '../data.service';
|
||||
import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../../core.reducers';
|
||||
import { ObjectCacheService } from '../../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
@@ -13,12 +12,14 @@ import { ProcessParameter } from '../../../process-page/processes/process-parame
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { URLCombiner } from '../../url-combiner/url-combiner';
|
||||
import { RemoteData } from '../remote-data';
|
||||
import { MultipartPostRequest, RestRequest } from '../request.models';
|
||||
import { MultipartPostRequest} from '../request.models';
|
||||
import { RequestService } from '../request.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { dataService } from '../../cache/builders/build-decorators';
|
||||
import { SCRIPT } from '../../../process-page/scripts/script.resource-type';
|
||||
import { Process } from '../../../process-page/processes/process.model';
|
||||
import { RestRequest } from '../rest-request.model';
|
||||
import { CoreState } from '../../core-state.model';
|
||||
|
||||
export const METADATA_IMPORT_SCRIPT_NAME = 'metadata-import';
|
||||
export const METADATA_EXPORT_SCRIPT_NAME = 'metadata-export';
|
||||
|
@@ -4,8 +4,8 @@ import {
|
||||
} from '../cache/response.models';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { ResponseParsingService } from './parsing.service';
|
||||
import { RestRequest } from './request.models';
|
||||
import { Registration } from '../shared/registration.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
|
@@ -10,7 +10,6 @@ import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
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';
|
||||
@@ -22,6 +21,7 @@ import { ItemDataService } from './item-data.service';
|
||||
import { PaginatedList } from './paginated-list.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { RequestService } from './request.service';
|
||||
import { CoreState } from '../core-state.model';
|
||||
|
||||
/**
|
||||
* Check if one side of a RelationshipType is the ItemType with the given label
|
||||
|
@@ -6,15 +6,16 @@ import { Relationship } from '../shared/item-relationships/relationship.model';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { PageInfo } from '../shared/page-info.model';
|
||||
import { buildPaginatedList } from './paginated-list.model';
|
||||
import { DeleteRequest, FindListOptions } from './request.models';
|
||||
import { DeleteRequest} from './request.models';
|
||||
import { RelationshipService } from './relationship.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service.stub';
|
||||
import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { getMockRemoteDataBuildServiceHrefMap } from '../../shared/mocks/remote-data-build.service.mock';
|
||||
import { getMockRequestService } from '../../shared/mocks/request.service.mock';
|
||||
import { createPaginatedList } from '../../shared/testing/utils.test';
|
||||
import { RequestEntry } from './request-entry.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
describe('RelationshipService', () => {
|
||||
let service: RelationshipService;
|
||||
|
@@ -21,7 +21,6 @@ import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { RequestParam } from '../cache/models/request-param.model';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { RelationshipType } from '../shared/item-relationships/relationship-type.model';
|
||||
@@ -39,11 +38,14 @@ import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { ItemDataService } from './item-data.service';
|
||||
import { PaginatedList } from './paginated-list.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { DeleteRequest, FindListOptions, PostRequest, RestRequest } from './request.models';
|
||||
import { DeleteRequest, PostRequest} from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { NoContent } from '../shared/NoContent.model';
|
||||
import { RequestEntryState } from './request-entry-state.model';
|
||||
import { sendRequest } from '../shared/request.operators';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
const relationshipListsStateSelector = (state: AppState) => state.relationshipLists;
|
||||
|
||||
|
13
src/app/core/data/request-entry.model.ts
Normal file
13
src/app/core/data/request-entry.model.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { RestRequestWithResponseParser } from './rest-request-with-response-parser.model';
|
||||
import { RequestEntryState } from './request-entry-state.model';
|
||||
import { ResponseState } from './response-state.model';
|
||||
|
||||
/**
|
||||
* An entry for a request in the NgRx store
|
||||
*/
|
||||
export class RequestEntry {
|
||||
request: RestRequestWithResponseParser;
|
||||
state: RequestEntryState;
|
||||
response: ResponseState;
|
||||
lastUpdated: number;
|
||||
}
|
8
src/app/core/data/request-state.model.ts
Normal file
8
src/app/core/data/request-state.model.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { RequestEntry } from './request-entry.model';
|
||||
|
||||
/**
|
||||
* The request sub-state of the NgRx store
|
||||
*/
|
||||
export interface RequestState {
|
||||
[uuid: string]: RequestEntry;
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
import { Action } from '@ngrx/store';
|
||||
import { type } from '../../shared/ngrx/type';
|
||||
import { RestRequest } from './request.models';
|
||||
import { HALLink } from '../shared/hal-link.model';
|
||||
import { UnCacheableObject } from '../shared/uncacheable-object.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
/**
|
||||
* The list of RequestAction type definitions
|
||||
|
@@ -16,11 +16,12 @@ import {
|
||||
RequestSuccessAction,
|
||||
ResetResponseTimestampsAction
|
||||
} from './request.actions';
|
||||
import { RestRequest } from './request.models';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { RequestService } from './request.service';
|
||||
import { ParsedResponse } from '../cache/response.models';
|
||||
import { RequestError } from './request-error.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
import { RestRequestWithResponseParser } from './rest-request-with-response-parser.model';
|
||||
import { RequestEntry } from './request-entry.model';
|
||||
|
||||
@Injectable()
|
||||
export class RequestEffects {
|
||||
@@ -34,7 +35,7 @@ export class RequestEffects {
|
||||
}),
|
||||
filter((entry: RequestEntry) => hasValue(entry)),
|
||||
map((entry: RequestEntry) => entry.request),
|
||||
mergeMap((request: RestRequest) => {
|
||||
mergeMap((request: RestRequestWithResponseParser) => {
|
||||
let body = request.body;
|
||||
if (isNotEmpty(request.body) && !request.isMultipart) {
|
||||
const serializer = new DSpaceSerializer(getClassForType(request.body.type));
|
||||
|
@@ -1,15 +1,16 @@
|
||||
import { SortOptions } from '../cache/models/sort-options.model';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { ResponseParsingService } from './parsing.service';
|
||||
import { EndpointMapResponseParsingService } from './endpoint-map-response-parsing.service';
|
||||
import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
||||
import { SubmissionResponseParsingService } from '../submission/submission-response-parsing.service';
|
||||
import {
|
||||
SubmissionResponseParsingService
|
||||
} from '../submission/submission-response-parsing.service';
|
||||
import { RestRequestMethod } from './rest-request-method';
|
||||
import { RequestParam } from '../cache/models/request-param.model';
|
||||
import { TaskResponseParsingService } from '../tasks/task-response-parsing.service';
|
||||
import { ContentSourceResponseParsingService } from './content-source-response-parsing.service';
|
||||
import { RestRequestWithResponseParser } from './rest-request-with-response-parser.model';
|
||||
import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing.service';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
|
||||
@@ -19,25 +20,13 @@ export enum IdentifierType {
|
||||
HANDLE = 'handle'
|
||||
}
|
||||
|
||||
export abstract class RestRequest {
|
||||
public responseMsToLive = environment.cache.msToLive.default;
|
||||
public isMultipart = false;
|
||||
|
||||
constructor(
|
||||
public uuid: string,
|
||||
public href: string,
|
||||
public method: RestRequestMethod = RestRequestMethod.GET,
|
||||
public body?: any,
|
||||
public options?: HttpOptions,
|
||||
) {
|
||||
}
|
||||
|
||||
class DSpaceRestRequest extends RestRequestWithResponseParser {
|
||||
getResponseParser(): GenericConstructor<ResponseParsingService> {
|
||||
return DspaceRestResponseParsingService;
|
||||
}
|
||||
}
|
||||
|
||||
export class GetRequest extends RestRequest {
|
||||
export class GetRequest extends DSpaceRestRequest {
|
||||
constructor(
|
||||
public uuid: string,
|
||||
public href: string,
|
||||
@@ -48,7 +37,7 @@ export class GetRequest extends RestRequest {
|
||||
}
|
||||
}
|
||||
|
||||
export class PostRequest extends RestRequest {
|
||||
export class PostRequest extends DSpaceRestRequest {
|
||||
constructor(
|
||||
public uuid: string,
|
||||
public href: string,
|
||||
@@ -62,7 +51,7 @@ export class PostRequest extends RestRequest {
|
||||
/**
|
||||
* Request representing a multipart post request
|
||||
*/
|
||||
export class MultipartPostRequest extends RestRequest {
|
||||
export class MultipartPostRequest extends DSpaceRestRequest {
|
||||
public isMultipart = true;
|
||||
constructor(
|
||||
public uuid: string,
|
||||
@@ -74,7 +63,7 @@ export class MultipartPostRequest extends RestRequest {
|
||||
}
|
||||
}
|
||||
|
||||
export class PutRequest extends RestRequest {
|
||||
export class PutRequest extends DSpaceRestRequest {
|
||||
constructor(
|
||||
public uuid: string,
|
||||
public href: string,
|
||||
@@ -85,7 +74,7 @@ export class PutRequest extends RestRequest {
|
||||
}
|
||||
}
|
||||
|
||||
export class DeleteRequest extends RestRequest {
|
||||
export class DeleteRequest extends DSpaceRestRequest {
|
||||
constructor(
|
||||
public uuid: string,
|
||||
public href: string,
|
||||
@@ -96,7 +85,7 @@ export class DeleteRequest extends RestRequest {
|
||||
}
|
||||
}
|
||||
|
||||
export class OptionsRequest extends RestRequest {
|
||||
export class OptionsRequest extends DSpaceRestRequest {
|
||||
constructor(
|
||||
public uuid: string,
|
||||
public href: string,
|
||||
@@ -107,7 +96,7 @@ export class OptionsRequest extends RestRequest {
|
||||
}
|
||||
}
|
||||
|
||||
export class HeadRequest extends RestRequest {
|
||||
export class HeadRequest extends DSpaceRestRequest {
|
||||
constructor(
|
||||
public uuid: string,
|
||||
public href: string,
|
||||
@@ -118,7 +107,7 @@ export class HeadRequest extends RestRequest {
|
||||
}
|
||||
}
|
||||
|
||||
export class PatchRequest extends RestRequest {
|
||||
export class PatchRequest extends DSpaceRestRequest {
|
||||
constructor(
|
||||
public uuid: string,
|
||||
public href: string,
|
||||
@@ -129,15 +118,6 @@ export class PatchRequest extends RestRequest {
|
||||
}
|
||||
}
|
||||
|
||||
export class FindListOptions {
|
||||
scopeID?: string;
|
||||
elementsPerPage?: number;
|
||||
currentPage?: number;
|
||||
sort?: SortOptions;
|
||||
searchParams?: RequestParam[];
|
||||
startsWith?: string;
|
||||
}
|
||||
|
||||
export class FindListRequest extends GetRequest {
|
||||
constructor(
|
||||
uuid: string,
|
||||
|
@@ -9,8 +9,9 @@ import {
|
||||
ResetResponseTimestampsAction
|
||||
} from './request.actions';
|
||||
import { GetRequest } from './request.models';
|
||||
import { requestReducer, RequestState } from './request.reducer';
|
||||
import { requestReducer} from './request.reducer';
|
||||
import { RequestEntryState } from './request-entry-state.model';
|
||||
import { RequestState } from './request-state.model';
|
||||
|
||||
class NullAction extends RequestSuccessAction {
|
||||
type = null;
|
||||
|
@@ -9,31 +9,9 @@ import {
|
||||
RequestSuccessAction,
|
||||
ResetResponseTimestampsAction
|
||||
} from './request.actions';
|
||||
import { RestRequest } from './request.models';
|
||||
import { HALLink } from '../shared/hal-link.model';
|
||||
import { UnCacheableObject } from '../shared/uncacheable-object.model';
|
||||
import { isNull } from '../../shared/empty.util';
|
||||
import { hasSucceeded, isStale, RequestEntryState } from './request-entry-state.model';
|
||||
|
||||
export class ResponseState {
|
||||
timeCompleted: number;
|
||||
statusCode: number;
|
||||
errorMessage?: string;
|
||||
payloadLink?: HALLink;
|
||||
unCacheableObject?: UnCacheableObject;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:max-classes-per-file
|
||||
export class RequestEntry {
|
||||
request: RestRequest;
|
||||
state: RequestEntryState;
|
||||
response: ResponseState;
|
||||
lastUpdated: number;
|
||||
}
|
||||
|
||||
export interface RequestState {
|
||||
[uuid: string]: RequestEntry;
|
||||
}
|
||||
import { RequestState } from './request-state.model';
|
||||
|
||||
// Object.create(null) ensures the object has no default js properties (e.g. `__proto__`)
|
||||
const initialState = Object.create(null);
|
||||
|
@@ -6,7 +6,7 @@ import { TestScheduler } from 'rxjs/testing';
|
||||
import { getMockObjectCacheService } from '../../shared/mocks/object-cache.service.mock';
|
||||
import { defaultUUID, getMockUUIDService } from '../../shared/mocks/uuid.service.mock';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { coreReducers, CoreState } from '../core.reducers';
|
||||
import { coreReducers} from '../core.reducers';
|
||||
import { UUIDService } from '../shared/uuid.service';
|
||||
import { RequestConfigureAction, RequestExecuteAction } from './request.actions';
|
||||
import {
|
||||
@@ -16,15 +16,16 @@ import {
|
||||
OptionsRequest,
|
||||
PatchRequest,
|
||||
PostRequest,
|
||||
PutRequest,
|
||||
RestRequest
|
||||
PutRequest
|
||||
} from './request.models';
|
||||
import { RequestEntry} from './request.reducer';
|
||||
import { RequestService } from './request.service';
|
||||
import { TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { storeModuleConfig } from '../../app.reducer';
|
||||
import { MockStore, provideMockStore } from '@ngrx/store/testing';
|
||||
import { RequestEntryState } from './request-entry-state.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { RequestEntry } from './request-entry.model';
|
||||
|
||||
describe('RequestService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
|
@@ -8,7 +8,6 @@ import { cloneDeep } from 'lodash';
|
||||
import { hasValue, isEmpty, isNotEmpty, hasNoValue } from '../../shared/empty.util';
|
||||
import { ObjectCacheEntry } from '../cache/object-cache.reducer';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { IndexState, MetaIndexState } from '../index/index.reducer';
|
||||
import { requestIndexSelector, getUrlWithoutEmbedParams } from '../index/index.selectors';
|
||||
import { UUIDService } from '../shared/uuid.service';
|
||||
@@ -17,12 +16,15 @@ import {
|
||||
RequestExecuteAction,
|
||||
RequestStaleAction
|
||||
} from './request.actions';
|
||||
import { GetRequest, RestRequest } from './request.models';
|
||||
import { RequestEntry, RequestState} from './request.reducer';
|
||||
import { GetRequest} from './request.models';
|
||||
import { CommitSSBAction } from '../cache/server-sync-buffer.actions';
|
||||
import { RestRequestMethod } from './rest-request-method';
|
||||
import { coreSelector } from '../core.selectors';
|
||||
import { isLoading, isStale } from './request-entry-state.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { RequestState } from './request-state.model';
|
||||
import { RequestEntry } from './request-entry.model';
|
||||
|
||||
/**
|
||||
* The base selector function to select the request state in the store
|
||||
@@ -145,7 +147,7 @@ export class RequestService {
|
||||
/**
|
||||
* Check if a GET request is currently pending
|
||||
*/
|
||||
isPending(request: GetRequest): boolean {
|
||||
isPending(request: RestRequest): boolean {
|
||||
// If the request is not a GET request, it will never be considered pending, because you may
|
||||
// want to execute the exact same e.g. POST multiple times
|
||||
if (request.method !== RestRequestMethod.GET) {
|
||||
@@ -242,7 +244,7 @@ export class RequestService {
|
||||
if (this.shouldDispatchRequest(request, useCachedVersionIfAvailable)) {
|
||||
this.dispatchRequest(request);
|
||||
if (request.method === RestRequestMethod.GET) {
|
||||
this.trackRequestsOnTheirWayToTheStore(request);
|
||||
this.trackRequestsOnTheirWayToTheStore(request as GetRequest);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
@@ -315,7 +317,7 @@ export class RequestService {
|
||||
* @param {boolean} useCachedVersionIfAvailable Whether or not to allow the use of a cached version
|
||||
* @returns {boolean} True if the request is cached or still pending
|
||||
*/
|
||||
public shouldDispatchRequest(request: GetRequest, useCachedVersionIfAvailable: boolean): boolean {
|
||||
public shouldDispatchRequest(request: RestRequest, useCachedVersionIfAvailable: boolean): boolean {
|
||||
// if it's not a GET request
|
||||
if (request.method !== RestRequestMethod.GET) {
|
||||
return true;
|
||||
|
13
src/app/core/data/response-state.model.ts
Normal file
13
src/app/core/data/response-state.model.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { HALLink } from '../shared/hal-link.model';
|
||||
import { UnCacheableObject } from '../shared/uncacheable-object.model';
|
||||
|
||||
/**
|
||||
* The response substate in the NgRx store
|
||||
*/
|
||||
export class ResponseState {
|
||||
timeCompleted: number;
|
||||
statusCode: number;
|
||||
errorMessage?: string;
|
||||
payloadLink?: HALLink;
|
||||
unCacheableObject?: UnCacheableObject;
|
||||
}
|
14
src/app/core/data/rest-request-with-response-parser.model.ts
Normal file
14
src/app/core/data/rest-request-with-response-parser.model.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { RestRequest } from './rest-request.model';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { ResponseParsingService } from './parsing.service';
|
||||
|
||||
/**
|
||||
* A RestRequest with a method to retrieve the ResponseParsingService needed for its response
|
||||
*/
|
||||
export abstract class RestRequestWithResponseParser extends RestRequest {
|
||||
|
||||
/**
|
||||
* Get the ResponseParsingService needed to parse the response to this request
|
||||
*/
|
||||
abstract getResponseParser(): GenericConstructor<ResponseParsingService>;
|
||||
}
|
20
src/app/core/data/rest-request.model.ts
Normal file
20
src/app/core/data/rest-request.model.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { RestRequestMethod } from './rest-request-method';
|
||||
import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
||||
|
||||
/**
|
||||
* A request to the DSpace REST API
|
||||
*/
|
||||
export abstract class RestRequest {
|
||||
public responseMsToLive = environment.cache.msToLive.default;
|
||||
public isMultipart = false;
|
||||
|
||||
constructor(
|
||||
public uuid: string,
|
||||
public href: string,
|
||||
public method: RestRequestMethod = RestRequestMethod.GET,
|
||||
public body?: any,
|
||||
public options?: HttpOptions,
|
||||
) {
|
||||
}
|
||||
}
|
@@ -6,7 +6,6 @@ import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RequestService } from './request.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
@@ -15,8 +14,9 @@ import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { PaginatedList } from './paginated-list.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
|
||||
|
@@ -5,8 +5,8 @@ import { ParsedResponse } from '../cache/response.models';
|
||||
import { RawRestResponse } from '../dspace-rest/raw-rest-response.model';
|
||||
import { DSpaceSerializer } from '../dspace-rest/dspace.serializer';
|
||||
import { MetadataMap, MetadataValue } from '../shared/metadata.models';
|
||||
import { RestRequest } from './request.models';
|
||||
import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing.service';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
|
||||
@Injectable()
|
||||
export class SearchResponseParsingService extends DspaceRestResponseParsingService {
|
||||
|
@@ -5,14 +5,14 @@ import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { Site } from '../shared/site.model';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { FindListOptions } from './request.models';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils';
|
||||
import { createPaginatedList } from '../../shared/testing/utils.test';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { FindListOptions } from './find-list-options.model';
|
||||
|
||||
describe('SiteDataService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user