diff --git a/.gitignore b/.gitignore index e073da107..f2e6073af 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /out-tsc # Only exists if Bazel was run /bazel-out +@scicatproject/ # dependencies /node_modules diff --git a/package-lock.json b/package-lock.json index ccfbee428..6d91ee279 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "@ngrx/effects": "^16", "@ngrx/router-store": "^16", "@ngrx/store": "^16", + "@scicatproject/scicat-sdk-ts": "^4.6.5", "autolinker": "^4.0.0", "deep-equal": "^2.0.5", "exceljs": "^4.3.0", @@ -34,6 +35,7 @@ "lodash-es": "^4.17.21", "luxon": "^3.3.0", "mathjs": "^13.0.0", + "ngx-cookie-service": "^16.1.0", "ngx-json-viewer": "^3", "ngx-linky": "^4.0.0", "ngx-material-luxon": "^1.1.1", @@ -60,7 +62,7 @@ "@types/deep-equal": "^1.0.1", "@types/file-saver": "^2.0.2", "@types/jasmine": "^5.1.0", - "@types/lodash": "^4.14.172", + "@types/lodash-es": "^4.17.12", "@types/luxon": "^3.3.0", "@types/node": "^22.0.0", "@types/shortid": "2.2.0", @@ -4984,6 +4986,19 @@ "yarn": ">= 1.13.0" } }, + "node_modules/@scicatproject/scicat-sdk-ts": { + "version": "4.6.5", + "resolved": "https://registry.npmjs.org/@scicatproject/scicat-sdk-ts/-/scicat-sdk-ts-4.6.5.tgz", + "integrity": "sha512-0bRT9kZaYIGEuL22Favx01GwRtwKtGV10H0a8E7zH0jI0dKScC+bRvevGTNlv8oKxeowTSN6OifjRTZXeCiK7w==", + "license": "Unlicense", + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@angular/core": "^16.2.12", + "rxjs": "^7.4.0" + } + }, "node_modules/@sigstore/bundle": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-1.1.0.tgz", @@ -5343,6 +5358,16 @@ "integrity": "sha512-lfx+dftrEZcdBPczf9d0Qv0x+j/rfNCMuC6OcfXmO8gkfeNAY88PgKUbvG56whcN23gc27yenwF6oJZXGFpYxg==", "dev": true }, + "node_modules/@types/lodash-es": { + "version": "4.17.12", + "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz", + "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/lodash": "*" + } + }, "node_modules/@types/luxon": { "version": "3.4.2", "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.4.2.tgz", @@ -14263,6 +14288,19 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "node_modules/ngx-cookie-service": { + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/ngx-cookie-service/-/ngx-cookie-service-16.1.0.tgz", + "integrity": "sha512-FrzMjsGCHZCd2sEucigMaGyzImBL0l6gwWn6jmLBhcNVx0D7P8Yvtgk9aUptlqBrVKy4c2upglSa3Ogv3679bw==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "peerDependencies": { + "@angular/common": "^16.0.0", + "@angular/core": "^16.0.0" + } + }, "node_modules/ngx-json-viewer": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ngx-json-viewer/-/ngx-json-viewer-3.2.1.tgz", diff --git a/package.json b/package.json index aaca6981a..6b165c90d 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "lint:fix": "ng lint --fix", "betterer": "betterer", "cypress:open": "cypress open", - "cypress:run": "cypress run" + "cypress:run": "cypress run", + "generate:sdk:local": "node scripts/generate-nestjs-sdk" }, "private": true, "dependencies": { @@ -33,6 +34,7 @@ "@ngrx/effects": "^16", "@ngrx/router-store": "^16", "@ngrx/store": "^16", + "@scicatproject/scicat-sdk-ts": "^4.6.5", "autolinker": "^4.0.0", "deep-equal": "^2.0.5", "exceljs": "^4.3.0", @@ -41,6 +43,7 @@ "lodash-es": "^4.17.21", "luxon": "^3.3.0", "mathjs": "^13.0.0", + "ngx-cookie-service": "^16.1.0", "ngx-json-viewer": "^3", "ngx-linky": "^4.0.0", "ngx-material-luxon": "^1.1.1", @@ -67,7 +70,7 @@ "@types/deep-equal": "^1.0.1", "@types/file-saver": "^2.0.2", "@types/jasmine": "^5.1.0", - "@types/lodash": "^4.14.172", + "@types/lodash-es": "^4.17.12", "@types/luxon": "^3.3.0", "@types/node": "^22.0.0", "@types/shortid": "2.2.0", diff --git a/scripts/generate-nestjs-sdk.bash b/scripts/generate-nestjs-sdk.bash new file mode 100755 index 000000000..bfa6ba726 --- /dev/null +++ b/scripts/generate-nestjs-sdk.bash @@ -0,0 +1,62 @@ +#!/bin/bash +# +# + +USER=`who am i | cut -d\ -f1` +echo -e "\nUser running the script: ${USER}" + +echo -e "\nCleanup old files..." +rm -rf node_modules/@scicatproject/scicat-sdk-ts +rm -rf @scicatproject/scicat-sdk-ts + +echo -e "\nGenerating the new sdk..." +docker run \ + --rm \ + --add-host host.docker.internal:host-gateway \ + -v "`pwd`:/local" \ + openapitools/openapi-generator-cli:v7.9.0 generate \ + -i http://host.docker.internal:3000/explorer-json \ + -g typescript-angular \ + -o local/@scicatproject/scicat-sdk-ts \ + --additional-properties=ngVersion=16.2.12,npmName=@scicatproject/scicat-sdk-ts,supportsES6=true,npmVersion=10.8.2,withInterfaces=true + +REMOVE_NPM_LINK=0 +if ! command -v npm 2>&1 1>/dev/null +then + if [ "--`env | grep NVM_BIN`--" != "----" ] + then + echo -e "\nCreating links to npm and node versions" + ln -s "$NVM_BIN/npm" "/usr/local/bin/npm" + whereis npm + ln -s "$NVM_BIN/node" "/usr/local/bin/node" + whereis node + REMOVE_NPM_LINK=1 + else + echo -e "\nNo npm found!!!" + exit 1 + fi +fi + +echo -e "\nInstalling dependencies and building the sdk..." +cd @scicatproject/scicat-sdk-ts +npm install +npm run build + +echo -e "\nCopying the build files in node_modules..." +cd ../.. +cp -rv @scicatproject/scicat-sdk-ts/dist node_modules/@scicatproject/scicat-sdk-ts + +echo -e "\nAdjusting ownership to user ${USER}" +chown -Rv ${USER} node_modules/@scicatproject/scicat-sdk-ts + +echo -e "\nFinal cleanup..." +echo -e "Removing sdk folder" +rm -rfv @scicatproject + +if [ $REMOVE_NPM_LINK -eq 1 ]; +then + echo -e "\nRemoving links to npm and node" + rm -fv "/usr/local/bin/npm" + rm -fv "/usr/local/bin/node" +fi + diff --git a/scripts/generate-nestjs-sdk.js b/scripts/generate-nestjs-sdk.js new file mode 100644 index 000000000..738d73aa8 --- /dev/null +++ b/scripts/generate-nestjs-sdk.js @@ -0,0 +1,68 @@ +/** + * NOTE: This file contains commands that generate new typescript-angular sdk against the running scicat backend + * which overwrites the node_modules/@scicatproject/scicat-sdk-ts for development purpose + * It should NOT be used in production because the real (@scicatproject/scicat-sdk-ts) npm package will be installed and used. + */ + +const execSync = require("child_process").execSync; +const os = require("os"); + +function isWindows() { + return os.platform() === "win32"; +} + +function getCurrentDirectory() { + if (isWindows()) { + return "%cd%"; + } + + return "$(pwd)"; +} + +if (isWindows()) { + + // NOTE: First do some cleanup before starting the generation + console.log("Cleanup old files..."); + execSync( + "rm -rf node_modules/@scicatproject/scicat-sdk-ts && rm -rf @scicatproject/scicat-sdk-ts", + { encoding: "utf-8" }, + ); + + console.log("Generating the new sdk..."); + const generationOutput = execSync( + `docker run --rm --add-host host.docker.internal:host-gateway -v "${getCurrentDirectory()}:/local" openapitools/openapi-generator-cli:v7.9.0 generate -i http://host.docker.internal:3000/explorer-json -g typescript-angular -o local/@scicatproject/scicat-sdk-ts --additional-properties=ngVersion=16.2.12,npmName=@scicatproject/scicat-sdk-ts,supportsES6=true,npmVersion=10.8.2,withInterfaces=true`, + { encoding: "utf-8" }, + ); + console.log(generationOutput); + + console.log("Installing dependencies and building the sdk..."); + const installBuildOutput = execSync( + "cd @scicatproject/scicat-sdk-ts && npm install && npm run build", + { encoding: "utf-8" }, + ); + console.log(installBuildOutput); + + console.log("Copying the build files in node_modules..."); + const copyToNodeModulesOutput = execSync( + "cp -r @scicatproject/scicat-sdk-ts/dist node_modules/@scicatproject/scicat-sdk-ts", + { encoding: "utf-8" }, + ); + console.log(copyToNodeModulesOutput); + + console.log("Final cleanup..."); + execSync("rm -rf @scicatproject", { + encoding: "utf-8", + }); + + console.log("Local SDK generation completed"); + +} else { + console.log("Your environment is a linux/unix"); + console.log("Please run the following command on your terminal:"); + console.log("> sudo -E ./scripts/generate-nestjs-sdk.bash"); + console.log(""); + console.log("IMPORTANT: the script runs under sudo. You will be asked your password."); + console.log(""); + +} + diff --git a/src/app/app-config.service.ts b/src/app/app-config.service.ts index 904df35da..bc39d68a7 100644 --- a/src/app/app-config.service.ts +++ b/src/app/app-config.service.ts @@ -109,14 +109,16 @@ export class AppConfigService { async loadAppConfig(): Promise { try { - this.appConfig = await this.http + const config = await this.http .get("/api/v3/admin/config") .pipe(timeout(2000)) .toPromise(); + this.appConfig = Object.assign({}, this.appConfig, config); } catch (err) { console.log("No config available in backend, trying with local config."); try { - this.appConfig = await this.http.get("/assets/config.json").toPromise(); + const config = await this.http.get("/assets/config.json").toPromise(); + this.appConfig = Object.assign({}, this.appConfig, config); } catch (err) { console.error("No config provided."); } diff --git a/src/app/app-routing/auth.guard.ts b/src/app/app-routing/auth.guard.ts index b1b464499..e4cba1249 100644 --- a/src/app/app-routing/auth.guard.ts +++ b/src/app/app-routing/auth.guard.ts @@ -5,7 +5,7 @@ import { ActivatedRouteSnapshot, RouterStateSnapshot, } from "@angular/router"; -import { UserApi } from "shared/sdk/services"; +import { UsersService } from "@scicatproject/scicat-sdk-ts"; /** * Ensure that the current user is logged in @@ -19,7 +19,7 @@ import { UserApi } from "shared/sdk/services"; }) export class AuthGuard implements CanActivate { constructor( - private us: UserApi, + private us: UsersService, private router: Router, ) {} @@ -31,7 +31,7 @@ export class AuthGuard implements CanActivate { state: RouterStateSnapshot, ): Promise { return this.us - .getCurrent() + .usersControllerGetMyUser() .toPromise() .catch(() => { this.router.navigate(["/login"], { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 579251bb7..ccdfd43be 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -9,7 +9,6 @@ import { ChangeDetectorRef, } from "@angular/core"; import { Store } from "@ngrx/store"; -import { LoopBackConfig } from "shared/sdk"; import { clearMessageAction, fetchCurrentUserAction, @@ -25,6 +24,7 @@ import { } from "state-management/selectors/user.selectors"; import { MessageType } from "state-management/models"; import { AppConfigService, AppConfig as Config } from "app-config.service"; +import { Configuration } from "@scicatproject/scicat-sdk-ts"; @Component({ selector: "app-root", @@ -45,6 +45,7 @@ export class AppComponent implements OnDestroy, OnInit, AfterViewChecked { constructor( @Inject(APP_CONFIG) public appConfig: AppConfig, private appConfigService: AppConfigService, + private apiConfigService: Configuration, private cdRef: ChangeDetectorRef, private metaService: Meta, public snackBar: MatSnackBar, @@ -68,8 +69,8 @@ export class AppComponent implements OnDestroy, OnInit, AfterViewChecked { * @memberof AppComponent */ ngOnInit() { - LoopBackConfig.setBaseURL(this.config.lbBaseURL); - console.log(LoopBackConfig.getPath()); + this.apiConfigService.basePath = this.config.lbBaseURL; + console.log(this.apiConfigService.basePath); this.store.dispatch(loadDefaultSettings({ config: this.config })); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 039a64785..093937260 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -8,9 +8,8 @@ import { EffectsModule } from "@ngrx/effects"; import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http"; import { APP_INITIALIZER, NgModule } from "@angular/core"; import { ExtraOptions, RouterModule } from "@angular/router"; -import { SampleApi, SDKBrowserModule } from "shared/sdk/index"; import { StoreModule } from "@ngrx/store"; -import { UserApi } from "shared/sdk/services"; +import { ApiModule, Configuration } from "@scicatproject/scicat-sdk-ts"; import { routerReducer } from "@ngrx/router-store"; import { extModules } from "./build-specifics"; import { MatNativeDateModule } from "@angular/material/core"; @@ -26,6 +25,9 @@ import { LayoutModule } from "_layout/layout.module"; import { AppConfigService } from "app-config.service"; import { AppThemeService } from "app-theme.service"; import { SnackbarInterceptor } from "shared/interceptors/snackbar.interceptor"; +import { AuthService } from "shared/services/auth/auth.service"; +import { InternalStorage, SDKStorage } from "shared/services/auth/base.storage"; +import { CookieService } from "ngx-cookie-service"; const appConfigInitializerFn = (appConfig: AppConfigService) => { return () => appConfig.loadAppConfig(); @@ -35,6 +37,15 @@ const appThemeInitializerFn = (appTheme: AppThemeService) => { return () => appTheme.loadTheme(); }; +const apiConfigurationFn = ( + authService: AuthService, + configurationService: AppConfigService, +) => + new Configuration({ + basePath: configurationService.getConfig().lbBaseURL, + accessToken: authService.getToken().id, + }); + @NgModule({ declarations: [AppComponent], imports: [ @@ -49,7 +60,7 @@ const appThemeInitializerFn = (appTheme: AppThemeService) => { MatTabsModule, MatChipsModule, MatSnackBarModule, - SDKBrowserModule.forRoot(), + ApiModule, StoreModule.forRoot( { router: routerReducer, users: userReducer }, { @@ -93,11 +104,18 @@ const appThemeInitializerFn = (appTheme: AppThemeService) => { subscriptSizing: "dynamic", }, }, + AuthService, AppThemeService, - UserApi, - SampleApi, Title, MatNativeDateModule, + { provide: InternalStorage, useClass: CookieService }, + { provide: SDKStorage, useClass: CookieService }, + { + provide: Configuration, + useFactory: apiConfigurationFn, + deps: [AuthService, AppConfigService], + multi: false, + }, ], bootstrap: [AppComponent], }) diff --git a/src/app/datasets/admin-tab/admin-tab.component.html b/src/app/datasets/admin-tab/admin-tab.component.html index 6de050352..a20c63f4a 100644 --- a/src/app/datasets/admin-tab/admin-tab.component.html +++ b/src/app/datasets/admin-tab/admin-tab.component.html @@ -2,7 +2,7 @@

Datablocks: {{ datablocks.length }}

    -
  • {{ block.id }}
  • +
  • {{ block._id }}
    • {{ block.archiveId }}
    diff --git a/src/app/datasets/admin-tab/admin-tab.component.spec.ts b/src/app/datasets/admin-tab/admin-tab.component.spec.ts index 02911c781..d5b7b3a3a 100644 --- a/src/app/datasets/admin-tab/admin-tab.component.spec.ts +++ b/src/app/datasets/admin-tab/admin-tab.component.spec.ts @@ -1,6 +1,5 @@ -import { ComponentFixture, inject, TestBed } from "@angular/core/testing"; +import { TestBed } from "@angular/core/testing"; import { Store, StoreModule } from "@ngrx/store"; -import { Dataset } from "shared/sdk"; import { AdminTabComponent } from "./admin-tab.component"; import { MatCardModule } from "@angular/material/card"; import { of } from "rxjs"; diff --git a/src/app/datasets/admin-tab/admin-tab.component.ts b/src/app/datasets/admin-tab/admin-tab.component.ts index 468745310..19b77893c 100644 --- a/src/app/datasets/admin-tab/admin-tab.component.ts +++ b/src/app/datasets/admin-tab/admin-tab.component.ts @@ -3,7 +3,10 @@ import { Store } from "@ngrx/store"; import { FileObject } from "datasets/dataset-details-dashboard/dataset-details-dashboard.component"; import { Subscription } from "rxjs"; import { take } from "rxjs/operators"; -import { Dataset, Job } from "shared/sdk"; +import { + CreateJobDto, + OutputDatasetObsoleteDto, +} from "@scicatproject/scicat-sdk-ts"; import { submitJobAction } from "state-management/actions/jobs.actions"; import { selectCurrentDatablocks, @@ -22,7 +25,7 @@ import { }) export class AdminTabComponent implements OnInit, OnDestroy { private subscriptions: Subscription[] = []; - dataset: Dataset | undefined; + dataset: OutputDatasetObsoleteDto | undefined; datablocks$ = this.store.select(selectCurrentDatablocks); isAdmin$ = this.store.select(selectIsAdmin); loading$ = this.store.select(selectIsLoading); @@ -44,12 +47,13 @@ export class AdminTabComponent implements OnInit, OnDestroy { .pipe(take(1)) .subscribe((user) => { if (user && this.dataset) { - const job = new Job(); - job.emailJobInitiator = user.email; - job.jobParams = {}; + const job: CreateJobDto = { + emailJobInitiator: user.email, + type: "reset", + datasetList: [], + jobParams: {}, + }; job.jobParams["username"] = user.username; - job.creationTime = new Date(); - job.type = "reset"; const fileObj: FileObject = { pid: "", files: [], @@ -63,7 +67,6 @@ export class AdminTabComponent implements OnInit, OnDestroy { } fileObj.files = fileList; job.datasetList = [fileObj]; - console.log(job); this.store.dispatch(submitJobAction({ job })); } }); diff --git a/src/app/datasets/archiving.service.spec.ts b/src/app/datasets/archiving.service.spec.ts index f13153cc7..ec8f0fb4d 100644 --- a/src/app/datasets/archiving.service.spec.ts +++ b/src/app/datasets/archiving.service.spec.ts @@ -1,7 +1,7 @@ import { TestBed, waitForAsync } from "@angular/core/testing"; import { MockStore, provideMockStore } from "@ngrx/store/testing"; import { RetrieveDestinations } from "app-config.service"; -import { Dataset, Job, User } from "shared/sdk"; +import { Dataset, Job, User } from "@scicatproject/scicat-sdk-ts"; import { submitJobAction } from "state-management/actions/jobs.actions"; import { selectCurrentUser, diff --git a/src/app/datasets/archiving.service.ts b/src/app/datasets/archiving.service.ts index 8913c3b9c..fcf68c4a1 100644 --- a/src/app/datasets/archiving.service.ts +++ b/src/app/datasets/archiving.service.ts @@ -2,7 +2,6 @@ import { Injectable } from "@angular/core"; import { Store } from "@ngrx/store"; import { combineLatest, Observable } from "rxjs"; import { first, map } from "rxjs/operators"; -import { Dataset, Job, User } from "state-management/models"; import { submitJobAction } from "state-management/actions/jobs.actions"; import { selectCurrentUser, @@ -10,6 +9,10 @@ import { selectProfile, } from "state-management/selectors/user.selectors"; import { RetrieveDestinations } from "app-config.service"; +import { + OutputDatasetObsoleteDto, + ReturnedUserDto, +} from "@scicatproject/scicat-sdk-ts"; @Injectable() export class ArchivingService { @@ -19,12 +22,12 @@ export class ArchivingService { constructor(private store: Store) {} private createJob( - user: User, - datasets: Dataset[], + user: ReturnedUserDto, + datasets: OutputDatasetObsoleteDto[], archive: boolean, destinationPath?: Record, // Do not specify tape copies here - ): Job { + ) { const extra = archive ? {} : destinationPath; const jobParams = { username: user.username, @@ -46,11 +49,11 @@ export class ArchivingService { type: archive ? "archive" : "retrieve", }; - return new Job(data); + return data; } private archiveOrRetrieve( - datasets: Dataset[], + datasets: OutputDatasetObsoleteDto[], archive: boolean, destPath?: Record, ): Observable { @@ -71,18 +74,18 @@ export class ArchivingService { const job = this.createJob(user, datasets, archive, destPath); - this.store.dispatch(submitJobAction({ job })); + this.store.dispatch(submitJobAction({ job: job as any })); } }), ); } - public archive(datasets: Dataset[]): Observable { + public archive(datasets: OutputDatasetObsoleteDto[]): Observable { return this.archiveOrRetrieve(datasets, true); } public retrieve( - datasets: Dataset[], + datasets: OutputDatasetObsoleteDto[], destinationPath: Record, ): Observable { return this.archiveOrRetrieve(datasets, false, destinationPath); diff --git a/src/app/datasets/batch-view/batch-view.component.spec.ts b/src/app/datasets/batch-view/batch-view.component.spec.ts index a68670d2a..57a8977a8 100644 --- a/src/app/datasets/batch-view/batch-view.component.spec.ts +++ b/src/app/datasets/batch-view/batch-view.component.spec.ts @@ -11,7 +11,7 @@ import { MatIconModule } from "@angular/material/icon"; import { MatButtonModule } from "@angular/material/button"; import { MatDialogModule } from "@angular/material/dialog"; -import { DatasetApi, Dataset } from "shared/sdk"; +import { DatasetApi, Dataset } from "@scicatproject/scicat-sdk-ts"; import { SharedScicatFrontendModule } from "shared/shared.module"; import { MatTableModule } from "@angular/material/table"; import { MockStore, provideMockStore } from "@ngrx/store/testing"; diff --git a/src/app/datasets/batch-view/batch-view.component.ts b/src/app/datasets/batch-view/batch-view.component.ts index 89c03021b..e3760380d 100644 --- a/src/app/datasets/batch-view/batch-view.component.ts +++ b/src/app/datasets/batch-view/batch-view.component.ts @@ -10,7 +10,7 @@ import { removeFromBatchAction, storeBatchAction, } from "state-management/actions/datasets.actions"; -import { Dataset, Message, MessageType } from "state-management/models"; +import { Message, MessageType } from "state-management/models"; import { showMessageAction } from "state-management/actions/user.actions"; import { DialogComponent } from "shared/modules/dialog/dialog.component"; @@ -24,6 +24,7 @@ import { selectIsAdmin, selectProfile, } from "state-management/selectors/user.selectors"; +import { OutputDatasetObsoleteDto } from "@scicatproject/scicat-sdk-ts"; @Component({ selector: "batch-view", @@ -31,7 +32,9 @@ import { styleUrls: ["./batch-view.component.scss"], }) export class BatchViewComponent implements OnInit, OnDestroy { - batch$: Observable = this.store.select(selectDatasetsInBatch); + batch$: Observable = this.store.select( + selectDatasetsInBatch, + ); userProfile$ = this.store.select(selectProfile); isAdmin$ = this.store.select(selectIsAdmin); isAdmin = false; @@ -41,7 +44,7 @@ export class BatchViewComponent implements OnInit, OnDestroy { appConfig = this.appConfigService.getConfig(); shareEnabled = this.appConfig.shareEnabled; - datasetList: Dataset[] = []; + datasetList: OutputDatasetObsoleteDto[] = []; public hasBatch = false; visibleColumns: string[] = ["remove", "pid", "sourceFolder", "creationTime"]; @@ -57,7 +60,7 @@ export class BatchViewComponent implements OnInit, OnDestroy { this.store.dispatch(clearBatchAction()); } - private storeBatch(datasetUpdatedBatch: Dataset[]) { + private storeBatch(datasetUpdatedBatch: OutputDatasetObsoleteDto[]) { this.store.dispatch(storeBatchAction({ batch: datasetUpdatedBatch })); } @@ -69,7 +72,7 @@ export class BatchViewComponent implements OnInit, OnDestroy { } } - onRemove(dataset: Dataset) { + onRemove(dataset: OutputDatasetObsoleteDto) { this.store.dispatch(removeFromBatchAction({ dataset })); } diff --git a/src/app/datasets/dashboard/dashboard.component.spec.ts b/src/app/datasets/dashboard/dashboard.component.spec.ts index 61183b685..7364c0fb9 100644 --- a/src/app/datasets/dashboard/dashboard.component.spec.ts +++ b/src/app/datasets/dashboard/dashboard.component.spec.ts @@ -15,7 +15,7 @@ import { addDatasetAction, changePageAction, } from "state-management/actions/datasets.actions"; -import { User, Dataset, DerivedDataset } from "shared/sdk"; +import { User, Dataset, DerivedDataset } from "@scicatproject/scicat-sdk-ts"; import { selectColumnAction, deselectColumnAction, diff --git a/src/app/datasets/dashboard/dashboard.component.ts b/src/app/datasets/dashboard/dashboard.component.ts index 94b501441..7528f692f 100644 --- a/src/app/datasets/dashboard/dashboard.component.ts +++ b/src/app/datasets/dashboard/dashboard.component.ts @@ -4,7 +4,7 @@ import { Store, ActionsSubject } from "@ngrx/store"; import deepEqual from "deep-equal"; -import { DatasetFilters, User } from "state-management/models"; +import { DatasetFilters } from "state-management/models"; import { fetchDatasetsAction, @@ -35,7 +35,10 @@ import { selectColumns, selectIsLoggedIn, } from "state-management/selectors/user.selectors"; -import { Dataset, DerivedDataset } from "shared/sdk"; +import { + OutputDatasetObsoleteDto, + ReturnedUserDto, +} from "@scicatproject/scicat-sdk-ts"; import { selectColumnAction, deselectColumnAction, @@ -74,7 +77,7 @@ export class DashboardComponent implements OnInit, OnDestroy { appConfig = this.appConfigService.getConfig(); - currentUser: User = new User(); + currentUser: ReturnedUserDto; userGroups: string[] = []; clearColumnSearch = false; @@ -122,7 +125,7 @@ export class DashboardComponent implements OnInit, OnDestroy { } } - onRowClick(dataset: Dataset): void { + onRowClick(dataset: OutputDatasetObsoleteDto): void { const pid = encodeURIComponent(dataset.pid); this.router.navigateByUrl("/datasets/" + pid); } @@ -136,10 +139,10 @@ export class DashboardComponent implements OnInit, OnDestroy { dialogRef.afterClosed().subscribe((res) => { if (res) { const { username, email } = this.currentUser; - const dataset = new DerivedDataset({ + const dataset = { accessGroups: [], contactEmail: email, // Required - creationTime: new Date(), // Required + creationTime: new Date().toString(), // Required datasetName: res.datasetName, description: res.description, isPublished: false, @@ -154,12 +157,17 @@ export class DashboardComponent implements OnInit, OnDestroy { inputDatasets: [], // Required investigator: email, // Required scientificMetadata: {}, + numberOfFilesArchived: 0, // Required usedSoftware: res.usedSoftware .split(",") .map((entry: string) => entry.trim()) .filter((entry: string) => entry !== ""), // Required - }); - this.store.dispatch(addDatasetAction({ dataset })); + }; + this.store.dispatch( + addDatasetAction({ + dataset: dataset, + }), + ); } }); } diff --git a/src/app/datasets/datablocks-table/datablocks-table.component.ts b/src/app/datasets/datablocks-table/datablocks-table.component.ts index 38abc124e..674d7e169 100644 --- a/src/app/datasets/datablocks-table/datablocks-table.component.ts +++ b/src/app/datasets/datablocks-table/datablocks-table.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from "@angular/core"; -import { Datablock } from "shared/sdk/models"; import { MatTableDataSource } from "@angular/material/table"; +import { Datablock } from "@scicatproject/scicat-sdk-ts"; @Component({ selector: "datablocks-table", diff --git a/src/app/datasets/datafiles-actions/datafiles-action.component.spec.ts b/src/app/datasets/datafiles-actions/datafiles-action.component.spec.ts index bfb2e2ce0..60e45a5d6 100644 --- a/src/app/datasets/datafiles-actions/datafiles-action.component.spec.ts +++ b/src/app/datasets/datafiles-actions/datafiles-action.component.spec.ts @@ -10,7 +10,7 @@ import { ReactiveFormsModule } from "@angular/forms"; import { MatDialogModule, MatDialogRef } from "@angular/material/dialog"; import { RouterModule } from "@angular/router"; import { StoreModule } from "@ngrx/store"; -import { UserApi } from "shared/sdk"; +import { UserApi } from "@scicatproject/scicat-sdk-ts"; import { MockHtmlElement, MockMatDialogRef, diff --git a/src/app/datasets/datafiles-actions/datafiles-action.component.ts b/src/app/datasets/datafiles-actions/datafiles-action.component.ts index 9ede93d88..414e63b6b 100644 --- a/src/app/datasets/datafiles-actions/datafiles-action.component.ts +++ b/src/app/datasets/datafiles-actions/datafiles-action.component.ts @@ -6,9 +6,10 @@ import { SimpleChanges, } from "@angular/core"; -import { UserApi } from "shared/sdk"; +import { UsersService } from "@scicatproject/scicat-sdk-ts"; import { ActionConfig, ActionDataset } from "./datafiles-action.interfaces"; import { DataFiles_File } from "datasets/datafiles/datafiles.interfaces"; +import { AuthService } from "shared/services/auth/auth.service"; @Component({ selector: "datafiles-action", @@ -33,8 +34,11 @@ export class DatafilesActionComponent implements OnInit, OnChanges { form: HTMLFormElement = null; - constructor(private userApi: UserApi) { - this.userApi.jwt().subscribe((jwt) => { + constructor( + private usersService: UsersService, + private authService: AuthService, + ) { + this.usersService.usersControllerGetUserJWT().subscribe((jwt) => { this.jwt = jwt.jwt; }); } @@ -126,7 +130,7 @@ export class DatafilesActionComponent implements OnInit, OnChanges { this.form.style.display = "none"; this.form.appendChild( - this.add_input("auth_token", this.userApi.getCurrentToken().id), + this.add_input("auth_token", `Bearer ${this.authService.getToken().id}`), ); this.form.appendChild(this.add_input("jwt", this.jwt)); diff --git a/src/app/datasets/datafiles-actions/datafiles-actions.component.spec.ts b/src/app/datasets/datafiles-actions/datafiles-actions.component.spec.ts index f8bdc5284..0bca67682 100644 --- a/src/app/datasets/datafiles-actions/datafiles-actions.component.spec.ts +++ b/src/app/datasets/datafiles-actions/datafiles-actions.component.spec.ts @@ -10,7 +10,7 @@ import { ReactiveFormsModule } from "@angular/forms"; import { MatDialogModule, MatDialogRef } from "@angular/material/dialog"; import { RouterModule } from "@angular/router"; import { StoreModule } from "@ngrx/store"; -import { UserApi } from "shared/sdk"; +import { UserApi } from "@scicatproject/scicat-sdk-ts"; import { MockMatDialogRef, MockUserApi } from "shared/MockStubs"; import { AppConfigService } from "app-config.service"; diff --git a/src/app/datasets/datafiles/datafiles.component.spec.ts b/src/app/datasets/datafiles/datafiles.component.spec.ts index 2e6e0125d..bf478ea58 100644 --- a/src/app/datasets/datafiles/datafiles.component.spec.ts +++ b/src/app/datasets/datafiles/datafiles.component.spec.ts @@ -2,7 +2,7 @@ import { NO_ERRORS_SCHEMA } from "@angular/core"; import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; import { ReactiveFormsModule } from "@angular/forms"; import { DatafilesComponent } from "./datafiles.component"; -import { UserApi } from "shared/sdk"; +import { UserApi } from "@scicatproject/scicat-sdk-ts"; import { MatTableModule } from "@angular/material/table"; import { PipesModule } from "shared/pipes/pipes.module"; import { RouterModule } from "@angular/router"; diff --git a/src/app/datasets/datafiles/datafiles.component.ts b/src/app/datasets/datafiles/datafiles.component.ts index 136e192bd..ee9cf4f21 100644 --- a/src/app/datasets/datafiles/datafiles.component.ts +++ b/src/app/datasets/datafiles/datafiles.component.ts @@ -22,7 +22,7 @@ import { selectIsLoading, selectIsLoggedIn, } from "state-management/selectors/user.selectors"; -import { Job, UserApi } from "shared/sdk"; +import { UsersService } from "@scicatproject/scicat-sdk-ts"; import { FileSizePipe } from "shared/pipes/filesize.pipe"; import { MatCheckboxChange } from "@angular/material/checkbox"; import { MatDialog } from "@angular/material/dialog"; @@ -32,6 +32,7 @@ import { AppConfigService } from "app-config.service"; import { NgForm } from "@angular/forms"; import { DataFiles_File } from "./datafiles.interfaces"; import { ActionDataset } from "datasets/datafiles-actions/datafiles-action.interfaces"; +import { AuthService } from "shared/services/auth/auth.service"; @Component({ selector: "datafiles", @@ -110,7 +111,8 @@ export class DatafilesComponent private store: Store, private cdRef: ChangeDetectorRef, private dialog: MatDialog, - private userApi: UserApi, + private usersService: UsersService, + private authService: AuthService, ) {} onPageChange(event: PageChangeEvent) { @@ -219,7 +221,7 @@ export class DatafilesComponent if (datablocks) { const files: DataFiles_File[] = []; datablocks.forEach((block) => { - block.dataFileList.map((file) => { + block.dataFileList.map((file: DataFiles_File) => { this.totalFileSize += file.size; file.selected = false; files.push(file); @@ -240,12 +242,12 @@ export class DatafilesComponent downloadFiles(form: "downloadAllForm" | "downloadSelectedForm") { if (this.appConfig.multipleDownloadUseAuthToken) { - this.auth_token = this.userApi.getCurrentToken().id; + this.auth_token = `Bearer ${this.authService.getToken().id}`; this[`${form}Element`].nativeElement.auth_token.value = this.auth_token; } if (!this.jwt) { this.subscriptions.push( - this.userApi.jwt().subscribe((jwt) => { + this.usersService.usersControllerGetUserJWT().subscribe((jwt) => { this.jwt = jwt; this[`${form}Element`].nativeElement.jwt.value = jwt.jwt; this[`${form}Element`].nativeElement.submit(); @@ -278,8 +280,7 @@ export class DatafilesComponent }, ], }; - const job = new Job(data); - this.store.dispatch(submitJobAction({ job })); + this.store.dispatch(submitJobAction({ job: data })); } }); } diff --git a/src/app/datasets/dataset-detail/dataset-detail.component.spec.ts b/src/app/datasets/dataset-detail/dataset-detail.component.spec.ts index e83e5f4fd..c1d2539da 100644 --- a/src/app/datasets/dataset-detail/dataset-detail.component.spec.ts +++ b/src/app/datasets/dataset-detail/dataset-detail.component.spec.ts @@ -12,7 +12,7 @@ import { SharedScicatFrontendModule } from "shared/shared.module"; import { MatTableModule } from "@angular/material/table"; import { MatChipInputEvent, MatChipsModule } from "@angular/material/chips"; import { of } from "rxjs"; -import { Dataset, Sample, User } from "shared/sdk"; +import { Dataset, Sample, User } from "@scicatproject/scicat-sdk-ts"; import { MatDialogRef } from "@angular/material/dialog"; import { SampleEditComponent } from "datasets/sample-edit/sample-edit.component"; import { MatCardModule } from "@angular/material/card"; diff --git a/src/app/datasets/dataset-detail/dataset-detail.component.ts b/src/app/datasets/dataset-detail/dataset-detail.component.ts index 3de466a4e..41bee3ade 100644 --- a/src/app/datasets/dataset-detail/dataset-detail.component.ts +++ b/src/app/datasets/dataset-detail/dataset-detail.component.ts @@ -1,5 +1,4 @@ import { Component, OnInit, OnDestroy, Inject } from "@angular/core"; -import { Dataset, Proposal, Sample } from "shared/sdk/models"; import { ENTER, COMMA, SPACE } from "@angular/cdk/keycodes"; import { MatChipInputEvent } from "@angular/material/chips"; @@ -29,7 +28,6 @@ import { } from "state-management/actions/datasets.actions"; import { Router } from "@angular/router"; import { selectCurrentProposal } from "state-management/selectors/proposals.selectors"; -import { DerivedDataset, Instrument, RawDataset, User } from "shared/sdk"; import { MatSlideToggleChange } from "@angular/material/slide-toggle"; import { EditableComponent } from "app-routing/pending-changes.guard"; import { AppConfigService } from "app-config.service"; @@ -44,6 +42,13 @@ import { } from "@angular/forms"; import { Message, MessageType } from "state-management/models"; import { DOCUMENT } from "@angular/common"; +import { + Instrument, + OutputDatasetObsoleteDto, + ProposalClass, + ReturnedUserDto, + SampleClass, +} from "@scicatproject/scicat-sdk-ts"; import { AttachmentService } from "shared/services/attachment.service"; /** @@ -72,14 +77,14 @@ export class DatasetDetailComponent appConfig = this.appConfigService.getConfig(); - dataset: Dataset | undefined; + dataset: OutputDatasetObsoleteDto | undefined; datasetWithout$ = this.store.select(selectCurrentDatasetWithoutFileInfo); attachments$ = this.store.select(selectCurrentAttachments); loading$ = this.store.select(selectIsLoading); instrument: Instrument | undefined; - proposal: Proposal | undefined; - sample: Sample | undefined; - user: User | undefined; + proposal: ProposalClass | undefined; + sample: SampleClass | undefined; + user: ReturnedUserDto | undefined; editingAllowed = false; editEnabled = false; show = false; @@ -173,17 +178,13 @@ export class DatasetDetailComponent if (this.dataset.type === "raw") { return ( this.user.email.toLowerCase() === - (this.dataset as unknown as RawDataset)[ - "principalInvestigator" - ].toLowerCase() + this.dataset["principalInvestigator"].toLowerCase() ); } if (this.dataset.type === "derived") { return ( this.user.email.toLowerCase() === - (this.dataset as unknown as DerivedDataset)[ - "investigator" - ].toLowerCase() + this.dataset["investigator"].toLowerCase() ); } } diff --git a/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.spec.ts b/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.spec.ts index a717e90c0..c2a16bc88 100644 --- a/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.spec.ts +++ b/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.spec.ts @@ -8,7 +8,7 @@ import { import { DatasetDetailsDashboardComponent } from "./dataset-details-dashboard.component"; import { MockActivatedRoute, MockUserApi } from "shared/MockStubs"; import { Store, StoreModule } from "@ngrx/store"; -import { UserApi } from "shared/sdk"; +import { UserApi } from "@scicatproject/scicat-sdk-ts"; import { NO_ERRORS_SCHEMA } from "@angular/core"; import { SharedScicatFrontendModule } from "shared/shared.module"; import { Router, ActivatedRoute } from "@angular/router"; diff --git a/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts b/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts index e022a675b..52b505b6a 100644 --- a/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts +++ b/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts @@ -6,8 +6,10 @@ import { AfterViewChecked, } from "@angular/core"; import { Store } from "@ngrx/store"; -import { Dataset } from "shared/sdk/models"; -import { UserApi } from "shared/sdk"; +import { + OutputDatasetObsoleteDto, + UsersService, +} from "@scicatproject/scicat-sdk-ts"; import { selectCurrentDataset } from "state-management/selectors/datasets.selectors"; import { selectIsAdmin, @@ -76,7 +78,7 @@ export class DatasetDetailsDashboardComponent jwt$: Observable = new Observable(); appConfig = this.appConfigService.getConfig(); - dataset: Dataset | undefined; + dataset: OutputDatasetObsoleteDto | undefined; navLinks: { location: string; label: string; @@ -114,7 +116,7 @@ export class DatasetDetailsDashboardComponent private cdRef: ChangeDetectorRef, private route: ActivatedRoute, private store: Store, - private userApi: UserApi, + private userService: UsersService, public dialog: MatDialog, ) {} @@ -221,7 +223,7 @@ export class DatasetDetailsDashboardComponent } }); this.subscriptions.push(datasetSub); - this.jwt$ = this.userApi.jwt(); + this.jwt$ = this.userService.usersControllerGetUserJWT(); } resetTabs() { Object.values(this.fetchDataActions).forEach((tab) => { diff --git a/src/app/datasets/dataset-file-uploader/dataset-file-uploader.component.spec.ts b/src/app/datasets/dataset-file-uploader/dataset-file-uploader.component.spec.ts index cb14374dc..94980d969 100644 --- a/src/app/datasets/dataset-file-uploader/dataset-file-uploader.component.spec.ts +++ b/src/app/datasets/dataset-file-uploader/dataset-file-uploader.component.spec.ts @@ -3,7 +3,7 @@ import { Router } from "@angular/router"; import { Store, StoreModule } from "@ngrx/store"; import { MockStore } from "@ngrx/store/testing"; import { SubmitCaptionEvent } from "shared/modules/file-uploader/file-uploader.component"; -import { Dataset, User } from "shared/sdk"; +import { Dataset, User } from "@scicatproject/scicat-sdk-ts"; import { addAttachmentAction, removeAttachmentAction, diff --git a/src/app/datasets/dataset-file-uploader/dataset-file-uploader.component.ts b/src/app/datasets/dataset-file-uploader/dataset-file-uploader.component.ts index 4194c61e3..7b54b3996 100644 --- a/src/app/datasets/dataset-file-uploader/dataset-file-uploader.component.ts +++ b/src/app/datasets/dataset-file-uploader/dataset-file-uploader.component.ts @@ -6,7 +6,11 @@ import { PickedFile, SubmitCaptionEvent, } from "shared/modules/file-uploader/file-uploader.component"; -import { Attachment, Dataset, User } from "shared/sdk"; +import { + Attachment, + OutputDatasetObsoleteDto, + ReturnedUserDto, +} from "@scicatproject/scicat-sdk-ts"; import { OwnershipService } from "shared/services/ownership.service"; import { addAttachmentAction, @@ -28,8 +32,8 @@ export class DatasetFileUploaderComponent implements OnInit, OnDestroy { attachments: Attachment[] = []; subscriptions: Subscription[] = []; attachment: Partial = {}; - dataset: Dataset | undefined; - user: User | undefined; + dataset: OutputDatasetObsoleteDto | undefined; + user: ReturnedUserDto | undefined; constructor( private store: Store, private ownershipService: OwnershipService, diff --git a/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.spec.ts b/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.spec.ts index 626b64377..187515e9d 100644 --- a/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.spec.ts +++ b/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.spec.ts @@ -10,7 +10,7 @@ import { DatasetLifecycleComponent } from "./dataset-lifecycle.component"; import { NO_ERRORS_SCHEMA } from "@angular/core"; import { PipesModule } from "shared/pipes/pipes.module"; import { DatePipe } from "@angular/common"; -import { Dataset } from "shared/sdk"; +import { Dataset } from "@scicatproject/scicat-sdk-ts"; import { MatCardModule } from "@angular/material/card"; import { MatIconModule } from "@angular/material/icon"; import { MatTableModule } from "@angular/material/table"; diff --git a/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.ts b/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.ts index ac67f1189..ba61e88ec 100644 --- a/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.ts +++ b/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.ts @@ -1,5 +1,8 @@ import { Component, OnInit, OnChanges, SimpleChange } from "@angular/core"; -import { Dataset } from "shared/sdk"; +import { + DatasetClass, + OutputDatasetObsoleteDto, +} from "@scicatproject/scicat-sdk-ts"; import { trigger, state, @@ -40,7 +43,7 @@ export interface HistoryItem { export class DatasetLifecycleComponent implements OnInit, OnChanges { appConfig = this.appConfigService.getConfig(); - dataset: Dataset | undefined; + dataset: OutputDatasetObsoleteDto | undefined; historyItems: HistoryItem[] = []; pageSizeOptions = [10, 25, 50, 100, 500, 1000]; @@ -59,8 +62,10 @@ export class DatasetLifecycleComponent implements OnInit, OnChanges { ) {} private parseHistoryItems(): HistoryItem[] { - if (this.dataset && this.dataset.history) { - const history = this.dataset.history.map( + // TODO: This should be checked because something is wrong with the types + const dataset = this.dataset as DatasetClass; + if (dataset && dataset.history) { + const history = dataset.history.map( ({ updatedAt, updatedBy, id, ...properties }) => Object.keys(properties).map( (property) => diff --git a/src/app/datasets/dataset-table-actions/dataset-table-actions.component.ts b/src/app/datasets/dataset-table-actions/dataset-table-actions.component.ts index dd33b31b1..5f430fb92 100644 --- a/src/app/datasets/dataset-table-actions/dataset-table-actions.component.ts +++ b/src/app/datasets/dataset-table-actions/dataset-table-actions.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input, OnDestroy } from "@angular/core"; -import { ArchViewMode, MessageType, Dataset } from "state-management/models"; +import { ArchViewMode, MessageType } from "state-management/models"; import { Store } from "@ngrx/store"; import { setPublicViewModeAction, @@ -19,6 +19,7 @@ import { DialogComponent } from "shared/modules/dialog/dialog.component"; import { showMessageAction } from "state-management/actions/user.actions"; import { selectSubmitError } from "state-management/selectors/jobs.selectors"; import { AppConfigService } from "app-config.service"; +import { OutputDatasetObsoleteDto } from "@scicatproject/scicat-sdk-ts"; @Component({ selector: "dataset-table-actions", @@ -29,7 +30,7 @@ export class DatasetTableActionsComponent implements OnInit, OnDestroy { appConfig = this.appConfigService.getConfig(); loading$ = this.store.select(selectIsLoading); - @Input() selectedSets: Dataset[] | null = []; + @Input() selectedSets: OutputDatasetObsoleteDto[] | null = []; public currentArchViewMode: ArchViewMode = ArchViewMode.all; public viewModes = ArchViewMode; diff --git a/src/app/datasets/dataset-table/dataset-table.component.spec.ts b/src/app/datasets/dataset-table/dataset-table.component.spec.ts index fbf8d9acc..be99ffc0e 100644 --- a/src/app/datasets/dataset-table/dataset-table.component.spec.ts +++ b/src/app/datasets/dataset-table/dataset-table.component.spec.ts @@ -13,7 +13,7 @@ import { waitForAsync, } from "@angular/core/testing"; import { StoreModule, Store } from "@ngrx/store"; -import { Dataset, DatasetApi } from "shared/sdk"; +import { Dataset, DatasetApi } from "@scicatproject/scicat-sdk-ts"; import { SharedScicatFrontendModule } from "shared/shared.module"; import { selectDatasetAction, diff --git a/src/app/datasets/dataset-table/dataset-table.component.ts b/src/app/datasets/dataset-table/dataset-table.component.ts index c3976abd8..fc7a121c1 100644 --- a/src/app/datasets/dataset-table/dataset-table.component.ts +++ b/src/app/datasets/dataset-table/dataset-table.component.ts @@ -9,7 +9,7 @@ import { SimpleChange, ViewEncapsulation, } from "@angular/core"; -import { Dataset, TableColumn } from "state-management/models"; +import { TableColumn } from "state-management/models"; import { MatCheckboxChange } from "@angular/material/checkbox"; import { Subscription } from "rxjs"; import { Store } from "@ngrx/store"; @@ -28,20 +28,19 @@ import { selectTotalSets, selectDatasetsInBatch, } from "state-management/selectors/datasets.selectors"; -import { get } from "lodash"; +import { get } from "lodash-es"; import { AppConfigService } from "app-config.service"; import { selectCurrentUser } from "state-management/selectors/user.selectors"; +import { + DatasetClass, + OutputDatasetObsoleteDto, +} from "@scicatproject/scicat-sdk-ts"; import { PageEvent } from "@angular/material/paginator"; export interface SortChangeEvent { active: string; direction: "asc" | "desc" | ""; } -// interface DatasetDerivationsMap { -// datasetPid: string; -// derivedDatasetsNum: number; -// } - @Component({ selector: "dataset-table", templateUrl: "dataset-table.component.html", @@ -61,18 +60,16 @@ export class DatasetTableComponent implements OnInit, OnDestroy, OnChanges { @Input() tableColumns: TableColumn[] | null = null; displayedColumns: string[] = []; - @Input() selectedSets: Dataset[] | null = null; + @Input() selectedSets: OutputDatasetObsoleteDto[] | null = null; @Output() pageChange = new EventEmitter<{ pageIndex: number; pageSize: number; }>(); - datasets: Dataset[] = []; - // datasetDerivationsMaps: DatasetDerivationsMap[] = []; - // derivationMapPids: string[] = []; + datasets: OutputDatasetObsoleteDto[] = []; @Output() settingsClick = new EventEmitter(); - @Output() rowClick = new EventEmitter(); + @Output() rowClick = new EventEmitter(); constructor( public appConfigService: AppConfigService, @@ -89,13 +86,13 @@ export class DatasetTableComponent implements OnInit, OnDestroy, OnChanges { this.settingsClick.emit(event); } - doRowClick(dataset: Dataset): void { + doRowClick(dataset: OutputDatasetObsoleteDto): void { this.rowClick.emit(dataset); } // conditional to asses dataset status and assign correct icon ArchViewMode.work_in_progress // TODO: when these concepts stabilise, we should move the definitions to site config - wipCondition(dataset: Dataset): boolean { + wipCondition(dataset: DatasetClass): boolean { if ( !dataset.datasetlifecycle.archivable && !dataset.datasetlifecycle.retrievable && @@ -109,7 +106,7 @@ export class DatasetTableComponent implements OnInit, OnDestroy, OnChanges { return false; } - systemErrorCondition(dataset: Dataset): boolean { + systemErrorCondition(dataset: DatasetClass): boolean { if ( (dataset.datasetlifecycle.retrievable && dataset.datasetlifecycle.archivable) || @@ -123,14 +120,14 @@ export class DatasetTableComponent implements OnInit, OnDestroy, OnChanges { return false; } - userErrorCondition(dataset: Dataset): boolean { + userErrorCondition(dataset: DatasetClass): boolean { if (dataset.datasetlifecycle.archiveStatusMessage === "missingFilesError") { return true; } return false; } - archivableCondition(dataset: Dataset): boolean { + archivableCondition(dataset: DatasetClass): boolean { if ( dataset.datasetlifecycle.archivable && !dataset.datasetlifecycle.retrievable && @@ -141,7 +138,7 @@ export class DatasetTableComponent implements OnInit, OnDestroy, OnChanges { return false; } - retrievableCondition(dataset: Dataset): boolean { + retrievableCondition(dataset: DatasetClass): boolean { if ( !dataset.datasetlifecycle.archivable && dataset.datasetlifecycle.retrievable @@ -151,7 +148,7 @@ export class DatasetTableComponent implements OnInit, OnDestroy, OnChanges { return false; } - isSelected(dataset: Dataset): boolean { + isSelected(dataset: DatasetClass): boolean { if (!this.selectedSets) { return false; } @@ -164,11 +161,11 @@ export class DatasetTableComponent implements OnInit, OnDestroy, OnChanges { return numSelected === numRows; } - isInBatch(dataset: Dataset): boolean { + isInBatch(dataset: DatasetClass): boolean { return this.inBatchPids.indexOf(dataset.pid) !== -1; } - onSelect(event: MatCheckboxChange, dataset: Dataset): void { + onSelect(event: MatCheckboxChange, dataset: OutputDatasetObsoleteDto): void { if (event.checked) { this.store.dispatch(selectDatasetAction({ dataset })); } else { diff --git a/src/app/datasets/publish/publish.component.spec.ts b/src/app/datasets/publish/publish.component.spec.ts index b0418dce9..db0da708b 100644 --- a/src/app/datasets/publish/publish.component.spec.ts +++ b/src/app/datasets/publish/publish.component.spec.ts @@ -9,7 +9,7 @@ import { MockActivatedRoute, } from "shared/MockStubs"; import { Store, ActionsSubject } from "@ngrx/store"; -import { PublishedDataApi } from "shared/sdk"; +import { PublishedDataApi } from "@scicatproject/scicat-sdk-ts"; import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { of } from "rxjs"; import { NO_ERRORS_SCHEMA } from "@angular/core"; diff --git a/src/app/datasets/publish/publish.component.ts b/src/app/datasets/publish/publish.component.ts index d79cda7cd..0f0f55d6c 100644 --- a/src/app/datasets/publish/publish.component.ts +++ b/src/app/datasets/publish/publish.component.ts @@ -11,8 +11,7 @@ import { fetchPublishedDataCompleteAction, } from "state-management/actions/published-data.actions"; -import { PublishedDataApi } from "shared/sdk/services/custom"; -import { PublishedData } from "shared/sdk/models"; +import { PublishedDataService } from "@scicatproject/scicat-sdk-ts"; import { formatDate } from "@angular/common"; import { Router } from "@angular/router"; import { selectCurrentPublishedData } from "state-management/selectors/published-data.selectors"; @@ -60,7 +59,7 @@ export class PublishComponent implements OnInit, OnDestroy { constructor( private appConfigService: AppConfigService, private store: Store, - private publishedDataApi: PublishedDataApi, + private publishedDataApi: PublishedDataService, private actionsSubj: ActionsSubject, private router: Router, ) {} @@ -147,7 +146,7 @@ export class PublishComponent implements OnInit, OnDestroy { }); this.publishedDataApi - .formPopulate(this.form.pidArray[0]) + .publishedDataControllerFormPopulate(this.form.pidArray[0]) .subscribe((result) => { this.form.abstract = result.abstract; this.form.title = result.title; @@ -175,7 +174,7 @@ export class PublishComponent implements OnInit, OnDestroy { } public onPublish() { - const publishedData = new PublishedData(); + const publishedData = null; publishedData.title = this.form.title; publishedData.abstract = this.form.abstract; publishedData.dataDescription = this.form.description; diff --git a/src/app/datasets/reduce/reduce.component.spec.ts b/src/app/datasets/reduce/reduce.component.spec.ts index b3b9f31ce..d4221fe7b 100644 --- a/src/app/datasets/reduce/reduce.component.spec.ts +++ b/src/app/datasets/reduce/reduce.component.spec.ts @@ -17,7 +17,7 @@ import { selectOpenwhiskResult, selectDatasets, } from "state-management/selectors/datasets.selectors"; -import { Dataset } from "shared/sdk"; +import { Dataset } from "@scicatproject/scicat-sdk-ts"; import { reduceDatasetAction } from "state-management/actions/datasets.actions"; import { FormBuilder } from "@angular/forms"; import { MatButtonModule } from "@angular/material/button"; diff --git a/src/app/datasets/reduce/reduce.component.ts b/src/app/datasets/reduce/reduce.component.ts index bfc198f0c..d91884fd5 100644 --- a/src/app/datasets/reduce/reduce.component.ts +++ b/src/app/datasets/reduce/reduce.component.ts @@ -7,7 +7,6 @@ import { } from "@angular/core"; import { Router } from "@angular/router"; import { Store } from "@ngrx/store"; -import { Dataset, DerivedDataset } from "shared/sdk/models"; import { selectOpenwhiskResult, selectDatasets, @@ -22,6 +21,10 @@ import { selectIsLoggedIn, } from "state-management/selectors/user.selectors"; import { OwnershipService } from "shared/services/ownership.service"; +import { + DatasetClass, + OutputDatasetObsoleteDto, +} from "@scicatproject/scicat-sdk-ts"; @Component({ selector: "reduce", @@ -29,20 +32,21 @@ import { OwnershipService } from "shared/services/ownership.service"; styleUrls: ["./reduce.component.scss"], }) export class ReduceComponent implements OnInit, OnChanges, OnDestroy { - dataset: Dataset | undefined; + dataset: OutputDatasetObsoleteDto | undefined; subscriptions: Subscription[] = []; - derivedDatasets$ = this.store.select(selectDatasets).pipe( - map((datasets) => - datasets - .filter((dataset) => dataset.type === "derived") - .map((dataset: unknown) => dataset as DerivedDataset) - .filter((dataset) => - dataset["inputDatasets"].includes(this.dataset?.pid), - ), - ), - ); - - derivedDatasets: DerivedDataset[] = []; + derivedDatasets$ = this.store + .select(selectDatasets) + .pipe( + map((datasets) => + datasets + .filter((dataset) => dataset.type === "derived") + .filter((dataset) => + dataset["inputDatasets"].includes(this.dataset?.pid), + ), + ), + ); + + derivedDatasets = []; loading$ = this.store.select(selectIsLoading); loggedIn$ = this.store.select(selectIsLoggedIn); result$ = this.store.select(selectOpenwhiskResult); @@ -83,11 +87,11 @@ export class ReduceComponent implements OnInit, OnChanges, OnDestroy { private ownershipService: OwnershipService, ) {} - reduceDataset(dataset: Dataset): void { + reduceDataset(dataset: OutputDatasetObsoleteDto): void { this.store.dispatch(reduceDatasetAction({ dataset })); } - onRowClick(dataset: Dataset): void { + onRowClick(dataset: DatasetClass): void { const pid = encodeURIComponent(dataset.pid); this.router.navigateByUrl("/datasets/" + pid); } @@ -130,16 +134,17 @@ export class ReduceComponent implements OnInit, OnChanges, OnDestroy { for (const propName in changes) { if (propName === "dataset") { this.dataset = changes[propName].currentValue; - this.derivedDatasets$ = this.store.select(selectDatasets).pipe( - map((datasets) => - datasets - .filter((dataset) => dataset.type === "derived") - .map((dataset: unknown) => dataset as DerivedDataset) - .filter((dataset) => - dataset["inputDatasets"].includes(this.dataset?.pid), - ), - ), - ); + this.derivedDatasets$ = this.store + .select(selectDatasets) + .pipe( + map((datasets) => + datasets + .filter((dataset) => dataset.type === "derived") + .filter((dataset) => + dataset["inputDatasets"].includes(this.dataset?.pid), + ), + ), + ); } } } diff --git a/src/app/datasets/related-datasets/related-datasets.component.spec.ts b/src/app/datasets/related-datasets/related-datasets.component.spec.ts index d90f547e5..d565162b8 100644 --- a/src/app/datasets/related-datasets/related-datasets.component.spec.ts +++ b/src/app/datasets/related-datasets/related-datasets.component.spec.ts @@ -4,7 +4,7 @@ import { Router } from "@angular/router"; import { Store } from "@ngrx/store"; import { provideMockStore } from "@ngrx/store/testing"; import { PageChangeEvent } from "shared/modules/table/table.component"; -import { Dataset } from "shared/sdk"; +import { Dataset } from "@scicatproject/scicat-sdk-ts"; import { changeRelatedDatasetsPageAction, fetchRelatedDatasetsAction, diff --git a/src/app/datasets/related-datasets/related-datasets.component.ts b/src/app/datasets/related-datasets/related-datasets.component.ts index 85981282d..2c1007323 100644 --- a/src/app/datasets/related-datasets/related-datasets.component.ts +++ b/src/app/datasets/related-datasets/related-datasets.component.ts @@ -7,7 +7,10 @@ import { PageChangeEvent, TableColumn, } from "shared/modules/table/table.component"; -import { Dataset } from "shared/sdk"; +import { + DatasetClass, + OutputDatasetObsoleteDto, +} from "@scicatproject/scicat-sdk-ts"; import { changeRelatedDatasetsPageAction, fetchRelatedDatasetsAction, @@ -79,7 +82,9 @@ export class RelatedDatasetsComponent { private store: Store, ) {} - formatTableData(datasets: Dataset[]): Record[] { + formatTableData( + datasets: OutputDatasetObsoleteDto[], + ): Record[] { if (!datasets) { return []; } @@ -108,7 +113,7 @@ export class RelatedDatasetsComponent { this.store.dispatch(fetchRelatedDatasetsAction()); } - onRowClick(dataset: Dataset): void { + onRowClick(dataset: DatasetClass): void { const pid = encodeURIComponent(dataset.pid); this.router.navigateByUrl("/datasets/" + pid); } diff --git a/src/app/datasets/sample-edit/sample-edit.component.spec.ts b/src/app/datasets/sample-edit/sample-edit.component.spec.ts index d8222c610..b0667aa98 100644 --- a/src/app/datasets/sample-edit/sample-edit.component.spec.ts +++ b/src/app/datasets/sample-edit/sample-edit.component.spec.ts @@ -24,7 +24,7 @@ import { PageChangeEvent, SortChangeEvent, } from "shared/modules/table/table.component"; -import { Sample } from "shared/sdk"; +import { Sample } from "@scicatproject/scicat-sdk-ts"; import { changePageAction, setTextFilterAction, diff --git a/src/app/datasets/sample-edit/sample-edit.component.ts b/src/app/datasets/sample-edit/sample-edit.component.ts index da7b6f1c2..3f744e3c6 100644 --- a/src/app/datasets/sample-edit/sample-edit.component.ts +++ b/src/app/datasets/sample-edit/sample-edit.component.ts @@ -21,7 +21,7 @@ import { PageChangeEvent, SortChangeEvent, } from "shared/modules/table/table.component"; -import { Sample } from "shared/sdk"; +import { SampleClass } from "@scicatproject/scicat-sdk-ts"; import { changePageAction, fetchSamplesAction, @@ -57,7 +57,7 @@ export class SampleEditComponent implements OnInit, OnDestroy { ); samplesSubscription: Subscription = new Subscription(); - samples: Sample[] = []; + samples: SampleClass[] = []; selectedSampleId = ""; displayedColumns = [ @@ -69,7 +69,7 @@ export class SampleEditComponent implements OnInit, OnDestroy { ]; form = new FormGroup({ - sample: new FormControl(null, [ + sample: new FormControl(null, [ Validators.required, this.sampleValidator(), ]), @@ -79,7 +79,7 @@ export class SampleEditComponent implements OnInit, OnDestroy { @Inject(MAT_DIALOG_DATA) public data: { ownerGroup: string; sampleId: string }, public dialogRef: MatDialogRef, - private store: Store, + private store: Store, ) { this.store.dispatch(setTextFilterAction({ text: "" })); this.store.dispatch(changePageAction({ page: 0, limit: 10 })); @@ -128,7 +128,7 @@ export class SampleEditComponent implements OnInit, OnDestroy { sortByColumnAction({ column: event.active, direction: event.direction }), ); - onRowClick = (sample: Sample): void => { + onRowClick = (sample: SampleClass): void => { this.selectedSampleId = sample.sampleId; this.sample?.setValue(sample); }; diff --git a/src/app/datasets/share-dialog/share-dialog.component.spec.ts b/src/app/datasets/share-dialog/share-dialog.component.spec.ts index a1144532d..0e0434507 100644 --- a/src/app/datasets/share-dialog/share-dialog.component.spec.ts +++ b/src/app/datasets/share-dialog/share-dialog.component.spec.ts @@ -32,7 +32,7 @@ import { SampleApi, UserApi, UserIdentityApi, -} from "shared/sdk"; +} from "@scicatproject/scicat-sdk-ts"; import { showMessageAction } from "state-management/actions/user.actions"; import { Message, MessageType } from "state-management/models"; diff --git a/src/app/datasets/share-dialog/share-dialog.component.ts b/src/app/datasets/share-dialog/share-dialog.component.ts index 245faa423..fa4540e70 100644 --- a/src/app/datasets/share-dialog/share-dialog.component.ts +++ b/src/app/datasets/share-dialog/share-dialog.component.ts @@ -2,7 +2,10 @@ import { Component, Inject } from "@angular/core"; import { FormControl, Validators } from "@angular/forms"; import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog"; import { Store } from "@ngrx/store"; -import { UserIdentityApi } from "shared/sdk"; +import { + UserIdentitiesService, + UsersService, +} from "@scicatproject/scicat-sdk-ts"; import { showMessageAction } from "state-management/actions/user.actions"; import { Message, MessageType } from "state-management/models"; @@ -23,7 +26,7 @@ export class ShareDialogComponent { constructor( public dialogRef: MatDialogRef, public store: Store, - public userIdentityApi: UserIdentityApi, + public userIdentititiesService: UserIdentitiesService, @Inject(MAT_DIALOG_DATA) data: { infoMessage: string; @@ -41,10 +44,12 @@ export class ShareDialogComponent { add = async (email: string): Promise => { try { - const isValidEmail = await this.userIdentityApi - .isValidEmail({ - where: { "profile.email": email.trim() }, - }) + const isValidEmail = await this.userIdentititiesService + .userIdentitiesControllerIsValidEmail( + JSON.stringify({ + where: { "profile.email": email.trim() }, + }), + ) .toPromise(); if (!isValidEmail) { diff --git a/src/app/instruments/instruments-dashboard/instruments-dashboard.component.spec.ts b/src/app/instruments/instruments-dashboard/instruments-dashboard.component.spec.ts index 880e9d244..f66abc37e 100644 --- a/src/app/instruments/instruments-dashboard/instruments-dashboard.component.spec.ts +++ b/src/app/instruments/instruments-dashboard/instruments-dashboard.component.spec.ts @@ -22,7 +22,7 @@ import { sortByColumnAction, } from "state-management/actions/instruments.actions"; import { Router } from "@angular/router"; -import { Instrument } from "shared/sdk"; +import { Instrument } from "@scicatproject/scicat-sdk-ts"; import { FlexLayoutModule } from "@ngbracket/ngx-layout"; describe("InstrumentsDashboardComponent", () => { diff --git a/src/app/instruments/instruments-dashboard/instruments-dashboard.component.ts b/src/app/instruments/instruments-dashboard/instruments-dashboard.component.ts index 85e1df1b1..29dd67d7b 100644 --- a/src/app/instruments/instruments-dashboard/instruments-dashboard.component.ts +++ b/src/app/instruments/instruments-dashboard/instruments-dashboard.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from "@angular/core"; import { Store } from "@ngrx/store"; -import { Instrument } from "shared/sdk"; +import { Instrument } from "@scicatproject/scicat-sdk-ts"; import { fetchInstrumentsAction, changePageAction, diff --git a/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.spec.ts b/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.spec.ts index ab4c4b82b..6d23d5a50 100644 --- a/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.spec.ts +++ b/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.spec.ts @@ -13,7 +13,7 @@ import { JobsDashboardNewComponent } from "./jobs-dashboard-new.component"; import { SharedTableModule } from "shared/modules/shared-table/shared-table.module"; import { SharedScicatFrontendModule } from "shared/shared.module"; import { HttpClient } from "@angular/common/http"; -import { InternalStorage, LoopBackAuth } from "shared/sdk"; +import { InternalStorage, LoopBackAuth } from "@scicatproject/scicat-sdk-ts"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; describe("JobsDashboardNewComponent", () => { diff --git a/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.ts b/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.ts index 753b181cb..611ee66ce 100644 --- a/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.ts +++ b/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.ts @@ -7,9 +7,9 @@ import { import { SciCatDataSource } from "../../shared/services/scicat.datasource"; import { ScicatDataService } from "../../shared/services/scicat-data-service"; import { ExportExcelService } from "../../shared/services/export-excel.service"; -import { Job } from "shared/sdk"; import { Column } from "shared/modules/shared-table/shared-table.module"; import { AppConfigService } from "app-config.service"; +import { JobsTableData } from "jobs/jobs-dashboard/jobs-dashboard.component"; @Component({ selector: "app-jobs-new-dashboard", @@ -119,7 +119,7 @@ export class JobsDashboardNewComponent implements OnDestroy, AfterViewChecked { this.dataSource.disconnectExportData(); } - onRowClick(job: Job) { + onRowClick(job: JobsTableData) { // currently deactivated, no extra data available /* console.log("Row clicked:", job); const id = encodeURIComponent(job.id); diff --git a/src/app/jobs/jobs-dashboard/jobs-dashboard.component.spec.ts b/src/app/jobs/jobs-dashboard/jobs-dashboard.component.spec.ts index f2e118367..6e4acb8f4 100644 --- a/src/app/jobs/jobs-dashboard/jobs-dashboard.component.spec.ts +++ b/src/app/jobs/jobs-dashboard/jobs-dashboard.component.spec.ts @@ -9,7 +9,7 @@ import { JobsDashboardComponent } from "./jobs-dashboard.component"; import { MockStore } from "shared/MockStubs"; import { Router } from "@angular/router"; import { Store, StoreModule } from "@ngrx/store"; -import { Job } from "shared/sdk"; +import { Job } from "@scicatproject/scicat-sdk-ts"; import { NO_ERRORS_SCHEMA } from "@angular/core"; import { SharedScicatFrontendModule } from "shared/shared.module"; import { DatePipe } from "@angular/common"; diff --git a/src/app/jobs/jobs-dashboard/jobs-dashboard.component.ts b/src/app/jobs/jobs-dashboard/jobs-dashboard.component.ts index 04b7ce599..2033ad245 100644 --- a/src/app/jobs/jobs-dashboard/jobs-dashboard.component.ts +++ b/src/app/jobs/jobs-dashboard/jobs-dashboard.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, OnDestroy } from "@angular/core"; import { Router } from "@angular/router"; import { Store } from "@ngrx/store"; -import { Job } from "shared/sdk"; +import { JobClass } from "@scicatproject/scicat-sdk-ts"; import { Subscription } from "rxjs"; import { selectJobs, @@ -91,11 +91,11 @@ export class JobsDashboardComponent implements OnInit, OnDestroy { ); } - formatTableData(jobs: Job[]): JobsTableData[] { + formatTableData(jobs: JobClass[]): JobsTableData[] { let tableData: JobsTableData[] = []; if (jobs) { tableData = jobs.map((job) => ({ - id: job.id, + id: job._id, initiator: job.emailJobInitiator, type: job.type, createdAt: this.datePipe.transform( @@ -145,7 +145,7 @@ export class JobsDashboardComponent implements OnInit, OnDestroy { ); } - onRowClick(job: Job) { + onRowClick(job: JobsTableData) { const id = encodeURIComponent(job.id); this.router.navigateByUrl("/user/jobs/" + id); } diff --git a/src/app/jobs/jobs-detail/jobs-detail.component.ts b/src/app/jobs/jobs-detail/jobs-detail.component.ts index 5ff6a899f..910febb14 100644 --- a/src/app/jobs/jobs-detail/jobs-detail.component.ts +++ b/src/app/jobs/jobs-detail/jobs-detail.component.ts @@ -3,7 +3,8 @@ import { fetchJobAction } from "state-management/actions/jobs.actions"; import { Store } from "@ngrx/store"; import { ActivatedRoute } from "@angular/router"; import { selectCurrentJob } from "state-management/selectors/jobs.selectors"; -import { Subscription } from "rxjs"; +import { Observable, Subscription } from "rxjs"; +import { JobClass } from "@scicatproject/scicat-sdk-ts"; @Component({ selector: "app-jobs-detail", @@ -11,7 +12,10 @@ import { Subscription } from "rxjs"; styleUrls: ["./jobs-detail.component.scss"], }) export class JobsDetailComponent implements OnInit, OnDestroy { - job$ = this.store.select(selectCurrentJob); + // TODO: We should extract the response dto with the right properties instead of using the schema for ApiResponse in the backend + job$ = this.store.select(selectCurrentJob) as Observable< + JobClass & { createdAt: string; updatedAt: string } + >; routeSubscription: Subscription = new Subscription(); constructor( diff --git a/src/app/logbooks/logbooks-dashboard/logbooks-dashboard.component.spec.ts b/src/app/logbooks/logbooks-dashboard/logbooks-dashboard.component.spec.ts index d061266a6..2c5ddbc01 100644 --- a/src/app/logbooks/logbooks-dashboard/logbooks-dashboard.component.spec.ts +++ b/src/app/logbooks/logbooks-dashboard/logbooks-dashboard.component.spec.ts @@ -22,7 +22,7 @@ import { RawDatasetInterface, Logbook, LogbookInterface, -} from "shared/sdk"; +} from "@scicatproject/scicat-sdk-ts"; import { LogbookFilters } from "state-management/models"; import { RouterTestingModule } from "@angular/router/testing"; diff --git a/src/app/logbooks/logbooks-dashboard/logbooks-dashboard.component.ts b/src/app/logbooks/logbooks-dashboard/logbooks-dashboard.component.ts index 821838901..0afd3148a 100644 --- a/src/app/logbooks/logbooks-dashboard/logbooks-dashboard.component.ts +++ b/src/app/logbooks/logbooks-dashboard/logbooks-dashboard.component.ts @@ -6,7 +6,10 @@ import { AfterViewChecked, } from "@angular/core"; import { Store } from "@ngrx/store"; -import { Dataset, Logbook } from "shared/sdk"; +import { + Logbook, + OutputDatasetObsoleteDto, +} from "@scicatproject/scicat-sdk-ts"; import { combineLatest, Subscription } from "rxjs"; import { selectLogbooksDashboardPageViewModel } from "state-management/selectors/logbooks.selectors"; import { @@ -48,7 +51,7 @@ export class LogbooksDashboardComponent { vm$ = this.store.select(selectLogbooksDashboardPageViewModel); - dataset: Dataset | undefined = undefined; + dataset: OutputDatasetObsoleteDto | undefined = undefined; appConfig = this.appConfigService.getConfig(); subscriptions: Subscription[] = []; diff --git a/src/app/logbooks/logbooks-detail/logbooks-detail.component.ts b/src/app/logbooks/logbooks-detail/logbooks-detail.component.ts index b7d7ce4e3..7a81635d8 100644 --- a/src/app/logbooks/logbooks-detail/logbooks-detail.component.ts +++ b/src/app/logbooks/logbooks-detail/logbooks-detail.component.ts @@ -5,7 +5,6 @@ import { EventEmitter, ViewEncapsulation, } from "@angular/core"; -import { Logbook } from "state-management/models"; import { PageChangeEvent, SortChangeEvent, @@ -18,7 +17,7 @@ import { encapsulation: ViewEncapsulation.None, }) export class LogbooksDetailComponent { - @Input() logbook: Logbook = new Logbook(); + @Input() logbook: any; @Input() entriesCount: number | null = 0; @Input() entriesPerPage: number | null = 0; @Input() currentPage: number | null = 0; diff --git a/src/app/logbooks/logbooks-table/logbooks-table.component.spec.ts b/src/app/logbooks/logbooks-table/logbooks-table.component.spec.ts index 5d43ca1b4..bedf35fb7 100644 --- a/src/app/logbooks/logbooks-table/logbooks-table.component.spec.ts +++ b/src/app/logbooks/logbooks-table/logbooks-table.component.spec.ts @@ -5,7 +5,7 @@ import { Router } from "@angular/router"; import { LogbooksTableComponent } from "./logbooks-table.component"; import { MockStore } from "shared/MockStubs"; -import { Logbook } from "shared/sdk"; +import { Logbook } from "@scicatproject/scicat-sdk-ts"; import { MatTableModule } from "@angular/material/table"; import { MatIconModule } from "@angular/material/icon"; import { MatCardModule } from "@angular/material/card"; diff --git a/src/app/logbooks/logbooks-table/logbooks-table.component.ts b/src/app/logbooks/logbooks-table/logbooks-table.component.ts index a583b3d27..e90e1f21e 100644 --- a/src/app/logbooks/logbooks-table/logbooks-table.component.ts +++ b/src/app/logbooks/logbooks-table/logbooks-table.component.ts @@ -1,10 +1,10 @@ import { Component, OnInit } from "@angular/core"; import { Router } from "@angular/router"; import { Store } from "@ngrx/store"; +import { Logbook } from "@scicatproject/scicat-sdk-ts"; import { fetchLogbooksAction } from "state-management/actions/logbooks.actions"; import { selectLogbooks } from "state-management/selectors/logbooks.selectors"; -import { Logbook } from "state-management/models"; @Component({ selector: "app-logbooks-table", diff --git a/src/app/policies/edit-dialog/edit-dialog.component.ts b/src/app/policies/edit-dialog/edit-dialog.component.ts index cd85bcad8..4d2827868 100644 --- a/src/app/policies/edit-dialog/edit-dialog.component.ts +++ b/src/app/policies/edit-dialog/edit-dialog.component.ts @@ -3,7 +3,7 @@ import { MatChipInputEvent } from "@angular/material/chips"; import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog"; import { FormControl, FormGroup } from "@angular/forms"; import { COMMA, ENTER } from "@angular/cdk/keycodes"; -import { Policy } from "shared/sdk"; +import { Policy } from "@scicatproject/scicat-sdk-ts"; @Component({ selector: "edit-dialog", diff --git a/src/app/policies/policies-dashboard/policies-dashboard.component.spec.ts b/src/app/policies/policies-dashboard/policies-dashboard.component.spec.ts index dd8a93e55..27d9ad03f 100644 --- a/src/app/policies/policies-dashboard/policies-dashboard.component.spec.ts +++ b/src/app/policies/policies-dashboard/policies-dashboard.component.spec.ts @@ -8,7 +8,7 @@ import { import { PoliciesDashboardComponent } from "./policies-dashboard.component"; import { NO_ERRORS_SCHEMA } from "@angular/core"; import { SharedScicatFrontendModule } from "shared/shared.module"; -import { DatasetApi, Policy } from "shared/sdk"; +import { DatasetApi, Policy } from "@scicatproject/scicat-sdk-ts"; import { MockDatasetApi, MockStore } from "shared/MockStubs"; import { StoreModule, Store } from "@ngrx/store"; import { diff --git a/src/app/policies/policies-dashboard/policies-dashboard.component.ts b/src/app/policies/policies-dashboard/policies-dashboard.component.ts index 2574d4e20..b6319513c 100644 --- a/src/app/policies/policies-dashboard/policies-dashboard.component.ts +++ b/src/app/policies/policies-dashboard/policies-dashboard.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from "@angular/core"; import { Store } from "@ngrx/store"; -import { Policy, DatasetApi } from "shared/sdk"; +import { DatasetsService, Policy } from "@scicatproject/scicat-sdk-ts"; import { TableColumn, PageChangeEvent, @@ -75,7 +75,7 @@ export class PoliciesDashboardComponent implements OnInit { ]; constructor( - private datasetApi: DatasetApi, + private datasetService: DatasetsService, public dialog: MatDialog, private router: Router, private store: Store, @@ -195,8 +195,8 @@ export class PoliciesDashboardComponent implements OnInit { ); // if datasets already exist this.selectedGroups.forEach((group) => { - this.datasetApi - .count({ ownerGroup: group }) + this.datasetService + .datasetsControllerCount(`{ "ownerGroup": "${group}" }`) .pipe( map((count) => { if (count) { diff --git a/src/app/proposals/proposal-dashboard/proposal-dashboard.component.spec.ts b/src/app/proposals/proposal-dashboard/proposal-dashboard.component.spec.ts index e2c468ec3..e2acffda7 100644 --- a/src/app/proposals/proposal-dashboard/proposal-dashboard.component.spec.ts +++ b/src/app/proposals/proposal-dashboard/proposal-dashboard.component.spec.ts @@ -16,7 +16,11 @@ import { Store, StoreModule } from "@ngrx/store"; import { ProposalDashboardComponent } from "./proposal-dashboard.component"; import { ProposalsModule } from "proposals/proposals.module"; import { EffectsModule } from "@ngrx/effects"; -import { DatasetApi, LogbookApi, ProposalApi } from "shared/sdk"; +import { + DatasetApi, + LogbookApi, + ProposalApi, +} from "@scicatproject/scicat-sdk-ts"; import { HttpClient } from "@angular/common/http"; import { ScicatDataService } from "shared/services/scicat-data-service"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; diff --git a/src/app/proposals/proposal-dashboard/proposal-dashboard.component.ts b/src/app/proposals/proposal-dashboard/proposal-dashboard.component.ts index 59c2c6d59..741540750 100644 --- a/src/app/proposals/proposal-dashboard/proposal-dashboard.component.ts +++ b/src/app/proposals/proposal-dashboard/proposal-dashboard.component.ts @@ -7,7 +7,7 @@ import { import { Router } from "@angular/router"; import { AppConfigService } from "app-config.service"; import { Column } from "shared/modules/shared-table/shared-table.module"; -import { Proposal } from "shared/sdk"; +import { ProposalClass } from "@scicatproject/scicat-sdk-ts"; import { ExportExcelService } from "shared/services/export-excel.service"; import { ScicatDataService } from "shared/services/scicat-data-service"; import { SciCatDataSource } from "shared/services/scicat.datasource"; @@ -97,7 +97,7 @@ export class ProposalDashboardComponent implements OnDestroy, AfterViewChecked { ngOnDestroy() { this.dataSource.disconnectExportData(); } - onRowClick(proposal: Proposal) { + onRowClick(proposal: ProposalClass) { const id = encodeURIComponent(proposal.proposalId); this.router.navigateByUrl("/proposals/" + id); } diff --git a/src/app/proposals/proposal-detail/proposal-detail.component.ts b/src/app/proposals/proposal-detail/proposal-detail.component.ts index 97e4befb9..d1b46df23 100644 --- a/src/app/proposals/proposal-detail/proposal-detail.component.ts +++ b/src/app/proposals/proposal-detail/proposal-detail.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnDestroy, OnInit } from "@angular/core"; -import { Proposal } from "state-management/models"; +import { ProposalClass } from "@scicatproject/scicat-sdk-ts"; import { AppConfigService } from "app-config.service"; import { Store } from "@ngrx/store"; import { @@ -30,8 +30,8 @@ import { clearProposalsStateAction } from "state-management/actions/proposals.ac export class ProposalDetailComponent implements OnInit, OnDestroy { private subscriptions: Subscription[] = []; private _hasUnsavedChanges = false; - @Input() proposal: Proposal; - parentProposal: Proposal | undefined; + @Input() proposal: ProposalClass; + parentProposal: ProposalClass | undefined; parentProposal$ = this.store.select(selectParentProposal); editingAllowed = false; userProfile$ = this.store.select(selectProfile); diff --git a/src/app/proposals/proposal-logbook/proposal-logbook.component.spec.ts b/src/app/proposals/proposal-logbook/proposal-logbook.component.spec.ts index f221861c5..202d64acf 100644 --- a/src/app/proposals/proposal-logbook/proposal-logbook.component.spec.ts +++ b/src/app/proposals/proposal-logbook/proposal-logbook.component.spec.ts @@ -17,7 +17,7 @@ import { sortByColumnAction, fetchLogbookAction, } from "state-management/actions/logbooks.actions"; -import { Logbook, LogbookInterface } from "shared/sdk"; +import { Logbook, LogbookInterface } from "@scicatproject/scicat-sdk-ts"; import { LogbookFilters } from "state-management/models"; import { RouterTestingModule } from "@angular/router/testing"; diff --git a/src/app/proposals/proposal-logbook/proposal-logbook.component.ts b/src/app/proposals/proposal-logbook/proposal-logbook.component.ts index 9133cb58b..3242ba76e 100644 --- a/src/app/proposals/proposal-logbook/proposal-logbook.component.ts +++ b/src/app/proposals/proposal-logbook/proposal-logbook.component.ts @@ -7,7 +7,6 @@ import { AfterViewChecked, } from "@angular/core"; import { Store } from "@ngrx/store"; -import { Logbook } from "shared/sdk"; import { Observable, Subscription, take } from "rxjs"; import { selectCurrentLogbook } from "state-management/selectors/logbooks.selectors"; import { @@ -25,6 +24,7 @@ import { SortChangeEvent, } from "shared/modules/table/table.component"; import { AppConfigService } from "app-config.service"; +import { Logbook } from "@scicatproject/scicat-sdk-ts"; export interface LogbookData { logbook: Logbook; @@ -41,8 +41,7 @@ export interface LogbookData { export class ProposalLogbookComponent implements OnInit, OnDestroy, AfterViewChecked { - logbook$: Observable = - this.store.select(selectCurrentLogbook); + logbook$: Observable = this.store.select(selectCurrentLogbook); appConfig = this.appConfigService.getConfig(); subscriptions: Subscription[] = []; diff --git a/src/app/proposals/view-proposal-page/view-proposal-page.component.spec.ts b/src/app/proposals/view-proposal-page/view-proposal-page.component.spec.ts index c1d092427..572b6f00e 100644 --- a/src/app/proposals/view-proposal-page/view-proposal-page.component.spec.ts +++ b/src/app/proposals/view-proposal-page/view-proposal-page.component.spec.ts @@ -11,7 +11,7 @@ import { Router, ActivatedRoute } from "@angular/router"; import { StoreModule, Store } from "@ngrx/store"; import { DatePipe, SlicePipe } from "@angular/common"; import { FileSizePipe } from "shared/pipes/filesize.pipe"; -import { Dataset, Proposal } from "shared/sdk"; +import { Dataset, Proposal } from "@scicatproject/scicat-sdk-ts"; import { changeDatasetsPageAction, fetchProposalDatasetsAction, diff --git a/src/app/proposals/view-proposal-page/view-proposal-page.component.ts b/src/app/proposals/view-proposal-page/view-proposal-page.component.ts index d7e0c0341..5ea64cae1 100644 --- a/src/app/proposals/view-proposal-page/view-proposal-page.component.ts +++ b/src/app/proposals/view-proposal-page/view-proposal-page.component.ts @@ -10,7 +10,6 @@ import { clearProposalsStateAction, } from "state-management/actions/proposals.actions"; import { selectViewProposalPageViewModel } from "state-management/selectors/proposals.selectors"; -import { Dataset, Proposal } from "state-management/models"; import { TableColumn, PageChangeEvent, @@ -20,6 +19,11 @@ import { FileSizePipe } from "shared/pipes/filesize.pipe"; import { fetchLogbookAction } from "state-management/actions/logbooks.actions"; import { AppConfigService } from "app-config.service"; import { selectLogbooksDashboardPageViewModel } from "state-management/selectors/logbooks.selectors"; +import { + DatasetClass, + OutputDatasetObsoleteDto, + ProposalClass, +} from "@scicatproject/scicat-sdk-ts"; export interface TableData { pid: string; @@ -41,7 +45,7 @@ export class ViewProposalPageComponent implements OnInit, OnDestroy { logbook$ = this.store.select(selectLogbooksDashboardPageViewModel); appConfig = this.appConfigService.getConfig(); - proposal: Proposal; + proposal: ProposalClass; subscriptions: Subscription[] = []; @@ -66,7 +70,7 @@ export class ViewProposalPageComponent implements OnInit, OnDestroy { private store: Store, ) {} - formatTableData(datasets: Dataset[]): TableData[] { + formatTableData(datasets: OutputDatasetObsoleteDto[]): TableData[] { let tableData: TableData[] = []; if (datasets) { tableData = datasets.map((dataset: any) => ({ @@ -98,7 +102,7 @@ export class ViewProposalPageComponent implements OnInit, OnDestroy { ); } - onRowClick(dataset: Dataset) { + onRowClick(dataset: DatasetClass) { const pid = encodeURIComponent(dataset.pid); this.router.navigateByUrl("/datasets/" + pid); } diff --git a/src/app/publisheddata/publisheddata-dashboard/publisheddata-dashboard.component.spec.ts b/src/app/publisheddata/publisheddata-dashboard/publisheddata-dashboard.component.spec.ts index c088d2a66..221b8e9b9 100644 --- a/src/app/publisheddata/publisheddata-dashboard/publisheddata-dashboard.component.spec.ts +++ b/src/app/publisheddata/publisheddata-dashboard/publisheddata-dashboard.component.spec.ts @@ -11,7 +11,7 @@ import { NO_ERRORS_SCHEMA } from "@angular/core"; import { StoreModule, Store } from "@ngrx/store"; import { Router } from "@angular/router"; import { CheckboxEvent } from "shared/modules/table/table.component"; -import { PublishedData } from "shared/sdk"; +import { PublishedData } from "@scicatproject/scicat-sdk-ts"; import { MatCheckboxChange } from "@angular/material/checkbox"; import { of } from "rxjs"; import { Message, MessageType } from "state-management/models"; diff --git a/src/app/publisheddata/publisheddata-dashboard/publisheddata-dashboard.component.ts b/src/app/publisheddata/publisheddata-dashboard/publisheddata-dashboard.component.ts index 9f01cfef8..f0b205b95 100644 --- a/src/app/publisheddata/publisheddata-dashboard/publisheddata-dashboard.component.ts +++ b/src/app/publisheddata/publisheddata-dashboard/publisheddata-dashboard.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, OnDestroy, Inject } from "@angular/core"; import { Store } from "@ngrx/store"; -import { PublishedData } from "shared/sdk"; +import { PublishedData } from "@scicatproject/scicat-sdk-ts"; import { Router } from "@angular/router"; import { selectPublishedDataDashboardPageViewModel } from "state-management/selectors/published-data.selectors"; import { CheckboxEvent } from "shared/modules/table/table.component"; diff --git a/src/app/publisheddata/publisheddata-details/publisheddata-details.component.spec.ts b/src/app/publisheddata/publisheddata-details/publisheddata-details.component.spec.ts index 4a2a52f1a..4bf2ffab3 100644 --- a/src/app/publisheddata/publisheddata-details/publisheddata-details.component.spec.ts +++ b/src/app/publisheddata/publisheddata-details/publisheddata-details.component.spec.ts @@ -7,7 +7,7 @@ import { MockActivatedRoute, } from "shared/MockStubs"; import { Store } from "@ngrx/store"; -import { PublishedDataApi } from "shared/sdk"; +import { PublishedDataApi } from "@scicatproject/scicat-sdk-ts"; import { NgxJsonViewerModule } from "ngx-json-viewer"; import { Router, ActivatedRoute } from "@angular/router"; import { LinkyModule } from "ngx-linky"; diff --git a/src/app/publisheddata/publisheddata-details/publisheddata-details.component.ts b/src/app/publisheddata/publisheddata-details/publisheddata-details.component.ts index e4527a267..bbfd06043 100644 --- a/src/app/publisheddata/publisheddata-details/publisheddata-details.component.ts +++ b/src/app/publisheddata/publisheddata-details/publisheddata-details.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, OnDestroy } from "@angular/core"; -import { PublishedData } from "shared/sdk"; +import { PublishedData } from "@scicatproject/scicat-sdk-ts"; import { Store } from "@ngrx/store"; import { ActivatedRoute, Router } from "@angular/router"; import { @@ -18,7 +18,7 @@ import { AppConfigService } from "app-config.service"; }) export class PublisheddataDetailsComponent implements OnInit, OnDestroy { currentData$ = this.store.select(selectCurrentPublishedData); - publishedData: PublishedData = new PublishedData(); + publishedData: PublishedData; subscriptions: Subscription[] = []; appConfig = this.appConfigService.getConfig(); show = false; diff --git a/src/app/publisheddata/publisheddata-edit/publisheddata-edit.component.spec.ts b/src/app/publisheddata/publisheddata-edit/publisheddata-edit.component.spec.ts index 472b77d97..a9330015c 100644 --- a/src/app/publisheddata/publisheddata-edit/publisheddata-edit.component.spec.ts +++ b/src/app/publisheddata/publisheddata-edit/publisheddata-edit.component.spec.ts @@ -9,7 +9,7 @@ import { MockActivatedRoute, } from "shared/MockStubs"; import { Store, ActionsSubject } from "@ngrx/store"; -import { PublishedDataApi } from "shared/sdk"; +import { PublishedDataApi } from "@scicatproject/scicat-sdk-ts"; import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { of } from "rxjs"; import { NO_ERRORS_SCHEMA } from "@angular/core"; diff --git a/src/app/publisheddata/publisheddata-edit/publisheddata-edit.component.ts b/src/app/publisheddata/publisheddata-edit/publisheddata-edit.component.ts index 6618d555b..d7c3ca73c 100644 --- a/src/app/publisheddata/publisheddata-edit/publisheddata-edit.component.ts +++ b/src/app/publisheddata/publisheddata-edit/publisheddata-edit.component.ts @@ -8,7 +8,7 @@ import { import { ActivatedRoute, Router } from "@angular/router"; import { selectCurrentPublishedData } from "state-management/selectors/published-data.selectors"; import { MatChipInputEvent } from "@angular/material/chips"; -import { Attachment, PublishedData } from "shared/sdk"; +import { Attachment, PublishedData } from "@scicatproject/scicat-sdk-ts"; import { PickedFile } from "shared/modules/file-uploader/file-uploader.component"; import { tap } from "rxjs/operators"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; diff --git a/src/app/samples/sample-dashboard/sample-dashboard.component.spec.ts b/src/app/samples/sample-dashboard/sample-dashboard.component.spec.ts index 350453726..6e7e08fe8 100644 --- a/src/app/samples/sample-dashboard/sample-dashboard.component.spec.ts +++ b/src/app/samples/sample-dashboard/sample-dashboard.component.spec.ts @@ -14,7 +14,7 @@ import { changePageAction, sortByColumnAction, } from "state-management/actions/samples.actions"; -import { Sample } from "shared/sdk"; +import { Sample } from "@scicatproject/scicat-sdk-ts"; import { PageChangeEvent, SortChangeEvent, diff --git a/src/app/samples/sample-dashboard/sample-dashboard.component.ts b/src/app/samples/sample-dashboard/sample-dashboard.component.ts index 495a8dc12..9fdb827aa 100644 --- a/src/app/samples/sample-dashboard/sample-dashboard.component.ts +++ b/src/app/samples/sample-dashboard/sample-dashboard.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, OnDestroy } from "@angular/core"; import { Store } from "@ngrx/store"; -import { Sample } from "shared/sdk"; +import { SampleClass } from "@scicatproject/scicat-sdk-ts"; import { changePageAction, fetchSamplesAction, @@ -65,7 +65,7 @@ export class SampleDashboardComponent implements OnInit, OnDestroy { private store: Store, ) {} - formatTableData(samples: Sample[]): any { + formatTableData(samples: SampleClass[]): any { if (samples) { return samples.map((sample) => ({ sampleId: sample.sampleId, @@ -127,7 +127,7 @@ export class SampleDashboardComponent implements OnInit, OnDestroy { ); } - onRowClick(sample: Sample) { + onRowClick(sample: SampleClass) { const id = encodeURIComponent(sample.sampleId); this.router.navigateByUrl("/samples/" + id); } diff --git a/src/app/samples/sample-detail/sample-detail.component.spec.ts b/src/app/samples/sample-detail/sample-detail.component.spec.ts index 3128c8288..d55c8b4e2 100644 --- a/src/app/samples/sample-detail/sample-detail.component.spec.ts +++ b/src/app/samples/sample-detail/sample-detail.component.spec.ts @@ -19,7 +19,7 @@ import { removeAttachmentAction, addAttachmentAction, } from "state-management/actions/samples.actions"; -import { Dataset, Sample, User } from "shared/sdk"; +import { Dataset, Sample, User } from "@scicatproject/scicat-sdk-ts"; import { SharedScicatFrontendModule } from "shared/shared.module"; import { DatePipe, SlicePipe } from "@angular/common"; import { FileSizePipe } from "shared/pipes/filesize.pipe"; diff --git a/src/app/samples/sample-detail/sample-detail.component.ts b/src/app/samples/sample-detail/sample-detail.component.ts index 657da590c..a807baabb 100644 --- a/src/app/samples/sample-detail/sample-detail.component.ts +++ b/src/app/samples/sample-detail/sample-detail.component.ts @@ -1,7 +1,6 @@ import { ActivatedRoute, Router } from "@angular/router"; import { Component, OnDestroy, OnInit } from "@angular/core"; import { fromEvent, Subscription } from "rxjs"; -import { Sample, Attachment, User, Dataset } from "shared/sdk/models"; import { selectSampleDetailPageViewModel } from "../../state-management/selectors/samples.selectors"; import { Store } from "@ngrx/store"; import { @@ -26,6 +25,14 @@ import { } from "shared/modules/file-uploader/file-uploader.component"; import { EditableComponent } from "app-routing/pending-changes.guard"; import { AppConfigService } from "app-config.service"; +import { + Attachment, + CreateAttachmentDto, + DatasetClass, + OutputDatasetObsoleteDto, + ReturnedUserDto, + SampleClass, +} from "@scicatproject/scicat-sdk-ts"; export interface TableData { pid: string; @@ -50,10 +57,10 @@ export class SampleDetailComponent appConfig = this.appConfigService.getConfig(); - sample: Sample = new Sample(); - user: User = new User(); - attachment: Partial = new Attachment(); - attachments: Attachment[] = [new Attachment()]; + sample: SampleClass; + user: ReturnedUserDto; + attachment: CreateAttachmentDto; + attachments: Attachment[] = []; show = false; subscriptions: Subscription[] = []; @@ -78,7 +85,7 @@ export class SampleDetailComponent private store: Store, ) {} - formatTableData(datasets: Dataset[]): TableData[] { + formatTableData(datasets: OutputDatasetObsoleteDto[]): TableData[] { let tableData: TableData[] = []; if (datasets) { tableData = datasets.map((dataset: any) => ({ @@ -114,12 +121,6 @@ export class SampleDetailComponent ownerGroup: this.sample.ownerGroup, accessGroups: this.sample.accessGroups, sampleId: this.sample.sampleId, - dataset: undefined, - datasetId: undefined, - rawDatasetId: undefined, - derivedDatasetId: undefined, - proposal: undefined, - proposalId: undefined, }; this.store.dispatch(addAttachmentAction({ attachment: this.attachment })); } @@ -153,7 +154,7 @@ export class SampleDetailComponent ); } - onRowClick(dataset: Dataset) { + onRowClick(dataset: DatasetClass) { const id = encodeURIComponent(dataset.pid); this.router.navigateByUrl("/datasets/" + id); } diff --git a/src/app/samples/sample-dialog/sample-dialog.component.ts b/src/app/samples/sample-dialog/sample-dialog.component.ts index 9fa54cbf9..b52d90cd5 100644 --- a/src/app/samples/sample-dialog/sample-dialog.component.ts +++ b/src/app/samples/sample-dialog/sample-dialog.component.ts @@ -2,7 +2,7 @@ import { Component, Inject, OnInit, OnDestroy } from "@angular/core"; import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { Sample } from "shared/sdk"; +import { SampleClass } from "@scicatproject/scicat-sdk-ts"; import { Store } from "@ngrx/store"; import { addSampleAction, @@ -22,7 +22,7 @@ export class SampleDialogComponent implements OnInit, OnDestroy { private vm$ = this.store.select(selectSampleDialogPageViewModel); public form: FormGroup; description: string; - sample: Sample = new Sample(); + sample: SampleClass; username = ""; userGroups: string[] | undefined; @@ -33,7 +33,7 @@ export class SampleDialogComponent implements OnInit, OnDestroy { private fb: FormBuilder, public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) - { description, sampleCharacteristics, ownerGroup }: Sample, + { description, sampleCharacteristics, ownerGroup }: SampleClass, ) { this.description = description; @@ -47,7 +47,6 @@ export class SampleDialogComponent implements OnInit, OnDestroy { save() { this.dialogRef.close(this.form.value); console.log("gmnov", this.form.value); - this.sample = new Sample(); this.sample.sampleCharacteristics = { characteristics: this.form.value.sampleCharacteristics, }; diff --git a/src/app/shared/modules/file-uploader/file-uploader.component.ts b/src/app/shared/modules/file-uploader/file-uploader.component.ts index 9970a2b0e..e05d1495b 100644 --- a/src/app/shared/modules/file-uploader/file-uploader.component.ts +++ b/src/app/shared/modules/file-uploader/file-uploader.component.ts @@ -2,7 +2,7 @@ import { Component, Output, EventEmitter, Input } from "@angular/core"; import { Store } from "@ngrx/store"; import { AppConfigService } from "app-config.service"; import saveAs from "file-saver"; -import { Attachment } from "shared/sdk"; +import { Attachment } from "@scicatproject/scicat-sdk-ts"; import { AttachmentService } from "shared/services/attachment.service"; import { showMessageAction } from "state-management/actions/user.actions"; import { Message, MessageType } from "state-management/models"; diff --git a/src/app/shared/modules/scientific-metadata/metadata-view/metadata-view.component.ts b/src/app/shared/modules/scientific-metadata/metadata-view/metadata-view.component.ts index 125b7220a..92f072a86 100644 --- a/src/app/shared/modules/scientific-metadata/metadata-view/metadata-view.component.ts +++ b/src/app/shared/modules/scientific-metadata/metadata-view/metadata-view.component.ts @@ -18,7 +18,7 @@ import { UnitsService } from "shared/services/units.service"; styleUrls: ["./metadata-view.component.scss"], }) export class MetadataViewComponent implements OnInit, OnChanges { - @Input() metadata: Record = {}; + @Input() metadata: object = {}; tableData: ScientificMetadataTableData[] = []; columnsToDisplay: string[] = ["name", "value", "unit"]; diff --git a/src/app/shared/sdk/index.ts b/src/app/shared/sdk/index.ts deleted file mode 100644 index c49b274a9..000000000 --- a/src/app/shared/sdk/index.ts +++ /dev/null @@ -1,134 +0,0 @@ -/* eslint-disable */ -/** - * @module SDKModule - * @author Jonathan Casarrubias - * @license MIT 2016 Jonathan Casarrubias - * @version 2.1.0 - * @description - * The SDKModule is a generated Software Development Kit automatically built by - * the LoopBack SDK Builder open source module. - * - * The SDKModule provides Angular 2 >= RC.5 support, which means that NgModules - * can import this Software Development Kit as follows: - * - * - * APP Route Module Context - * ============================================================================ - * import { NgModule } from '@angular/core'; - * import { BrowserModule } from '@angular/platform-browser'; - * // App Root - * import { AppComponent } from './app.component'; - * // Feature Modules - * import { SDK[Browser|Node|Native]Module } from './shared/sdk/sdk.module'; - * // Import Routing - * import { routing } from './app.routing'; - * @NgModule({ - * imports: [ - * BrowserModule, - * routing, - * SDK[Browser|Node|Native]Module.forRoot() - * ], - * declarations: [ AppComponent ], - * bootstrap: [ AppComponent ] - * }) - * export class AppModule { } - * - **/ -import { ErrorHandler } from "./services/core/error.service"; -import { LoopBackAuth } from "./services/core/auth.service"; -import { LoggerService } from "./services/custom/logger.service"; -import { SDKModels } from "./services/custom/SDKModels"; -import { InternalStorage, SDKStorage } from "./storage/storage.swaps"; -import { HttpClientModule } from "@angular/common/http"; -import { CommonModule } from "@angular/common"; -import { NgModule, ModuleWithProviders } from "@angular/core"; -import { CookieBrowser } from "./storage/cookie.browser"; -import { StorageBrowser } from "./storage/storage.browser"; -import { SocketBrowser } from "./sockets/socket.browser"; -import { SocketDriver } from "./sockets/socket.driver"; -import { SocketConnection } from "./sockets/socket.connections"; -import { RealTime } from "./services/core/real.time"; -import { UserApi } from "./services/custom/User"; -import { UserCredentialApi } from "./services/custom/UserCredential"; -import { UserIdentityApi } from "./services/custom/UserIdentity"; -import { ApplicationCredentialApi } from "./services/custom/ApplicationCredential"; -import { LogbookApi } from "./services/custom/Logbook"; -import { PublishedDataApi } from "./services/custom/PublishedData"; -import { DatasetApi } from "./services/custom/Dataset"; -import { RawDatasetApi } from "./services/custom/RawDataset"; -import { DerivedDatasetApi } from "./services/custom/DerivedDataset"; -import { SampleApi } from "./services/custom/Sample"; -import { ProposalApi } from "./services/custom/Proposal"; -import { DatablockApi } from "./services/custom/Datablock"; -import { PolicyApi } from "./services/custom/Policy"; -import { OrigDatablockApi } from "./services/custom/OrigDatablock"; -import { AttachmentApi } from "./services/custom/Attachment"; -import { JobApi } from "./services/custom/Job"; -import { ShareGroupApi } from "./services/custom/ShareGroup"; -import { UserSettingApi } from "./services/custom/UserSetting"; -import { InstrumentApi } from "./services/custom/Instrument"; -/** - * @module SDKBrowserModule - * @description - * This module should be imported when building a Web Application in the following scenarios: - * - * 1.- Regular web application - * 2.- Angular universal application (Browser Portion) - * 3.- Progressive applications (Angular Mobile, Ionic, WebViews, etc) - **/ -@NgModule({ - imports: [CommonModule, HttpClientModule], - declarations: [], - exports: [], - providers: [ErrorHandler, SocketConnection], -}) -export class SDKBrowserModule { - static forRoot( - internalStorageProvider: any = { - provide: InternalStorage, - useClass: CookieBrowser, - }, - ): ModuleWithProviders { - return { - ngModule: SDKBrowserModule, - providers: [ - LoopBackAuth, - LoggerService, - SDKModels, - RealTime, - UserApi, - UserCredentialApi, - UserIdentityApi, - ApplicationCredentialApi, - LogbookApi, - PublishedDataApi, - DatasetApi, - RawDatasetApi, - DerivedDatasetApi, - SampleApi, - ProposalApi, - DatablockApi, - PolicyApi, - OrigDatablockApi, - AttachmentApi, - JobApi, - ShareGroupApi, - UserSettingApi, - InstrumentApi, - internalStorageProvider, - { provide: SDKStorage, useClass: StorageBrowser }, - { provide: SocketDriver, useClass: SocketBrowser }, - ], - }; - } -} -/** - * Have Fun!!! - * - Jon - **/ -export * from "./models/index"; -export * from "./services/index"; -export * from "./lb.config"; -export * from "./storage/storage.swaps"; -export { CookieBrowser } from "./storage/cookie.browser"; -export { StorageBrowser } from "./storage/storage.browser"; diff --git a/src/app/shared/sdk/lb.config.ts b/src/app/shared/sdk/lb.config.ts deleted file mode 100644 index 9f8cf2b64..000000000 --- a/src/app/shared/sdk/lb.config.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* eslint-disable */ -/** - * @module LoopBackConfig - * @description - * - * The LoopBackConfig module help developers to externally - * configure the base url and api version for loopback.io - * - * Example - * - * import { LoopBackConfig } from './sdk'; - * - * @Component() // No metadata needed for this module - * - * export class MyApp { - * constructor() { - * LoopBackConfig.setBaseURL('http://localhost:3000'); - * LoopBackConfig.setApiVersion('api'); - * } - * } - **/ -export class LoopBackConfig { - private static path: string = "//0.0.0.0:3000"; - private static version: string | number = "api/v3"; - private static authPrefix: string = ""; - private static debug: boolean = true; - private static filterOn: string = "headers"; - private static whereOn: string = "headers"; - private static secure: boolean = false; - private static withCredentials: boolean = false; - - public static setApiVersion(version: string = "api"): void { - LoopBackConfig.version = version; - } - - public static getApiVersion(): string | number { - return LoopBackConfig.version; - } - - public static setBaseURL(url: string = "/"): void { - LoopBackConfig.path = url; - } - - public static getPath(): string { - return LoopBackConfig.path; - } - - public static setAuthPrefix(authPrefix: string = ""): void { - LoopBackConfig.authPrefix = authPrefix; - } - - public static getAuthPrefix(): string { - return LoopBackConfig.authPrefix; - } - - public static setDebugMode(isEnabled: boolean): void { - LoopBackConfig.debug = isEnabled; - } - - public static debuggable(): boolean { - return LoopBackConfig.debug; - } - - public static filterOnUrl(): void { - LoopBackConfig.filterOn = "url"; - } - - public static filterOnHeaders(): void { - LoopBackConfig.filterOn = "headers"; - } - - public static whereOnUrl(): void { - LoopBackConfig.whereOn = "url"; - } - - public static whereOnHeaders(): void { - LoopBackConfig.whereOn = "headers"; - } - - public static isHeadersFilteringSet(): boolean { - return LoopBackConfig.filterOn === "headers"; - } - - public static isHeadersWhereSet(): boolean { - return LoopBackConfig.whereOn === "headers"; - } - - public static setSecureWebSockets(): void { - LoopBackConfig.secure = true; - } - - public static unsetSecureWebSockets(): void { - LoopBackConfig.secure = false; - } - - public static isSecureWebSocketsSet(): boolean { - return LoopBackConfig.secure; - } - - public static setRequestOptionsCredentials( - withCredentials: boolean = false, - ): void { - LoopBackConfig.withCredentials = withCredentials; - } - - public static getRequestOptionsCredentials(): boolean { - return LoopBackConfig.withCredentials; - } -} diff --git a/src/app/shared/sdk/models/ApplicationCredential.ts b/src/app/shared/sdk/models/ApplicationCredential.ts deleted file mode 100644 index 100154ff3..000000000 --- a/src/app/shared/sdk/models/ApplicationCredential.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* eslint-disable */ - -declare var Object: any; -export interface ApplicationCredentialInterface { - provider: string; - authScheme?: string; - credentials?: any; - created?: Date; - modified?: Date; - id?: any; -} - -export class ApplicationCredential implements ApplicationCredentialInterface { - "provider": string; - "authScheme": string; - "credentials": any; - "created": Date; - "modified": Date; - "id": any; - constructor(data?: ApplicationCredentialInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `ApplicationCredential`. - */ - public static getModelName() { - return "ApplicationCredential"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of ApplicationCredential for dynamic purposes. - **/ - public static factory( - data: ApplicationCredentialInterface, - ): ApplicationCredential { - return new ApplicationCredential(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "ApplicationCredential", - plural: "ApplicationCredentials", - path: "ApplicationCredentials", - idName: "id", - properties: { - provider: { - name: "provider", - type: "string", - }, - authScheme: { - name: "authScheme", - type: "string", - }, - credentials: { - name: "credentials", - type: "any", - }, - created: { - name: "created", - type: "Date", - }, - modified: { - name: "modified", - type: "Date", - }, - id: { - name: "id", - type: "any", - }, - }, - relations: {}, - }; - } -} diff --git a/src/app/shared/sdk/models/Attachment.ts b/src/app/shared/sdk/models/Attachment.ts deleted file mode 100644 index 15b3f8d6b..000000000 --- a/src/app/shared/sdk/models/Attachment.ts +++ /dev/null @@ -1,163 +0,0 @@ -/* eslint-disable */ -import { Dataset, Sample, Proposal } from "../index"; - -declare var Object: any; -export interface AttachmentInterface { - id?: string; - thumbnail: string; - caption?: string; - ownerGroup: string; - accessGroups?: Array; - createdBy?: string; - updatedBy?: string; - datasetId?: string; - sampleId?: string; - proposalId?: string; - rawDatasetId?: string; - derivedDatasetId?: string; - createdAt?: Date; - updatedAt?: Date; - dataset?: Dataset; - sample?: Sample; - proposal?: Proposal; -} - -export class Attachment implements AttachmentInterface { - "id": string; - "thumbnail": string; - "caption": string; - "ownerGroup": string; - "accessGroups": Array; - "createdBy": string; - "updatedBy": string; - "datasetId": string; - "sampleId": string; - "proposalId": string; - "rawDatasetId": string; - "derivedDatasetId": string; - "createdAt": Date; - "updatedAt": Date; - dataset: Dataset; - sample: Sample; - proposal: Proposal; - constructor(data?: AttachmentInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `Attachment`. - */ - public static getModelName() { - return "Attachment"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of Attachment for dynamic purposes. - **/ - public static factory(data: AttachmentInterface): Attachment { - return new Attachment(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "Attachment", - plural: "Attachments", - path: "Attachments", - idName: "id", - properties: { - id: { - name: "id", - type: "string", - }, - thumbnail: { - name: "thumbnail", - type: "string", - default: "retrieve", - }, - caption: { - name: "caption", - type: "string", - default: "", - }, - ownerGroup: { - name: "ownerGroup", - type: "string", - }, - accessGroups: { - name: "accessGroups", - type: "Array<any>", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - datasetId: { - name: "datasetId", - type: "string", - }, - sampleId: { - name: "sampleId", - type: "string", - }, - proposalId: { - name: "proposalId", - type: "string", - }, - rawDatasetId: { - name: "rawDatasetId", - type: "string", - }, - derivedDatasetId: { - name: "derivedDatasetId", - type: "string", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - }, - relations: { - dataset: { - name: "dataset", - type: "Dataset", - model: "Dataset", - relationType: "belongsTo", - keyFrom: "datasetId", - keyTo: "pid", - }, - sample: { - name: "sample", - type: "Sample", - model: "Sample", - relationType: "belongsTo", - keyFrom: "sampleId", - keyTo: "sampleId", - }, - proposal: { - name: "proposal", - type: "Proposal", - model: "Proposal", - relationType: "belongsTo", - keyFrom: "proposalId", - keyTo: "proposalId", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/BaseModels.ts b/src/app/shared/sdk/models/BaseModels.ts deleted file mode 100644 index 9db3d4679..000000000 --- a/src/app/shared/sdk/models/BaseModels.ts +++ /dev/null @@ -1,127 +0,0 @@ -/* eslint-disable */ - -import { FilterLimits } from "shared/services/scicat-data-service"; - -declare var Object: any; -export interface LoopBackFilter { - fields?: any; - include?: any; - limit?: any; - limits?: FilterLimits; - order?: any; - skip?: any; - offset?: any; - where?: any; -} - -export interface AccessTokenInterface { - id?: string; - ttl?: number; - scopes?: ["string"]; - created?: Date; - userId?: string; - user?: any; -} - -export class AccessToken implements AccessTokenInterface { - "id": string; - "ttl": number; - "scopes": ["string"]; - "created": Date; - "userId": string; - "user": any; - constructor(data?: AccessTokenInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `AccessToken`. - */ - public static getModelName() { - return "AccessToken"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of AccessToken for dynamic purposes. - **/ - public static factory(data: AccessTokenInterface): AccessToken { - return new AccessToken(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "AccessToken", - plural: "AccessTokens", - properties: { - id: { - name: "id", - type: "string", - }, - ttl: { - name: "ttl", - type: "number", - default: 1209600, - }, - scopes: { - name: "scopes", - type: '["string"]', - }, - created: { - name: "created", - type: "Date", - }, - userId: { - name: "userId", - type: "string", - }, - }, - relations: { - user: { - name: "user", - type: "User", - model: "User", - }, - }, - }; - } -} - -export class SDKToken implements AccessTokenInterface { - id: any = null; - ttl: number = null; - scopes: any = null; - created: any = null; - userId: any = null; - user: any = null; - rememberMe: boolean = null; - constructor(data?: AccessTokenInterface) { - Object.assign(this, data); - } -} -/** - * This GeoPoint represents both, LoopBack and MongoDB GeoPoint - **/ -export interface GeoPoint { - lat?: number; - lng?: number; - type?: string; - coordinates?: number[]; -} - -export interface StatFilter { - range: string; - custom?: { - start: string; - end: string; - }; - where?: {}; - groupBy?: string; -} diff --git a/src/app/shared/sdk/models/Datablock.ts b/src/app/shared/sdk/models/Datablock.ts deleted file mode 100644 index f5cbae169..000000000 --- a/src/app/shared/sdk/models/Datablock.ts +++ /dev/null @@ -1,153 +0,0 @@ -/* eslint-disable */ -import { Dataset } from "../index"; - -declare var Object: any; -export interface DatablockInterface { - id?: string; - archiveId: string; - size: number; - packedSize?: number; - chkAlg?: string; - version: string; - dataFileList: Array; - ownerGroup: string; - accessGroups?: Array; - createdBy?: string; - updatedBy?: string; - datasetId?: string; - rawDatasetId?: string; - derivedDatasetId?: string; - createdAt?: Date; - updatedAt?: Date; - dataset?: Dataset; -} - -export class Datablock implements DatablockInterface { - "id": string; - "archiveId": string; - "size": number; - "packedSize": number; - "chkAlg": string; - "version": string; - "dataFileList": Array; - "ownerGroup": string; - "accessGroups": Array; - "createdBy": string; - "updatedBy": string; - "datasetId": string; - "rawDatasetId": string; - "derivedDatasetId": string; - "createdAt": Date; - "updatedAt": Date; - dataset: Dataset; - constructor(data?: DatablockInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `Datablock`. - */ - public static getModelName() { - return "Datablock"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of Datablock for dynamic purposes. - **/ - public static factory(data: DatablockInterface): Datablock { - return new Datablock(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "Datablock", - plural: "Datablocks", - path: "Datablocks", - idName: "id", - properties: { - id: { - name: "id", - type: "string", - }, - archiveId: { - name: "archiveId", - type: "string", - }, - size: { - name: "size", - type: "number", - }, - packedSize: { - name: "packedSize", - type: "number", - }, - chkAlg: { - name: "chkAlg", - type: "string", - }, - version: { - name: "version", - type: "string", - }, - dataFileList: { - name: "dataFileList", - type: "Array<any>", - }, - ownerGroup: { - name: "ownerGroup", - type: "string", - }, - accessGroups: { - name: "accessGroups", - type: "Array<any>", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - datasetId: { - name: "datasetId", - type: "string", - }, - rawDatasetId: { - name: "rawDatasetId", - type: "string", - }, - derivedDatasetId: { - name: "derivedDatasetId", - type: "string", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - }, - relations: { - dataset: { - name: "dataset", - type: "Dataset", - model: "Dataset", - relationType: "belongsTo", - keyFrom: "datasetId", - keyTo: "pid", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/Dataset.ts b/src/app/shared/sdk/models/Dataset.ts deleted file mode 100644 index cc2578b4f..000000000 --- a/src/app/shared/sdk/models/Dataset.ts +++ /dev/null @@ -1,354 +0,0 @@ -/* eslint-disable */ -import { - PublishedData, - Sample, - Datablock, - OrigDatablock, - Attachment, - Instrument, -} from "../index"; - -declare var Object: any; -export interface DatasetInterface { - pid?: string; - owner: string; - ownerEmail?: string; - orcidOfOwner?: string; - contactEmail: string; - sourceFolder: string; - sourceFolderHost?: string; - size?: number; - packedSize?: number; - numberOfFiles?: number; - numberOfFilesArchived?: number; - creationTime: Date; - type: string; - validationStatus?: string; - keywords?: Array; - description?: string; - datasetName?: string; - classification?: string; - license?: string; - version?: string; - isPublished?: boolean; - sharedWith?: Array; - ownerGroup: string; - accessGroups?: Array; - createdBy?: string; - updatedBy?: string; - history?: Array; - datasetlifecycle?: any; - publisheddataId?: string; - techniques?: Array; - publishedDataId?: string; - createdAt?: Date; - updatedAt?: Date; - instrumentId?: string; - proposalId?: string | string[]; - sampleId?: string | string[]; - historyList?: any[]; - datasetLifecycle?: any[]; - publisheddata?: PublishedData; - techniquesList?: any[]; - samples?: Sample[]; - datablocks?: Datablock[]; - origdatablocks?: OrigDatablock[]; - attachments?: Attachment[]; - instrument?: Instrument; - scientificMetadata?: any; -} - -export class Dataset implements DatasetInterface { - "pid": string; - "owner": string; - "ownerEmail": string; - "orcidOfOwner": string; - "contactEmail": string; - "sourceFolder": string; - "sourceFolderHost": string; - "size": number; - "packedSize": number; - "numberOfFiles": number; - "numberOfFilesArchived": number; - "creationTime": Date; - "type": string; - "validationStatus": string; - "keywords": Array; - "description": string; - "datasetName": string; - "classification": string; - "license": string; - "version": string; - "isPublished": boolean; - "sharedWith": Array; - "ownerGroup": string; - "accessGroups": Array; - "createdBy": string; - "updatedBy": string; - "history": Array; - "datasetlifecycle": any; - "publisheddataId": string; - "techniques": Array; - "publishedDataId": string; - "createdAt": Date; - "updatedAt": Date; - "instrumentId": string; - historyList: any[]; - datasetLifecycle: any[]; - publisheddata: PublishedData; - techniquesList: any[]; - samples: Sample[]; - datablocks: Datablock[]; - origdatablocks: OrigDatablock[]; - attachments: Attachment[]; - instrument: Instrument; - scientificMetadata?: any; - constructor(data?: DatasetInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `Dataset`. - */ - public static getModelName() { - return "Dataset"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of Dataset for dynamic purposes. - **/ - public static factory(data: DatasetInterface): Dataset { - return new Dataset(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "Dataset", - plural: "Datasets", - path: "Datasets", - idName: "pid", - properties: { - pid: { - name: "pid", - type: "string", - }, - owner: { - name: "owner", - type: "string", - }, - ownerEmail: { - name: "ownerEmail", - type: "string", - }, - orcidOfOwner: { - name: "orcidOfOwner", - type: "string", - }, - contactEmail: { - name: "contactEmail", - type: "string", - }, - sourceFolder: { - name: "sourceFolder", - type: "string", - }, - sourceFolderHost: { - name: "sourceFolderHost", - type: "string", - }, - size: { - name: "size", - type: "number", - }, - packedSize: { - name: "packedSize", - type: "number", - }, - numberOfFiles: { - name: "numberOfFiles", - type: "number", - }, - numberOfFilesArchived: { - name: "numberOfFilesArchived", - type: "number", - }, - creationTime: { - name: "creationTime", - type: "Date", - }, - type: { - name: "type", - type: "string", - }, - validationStatus: { - name: "validationStatus", - type: "string", - }, - keywords: { - name: "keywords", - type: "Array<any>", - }, - description: { - name: "description", - type: "string", - }, - datasetName: { - name: "datasetName", - type: "string", - }, - classification: { - name: "classification", - type: "string", - }, - license: { - name: "license", - type: "string", - }, - version: { - name: "version", - type: "string", - }, - isPublished: { - name: "isPublished", - type: "boolean", - }, - sharedWith: { - name: "sharedWith", - type: "Array<any>", - }, - ownerGroup: { - name: "ownerGroup", - type: "string", - }, - accessGroups: { - name: "accessGroups", - type: "Array<any>", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - history: { - name: "history", - type: "Array<any>", - default: [], - }, - datasetlifecycle: { - name: "datasetlifecycle", - type: "any", - }, - publisheddataId: { - name: "publisheddataId", - type: "string", - }, - techniques: { - name: "techniques", - type: "Array<any>", - default: [], - }, - publishedDataId: { - name: "publishedDataId", - type: "string", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - instrumentId: { - name: "instrumentId", - type: "string", - }, - }, - relations: { - historyList: { - name: "historyList", - type: "any[]", - model: "", - relationType: "embedsMany", - keyFrom: "history", - keyTo: "id", - }, - datasetLifecycle: { - name: "datasetLifecycle", - type: "any[]", - model: "", - relationType: "embedsOne", - keyFrom: "datasetlifecycle", - keyTo: "id", - }, - publisheddata: { - name: "publisheddata", - type: "PublishedData", - model: "PublishedData", - relationType: "belongsTo", - keyFrom: "publisheddataId", - keyTo: "doi", - }, - techniquesList: { - name: "techniquesList", - type: "any[]", - model: "", - relationType: "embedsMany", - keyFrom: "techniques", - keyTo: "pid", - }, - samples: { - name: "samples", - type: "Sample[]", - model: "Sample", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "datasetId", - }, - datablocks: { - name: "datablocks", - type: "Datablock[]", - model: "Datablock", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "datasetId", - }, - origdatablocks: { - name: "origdatablocks", - type: "OrigDatablock[]", - model: "OrigDatablock", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "datasetId", - }, - attachments: { - name: "attachments", - type: "Attachment[]", - model: "Attachment", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "datasetId", - }, - instrument: { - name: "instrument", - type: "Instrument", - model: "Instrument", - relationType: "belongsTo", - keyFrom: "instrumentId", - keyTo: "pid", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/DerivedDataset.ts b/src/app/shared/sdk/models/DerivedDataset.ts deleted file mode 100644 index aacf6f6ed..000000000 --- a/src/app/shared/sdk/models/DerivedDataset.ts +++ /dev/null @@ -1,380 +0,0 @@ -/* eslint-disable */ -import { - PublishedData, - Sample, - Datablock, - OrigDatablock, - Attachment, - Instrument, -} from "../index"; - -declare var Object: any; -export interface DerivedDatasetInterface { - investigator: string; - inputDatasets: Array; - usedSoftware: Array; - jobParameters?: any; - jobLogData?: string; - scientificMetadata?: any; - pid?: string; - owner: string; - ownerEmail?: string; - orcidOfOwner?: string; - contactEmail: string; - sourceFolder: string; - sourceFolderHost?: string; - size?: number; - packedSize?: number; - numberOfFiles?: number; - numberOfFilesArchived?: number; - creationTime: Date; - type: string; - validationStatus?: string; - keywords?: Array; - description?: string; - datasetName?: string; - classification?: string; - license?: string; - version?: string; - isPublished?: boolean; - sharedWith?: Array; - ownerGroup: string; - accessGroups?: Array; - createdBy?: string; - updatedBy?: string; - history?: Array; - datasetlifecycle?: any; - publisheddataId?: string; - techniques?: Array; - createdAt?: Date; - updatedAt?: Date; - instrumentId?: string; - historyList?: any[]; - datasetLifecycle?: any[]; - publisheddata?: PublishedData; - techniquesList?: any[]; - samples?: Sample[]; - datablocks?: Datablock[]; - origdatablocks?: OrigDatablock[]; - attachments?: Attachment[]; - instrument?: Instrument; -} - -export class DerivedDataset implements DerivedDatasetInterface { - "investigator": string; - "inputDatasets": Array; - "usedSoftware": Array; - "jobParameters": any; - "jobLogData": string; - "scientificMetadata": any; - "pid": string; - "owner": string; - "ownerEmail": string; - "orcidOfOwner": string; - "contactEmail": string; - "sourceFolder": string; - "sourceFolderHost": string; - "size": number; - "packedSize": number; - "numberOfFiles": number; - "numberOfFilesArchived": number; - "creationTime": Date; - "type": string; - "validationStatus": string; - "keywords": Array; - "description": string; - "datasetName": string; - "classification": string; - "license": string; - "version": string; - "isPublished": boolean; - "sharedWith": Array; - "ownerGroup": string; - "accessGroups": Array; - "createdBy": string; - "updatedBy": string; - "history": Array; - "datasetlifecycle": any; - "publisheddataId": string; - "techniques": Array; - "createdAt": Date; - "updatedAt": Date; - "instrumentId": string; - historyList: any[]; - datasetLifecycle: any[]; - publisheddata: PublishedData; - techniquesList: any[]; - samples: Sample[]; - datablocks: Datablock[]; - origdatablocks: OrigDatablock[]; - attachments: Attachment[]; - instrument: Instrument; - constructor(data?: DerivedDatasetInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `DerivedDataset`. - */ - public static getModelName() { - return "DerivedDataset"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of DerivedDataset for dynamic purposes. - **/ - public static factory(data: DerivedDatasetInterface): DerivedDataset { - return new DerivedDataset(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "DerivedDataset", - plural: "DerivedDatasets", - path: "DerivedDatasets", - idName: "pid", - properties: { - investigator: { - name: "investigator", - type: "string", - }, - inputDatasets: { - name: "inputDatasets", - type: "Array<any>", - }, - usedSoftware: { - name: "usedSoftware", - type: "Array<any>", - }, - jobParameters: { - name: "jobParameters", - type: "any", - }, - jobLogData: { - name: "jobLogData", - type: "string", - }, - scientificMetadata: { - name: "scientificMetadata", - type: "any", - }, - pid: { - name: "pid", - type: "string", - }, - owner: { - name: "owner", - type: "string", - }, - ownerEmail: { - name: "ownerEmail", - type: "string", - }, - orcidOfOwner: { - name: "orcidOfOwner", - type: "string", - }, - contactEmail: { - name: "contactEmail", - type: "string", - }, - sourceFolder: { - name: "sourceFolder", - type: "string", - }, - sourceFolderHost: { - name: "sourceFolderHost", - type: "string", - }, - size: { - name: "size", - type: "number", - }, - packedSize: { - name: "packedSize", - type: "number", - }, - numberOfFiles: { - name: "numberOfFiles", - type: "number", - }, - numberOfFilesArchived: { - name: "numberOfFilesArchived", - type: "number", - }, - creationTime: { - name: "creationTime", - type: "Date", - }, - type: { - name: "type", - type: "string", - }, - validationStatus: { - name: "validationStatus", - type: "string", - }, - keywords: { - name: "keywords", - type: "Array<any>", - }, - description: { - name: "description", - type: "string", - }, - datasetName: { - name: "datasetName", - type: "string", - }, - classification: { - name: "classification", - type: "string", - }, - license: { - name: "license", - type: "string", - }, - version: { - name: "version", - type: "string", - }, - isPublished: { - name: "isPublished", - type: "boolean", - }, - sharedWith: { - name: "sharedWith", - type: "Array<any>", - }, - ownerGroup: { - name: "ownerGroup", - type: "string", - }, - accessGroups: { - name: "accessGroups", - type: "Array<any>", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - history: { - name: "history", - type: "Array<any>", - default: [], - }, - datasetlifecycle: { - name: "datasetlifecycle", - type: "any", - }, - publisheddataId: { - name: "publisheddataId", - type: "string", - }, - techniques: { - name: "techniques", - type: "Array<any>", - default: [], - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - instrumentId: { - name: "instrumentId", - type: "string", - }, - }, - relations: { - historyList: { - name: "historyList", - type: "any[]", - model: "", - relationType: "embedsMany", - keyFrom: "history", - keyTo: "id", - }, - datasetLifecycle: { - name: "datasetLifecycle", - type: "any[]", - model: "", - relationType: "embedsOne", - keyFrom: "datasetlifecycle", - keyTo: "id", - }, - publisheddata: { - name: "publisheddata", - type: "PublishedData", - model: "PublishedData", - relationType: "belongsTo", - keyFrom: "publisheddataId", - keyTo: "doi", - }, - techniquesList: { - name: "techniquesList", - type: "any[]", - model: "", - relationType: "embedsMany", - keyFrom: "techniques", - keyTo: "pid", - }, - samples: { - name: "samples", - type: "Sample[]", - model: "Sample", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "derivedDatasetId", - }, - datablocks: { - name: "datablocks", - type: "Datablock[]", - model: "Datablock", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "derivedDatasetId", - }, - origdatablocks: { - name: "origdatablocks", - type: "OrigDatablock[]", - model: "OrigDatablock", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "derivedDatasetId", - }, - attachments: { - name: "attachments", - type: "Attachment[]", - model: "Attachment", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "derivedDatasetId", - }, - instrument: { - name: "instrument", - type: "Instrument", - model: "Instrument", - relationType: "belongsTo", - keyFrom: "instrumentId", - keyTo: "pid", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/FireLoop.ts b/src/app/shared/sdk/models/FireLoop.ts deleted file mode 100644 index 4ffdd88d8..000000000 --- a/src/app/shared/sdk/models/FireLoop.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint-disable */ -import { FireLoopRef } from "./index"; - -export class FireLoop { - private references: any = {}; - - constructor( - private socket: any, - private models: { get: Function }, - ) {} - - public ref(model: any): FireLoopRef { - let name: string = model.getModelName(); - model.models = this.models; - this.references[name] = new FireLoopRef(model, this.socket); - return this.references[name]; - } -} diff --git a/src/app/shared/sdk/models/FireLoopRef.ts b/src/app/shared/sdk/models/FireLoopRef.ts deleted file mode 100644 index ad93b6b96..000000000 --- a/src/app/shared/sdk/models/FireLoopRef.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* eslint-disable */ -import { merge, Observable, Subject, throwError } from "rxjs"; -import { catchError } from "rxjs/operators"; -import { LoopBackFilter, StatFilter } from "./index"; -import { SocketConnection } from "../sockets/socket.connections"; -/** - * @class FireLoopRef - * @author Jonathan Casarrubias - * @license MIT - * @description - * This class allows to create FireLoop References which will be in sync with - * Server. It also allows to create FireLoop Reference Childs, that allows to - * persist data according the generic model relationships. - **/ -export class FireLoopRef { - // Reference ID - private id: number = this.buildId(); - // Model Instance (For child references, empty on root references) - private instance: any; - // Model Childs - private childs: any = {}; - // Disposable Events - private disposable: { [key: string]: any } = {}; - /** - * @method constructor - * @param {any} model The model we want to create a reference - * @param {SocketConnection} socket Socket connection to handle events - * @param {FireLoopRef} parent Parent FireLoop model reference - * @param {string} relationship The defined model relationship - * @description - * The constructor will receive the required parameters and then will register this reference - * into the server, needed to allow multiple references for the same model. - * This ids are referenced into this specific client connection and won't have issues - * with other client ids. - **/ - constructor( - private model: any, - private socket: SocketConnection, - private parent: FireLoopRef = null, - private relationship: string = null, - ) { - this.socket.emit( - `Subscribe.${ - !parent ? model.getModelName() : parent.model.getModelName() - }`, - { id: this.id, scope: model.getModelName(), relationship: relationship }, - ); - return this; - } - /** - * @method dispose - * @return {void} - * @description - * This method is super important to avoid memory leaks in the server. - * This method requires to be called on components destroy - * - * ngOnDestroy() { - * this.someRef.dispose() - * } - **/ - public dispose(): void { - const subscription = this.operation("dispose", {}).subscribe(() => { - Object.keys(this.disposable).forEach((channel: string) => { - this.socket.removeListener(channel, this.disposable[channel]); - this.socket.removeAllListeners(channel); - }); - subscription.unsubscribe(); - }); - } - /** - * @method upsert - * @param {T} data Persisted model instance - * @return {Observable} - * @description - * Operation wrapper for upsert function. - **/ - public upsert(data: T): Observable { - return this.operation("upsert", data); - } - /** - * @method create - * @param {T} data Persisted model instance - * @return {Observable} - * @description - * Operation wrapper for create function. - **/ - public create(data: T): Observable { - return this.operation("create", data); - } - /** - * @method remove - * @param {T} data Persisted model instance - * @return {Observable} - * @description - * Operation wrapper for remove function. - **/ - public remove(data: T): Observable { - return this.operation("remove", data); - } - /** - * @method remote - * @param {string} method Remote method name - * @param {any[]=} params Parameters to be applied into the remote method - * @param {boolean} broadcast Flag to define if the method results should be broadcasted - * @return {Observable} - * @description - * This method calls for any remote method. It is flexible enough to - * allow you call either built-in or custom remote methods. - * - * FireLoop provides this interface to enable calling remote methods - * but also to optionally send any defined accept params that will be - * applied within the server. - **/ - public remote( - method: string, - params?: any[], - broadcast: boolean = false, - ): Observable { - return this.operation("remote", { method, params, broadcast }); - } - /** - * @method onRemote - * @param {string} method Remote method name - * @return {Observable} - * @description - * This method listen for public broadcasted remote method results. If the remote method - * execution is not public only the owner will receive the result data. - **/ - public onRemote(method: string): Observable { - let event: string = "remote"; - if (!this.relationship) { - event = `${this.model.getModelName()}.${event}`; - } else { - event = `${this.parent.model.getModelName()}.${ - this.relationship - }.${event}`; - } - return this.broadcasts(event, {}); - } - /** - * @method on - * @param {string} event Event name - * @param {LoopBackFilter} filter LoopBack query filter - * @return {Observable} - * @description - * Listener for different type of events. Valid events are: - * - change (Triggers on any model change -create, update, remove-) - * - value (Triggers on new entries) - * - child_added (Triggers when a child is added) - * - child_updated (Triggers when a child is updated) - * - child_removed (Triggers when a child is removed) - **/ - public on( - event: string, - filter: LoopBackFilter = { limit: 100, order: "id DESC" }, - ): Observable { - if (event === "remote") { - throw new Error( - 'The "remote" event is not allowed using "on()" method, use "onRemote()" instead', - ); - } - let request: any; - if (!this.relationship) { - event = `${this.model.getModelName()}.${event}`; - request = { filter }; - } else { - event = `${this.parent.model.getModelName()}.${ - this.relationship - }.${event}`; - request = { filter, parent: this.parent.instance }; - } - if (event.match(/(value|change|stats)/)) { - return merge(this.pull(event, request), this.broadcasts(event, request)); - } else { - return this.broadcasts(event, request); - } - } - /** - * @method stats - * @param {LoopBackFilter=} filter LoopBack query filter - * @return {Observable} - * @description - * Listener for real-time statistics, will trigger on every - * statistic modification. - * TIP: You can improve performance by adding memcached to LoopBack models. - **/ - public stats(filter?: StatFilter): Observable { - return this.on("stats", filter); - } - /** - * @method make - * @param {any} instance Persisted model instance reference - * @return {Observable} - * @description - * This method will set a model instance into this a new FireLoop Reference. - * This allows to persiste parentship when creating related instances. - * - * It also allows to have multiple different persisted instance references to same model. - * otherwise if using singleton will replace a previous instance for a new instance, when - * we actually want to have more than 1 instance of same model. - **/ - public make(instance: any): FireLoopRef { - let reference: FireLoopRef = new FireLoopRef(this.model, this.socket); - reference.instance = instance; - return reference; - } - /** - * @method child - * @param {string} relationship A defined model relationship - * @return {FireLoopRef} - * @description - * This method creates child references, which will persist related model - * instances. e.g. Room.messages, where messages belongs to a specific Room. - **/ - public child(relationship: string): FireLoopRef { - // Return singleton instance - if (this.childs[relationship]) { - return this.childs[relationship]; - } - // Try to get relation settings from current model - let settings: any = this.model.getModelDefinition().relations[relationship]; - // Verify the relationship actually exists - if (!settings) { - throw new Error( - `Invalid model relationship ${this.model.getModelName()} <-> ${relationship}, verify your model settings.`, - ); - } - // Verify if the relationship model is public - if (settings.model === "") { - throw new Error( - `Relationship model is private, cam't use ${relationship} unless you set your model as public.`, - ); - } - // Lets get a model reference and add a reference for all of the models - let model: any = this.model.models.get(settings.model); - model.models = this.model.models; - // If everything goes well, we will store a child reference and return it. - this.childs[relationship] = new FireLoopRef( - model, - this.socket, - this, - relationship, - ); - return this.childs[relationship]; - } - /** - * @method pull - * @param {string} event Event name - * @param {any} request Type of request, can be LB-only filter or FL+LB filter - * @return {Observable} - * @description - * This method will pull initial data from server - **/ - private pull(event: string, request: any): Observable { - let sbj: Subject = new Subject(); - let that: FireLoopRef = this; - let nowEvent: any = `${event}.pull.requested.${this.id}`; - this.socket.emit(`${event}.pull.request.${this.id}`, request); - function pullNow(data: any) { - if (that.socket.removeListener) { - that.socket.removeListener(nowEvent, pullNow); - } - sbj.next(data); - } - this.socket.on(nowEvent, pullNow); - return sbj.asObservable(); - } - /** - * @method broadcasts - * @param {string} event Event name - * @param {any} request Type of request, can be LB-only filter or FL+LB filter - * @return {Observable} - * @description - * This will listen for public broadcasts announces and then request - * for data according a specific client request, not shared with other clients. - **/ - private broadcasts(event: string, request: any): Observable { - let sbj: Subject = new Subject(); - let channels: { announce: string; broadcast: string } = { - announce: `${event}.broadcast.announce.${this.id}`, - broadcast: `${event}.broadcast.${this.id}`, - }; - let that = this; - // Announces Handler - this.disposable[channels.announce] = function (res: T) { - that.socket.emit(`${event}.broadcast.request.${that.id}`, request); - }; - // Broadcasts Handler - this.disposable[channels.broadcast] = function (data: any) { - sbj.next(data); - }; - this.socket.on(channels.announce, this.disposable[channels.announce]); - this.socket.on(channels.broadcast, this.disposable[channels.broadcast]); - return sbj.asObservable(); - } - /** - * @method operation - * @param {string} event Event name - * @param {any} data Any type of data sent to the server - * @return {Observable} - * @description - * This internal method will run operations depending on current context - **/ - private operation(event: string, data: any): Observable { - if (!this.relationship) { - event = `${this.model.getModelName()}.${event}.${this.id}`; - } else { - event = `${this.parent.model.getModelName()}.${ - this.relationship - }.${event}.${this.id}`; - } - let subject: Subject = new Subject(); - let config: { data: any; parent: any } = { - data, - parent: this.parent && this.parent.instance ? this.parent.instance : null, - }; - this.socket.emit(event, config); - let resultEvent: string = ""; - if (!this.relationship) { - resultEvent = `${this.model.getModelName()}.value.result.${this.id}`; - } else { - resultEvent = `${this.parent.model.getModelName()}.${ - this.relationship - }.value.result.${this.id}`; - } - this.socket.on(resultEvent, (res: any) => { - if (res.error) { - subject.error(res); - } else { - subject.next(res); - } - }); - if (event.match("dispose")) { - setTimeout(() => subject.next(null)); - } - // This event listener will be wiped within socket.connections - this.socket.sharedObservables.sharedOnDisconnect.subscribe(() => - subject.complete(), - ); - return subject - .asObservable() - .pipe(catchError((error: any) => throwError(() => new Error(error)))); - } - /** - * @method buildId - * @return {number} - * @description - * This internal method build an ID for this reference, this allows to have - * multiple references for the same model or relationships. - **/ - private buildId(): number { - return ( - Date.now() + - Math.floor(Math.random() * 100800) * - Math.floor(Math.random() * 100700) * - Math.floor(Math.random() * 198500) - ); - } -} diff --git a/src/app/shared/sdk/models/Instrument.ts b/src/app/shared/sdk/models/Instrument.ts deleted file mode 100644 index 241ca5871..000000000 --- a/src/app/shared/sdk/models/Instrument.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* eslint-disable */ -import { Dataset } from "../index"; - -declare var Object: any; -export interface InstrumentInterface { - pid?: string; - uniqueName: string; - name: string; - customMetadata?: any; - createdBy?: string; - updatedBy?: string; - createdAt?: Date; - updatedAt?: Date; - datasets?: Dataset[]; -} - -export class Instrument implements InstrumentInterface { - "pid": string; - "uniqueName": string; - "name": string; - "customMetadata": any; - "createdBy": string; - "updatedBy": string; - "createdAt": Date; - "updatedAt": Date; - datasets: Dataset[]; - constructor(data?: InstrumentInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `Instrument`. - */ - public static getModelName() { - return "Instrument"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of Instrument for dynamic purposes. - **/ - public static factory(data: InstrumentInterface): Instrument { - return new Instrument(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "Instrument", - plural: "Instruments", - path: "Instruments", - idName: "pid", - properties: { - pid: { - name: "pid", - type: "string", - }, - name: { - name: "name", - type: "string", - }, - customMetadata: { - name: "customMetadata", - type: "any", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - }, - relations: { - datasets: { - name: "datasets", - type: "Dataset[]", - model: "Dataset", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "instrumentId", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/Job.ts b/src/app/shared/sdk/models/Job.ts deleted file mode 100644 index 52e0e77a8..000000000 --- a/src/app/shared/sdk/models/Job.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* eslint-disable */ - -declare var Object: any; -export interface JobInterface { - id?: string; - emailJobInitiator: string; - type: string; - creationTime?: Date; - executionTime?: Date; - jobParams?: any; - jobStatusMessage?: string; - datasetList?: any; - jobResultObject?: any; - createdBy?: string; - updatedBy?: string; - createdAt?: Date; - updatedAt?: Date; -} - -export class Job implements JobInterface { - "id": string; - "emailJobInitiator": string; - "type": string; - "creationTime": Date; - "executionTime": Date; - "jobParams": any; - "jobStatusMessage": string; - "datasetList": any; - "jobResultObject": any; - "createdBy": string; - "updatedBy": string; - "createdAt": Date; - "updatedAt": Date; - constructor(data?: JobInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `Job`. - */ - public static getModelName() { - return "Job"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of Job for dynamic purposes. - **/ - public static factory(data: JobInterface): Job { - return new Job(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "Job", - plural: "Jobs", - path: "Jobs", - idName: "id", - properties: { - id: { - name: "id", - type: "string", - }, - emailJobInitiator: { - name: "emailJobInitiator", - type: "string", - }, - type: { - name: "type", - type: "string", - default: "retrieve", - }, - creationTime: { - name: "creationTime", - type: "Date", - }, - executionTime: { - name: "executionTime", - type: "Date", - }, - jobParams: { - name: "jobParams", - type: "any", - }, - jobStatusMessage: { - name: "jobStatusMessage", - type: "string", - }, - datasetList: { - name: "datasetList", - type: "any", - }, - jobResultObject: { - name: "jobResultObject", - type: "any", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - }, - relations: {}, - }; - } -} diff --git a/src/app/shared/sdk/models/Logbook.ts b/src/app/shared/sdk/models/Logbook.ts deleted file mode 100644 index a7b09685d..000000000 --- a/src/app/shared/sdk/models/Logbook.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable */ - -declare var Object: any; -export interface LogbookInterface { - name?: string; - roomId?: string; - messages?: Array; -} - -export class Logbook implements LogbookInterface { - "name": string; - "roomId": string; - "messages": Array; - constructor(data?: LogbookInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `Logbook`. - */ - public static getModelName() { - return "Logbook"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of Logbook for dynamic purposes. - **/ - public static factory(data: LogbookInterface): Logbook { - return new Logbook(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "Logbook", - plural: "Logbooks", - path: "Logbooks", - idName: "id", - properties: { - name: { - name: "name", - type: "string", - }, - roomId: { - name: "roomId", - type: "string", - }, - messages: { - name: "messages", - type: "Array<any>", - }, - }, - relations: {}, - }; - } -} diff --git a/src/app/shared/sdk/models/OrigDatablock.ts b/src/app/shared/sdk/models/OrigDatablock.ts deleted file mode 100644 index 55b71f2cc..000000000 --- a/src/app/shared/sdk/models/OrigDatablock.ts +++ /dev/null @@ -1,140 +0,0 @@ -/* eslint-disable */ -import { Dataset } from "../index"; - -declare var Object: any; -export interface OrigDatablockInterface { - id?: string; - size: number; - ownerGroup: string; - accessGroups?: Array; - createdBy?: string; - updatedBy?: string; - datasetId?: string; - dataFileList?: Array; - rawDatasetId?: string; - derivedDatasetId?: string; - createdAt?: Date; - updatedAt?: Date; - dataset?: Dataset; - files?: any[]; -} - -export class OrigDatablock implements OrigDatablockInterface { - "id": string; - "size": number; - "ownerGroup": string; - "accessGroups": Array; - "createdBy": string; - "updatedBy": string; - "datasetId": string; - "dataFileList": Array; - "rawDatasetId": string; - "derivedDatasetId": string; - "createdAt": Date; - "updatedAt": Date; - dataset: Dataset; - files: any[]; - constructor(data?: OrigDatablockInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `OrigDatablock`. - */ - public static getModelName() { - return "OrigDatablock"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of OrigDatablock for dynamic purposes. - **/ - public static factory(data: OrigDatablockInterface): OrigDatablock { - return new OrigDatablock(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "OrigDatablock", - plural: "OrigDatablocks", - path: "OrigDatablocks", - idName: "id", - properties: { - id: { - name: "id", - type: "string", - }, - size: { - name: "size", - type: "number", - }, - ownerGroup: { - name: "ownerGroup", - type: "string", - }, - accessGroups: { - name: "accessGroups", - type: "Array<any>", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - datasetId: { - name: "datasetId", - type: "string", - }, - dataFileList: { - name: "dataFileList", - type: "Array<any>", - default: [], - }, - rawDatasetId: { - name: "rawDatasetId", - type: "string", - }, - derivedDatasetId: { - name: "derivedDatasetId", - type: "string", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - }, - relations: { - dataset: { - name: "dataset", - type: "Dataset", - model: "Dataset", - relationType: "belongsTo", - keyFrom: "datasetId", - keyTo: "pid", - }, - files: { - name: "files", - type: "any[]", - model: "", - relationType: "embedsMany", - keyFrom: "dataFileList", - keyTo: "path", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/Policy.ts b/src/app/shared/sdk/models/Policy.ts deleted file mode 100644 index eb0b3a154..000000000 --- a/src/app/shared/sdk/models/Policy.ts +++ /dev/null @@ -1,147 +0,0 @@ -/* eslint-disable */ - -declare var Object: any; -export interface PolicyInterface { - id?: string; - manager?: Array; - tapeRedundancy?: string; - autoArchive?: boolean; - autoArchiveDelay?: number; - archiveEmailNotification?: boolean; - archiveEmailsToBeNotified?: Array; - retrieveEmailNotification?: boolean; - retrieveEmailsToBeNotified?: Array; - embargoPeriod?: number; - ownerGroup: string; - accessGroups?: Array; - createdBy?: string; - updatedBy?: string; - createdAt?: Date; - updatedAt?: Date; -} - -export class Policy implements PolicyInterface { - "id": string; - "manager": Array; - "tapeRedundancy": string; - "autoArchive": boolean; - "autoArchiveDelay": number; - "archiveEmailNotification": boolean; - "archiveEmailsToBeNotified": Array; - "retrieveEmailNotification": boolean; - "retrieveEmailsToBeNotified": Array; - "embargoPeriod": number; - "ownerGroup": string; - "accessGroups": Array; - "createdBy": string; - "updatedBy": string; - "createdAt": Date; - "updatedAt": Date; - constructor(data?: PolicyInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `Policy`. - */ - public static getModelName() { - return "Policy"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of Policy for dynamic purposes. - **/ - public static factory(data: PolicyInterface): Policy { - return new Policy(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "Policy", - plural: "Policies", - path: "Policies", - idName: "id", - properties: { - id: { - name: "id", - type: "string", - }, - manager: { - name: "manager", - type: "Array<any>", - }, - tapeRedundancy: { - name: "tapeRedundancy", - type: "string", - default: "low", - }, - autoArchive: { - name: "autoArchive", - type: "boolean", - default: true, - }, - autoArchiveDelay: { - name: "autoArchiveDelay", - type: "number", - default: 7, - }, - archiveEmailNotification: { - name: "archiveEmailNotification", - type: "boolean", - default: false, - }, - archiveEmailsToBeNotified: { - name: "archiveEmailsToBeNotified", - type: "Array<any>", - }, - retrieveEmailNotification: { - name: "retrieveEmailNotification", - type: "boolean", - default: false, - }, - retrieveEmailsToBeNotified: { - name: "retrieveEmailsToBeNotified", - type: "Array<any>", - }, - embargoPeriod: { - name: "embargoPeriod", - type: "number", - default: 3, - }, - ownerGroup: { - name: "ownerGroup", - type: "string", - }, - accessGroups: { - name: "accessGroups", - type: "Array<any>", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - }, - relations: {}, - }; - } -} diff --git a/src/app/shared/sdk/models/Proposal.ts b/src/app/shared/sdk/models/Proposal.ts deleted file mode 100644 index cbff6ac9c..000000000 --- a/src/app/shared/sdk/models/Proposal.ts +++ /dev/null @@ -1,176 +0,0 @@ -/* eslint-disable */ -import { Attachment } from "../index"; - -declare var Object: any; -export interface ProposalInterface { - proposalId: string; - pi_email?: string; - pi_firstname?: string; - pi_lastname?: string; - email: string; - firstname?: string; - lastname?: string; - title?: string; - abstract?: string; - startTime?: Date; - endTime?: Date; - ownerGroup: string; - accessGroups?: Array; - createdBy?: string; - updatedBy?: string; - MeasurementPeriodList?: Array; - createdAt?: Date; - updatedAt?: Date; - measurementPeriods?: any[]; - attachments?: Attachment[]; -} - -export class Proposal implements ProposalInterface { - "proposalId": string; - "pi_email": string; - "pi_firstname": string; - "pi_lastname": string; - "email": string; - "firstname": string; - "lastname": string; - "title": string; - "abstract": string; - "startTime": Date; - "endTime": Date; - "ownerGroup": string; - "accessGroups": Array; - "createdBy": string; - "updatedBy": string; - "MeasurementPeriodList": Array; - "createdAt": Date; - "updatedAt": Date; - measurementPeriods: any[]; - attachments: Attachment[]; - constructor(data?: ProposalInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `Proposal`. - */ - public static getModelName() { - return "Proposal"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of Proposal for dynamic purposes. - **/ - public static factory(data: ProposalInterface): Proposal { - return new Proposal(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "Proposal", - plural: "Proposals", - path: "Proposals", - idName: "proposalId", - properties: { - proposalId: { - name: "proposalId", - type: "string", - }, - pi_email: { - name: "pi_email", - type: "string", - }, - pi_firstname: { - name: "pi_firstname", - type: "string", - }, - pi_lastname: { - name: "pi_lastname", - type: "string", - }, - email: { - name: "email", - type: "string", - }, - firstname: { - name: "firstname", - type: "string", - }, - lastname: { - name: "lastname", - type: "string", - }, - title: { - name: "title", - type: "string", - }, - abstract: { - name: "abstract", - type: "string", - }, - startTime: { - name: "startTime", - type: "Date", - }, - endTime: { - name: "endTime", - type: "Date", - }, - ownerGroup: { - name: "ownerGroup", - type: "string", - }, - accessGroups: { - name: "accessGroups", - type: "Array<any>", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - MeasurementPeriodList: { - name: "MeasurementPeriodList", - type: "Array<any>", - default: [], - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - }, - relations: { - measurementPeriods: { - name: "measurementPeriods", - type: "any[]", - model: "", - relationType: "embedsMany", - keyFrom: "MeasurementPeriodList", - keyTo: "id", - }, - attachments: { - name: "attachments", - type: "Attachment[]", - model: "Attachment", - relationType: "hasMany", - keyFrom: "proposalId", - keyTo: "proposalId", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/PublishedData.ts b/src/app/shared/sdk/models/PublishedData.ts deleted file mode 100644 index 82790febb..000000000 --- a/src/app/shared/sdk/models/PublishedData.ts +++ /dev/null @@ -1,201 +0,0 @@ -/* eslint-disable */ -import { Dataset } from "../index"; - -declare var Object: any; -export interface PublishedDataInterface { - doi?: string; - affiliation?: string; - creator: Array; - publisher: string; - publicationYear: number; - title: string; - url?: string; - abstract: string; - dataDescription: string; - resourceType: string; - numberOfFiles?: number; - sizeOfArchive?: number; - pidArray: Array; - authors?: Array; - registeredTime?: Date; - status?: string; - scicatUser?: string; - thumbnail?: string; - relatedPublications?: Array; - downloadLink?: string; - createdBy?: string; - updatedBy?: string; - createdAt?: Date; - updatedAt?: Date; - datasets?: Dataset[]; -} - -export class PublishedData implements PublishedDataInterface { - "doi": string; - "affiliation": string; - "creator": Array; - "publisher": string; - "publicationYear": number; - "title": string; - "url": string; - "abstract": string; - "dataDescription": string; - "resourceType": string; - "numberOfFiles": number; - "sizeOfArchive": number; - "pidArray": Array; - "authors": Array; - "registeredTime": Date; - "status": string; - "scicatUser": string; - "thumbnail": string; - "relatedPublications": Array; - "downloadLink": string; - "createdBy": string; - "updatedBy": string; - "createdAt": Date; - "updatedAt": Date; - datasets: Dataset[]; - constructor(data?: PublishedDataInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `PublishedData`. - */ - public static getModelName() { - return "PublishedData"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of PublishedData for dynamic purposes. - **/ - public static factory(data: PublishedDataInterface): PublishedData { - return new PublishedData(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "PublishedData", - plural: "PublishedData", - path: "PublishedData", - idName: "doi", - properties: { - doi: { - name: "doi", - type: "string", - }, - affiliation: { - name: "affiliation", - type: "string", - }, - creator: { - name: "creator", - type: "Array<any>", - }, - publisher: { - name: "publisher", - type: "string", - }, - publicationYear: { - name: "publicationYear", - type: "number", - }, - title: { - name: "title", - type: "string", - }, - url: { - name: "url", - type: "string", - }, - abstract: { - name: "abstract", - type: "string", - }, - dataDescription: { - name: "dataDescription", - type: "string", - }, - resourceType: { - name: "resourceType", - type: "string", - }, - numberOfFiles: { - name: "numberOfFiles", - type: "number", - }, - sizeOfArchive: { - name: "sizeOfArchive", - type: "number", - }, - pidArray: { - name: "pidArray", - type: "Array<any>", - }, - authors: { - name: "authors", - type: "Array<any>", - }, - registeredTime: { - name: "registeredTime", - type: "Date", - }, - status: { - name: "status", - type: "string", - }, - scicatUser: { - name: "scicatUser", - type: "string", - }, - thumbnail: { - name: "thumbnail", - type: "string", - }, - relatedPublications: { - name: "relatedPublications", - type: "Array<any>", - }, - downloadLink: { - name: "downloadLink", - type: "string", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - }, - relations: { - datasets: { - name: "datasets", - type: "Dataset[]", - model: "Dataset", - relationType: "hasMany", - keyFrom: "doi", - keyTo: "publishedDataId", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/RawDataset.ts b/src/app/shared/sdk/models/RawDataset.ts deleted file mode 100644 index 53b66ceaf..000000000 --- a/src/app/shared/sdk/models/RawDataset.ts +++ /dev/null @@ -1,407 +0,0 @@ -/* eslint-disable */ -import { - PublishedData, - Sample, - Proposal, - Datablock, - OrigDatablock, - Attachment, - Instrument, -} from "../index"; - -declare var Object: any; -export interface RawDatasetInterface { - principalInvestigator: string; - endTime?: Date; - creationLocation: string; - dataFormat?: string; - scientificMetadata?: any; - pid?: string; - owner: string; - ownerEmail?: string; - orcidOfOwner?: string; - contactEmail: string; - sourceFolder: string; - sourceFolderHost?: string; - size?: number; - packedSize?: number; - numberOfFiles?: number; - numberOfFilesArchived?: number; - creationTime: Date; - type: string; - validationStatus?: string; - keywords?: Array; - description?: string; - datasetName?: string; - classification?: string; - license?: string; - version?: string; - isPublished?: boolean; - sharedWith?: Array; - ownerGroup: string; - accessGroups?: Array; - createdBy?: string; - updatedBy?: string; - history?: Array; - datasetlifecycle?: any; - publisheddataId?: string; - techniques?: Array; - createdAt?: Date; - updatedAt?: Date; - sampleId?: string; - proposalId?: string; - instrumentId?: string; - historyList?: any[]; - datasetLifecycle?: any[]; - publisheddata?: PublishedData; - techniquesList?: any[]; - samples?: Sample[]; - sample?: Sample; - proposal?: Proposal; - datablocks?: Datablock[]; - origdatablocks?: OrigDatablock[]; - attachments?: Attachment[]; - instrument?: Instrument; -} - -export class RawDataset implements RawDatasetInterface { - "principalInvestigator": string; - "endTime": Date; - "creationLocation": string; - "dataFormat": string; - "scientificMetadata": any; - "pid": string; - "owner": string; - "ownerEmail": string; - "orcidOfOwner": string; - "contactEmail": string; - "sourceFolder": string; - "sourceFolderHost": string; - "size": number; - "packedSize": number; - "numberOfFiles": number; - "numberOfFilesArchived": number; - "creationTime": Date; - "type": string; - "validationStatus": string; - "keywords": Array; - "description": string; - "datasetName": string; - "classification": string; - "license": string; - "version": string; - "isPublished": boolean; - "sharedWith": Array; - "ownerGroup": string; - "accessGroups": Array; - "createdBy": string; - "updatedBy": string; - "history": Array; - "datasetlifecycle": any; - "publisheddataId": string; - "techniques": Array; - "createdAt": Date; - "updatedAt": Date; - "sampleId": string; - "proposalId": string; - "instrumentId": string; - historyList: any[]; - datasetLifecycle: any[]; - publisheddata: PublishedData; - techniquesList: any[]; - samples: Sample[]; - sample: Sample; - proposal: Proposal; - datablocks: Datablock[]; - origdatablocks: OrigDatablock[]; - attachments: Attachment[]; - instrument: Instrument; - constructor(data?: RawDatasetInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `RawDataset`. - */ - public static getModelName() { - return "RawDataset"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of RawDataset for dynamic purposes. - **/ - public static factory(data: RawDatasetInterface): RawDataset { - return new RawDataset(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "RawDataset", - plural: "RawDatasets", - path: "RawDatasets", - idName: "pid", - properties: { - principalInvestigator: { - name: "principalInvestigator", - type: "string", - }, - endTime: { - name: "endTime", - type: "Date", - }, - creationLocation: { - name: "creationLocation", - type: "string", - }, - dataFormat: { - name: "dataFormat", - type: "string", - }, - scientificMetadata: { - name: "scientificMetadata", - type: "any", - }, - pid: { - name: "pid", - type: "string", - }, - owner: { - name: "owner", - type: "string", - }, - ownerEmail: { - name: "ownerEmail", - type: "string", - }, - orcidOfOwner: { - name: "orcidOfOwner", - type: "string", - }, - contactEmail: { - name: "contactEmail", - type: "string", - }, - sourceFolder: { - name: "sourceFolder", - type: "string", - }, - sourceFolderHost: { - name: "sourceFolderHost", - type: "string", - }, - size: { - name: "size", - type: "number", - }, - packedSize: { - name: "packedSize", - type: "number", - }, - numberOfFiles: { - name: "numberOfFiles", - type: "number", - }, - numberOfFilesArchived: { - name: "numberOfFilesArchived", - type: "number", - }, - creationTime: { - name: "creationTime", - type: "Date", - }, - type: { - name: "type", - type: "string", - }, - validationStatus: { - name: "validationStatus", - type: "string", - }, - keywords: { - name: "keywords", - type: "Array<any>", - }, - description: { - name: "description", - type: "string", - }, - datasetName: { - name: "datasetName", - type: "string", - }, - classification: { - name: "classification", - type: "string", - }, - license: { - name: "license", - type: "string", - }, - version: { - name: "version", - type: "string", - }, - isPublished: { - name: "isPublished", - type: "boolean", - }, - sharedWith: { - name: "sharedWith", - type: "Array<any>", - }, - ownerGroup: { - name: "ownerGroup", - type: "string", - }, - accessGroups: { - name: "accessGroups", - type: "Array<any>", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - history: { - name: "history", - type: "Array<any>", - default: [], - }, - datasetlifecycle: { - name: "datasetlifecycle", - type: "any", - }, - publisheddataId: { - name: "publisheddataId", - type: "string", - }, - techniques: { - name: "techniques", - type: "Array<any>", - default: [], - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - sampleId: { - name: "sampleId", - type: "string", - }, - proposalId: { - name: "proposalId", - type: "string", - }, - instrumentId: { - name: "instrumentId", - type: "string", - }, - }, - relations: { - historyList: { - name: "historyList", - type: "any[]", - model: "", - relationType: "embedsMany", - keyFrom: "history", - keyTo: "id", - }, - datasetLifecycle: { - name: "datasetLifecycle", - type: "any[]", - model: "", - relationType: "embedsOne", - keyFrom: "datasetlifecycle", - keyTo: "id", - }, - publisheddata: { - name: "publisheddata", - type: "PublishedData", - model: "PublishedData", - relationType: "belongsTo", - keyFrom: "publisheddataId", - keyTo: "doi", - }, - techniquesList: { - name: "techniquesList", - type: "any[]", - model: "", - relationType: "embedsMany", - keyFrom: "techniques", - keyTo: "pid", - }, - samples: { - name: "samples", - type: "Sample[]", - model: "Sample", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "rawDatasetId", - }, - sample: { - name: "sample", - type: "Sample", - model: "Sample", - relationType: "belongsTo", - keyFrom: "sampleId", - keyTo: "sampleId", - }, - proposal: { - name: "proposal", - type: "Proposal", - model: "Proposal", - relationType: "belongsTo", - keyFrom: "proposalId", - keyTo: "proposalId", - }, - datablocks: { - name: "datablocks", - type: "Datablock[]", - model: "Datablock", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "rawDatasetId", - }, - origdatablocks: { - name: "origdatablocks", - type: "OrigDatablock[]", - model: "OrigDatablock", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "rawDatasetId", - }, - attachments: { - name: "attachments", - type: "Attachment[]", - model: "Attachment", - relationType: "hasMany", - keyFrom: "pid", - keyTo: "rawDatasetId", - }, - instrument: { - name: "instrument", - type: "Instrument", - model: "Instrument", - relationType: "belongsTo", - keyFrom: "instrumentId", - keyTo: "pid", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/Sample.ts b/src/app/shared/sdk/models/Sample.ts deleted file mode 100644 index 6a6c74d28..000000000 --- a/src/app/shared/sdk/models/Sample.ts +++ /dev/null @@ -1,157 +0,0 @@ -/* eslint-disable */ -import { Dataset, Attachment } from "../index"; - -declare var Object: any; -export interface SampleInterface { - sampleId?: string; - owner?: string; - description?: string; - createdAt?: Date; - sampleCharacteristics?: any; - isPublished?: boolean; - ownerGroup: string; - accessGroups?: Array; - createdBy?: string; - updatedBy?: string; - datasetsId?: string; - datasetId?: string; - rawDatasetId?: string; - derivedDatasetId?: string; - updatedAt?: Date; - datasets?: Dataset; - attachments?: Attachment[]; -} - -export class Sample implements SampleInterface { - "sampleId": string; - "owner": string; - "description": string; - "createdAt": Date; - "sampleCharacteristics": any; - "isPublished": boolean; - "ownerGroup": string; - "accessGroups": Array; - "createdBy": string; - "updatedBy": string; - "datasetsId": string; - "datasetId": string; - "rawDatasetId": string; - "derivedDatasetId": string; - "updatedAt": Date; - datasets: Dataset; - attachments: Attachment[]; - constructor(data?: SampleInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `Sample`. - */ - public static getModelName() { - return "Sample"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of Sample for dynamic purposes. - **/ - public static factory(data: SampleInterface): Sample { - return new Sample(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "Sample", - plural: "Samples", - path: "Samples", - idName: "sampleId", - properties: { - sampleId: { - name: "sampleId", - type: "string", - }, - owner: { - name: "owner", - type: "string", - }, - description: { - name: "description", - type: "string", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - sampleCharacteristics: { - name: "sampleCharacteristics", - type: "any", - }, - isPublished: { - name: "isPublished", - type: "boolean", - }, - ownerGroup: { - name: "ownerGroup", - type: "string", - }, - accessGroups: { - name: "accessGroups", - type: "Array<any>", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - datasetsId: { - name: "datasetsId", - type: "string", - }, - datasetId: { - name: "datasetId", - type: "string", - }, - rawDatasetId: { - name: "rawDatasetId", - type: "string", - }, - derivedDatasetId: { - name: "derivedDatasetId", - type: "string", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - }, - relations: { - datasets: { - name: "datasets", - type: "Dataset", - model: "Dataset", - relationType: "belongsTo", - keyFrom: "datasetsId", - keyTo: "pid", - }, - attachments: { - name: "attachments", - type: "Attachment[]", - model: "Attachment", - relationType: "hasMany", - keyFrom: "sampleId", - keyTo: "sampleId", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/ShareGroup.ts b/src/app/shared/sdk/models/ShareGroup.ts deleted file mode 100644 index 8d65471ed..000000000 --- a/src/app/shared/sdk/models/ShareGroup.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* eslint-disable */ - -declare var Object: any; -export interface ShareGroupInterface { - groupID?: string; - members?: Array; - datasets?: Array; - createdBy?: string; - updatedBy?: string; - id?: any; - createdAt?: Date; - updatedAt?: Date; -} - -export class ShareGroup implements ShareGroupInterface { - "groupID": string; - "members": Array; - "datasets": Array; - "createdBy": string; - "updatedBy": string; - "id": any; - "createdAt": Date; - "updatedAt": Date; - constructor(data?: ShareGroupInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `ShareGroup`. - */ - public static getModelName() { - return "ShareGroup"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of ShareGroup for dynamic purposes. - **/ - public static factory(data: ShareGroupInterface): ShareGroup { - return new ShareGroup(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "ShareGroup", - plural: "ShareGroups", - path: "ShareGroups", - idName: "id", - properties: { - groupID: { - name: "groupID", - type: "string", - }, - members: { - name: "members", - type: "Array<any>", - }, - datasets: { - name: "datasets", - type: "Array<any>", - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - id: { - name: "id", - type: "any", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - }, - relations: {}, - }; - } -} diff --git a/src/app/shared/sdk/models/User.ts b/src/app/shared/sdk/models/User.ts deleted file mode 100644 index 4ab543376..000000000 --- a/src/app/shared/sdk/models/User.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* eslint-disable */ -import { UserSetting, UserIdentity, UserCredential } from "../index"; - -declare var Object: any; -export interface UserInterface { - realm?: string; - username?: string; - email: string; - emailVerified?: boolean; - id?: any; - password?: string; - accessTokens?: any[]; - settings?: UserSetting; - identities?: UserIdentity[]; - credentials?: UserCredential[]; -} - -export class User implements UserInterface { - "realm": string; - "username": string; - "email": string; - "emailVerified": boolean; - "id": any; - "password": string; - "authStrategy"?: string; - accessTokens: any[]; - settings: UserSetting; - identities: UserIdentity[]; - credentials: UserCredential[]; - constructor(data?: UserInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `User`. - */ - public static getModelName() { - return "User"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of User for dynamic purposes. - **/ - public static factory(data: UserInterface): User { - return new User(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "User", - plural: "Users", - path: "Users", - idName: "id", - properties: { - realm: { - name: "realm", - type: "string", - }, - username: { - name: "username", - type: "string", - }, - email: { - name: "email", - type: "string", - }, - emailVerified: { - name: "emailVerified", - type: "boolean", - }, - id: { - name: "id", - type: "any", - }, - password: { - name: "password", - type: "string", - }, - }, - relations: { - accessTokens: { - name: "accessTokens", - type: "any[]", - model: "", - relationType: "hasMany", - keyFrom: "id", - keyTo: "userId", - }, - settings: { - name: "settings", - type: "UserSetting", - model: "UserSetting", - relationType: "hasOne", - keyFrom: "id", - keyTo: "userId", - }, - identities: { - name: "identities", - type: "UserIdentity[]", - model: "UserIdentity", - relationType: "hasMany", - keyFrom: "id", - keyTo: "userId", - }, - credentials: { - name: "credentials", - type: "UserCredential[]", - model: "UserCredential", - relationType: "hasMany", - keyFrom: "id", - keyTo: "userId", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/UserCredential.ts b/src/app/shared/sdk/models/UserCredential.ts deleted file mode 100644 index 6ee853ef3..000000000 --- a/src/app/shared/sdk/models/UserCredential.ts +++ /dev/null @@ -1,111 +0,0 @@ -/* eslint-disable */ -import { User } from "../index"; - -declare var Object: any; -export interface UserCredentialInterface { - provider?: string; - authScheme?: string; - externalId?: string; - profile?: any; - credentials?: any; - created?: Date; - modified?: Date; - id?: any; - userId?: any; - user?: User; -} - -export class UserCredential implements UserCredentialInterface { - "provider": string; - "authScheme": string; - "externalId": string; - "profile": any; - "credentials": any; - "created": Date; - "modified": Date; - "id": any; - "userId": any; - user: User; - constructor(data?: UserCredentialInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `UserCredential`. - */ - public static getModelName() { - return "UserCredential"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of UserCredential for dynamic purposes. - **/ - public static factory(data: UserCredentialInterface): UserCredential { - return new UserCredential(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "UserCredential", - plural: "UserCredentials", - path: "UserCredentials", - idName: "id", - properties: { - provider: { - name: "provider", - type: "string", - }, - authScheme: { - name: "authScheme", - type: "string", - }, - externalId: { - name: "externalId", - type: "string", - }, - profile: { - name: "profile", - type: "any", - }, - credentials: { - name: "credentials", - type: "any", - }, - created: { - name: "created", - type: "Date", - }, - modified: { - name: "modified", - type: "Date", - }, - id: { - name: "id", - type: "any", - }, - userId: { - name: "userId", - type: "any", - }, - }, - relations: { - user: { - name: "user", - type: "User", - model: "User", - relationType: "belongsTo", - keyFrom: "userId", - keyTo: "id", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/UserIdentity.ts b/src/app/shared/sdk/models/UserIdentity.ts deleted file mode 100644 index 037dcec4d..000000000 --- a/src/app/shared/sdk/models/UserIdentity.ts +++ /dev/null @@ -1,111 +0,0 @@ -/* eslint-disable */ -import { User } from "../index"; - -declare var Object: any; -export interface UserIdentityInterface { - provider?: string; - authScheme?: string; - externalId?: string; - profile?: any; - credentials?: any; - created?: Date; - modified?: Date; - id?: any; - userId?: any; - user?: User; -} - -export class UserIdentity implements UserIdentityInterface { - "provider": string; - "authScheme": string; - "externalId": string; - "profile": any; - "credentials": any; - "created": Date; - "modified": Date; - "id": any; - "userId": any; - user: User; - constructor(data?: UserIdentityInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `UserIdentity`. - */ - public static getModelName() { - return "UserIdentity"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of UserIdentity for dynamic purposes. - **/ - public static factory(data: UserIdentityInterface): UserIdentity { - return new UserIdentity(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "UserIdentity", - plural: "UserIdentities", - path: "UserIdentities", - idName: "id", - properties: { - provider: { - name: "provider", - type: "string", - }, - authScheme: { - name: "authScheme", - type: "string", - }, - externalId: { - name: "externalId", - type: "string", - }, - profile: { - name: "profile", - type: "any", - }, - credentials: { - name: "credentials", - type: "any", - }, - created: { - name: "created", - type: "Date", - }, - modified: { - name: "modified", - type: "Date", - }, - id: { - name: "id", - type: "any", - }, - userId: { - name: "userId", - type: "any", - }, - }, - relations: { - user: { - name: "user", - type: "User", - model: "User", - relationType: "belongsTo", - keyFrom: "userId", - keyTo: "id", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/UserSetting.ts b/src/app/shared/sdk/models/UserSetting.ts deleted file mode 100644 index 3f516e82a..000000000 --- a/src/app/shared/sdk/models/UserSetting.ts +++ /dev/null @@ -1,129 +0,0 @@ -/* eslint-disable */ -import { User } from "../index"; -import { - ConditionConfig, - FilterConfig, -} from "../../modules/filters/filters.module"; - -declare var Object: any; -export interface UserSettingInterface { - id?: string; - columns?: Array; - datasetCount?: number; - jobCount?: number; - createdBy?: string; - updatedBy?: string; - userId?: any; - createdAt?: Date; - updatedAt?: Date; - user?: User; - conditions?: Array; - filters?: Array; -} - -export class UserSetting implements UserSettingInterface { - "id": string; - "columns": Array; - "datasetCount": number; - "jobCount": number; - "createdBy": string; - "updatedBy": string; - "userId": any; - "createdAt": Date; - "updatedAt": Date; - "conditions": Array; - "filters": Array; - user: User; - constructor(data?: UserSettingInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `UserSetting`. - */ - public static getModelName() { - return "UserSetting"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of UserSetting for dynamic purposes. - **/ - public static factory(data: UserSettingInterface): UserSetting { - return new UserSetting(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: "UserSetting", - plural: "UserSettings", - path: "UserSettings", - idName: "id", - properties: { - id: { - name: "id", - type: "string", - }, - columns: { - name: "columns", - type: "Array<any>", - }, - datasetCount: { - name: "datasetCount", - type: "number", - default: 25, - }, - jobCount: { - name: "jobCount", - type: "number", - default: 25, - }, - createdBy: { - name: "createdBy", - type: "string", - }, - updatedBy: { - name: "updatedBy", - type: "string", - }, - userId: { - name: "userId", - type: "any", - }, - createdAt: { - name: "createdAt", - type: "Date", - }, - updatedAt: { - name: "updatedAt", - type: "Date", - }, - conditions: { - name: "conditions", - type: "Array<ConditionConfig>", - }, - filters: { - name: "filters", - type: "Array<FilterConfig>", - }, - }, - relations: { - user: { - name: "user", - type: "User", - model: "User", - relationType: "belongsTo", - keyFrom: "userId", - keyTo: "id", - }, - }, - }; - } -} diff --git a/src/app/shared/sdk/models/index.ts b/src/app/shared/sdk/models/index.ts deleted file mode 100644 index 99ae94433..000000000 --- a/src/app/shared/sdk/models/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* eslint-disable */ -export * from "./User"; -export * from "./UserCredential"; -export * from "./UserIdentity"; -export * from "./ApplicationCredential"; -export * from "./Logbook"; -export * from "./PublishedData"; -export * from "./Dataset"; -export * from "./RawDataset"; -export * from "./DerivedDataset"; -export * from "./Sample"; -export * from "./Proposal"; -export * from "./Datablock"; -export * from "./Policy"; -export * from "./OrigDatablock"; -export * from "./Attachment"; -export * from "./Job"; -export * from "./ShareGroup"; -export * from "./UserSetting"; -export * from "./Instrument"; -export * from "./BaseModels"; -export * from "./FireLoopRef"; diff --git a/src/app/shared/sdk/services/core/auth.service.ts b/src/app/shared/sdk/services/core/auth.service.ts deleted file mode 100644 index d09b832fa..000000000 --- a/src/app/shared/sdk/services/core/auth.service.ts +++ /dev/null @@ -1,167 +0,0 @@ -/* eslint-disable */ -declare var Object: any; -import { Injectable, Inject } from "@angular/core"; -import { InternalStorage } from "../../storage/storage.swaps"; -import { SDKToken } from "../../models/BaseModels"; -/** - * @author Jonathan Casarrubias - * @module SocketConnection - * @license MIT - * @description - * This module handle socket connections and return singleton instances for each - * connection, it will use the SDK Socket Driver Available currently supporting - * Angular 2 for web, NativeScript 2 and Angular Universal. - **/ -@Injectable() -export class LoopBackAuth { - /** - * @type {SDKToken} - **/ - private token: SDKToken = new SDKToken(); - /** - * @type {string} - **/ - protected prefix: string = "$LoopBackSDK$"; - /** - * @method constructor - * @param {InternalStorage} storage Internal Storage Driver - * @description - * The constructor will initialize the token loading data from storage - **/ - constructor(@Inject(InternalStorage) protected storage: InternalStorage) { - this.token.id = this.load("id"); - this.token.user = this.load("user"); - this.token.userId = this.load("userId"); - this.token.created = this.load("created"); - this.token.ttl = this.load("ttl"); - this.token.rememberMe = this.load("rememberMe"); - } - /** - * @method setRememberMe - * @param {boolean} value Flag to remember credentials - * @return {void} - * @description - * This method will set a flag in order to remember the current credentials - **/ - public setRememberMe(value: boolean): void { - this.token.rememberMe = value; - } - /** - * @method setUser - * @param {any} user Any type of user model - * @return {void} - * @description - * This method will update the user information and persist it if the - * rememberMe flag is set. - **/ - public setUser(user: any) { - this.token.user = user; - this.save(); - } - /** - * @method setToken - * @param {SDKToken} token SDKToken or casted AccessToken instance - * @return {void} - * @description - * This method will set a flag in order to remember the current credentials - **/ - public setToken(token: SDKToken): void { - this.token = Object.assign({}, this.token, token); - this.save(); - } - /** - * @method getToken - * @return {void} - * @description - * This method will set a flag in order to remember the current credentials. - **/ - public getToken(): SDKToken { - return this.token; - } - /** - * @method getAccessTokenId - * @return {string} - * @description - * This method will return the actual token string, not the object instance. - **/ - public getAccessTokenId(): string { - return this.token.id; - } - /** - * @method getCurrentUserId - * @return {any} - * @description - * This method will return the current user id, it can be number or string. - **/ - public getCurrentUserId(): any { - return this.token.userId; - } - /** - * @method getCurrentUserData - * @return {any} - * @description - * This method will return the current user instance. - **/ - public getCurrentUserData(): any { - return typeof this.token.user === "string" - ? JSON.parse(this.token.user) - : this.token.user; - } - /** - * @method save - * @return {boolean} Whether or not the information was saved - * @description - * This method will save in either local storage or cookies the current credentials. - * But only if rememberMe is enabled. - **/ - public save(): boolean { - let today = new Date(); - let expires = new Date(today.getTime() + this.token.ttl * 1000); - this.persist("id", this.token.id, expires); - this.persist("user", this.token.user, expires); - this.persist("userId", this.token.userId, expires); - this.persist("created", this.token.created, expires); - this.persist("ttl", this.token.ttl, expires); - this.persist("rememberMe", this.token.rememberMe, expires); - return true; - } - /** - * @method load - * @param {string} prop Property name - * @return {any} Any information persisted in storage - * @description - * This method will load either from local storage or cookies the provided property. - **/ - protected load(prop: string): any { - return decodeURIComponent(this.storage.get(`${this.prefix}${prop}`)); - } - /** - * @method clear - * @return {void} - * @description - * This method will clear cookies or the local storage. - **/ - public clear(): void { - Object.keys(this.token).forEach((prop: string) => - this.storage.remove(`${this.prefix}${prop}`), - ); - this.token = new SDKToken(); - } - /** - * @method persist - * @return {void} - * @description - * This method saves values to storage - **/ - protected persist(prop: string, value: any, expires?: Date): void { - try { - this.storage.set( - `${this.prefix}${prop}`, - typeof value === "object" ? JSON.stringify(value) : value, - this.token.rememberMe ? expires : null, - ); - } catch (err) { - console.error("Cannot access local/session storage:", err); - } - } -} diff --git a/src/app/shared/sdk/services/core/base.service.ts b/src/app/shared/sdk/services/core/base.service.ts deleted file mode 100644 index 5011a6ccc..000000000 --- a/src/app/shared/sdk/services/core/base.service.ts +++ /dev/null @@ -1,892 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { - HttpClient, - HttpHeaders, - HttpRequest, - HttpParams, - HttpResponse, - HttpParameterCodec, -} from "@angular/common/http"; -import { NgModule, ModuleWithProviders } from "@angular/core"; -import { ErrorHandler } from "./error.service"; -import { LoopBackAuth } from "./auth.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackFilter, AccessToken } from "../../models/BaseModels"; -import { SDKModels } from "../custom/SDKModels"; -import { Observable, Subject } from "rxjs"; -import { catchError, map, filter } from "rxjs/operators"; -import { SocketConnection } from "../../sockets/socket.connections"; -// Making Sure EventSource Type is available to avoid compilation issues. -declare var EventSource: any; -class CustomQueryEncoderHelper implements HttpParameterCodec { - encodeKey(k: string): string { - return encodeURIComponent(k); - } - - encodeValue(v: string): string { - return encodeURIComponent(v); - } - - decodeKey(k: string): string { - return decodeURIComponent(k); - } - - decodeValue(v: string): string { - return decodeURIComponent(v); - } -} -/** - * @module BaseLoopBackApi - * @author Jonathan Casarrubias <@johncasarrubias> - * @author Nikolay Matiushenkov - * @license MIT - * @description - * Abstract class that will be implemented in every custom service automatically built - * by the sdk builder. - * It provides the core functionallity for every API call, either by HTTP Calls or by - * WebSockets. - **/ -@Injectable() -export abstract class BaseLoopBackApi { - protected path: string; - protected model: any; - - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - this.model = this.models.get(this.getModelName()); - } - /** - * @method request - * @param {string} method Request method (GET, POST, PUT) - * @param {string} url Request url (my-host/my-url/:id) - * @param {any} routeParams Values of url parameters - * @param {any} urlParams Parameters for building url (filter and other) - * @param {any} postBody Request postBody - * @return {Observable} - * @description - * This is a core method, every HTTP Call will be done from here, every API Service will - * extend this class and use this method to get RESTful communication. - **/ - public request( - method: string, - url: string, - routeParams: any = {}, - urlParams: any = {}, - postBody: any = {}, - pubsub: boolean = false, - customHeaders?: Function, - ): Observable { - // Transpile route variables to the actual request Values - Object.keys(routeParams).forEach((key: string) => { - url = url.replace( - new RegExp(":" + key + "(/|$)", "g"), - routeParams[key] + "$1", - ); - }); - if (pubsub) { - if (url.match(/fk/)) { - let arr = url.split("/"); - arr.pop(); - url = arr.join("/"); - } - let event: string = `[${method}]${url}`.replace(/\?/, ""); - let subject: Subject = new Subject(); - this.connection.on(event, (res: any) => subject.next(res)); - return subject.asObservable(); - } else { - let httpParams = new HttpParams({ - encoder: new CustomQueryEncoderHelper(), - }); - // Headers to be sent - let headers: HttpHeaders = new HttpHeaders(); - headers = headers.append("Content-Type", "application/json"); - // Authenticate request - headers = this.authenticate(url, headers); - // Body fix for built in remote methods using "data", "options" or "credentials - // that are the actual body, Custom remote method properties are different and need - // to be wrapped into a body object - let body: any; - let postBodyKeys = - typeof postBody === "object" ? Object.keys(postBody) : []; - if (postBodyKeys.length === 1) { - body = postBody[postBodyKeys.shift()]; - } else { - body = postBody; - } - - let queryString: string = ""; - - // Separate filter object from url params and add to search query - if (urlParams.filter) { - if (LoopBackConfig.isHeadersFilteringSet()) { - headers = headers.append("filter", JSON.stringify(urlParams.filter)); - } else { - queryString = `?filter=${encodeURIComponent( - JSON.stringify(urlParams.filter), - )}`; - } - delete urlParams.filter; - } - - // Separate where object from url params and add to search query - if (urlParams.where) { - if (LoopBackConfig.isHeadersWhereSet()) { - /** - CODE BELOW WILL GENERATE THE FOLLOWING ISSUES: - - https://github.com/mean-expert-official/loopback-sdk-builder/issues/356 - - https://github.com/mean-expert-official/loopback-sdk-builder/issues/328 - **/ - headers = headers.append("where", JSON.stringify(urlParams.where)); - } else { - queryString = `?where=${encodeURIComponent( - JSON.stringify(urlParams.where), - )}`; - } - delete urlParams.where; - } - - if (typeof customHeaders === "function") { - headers = customHeaders(headers); - } - /* enhancement/configure-where-headers - this.searchParams.setJSON(urlParams); - let request: Request = new Request( - new RequestOptions({ - headers : headers, - method : method, - url : `${url}${queryString}`, - search : Object.keys(urlParams).length > 0 ? this.searchParams.getURLSearchParams() : null, - body : body ? JSON.stringify(body) : undefined, - withCredentials: LoopBackConfig.getRequestOptionsCredentials() - }) - ); -TODO Fix Merge Conflict */ - Object.keys(urlParams).forEach((paramKey) => { - let paramValue = urlParams[paramKey]; - paramValue = - typeof paramValue === "object" - ? JSON.stringify(paramValue) - : paramValue; - httpParams = httpParams.append(paramKey, paramValue); - }); - let request = new HttpRequest(method, `${url}${queryString}`, body, { - headers: headers, - params: httpParams, - withCredentials: LoopBackConfig.getRequestOptionsCredentials(), - }); - return this.http.request(request).pipe( - filter((event) => event instanceof HttpResponse), - map((res: HttpResponse) => res.body), - catchError((e) => this.errorHandler.handleError(e)), - ); - } - } - /** - * @method authenticate - * @author Jonathan Casarrubias - * @license MIT - * @param {string} url Server URL - * @param {Headers} headers HTTP Headers - * @return {void} - * @description - * This method will try to authenticate using either an access_token or basic http auth - */ - public authenticate(url: string, headers: HttpHeaders): HttpHeaders { - if (this.auth.getAccessTokenId()) { - headers = headers.append( - "Authorization", - LoopBackConfig.getAuthPrefix() + this.auth.getAccessTokenId(), - ); - } - - return headers; - } - /** - * @method create - * @author Jonathan Casarrubias - * @license MIT - * @param {T} data Generic data type - * @return {Observable} - * @description - * Generic create method - */ - public create(data: T, customHeaders?: Function): Observable { - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ].join("/"), - undefined, - undefined, - { data }, - null, - customHeaders, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method onCreate - * @author Jonathan Casarrubias - * @license MIT - * @param {T[]} data Generic data type array - * @return {Observable} - * @description - * Generic pubsub oncreate many method - */ - public onCreate(data: T[]): Observable { - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ].join("/"), - undefined, - undefined, - { data }, - true, - ).pipe( - map((datum: T[]) => datum.map((data: T) => this.model.factory(data))), - ); - } - /** - * @method createMany - * @author Jonathan Casarrubias - * @license MIT - * @param {T[]} data Generic data type array - * @return {Observable} - * @description - * Generic create many method - */ - public createMany(data: T[], customHeaders?: Function): Observable { - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ].join("/"), - undefined, - undefined, - { data }, - null, - customHeaders, - ).pipe( - map((datum: T[]) => datum.map((data: T) => this.model.factory(data))), - ); - } - /** - * @method onCreateMany - * @author Jonathan Casarrubias - * @license MIT - * @param {T[]} data Generic data type array - * @return {Observable} - * @description - * Generic create many method - */ - public onCreateMany(data: T[]): Observable { - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ].join("/"), - undefined, - undefined, - { data }, - true, - ).pipe( - map((datum: T[]) => datum.map((data: T) => this.model.factory(data))), - ); - } - /** - * @method findById - * @author Jonathan Casarrubias - * @license MIT - * @param {any} data Generic data type - * @return {Observable} - * @description - * Generic findById method - */ - public findById( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _urlParams: any = {}; - if (filter) _urlParams.filter = filter; - return this.request( - "GET", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ":id", - ].join("/"), - { id }, - _urlParams, - undefined, - null, - customHeaders, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method find - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic find method - */ - public find( - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - return this.request( - "GET", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ].join("/"), - undefined, - { filter }, - undefined, - null, - customHeaders, - ).pipe( - map((datum: T[]) => datum.map((data: T) => this.model.factory(data))), - ); - } - /** - * @method exists - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic exists method - */ - public exists(id: any, customHeaders?: Function): Observable { - return this.request( - "GET", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ":id/exists", - ].join("/"), - { id }, - undefined, - undefined, - null, - customHeaders, - ); - } - /** - * @method findOne - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic findOne method - */ - public findOne( - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - return this.request( - "GET", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - "findOne", - ].join("/"), - undefined, - { filter }, - undefined, - null, - customHeaders, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method updateAll - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic updateAll method - */ - public updateAll( - where: any = {}, - data: T, - customHeaders?: Function, - ): Observable<{ count: "number" }> { - let _urlParams: any = {}; - if (where) _urlParams.where = where; - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - "update", - ].join("/"), - undefined, - _urlParams, - { data }, - null, - customHeaders, - ); - } - /** - * @method onUpdateAll - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic pubsub onUpdateAll method - */ - public onUpdateAll( - where: any = {}, - data: T, - ): Observable<{ count: "number" }> { - let _urlParams: any = {}; - if (where) _urlParams.where = where; - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - "update", - ].join("/"), - undefined, - _urlParams, - { data }, - true, - ); - } - /** - * @method deleteById - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic deleteById method - */ - public deleteById(id: any, customHeaders?: Function): Observable { - return this.request( - "DELETE", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ":id", - ].join("/"), - { id }, - undefined, - undefined, - null, - customHeaders, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method onDeleteById - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic pubsub onDeleteById method - */ - public onDeleteById(id: any): Observable { - return this.request( - "DELETE", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ":id", - ].join("/"), - { id }, - undefined, - undefined, - true, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method count - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable<{ count: number }>} - * @description - * Generic count method - */ - public count( - where: any = {}, - customHeaders?: Function, - ): Observable<{ count: number }> { - let _urlParams: any = {}; - if (where) _urlParams.where = where; - return this.request( - "GET", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - "count", - ].join("/"), - undefined, - _urlParams, - undefined, - null, - customHeaders, - ); - } - /** - * @method updateAttributes - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic updateAttributes method - */ - public updateAttributes( - id: any, - data: T, - customHeaders?: Function, - ): Observable { - return this.request( - "PUT", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ":id", - ].join("/"), - { id }, - undefined, - { data }, - null, - customHeaders, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method onUpdateAttributes - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic onUpdateAttributes method - */ - public onUpdateAttributes(id: any, data: T): Observable { - return this.request( - "PUT", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ":id", - ].join("/"), - { id }, - undefined, - { data }, - true, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method upsert - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic upsert method - */ - public upsert(data: any = {}, customHeaders?: Function): Observable { - return this.request( - "PUT", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ].join("/"), - undefined, - undefined, - { data }, - null, - customHeaders, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method onUpsert - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic pubsub onUpsert method - */ - public onUpsert(data: any = {}): Observable { - return this.request( - "PUT", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ].join("/"), - undefined, - undefined, - { data }, - true, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method upsertPatch - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic upsert method using patch http method - */ - public upsertPatch( - data: any = {}, - customHeaders?: Function, - ): Observable { - return this.request( - "PATCH", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ].join("/"), - undefined, - undefined, - { data }, - null, - customHeaders, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method onUpsertPatch - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic pubsub onUpsertPatch method using patch http method - */ - public onUpsertPatch(data: any = {}): Observable { - return this.request( - "PATCH", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ].join("/"), - undefined, - undefined, - { data }, - true, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method upsertWithWhere - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic upsertWithWhere method - */ - public upsertWithWhere( - where: any = {}, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _urlParams: any = {}; - if (where) _urlParams.where = where; - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - "upsertWithWhere", - ].join("/"), - undefined, - _urlParams, - { data }, - null, - customHeaders, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method onUpsertWithWhere - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic pubsub onUpsertWithWhere method - */ - public onUpsertWithWhere(where: any = {}, data: any = {}): Observable { - let _urlParams: any = {}; - if (where) _urlParams.where = where; - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - "upsertWithWhere", - ].join("/"), - undefined, - _urlParams, - { data }, - true, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method replaceOrCreate - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic replaceOrCreate method - */ - public replaceOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - "replaceOrCreate", - ].join("/"), - undefined, - undefined, - { data }, - null, - customHeaders, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method onReplaceOrCreate - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic onReplaceOrCreate method - */ - public onReplaceOrCreate(data: any = {}): Observable { - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - "replaceOrCreate", - ].join("/"), - undefined, - undefined, - { data }, - true, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method replaceById - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic replaceById method - */ - public replaceById( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ":id", - "replace", - ].join("/"), - { id }, - undefined, - { data }, - null, - customHeaders, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method onReplaceById - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic onReplaceById method - */ - public onReplaceById(id: any, data: any = {}): Observable { - return this.request( - "POST", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - ":id", - "replace", - ].join("/"), - { id }, - undefined, - { data }, - true, - ).pipe(map((data: T) => this.model.factory(data))); - } - /** - * @method createChangeStream - * @author Jonathan Casarrubias - * @license MIT - * @return {Observable} - * @description - * Generic createChangeStream method - */ - public createChangeStream(): Observable { - let subject = new Subject(); - if (typeof EventSource !== "undefined") { - let emit = (msg: any) => subject.next(JSON.parse(msg.data)); - var source = new EventSource( - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - "change-stream", - ].join("/"), - ); - source.addEventListener("data", emit); - source.onerror = emit; - } else { - console.warn("SDK Builder: EventSource is not supported"); - } - return subject.asObservable(); - } - /** - * @method getModelName - * @author Jonathan Casarrubias - * @license MIT - * @return {string} - * @description - * Abstract getModelName method - */ - abstract getModelName(): string; -} diff --git a/src/app/shared/sdk/services/core/error.service.ts b/src/app/shared/sdk/services/core/error.service.ts deleted file mode 100644 index eacd763d3..000000000 --- a/src/app/shared/sdk/services/core/error.service.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable */ -import { Injectable } from "@angular/core"; -import { HttpErrorResponse } from "@angular/common/http"; -import { Observable, throwError } from "rxjs"; -/** - * Default error handler - */ -@Injectable() -export class ErrorHandler { - public handleError(errorResponse: HttpErrorResponse): Observable { - return throwError(errorResponse.error.error || "Server error"); - } -} diff --git a/src/app/shared/sdk/services/core/index.ts b/src/app/shared/sdk/services/core/index.ts deleted file mode 100644 index 0b455c18d..000000000 --- a/src/app/shared/sdk/services/core/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* eslint-disable */ -export * from "./auth.service"; -export * from "./error.service"; -export * from "./base.service"; -export * from "./real.time"; diff --git a/src/app/shared/sdk/services/core/io.service.ts b/src/app/shared/sdk/services/core/io.service.ts deleted file mode 100644 index b4860d8e3..000000000 --- a/src/app/shared/sdk/services/core/io.service.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* eslint-disable */ -import { Observable, Subject } from "rxjs"; - -export class IO { - private socket: any; - private observables: any = {}; - - constructor(socket: any) { - this.socket = socket; - } - - emit(event: string, data: any): void { - this.socket.emit("ME:RT:1://event", { - event: event, - data: data, - }); - } - - on(event: string): Observable { - if (this.observables[event]) { - return this.observables[event]; - } - let subject: Subject = new Subject(); - this.socket.on(event, (res: any) => subject.next(res)); - this.observables[event] = subject.asObservable(); - return this.observables[event]; - } -} diff --git a/src/app/shared/sdk/services/core/real.time.ts b/src/app/shared/sdk/services/core/real.time.ts deleted file mode 100644 index 40260dbeb..000000000 --- a/src/app/shared/sdk/services/core/real.time.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject } from "@angular/core"; -import { IO } from "./io.service"; -import { LoopBackAuth } from "./auth.service"; -import { FireLoop } from "../../models/FireLoop"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { SDKModels } from "../custom/SDKModels"; -import { Observable, Subject, Subscription } from "rxjs"; -import { share } from "rxjs/operators"; -/** - * @author Jonathan Casarrubias - * @module RealTime - * @license MIT - * @description - * This module is a real-time interface for using socket connections, its main purpose - * is to make sure that when there is a valid connection, it will create instances - * of the different real-time functionalities like FireLoop, PubSub and IO. - **/ -@Injectable() -export class RealTime { - public IO: IO; - public FireLoop: FireLoop; - private connecting: boolean = false; - private onReadySubject: Subject = new Subject(); - private sharedOnReady: Observable = this.onReadySubject - .asObservable() - .pipe(share()); - /** - * @method constructor - * @param {SocketConnection} connection WebSocket connection service - * @param {SDKModels} models Model provider service - * @param {LoopBackAuth} auth LoopBack authentication service - * @description - * It will intialize the shared on ready communication channel. - **/ - constructor( - @Inject(SocketConnection) public connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - ) { - this.sharedOnReady.subscribe(); - } - /** - * @method onDisconnect - * @return {Observable} - * @description - * Will trigger when Real-Time Service is disconnected from server. - **/ - onDisconnect(): Observable { - return this.connection.sharedObservables.sharedOnDisconnect; - } - /** - * @method onAuthenticated - * @return {Observable} - * @description - * Will trigger when Real-Time Service is authenticated with the server. - **/ - onAuthenticated(): Observable { - return this.connection.sharedObservables.sharedOnAuthenticated; - } - /** - * @method onUnAuthorized - * @return {Observable} - * @description - * Will trigger when Real-Time Service is not authorized to connect with the server. - **/ - onUnAuthorized(): Observable { - return this.connection.sharedObservables.sharedOnUnAuthorized; - } - /** - * @method onReady - * @return {Observable} - * @description - * Will trigger when Real-Time Service is Ready for broadcasting. - * and will register connection flow events to notify subscribers. - **/ - public onReady(): Observable { - // If there is a valid connection, then we just send back to the EventLoop - // Or next will be executed before the actual subscription. - if (this.connection.isConnected()) { - let to = setTimeout(() => { - this.onReadySubject.next("shared-connection"); - clearTimeout(to); - }); - // Else if there is a current attempt of connection we wait for the prior - // process that started the connection flow. - } else if (this.connecting) { - let ti = setInterval(() => { - if (this.connection.isConnected()) { - this.onReadySubject.next("shared-connection"); - clearInterval(ti); - } - }, 500); - // If there is not valid connection or attempt, then we start the connection flow - // and make sure we notify all the onReady subscribers when done. - // Also it will listen for desconnections so we unsubscribe and avoid both: - // Memory leaks and duplicated triggered events. - } else { - this.connecting = true; - this.connection.connect(this.auth.getToken()); - this.IO = new IO(this.connection); - this.FireLoop = new FireLoop(this.connection, this.models); - // Fire event for those subscribed - let s1: Subscription = - this.connection.sharedObservables.sharedOnConnect.subscribe(() => { - console.log("Real-Time connection has been established"); - this.connecting = false; - this.onReadySubject.next("connected"); - let s2: Subscription = - this.connection.sharedObservables.sharedOnDisconnect.subscribe( - () => { - s1.unsubscribe(); - s2.unsubscribe(); - }, - ); - }); - } - return this.sharedOnReady; - } -} diff --git a/src/app/shared/sdk/services/custom/ApplicationCredential.ts b/src/app/shared/sdk/services/custom/ApplicationCredential.ts deleted file mode 100644 index a455aca45..000000000 --- a/src/app/shared/sdk/services/custom/ApplicationCredential.ts +++ /dev/null @@ -1,128 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { ApplicationCredential } from "../../models/ApplicationCredential"; -import { SocketConnection } from "../../sockets/socket.connections"; - -/** - * Api services for the `ApplicationCredential` model. - */ -@Injectable() -export class ApplicationCredentialApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `ApplicationCredential` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/ApplicationCredentials"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id ApplicationCredential id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `ApplicationCredential` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/ApplicationCredentials/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `ApplicationCredential`. - */ - public getModelName() { - return "ApplicationCredential"; - } -} diff --git a/src/app/shared/sdk/services/custom/Attachment.ts b/src/app/shared/sdk/services/custom/Attachment.ts deleted file mode 100644 index dc8ef74dc..000000000 --- a/src/app/shared/sdk/services/custom/Attachment.ts +++ /dev/null @@ -1,406 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { ErrorHandler } from "../core/error.service"; -import { Observable } from "rxjs"; -import { SocketConnection } from "../../sockets/socket.connections"; - -/** - * Api services for the `Attachment` model. - * - * **Details** - * - * Small less than 16 MB attachments, envisaged for png/jpeg previews - */ -@Injectable() -export class AttachmentApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Fetches belongsTo relation dataset. - * - * @param {any} id Attachment id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Attachment` object.) - * - */ - public getDataset( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Attachments/:id/dataset"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches belongsTo relation sample. - * - * @param {any} id Attachment id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Attachment` object.) - * - */ - public getSample( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Attachments/:id/sample"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches belongsTo relation proposal. - * - * @param {any} id Attachment id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Attachment` object.) - * - */ - public getProposal( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Attachments/:id/proposal"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Attachment` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Attachments"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id Attachment id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Attachment` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Attachments/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Attachment` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Attachments/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Attachment` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Attachments/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Check if data is valid according to a schema - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Attachment` object.) - * - */ - public isValid( - ownableItem: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Attachments/isValid"; - let _routeParams: any = {}; - let _postBody: any = { - ownableItem: ownableItem, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `Attachment`. - */ - public getModelName() { - return "Attachment"; - } -} diff --git a/src/app/shared/sdk/services/custom/Datablock.ts b/src/app/shared/sdk/services/custom/Datablock.ts deleted file mode 100644 index 13d711e73..000000000 --- a/src/app/shared/sdk/services/custom/Datablock.ts +++ /dev/null @@ -1,318 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { Datablock } from "../../models/Datablock"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { Dataset } from "../../models/Dataset"; - -/** - * Api services for the `Datablock` model. - * - * **Details** - * - * When archiving a dataset all files contained in the dataset are listed here together with their checksum information. Several datablocks can be created if the file listing is too long for a single datablock. This partitioning decision is done by the archiving system to allow for chunks of datablocks with managable sizes. E.g a dataset consisting of 10 TB of data could be split into 10 datablocks of about 1 TB each. The upper limit set by the data catalog system itself is given by the fact that documents must be smaller than 16 MB, which typically allows for datasets of about 100000 files. - */ -@Injectable() -export class DatablockApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Fetches belongsTo relation dataset. - * - * @param {any} id Datablock id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Datablock` object.) - * - */ - public getDataset( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datablocks/:id/dataset"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Datablock` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datablocks"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id Datablock id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Datablock` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datablocks/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Datablock` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datablocks/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Datablock` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datablocks/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Check if data is valid according to a schema - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Datablock` object.) - * - */ - public isValid( - ownableItem: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datablocks/isValid"; - let _routeParams: any = {}; - let _postBody: any = { - ownableItem: ownableItem, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `Datablock`. - */ - public getModelName() { - return "Datablock"; - } -} diff --git a/src/app/shared/sdk/services/custom/Dataset.ts b/src/app/shared/sdk/services/custom/Dataset.ts deleted file mode 100644 index d26e78d1e..000000000 --- a/src/app/shared/sdk/services/custom/Dataset.ts +++ /dev/null @@ -1,2989 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { Dataset } from "../../models/Dataset"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { PublishedData } from "../../models/PublishedData"; -import { Sample } from "../../models/Sample"; -import { Datablock } from "../../models/Datablock"; -import { OrigDatablock } from "../../models/OrigDatablock"; -import { Attachment } from "../../models/Attachment"; -import { Instrument } from "../../models/Instrument"; - -/** - * Api services for the `Dataset` model. - * - * **Details** - * - * Stores the meta data information for a given collection of files. It defines a list of mandatory and optional metadata fields to be defined. Datasets have a PID field for unique identification. This is the base 'class' for derived documents like raw datasets or derived datasets. The type field is used to distinguish between the different types of datasets. For each dataset in addition an embedded DatasetLifecycle is created. However the definition of which files belong to a given dataset is defined in an extra OrigDatablock collection. - */ -@Injectable() -export class DatasetApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Find a related item by id for historyList. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for historyList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public findByIdHistoryList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/historyList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for historyList. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for historyList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdHistoryList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/historyList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for historyList. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for historyList - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public updateByIdHistoryList( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/historyList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches hasOne relation datasetLifecycle. - * - * @param {any} id Dataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public getDatasetLifecycle( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datasetLifecycle of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createDatasetLifecycle( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update datasetLifecycle of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public updateDatasetLifecycle( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes datasetLifecycle of this model. - * - * @param {any} id Dataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyDatasetLifecycle( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches belongsTo relation publisheddata. - * - * @param {any} id Dataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public getPublisheddata( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/publisheddata"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for techniquesList. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for techniquesList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public findByIdTechniquesList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/techniquesList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for techniquesList. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for techniquesList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdTechniquesList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/techniquesList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for techniquesList. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for techniquesList - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public updateByIdTechniquesList( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/techniquesList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for samples. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for samples - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public findByIdSamples( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/samples/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for samples. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for samples - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdSamples( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/samples/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for samples. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for samples - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public updateByIdSamples( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/samples/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for datablocks. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for datablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public findByIdDatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for datablocks. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for datablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdDatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for datablocks. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for datablocks - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public updateByIdDatablocks( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for origdatablocks. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for origdatablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public findByIdOrigdatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/origdatablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for origdatablocks. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for origdatablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdOrigdatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/origdatablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for origdatablocks. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for origdatablocks - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public updateByIdOrigdatablocks( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/origdatablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for attachments. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for attachments - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public findByIdAttachments( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for attachments. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for attachments - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdAttachments( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for attachments. - * - * @param {any} id Dataset id - * - * @param {any} fk Foreign key for attachments - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public updateByIdAttachments( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches belongsTo relation instrument. - * - * @param {any} id Dataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public getInstrument( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/instrument"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries historyList of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public getHistoryList( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in historyList of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createHistoryList( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all historyList of this model. - * - * @param {any} id Dataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteHistoryList(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts historyList of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countHistoryList( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/historyList/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries techniquesList of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public getTechniquesList( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in techniquesList of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createTechniquesList( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all techniquesList of this model. - * - * @param {any} id Dataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteTechniquesList( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts techniquesList of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countTechniquesList( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/techniquesList/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries samples of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public getSamples( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in samples of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createSamples( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all samples of this model. - * - * @param {any} id Dataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteSamples(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts samples of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countSamples( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/samples/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries datablocks of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public getDatablocks( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datablocks of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createDatablocks( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all datablocks of this model. - * - * @param {any} id Dataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteDatablocks(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts datablocks of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countDatablocks( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datablocks/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries origdatablocks of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public getOrigdatablocks( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in origdatablocks of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createOrigdatablocks( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all origdatablocks of this model. - * - * @param {any} id Dataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteOrigdatablocks( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts origdatablocks of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countOrigdatablocks( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/origdatablocks/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries attachments of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public getAttachments( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in attachments of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createAttachments( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all attachments of this model. - * - * @param {any} id Dataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteAttachments(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts attachments of Dataset. - * - * @param {any} id Dataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countAttachments( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/attachments/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Check if data is valid according to a schema - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public isValid( - ownableItem: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/isValid"; - let _routeParams: any = {}; - let _postBody: any = { - ownableItem: ownableItem, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Reset archive status by deleting created datablocks of dataset and resetting archiveStatusMessage and archivable flag. - * - * @param {object} data Request data. - * - * - `datasetId` – `{string}` - - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public reset(datasetId: any = {}, customHeaders?: Function): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/resetArchiveStatus"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof datasetId !== "undefined" && datasetId !== null) - _urlParams.datasetId = datasetId; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Sends a post request for Dataset reduction to OpenWhisk - * - * @param {object} data Request data. - * - * - `dataset` – `{Dataset}` - The Dataset to send for reduction - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * The response from the OpenWhisk reduce action - */ - public reduceDataset( - dataset: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/reduce"; - let _routeParams: any = {}; - let _postBody: any = { - dataset: dataset, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * updates a single record by appending data to the specified field - * - * @param {object} data Request data. - * - * - `id` – `{string}` - - * - * - `fieldName` – `{string}` - Name of field to append data to - * - * - `data` – `{any}` - An array of values to append - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public appendToArrayField( - id: any, - fieldName: any, - data: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/appendToArrayField"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fieldName !== "undefined" && fieldName !== null) - _urlParams.fieldName = fieldName; - if (typeof data !== "undefined" && data !== null) _urlParams.data = data; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return array of metadata keys from datasets corresponding to the current filters. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There is also support for a `text` search to look for strings anywhere in the dataset. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public metadataKeys( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/metadataKeys"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * - * (The remote method definition does not provide any description.) - * - * - * @param {string} id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public thumbnail(id: any, customHeaders?: Function): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/thumbnail"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datasetLifecycle of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createManyDatasetLifecycle( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in historyList of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createManyHistoryList( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in techniquesList of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createManyTechniquesList( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in samples of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createManySamples( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datablocks of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createManyDatablocks( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in origdatablocks of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createManyOrigdatablocks( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in attachments of this model. - * - * @param {any} id Dataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public createManyAttachments( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `Dataset`. - */ - public getModelName() { - return "Dataset"; - } -} diff --git a/src/app/shared/sdk/services/custom/DerivedDataset.ts b/src/app/shared/sdk/services/custom/DerivedDataset.ts deleted file mode 100644 index d303b2fe6..000000000 --- a/src/app/shared/sdk/services/custom/DerivedDataset.ts +++ /dev/null @@ -1,2989 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { DerivedDataset } from "../../models/DerivedDataset"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { PublishedData } from "../../models/PublishedData"; -import { Sample } from "../../models/Sample"; -import { Datablock } from "../../models/Datablock"; -import { OrigDatablock } from "../../models/OrigDatablock"; -import { Attachment } from "../../models/Attachment"; -import { Instrument } from "../../models/Instrument"; - -/** - * Api services for the `DerivedDataset` model. - * - * **Details** - * - * Contains the information for datasets which are the result of an analysis step, typically based on raw datasets or other derived datasets as input. Derived datasets are typically added by the researcher pursuing the specific analysis. This schema inherits the fields from the generic Dataset collection and adds specific fields as defined below. - */ -@Injectable() -export class DerivedDatasetApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Find a related item by id for historyList. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for historyList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public findByIdHistoryList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/historyList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for historyList. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for historyList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdHistoryList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/historyList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for historyList. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for historyList - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public updateByIdHistoryList( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/historyList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches hasOne relation datasetLifecycle. - * - * @param {any} id DerivedDataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public getDatasetLifecycle( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datasetLifecycle of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createDatasetLifecycle( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update datasetLifecycle of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public updateDatasetLifecycle( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes datasetLifecycle of this model. - * - * @param {any} id DerivedDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyDatasetLifecycle( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches belongsTo relation publisheddata. - * - * @param {any} id DerivedDataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public getPublisheddata( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/publisheddata"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for techniquesList. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for techniquesList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public findByIdTechniquesList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/techniquesList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for techniquesList. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for techniquesList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdTechniquesList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/techniquesList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for techniquesList. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for techniquesList - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public updateByIdTechniquesList( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/techniquesList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for samples. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for samples - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public findByIdSamples( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/samples/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for samples. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for samples - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdSamples( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/samples/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for samples. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for samples - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public updateByIdSamples( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/samples/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for datablocks. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for datablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public findByIdDatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for datablocks. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for datablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdDatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for datablocks. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for datablocks - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public updateByIdDatablocks( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for origdatablocks. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for origdatablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public findByIdOrigdatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/origdatablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for origdatablocks. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for origdatablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdOrigdatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/origdatablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for origdatablocks. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for origdatablocks - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public updateByIdOrigdatablocks( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/origdatablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for attachments. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for attachments - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public findByIdAttachments( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for attachments. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for attachments - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdAttachments( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for attachments. - * - * @param {any} id DerivedDataset id - * - * @param {any} fk Foreign key for attachments - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public updateByIdAttachments( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches belongsTo relation instrument. - * - * @param {any} id DerivedDataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public getInstrument( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/instrument"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries historyList of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public getHistoryList( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in historyList of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createHistoryList( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all historyList of this model. - * - * @param {any} id DerivedDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteHistoryList(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts historyList of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countHistoryList( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/historyList/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries techniquesList of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public getTechniquesList( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in techniquesList of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createTechniquesList( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all techniquesList of this model. - * - * @param {any} id DerivedDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteTechniquesList( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts techniquesList of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countTechniquesList( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/techniquesList/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries samples of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public getSamples( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in samples of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createSamples( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all samples of this model. - * - * @param {any} id DerivedDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteSamples(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts samples of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countSamples( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/samples/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries datablocks of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public getDatablocks( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datablocks of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createDatablocks( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all datablocks of this model. - * - * @param {any} id DerivedDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteDatablocks(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts datablocks of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countDatablocks( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datablocks/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries origdatablocks of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public getOrigdatablocks( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in origdatablocks of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createOrigdatablocks( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all origdatablocks of this model. - * - * @param {any} id DerivedDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteOrigdatablocks( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts origdatablocks of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countOrigdatablocks( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/origdatablocks/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries attachments of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public getAttachments( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in attachments of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createAttachments( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all attachments of this model. - * - * @param {any} id DerivedDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteAttachments(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts attachments of DerivedDataset. - * - * @param {any} id DerivedDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countAttachments( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/attachments/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Check if data is valid according to a schema - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public isValid( - ownableItem: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/isValid"; - let _routeParams: any = {}; - let _postBody: any = { - ownableItem: ownableItem, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Reset archive status by deleting created datablocks of dataset and resetting archiveStatusMessage and archivable flag. - * - * @param {object} data Request data. - * - * - `datasetId` – `{string}` - - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public reset(datasetId: any = {}, customHeaders?: Function): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/resetArchiveStatus"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof datasetId !== "undefined" && datasetId !== null) - _urlParams.datasetId = datasetId; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Sends a post request for Dataset reduction to OpenWhisk - * - * @param {object} data Request data. - * - * - `dataset` – `{Dataset}` - The Dataset to send for reduction - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * The response from the OpenWhisk reduce action - */ - public reduceDataset( - dataset: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/reduce"; - let _routeParams: any = {}; - let _postBody: any = { - dataset: dataset, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * updates a single record by appending data to the specified field - * - * @param {object} data Request data. - * - * - `id` – `{string}` - - * - * - `fieldName` – `{string}` - Name of field to append data to - * - * - `data` – `{any}` - An array of values to append - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public appendToArrayField( - id: any, - fieldName: any, - data: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/appendToArrayField"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fieldName !== "undefined" && fieldName !== null) - _urlParams.fieldName = fieldName; - if (typeof data !== "undefined" && data !== null) _urlParams.data = data; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return array of metadata keys from datasets corresponding to the current filters. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There is also support for a `text` search to look for strings anywhere in the dataset. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public metadataKeys( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/metadataKeys"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * - * (The remote method definition does not provide any description.) - * - * - * @param {string} id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public thumbnail(id: any, customHeaders?: Function): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/thumbnail"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datasetLifecycle of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createManyDatasetLifecycle( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in historyList of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createManyHistoryList( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in techniquesList of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createManyTechniquesList( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in samples of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createManySamples( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datablocks of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createManyDatablocks( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in origdatablocks of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createManyOrigdatablocks( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in attachments of this model. - * - * @param {any} id DerivedDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public createManyAttachments( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/DerivedDatasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `DerivedDataset`. - */ - public getModelName() { - return "DerivedDataset"; - } -} diff --git a/src/app/shared/sdk/services/custom/Instrument.ts b/src/app/shared/sdk/services/custom/Instrument.ts deleted file mode 100644 index 70eedb99e..000000000 --- a/src/app/shared/sdk/services/custom/Instrument.ts +++ /dev/null @@ -1,590 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { Instrument } from "../../models/Instrument"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { Dataset } from "../../models/Dataset"; - -/** - * Api services for the `Instrument` model. - * - * **Details** - * - * Stores metadata information for an instrument - */ -@Injectable() -export class InstrumentApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Find a related item by id for datasets. - * - * @param {any} id Instrument id - * - * @param {any} fk Foreign key for datasets - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Instrument` object.) - * - */ - public findByIdDatasets( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/:id/datasets/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for datasets. - * - * @param {any} id Instrument id - * - * @param {any} fk Foreign key for datasets - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdDatasets( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/:id/datasets/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for datasets. - * - * @param {any} id Instrument id - * - * @param {any} fk Foreign key for datasets - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Instrument` object.) - * - */ - public updateByIdDatasets( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/:id/datasets/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries datasets of Instrument. - * - * @param {any} id Instrument id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Instrument` object.) - * - */ - public getDatasets( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/:id/datasets"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datasets of this model. - * - * @param {any} id Instrument id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Instrument` object.) - * - */ - public createDatasets( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/:id/datasets"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all datasets of this model. - * - * @param {any} id Instrument id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteDatasets(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/:id/datasets"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts datasets of Instrument. - * - * @param {any} id Instrument id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countDatasets( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/:id/datasets/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Instrument` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id Instrument id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Instrument` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Instrument` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Instrument` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datasets of this model. - * - * @param {any} id Instrument id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Instrument` object.) - * - */ - public createManyDatasets( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Instruments/:id/datasets"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `Instrument`. - */ - public getModelName() { - return "Instrument"; - } -} diff --git a/src/app/shared/sdk/services/custom/Job.ts b/src/app/shared/sdk/services/custom/Job.ts deleted file mode 100644 index f621ea746..000000000 --- a/src/app/shared/sdk/services/custom/Job.ts +++ /dev/null @@ -1,283 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { Job } from "../../models/Job"; -import { SocketConnection } from "../../sockets/socket.connections"; - -/** - * Api services for the `Job` model. - * - * **Details** - * - * This collection keeps information about jobs to be excuted in external systems. In particular it keeps information about the jobs submitted for archiving or retrieving datasets stored inside an archive system. It can also be used to keep track of analysis jobs e.g. for automated analysis workflows. - */ -@Injectable() -export class JobApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Job` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + "/" + LoopBackConfig.getApiVersion() + "/Jobs"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id Job id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Job` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Jobs/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Job` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Jobs/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Job` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Jobs/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Returns for all linked datasets the details as defined in the fields array. Useful to avoid URL size limititations for large dataset queries - * - * @param {string} jobId - * - * @param {object} datasetFields - * - * @param {object} include - * - * @param {object} includeFields - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Job` object.) - * - */ - public datasetDetails( - jobId: any = {}, - datasetFields: any = {}, - include: any = {}, - includeFields: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Jobs/datasetDetails"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof jobId !== "undefined" && jobId !== null) - _urlParams.jobId = jobId; - if (typeof datasetFields !== "undefined" && datasetFields !== null) - _urlParams.datasetFields = datasetFields; - if (typeof include !== "undefined" && include !== null) - _urlParams.include = include; - if (typeof includeFields !== "undefined" && includeFields !== null) - _urlParams.includeFields = includeFields; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `Job`. - */ - public getModelName() { - return "Job"; - } -} diff --git a/src/app/shared/sdk/services/custom/Logbook.ts b/src/app/shared/sdk/services/custom/Logbook.ts deleted file mode 100644 index 942b7b598..000000000 --- a/src/app/shared/sdk/services/custom/Logbook.ts +++ /dev/null @@ -1,168 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { Logbook } from "../../models/Logbook"; -import { SocketConnection } from "../../sockets/socket.connections"; - -/** - * Api services for the `Logbook` model. - */ -@Injectable() -export class LogbookApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Find Logbook model instance by name - * - * @param {string} name Name of the Logbook - * - * @param {string} filters Filter json object, keys: textSearch, showBotMessages, showUserMessages, showImages, skip, limit, sortField - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Logbook model instance - */ - public findByName( - name: any, - filters: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Logbooks/:name"; - let _routeParams: any = { - name: name, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filters !== "undefined" && filters !== null) - _urlParams.filters = filters; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result.pipe(map((instance: Logbook) => new Logbook(instance))); - } - - /** - * Find Logbook model instance associated to the dataset passed - * - * @param {string} pid Dataset pid - * - * @param {string} filters Filter json object, keys: textSearch, showBotMessages, showUserMessages, showImages, skip, limit, sortField - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Logbook model instance - */ - public findDatasetLogbook( - pid: any, - filters: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Datasets/:pid/Logbook"; - let _routeParams: any = { - pid: pid, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filters !== "undefined" && filters !== null) - _urlParams.filters = filters; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result.pipe(map((instance: Logbook) => new Logbook(instance))); - } - - /** - * Send message to a Logbook - * - * @param {string} name Name of the Logbook - * - * @param {object} data Request data. - * - * - `data` – `{object}` - JSON object with the key `message` - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Object containing the event id of the message - */ - public sendMessage( - name: any, - data: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Logbooks/:name/message"; - let _routeParams: any = { - name: name, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `Logbook`. - */ - public getModelName() { - return "Logbook"; - } -} diff --git a/src/app/shared/sdk/services/custom/OrigDatablock.ts b/src/app/shared/sdk/services/custom/OrigDatablock.ts deleted file mode 100644 index a34c5ac35..000000000 --- a/src/app/shared/sdk/services/custom/OrigDatablock.ts +++ /dev/null @@ -1,731 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { OrigDatablock } from "../../models/OrigDatablock"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { Dataset } from "../../models/Dataset"; - -/** - * Api services for the `OrigDatablock` model. - * - * **Details** - * - * Container list all files and their attributes which make up a dataset. Usually Filled at the time the datasets metadata is created in the data catalog. Can be used by subsequent archiving processes to create the archived datasets. - */ -@Injectable() -export class OrigDatablockApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Fetches belongsTo relation dataset. - * - * @param {any} id OrigDatablock id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public getDataset( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/:id/dataset"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for files. - * - * @param {any} id OrigDatablock id - * - * @param {any} fk Foreign key for files - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public findByIdFiles( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/:id/files/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for files. - * - * @param {any} id OrigDatablock id - * - * @param {any} fk Foreign key for files - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdFiles( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/:id/files/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for files. - * - * @param {any} id OrigDatablock id - * - * @param {any} fk Foreign key for files - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public updateByIdFiles( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/:id/files/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries files of OrigDatablock. - * - * @param {any} id OrigDatablock id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public getFiles( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/:id/files"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in files of this model. - * - * @param {any} id OrigDatablock id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public createFiles( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/:id/files"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all files of this model. - * - * @param {any} id OrigDatablock id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteFiles(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/:id/files"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts files of OrigDatablock. - * - * @param {any} id OrigDatablock id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countFiles( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/:id/files/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id OrigDatablock id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Check if data is valid according to a schema - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public isValid( - ownableItem: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/isValid"; - let _routeParams: any = {}; - let _postBody: any = { - ownableItem: ownableItem, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Returns matching file objects in dataFileList grouped by dataset pid - * - * @param {object} fields Define datasetId field to select a dataset and/or the filenameExp field to define a search regexp for file names. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public findFilesByName( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/findFilesByName"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result.pipe( - map((instances: Array) => - instances.map((instance: OrigDatablock) => new OrigDatablock(instance)), - ), - ); - } - - /** - * Creates a new instance in files of this model. - * - * @param {any} id OrigDatablock id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `OrigDatablock` object.) - * - */ - public createManyFiles( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/OrigDatablocks/:id/files"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `OrigDatablock`. - */ - public getModelName() { - return "OrigDatablock"; - } -} diff --git a/src/app/shared/sdk/services/custom/Policy.ts b/src/app/shared/sdk/services/custom/Policy.ts deleted file mode 100644 index 24da55d92..000000000 --- a/src/app/shared/sdk/services/custom/Policy.ts +++ /dev/null @@ -1,318 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { Policy } from "../../models/Policy"; -import { SocketConnection } from "../../sockets/socket.connections"; - -/** - * Api services for the `Policy` model. - * - * **Details** - * - * Definition of policy parameters relevant for the storgae lifecycle management of the datasets - */ -@Injectable() -export class PolicyApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Policy` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Policies"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id Policy id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Policy` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Policies/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Policy` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Policies/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Policy` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Policies/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Check if data is valid according to a schema - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Policy` object.) - * - */ - public isValid( - ownableItem: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Policies/isValid"; - let _routeParams: any = {}; - let _postBody: any = { - ownableItem: ownableItem, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * updates multiple records on the Policy model and uses ownerGroup to identify those records - * - * @param {object} data Request data. - * - * - `ownerGroupList` – `{string}` - Comma-separated string of owner groups to update e.g. "p14159, p24959" - * - * - `data` – `{object}` - - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Policy` object.) - * - */ - public updatewhere( - ownerGroupList: any, - data: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Policies/updatewhere"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof ownerGroupList !== "undefined" && ownerGroupList !== null) - _postBody.ownerGroupList = ownerGroupList; - if (typeof data !== "undefined" && data !== null) _postBody.data = data; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `Policy`. - */ - public getModelName() { - return "Policy"; - } -} diff --git a/src/app/shared/sdk/services/custom/Proposal.ts b/src/app/shared/sdk/services/custom/Proposal.ts deleted file mode 100644 index d95256b94..000000000 --- a/src/app/shared/sdk/services/custom/Proposal.ts +++ /dev/null @@ -1,1109 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { Proposal } from "../../models/Proposal"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { Attachment } from "../../models/Attachment"; - -/** - * Api services for the `Proposal` model. - * - * **Details** - * - * Defines the purpose of an experiment and links an experiment to principal investigator and main proposer - */ -@Injectable() -export class ProposalApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Find a related item by id for measurementPeriods. - * - * @param {any} id Proposal id - * - * @param {any} fk Foreign key for measurementPeriods - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public findByIdMeasurementPeriods( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/measurementPeriods/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for measurementPeriods. - * - * @param {any} id Proposal id - * - * @param {any} fk Foreign key for measurementPeriods - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdMeasurementPeriods( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/measurementPeriods/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for measurementPeriods. - * - * @param {any} id Proposal id - * - * @param {any} fk Foreign key for measurementPeriods - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public updateByIdMeasurementPeriods( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/measurementPeriods/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for attachments. - * - * @param {any} id Proposal id - * - * @param {any} fk Foreign key for attachments - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public findByIdAttachments( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for attachments. - * - * @param {any} id Proposal id - * - * @param {any} fk Foreign key for attachments - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdAttachments( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for attachments. - * - * @param {any} id Proposal id - * - * @param {any} fk Foreign key for attachments - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public updateByIdAttachments( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries measurementPeriods of Proposal. - * - * @param {any} id Proposal id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public getMeasurementPeriods( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/measurementPeriods"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in measurementPeriods of this model. - * - * @param {any} id Proposal id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public createMeasurementPeriods( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/measurementPeriods"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all measurementPeriods of this model. - * - * @param {any} id Proposal id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteMeasurementPeriods( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/measurementPeriods"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts measurementPeriods of Proposal. - * - * @param {any} id Proposal id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countMeasurementPeriods( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/measurementPeriods/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries attachments of Proposal. - * - * @param {any} id Proposal id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public getAttachments( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in attachments of this model. - * - * @param {any} id Proposal id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public createAttachments( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all attachments of this model. - * - * @param {any} id Proposal id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteAttachments(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts attachments of Proposal. - * - * @param {any} id Proposal id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countAttachments( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/attachments/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id Proposal id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Check if data is valid according to a schema - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public isValid( - ownableItem: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/isValid"; - let _routeParams: any = {}; - let _postBody: any = { - ownableItem: ownableItem, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * @method findByIdAccess - * @param {string} id ID of the resource - * @param {Function} [customHeaders] Optional custom headers function - * @return {Observable<{ canAccess: boolean }>} - */ - public findByIdAccess( - id: string, - customHeaders?: Function, - ): Observable<{ canAccess: boolean }> { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/authorization"; - let _routeParams: any = { id }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - /** - * Find proposal that took data at specified instrument and time - * - * @param {string} instrument - * - * @param {date} measureTime - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `findByInstrumentAndDate` – `{Object}` - - */ - public findByInstrumentAndDate( - instrument: any = {}, - measureTime: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/findByInstrumentAndDate"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof instrument !== "undefined" && instrument !== null) - _urlParams.instrument = instrument; - if (typeof measureTime !== "undefined" && measureTime !== null) - _urlParams.measureTime = measureTime; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result.pipe(map((instance: Proposal) => new Proposal(instance))); - } - - /** - * Search text inside proposal - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `searchText` – `{Object}` - - */ - public searchText(customHeaders?: Function): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/searchText"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in measurementPeriods of this model. - * - * @param {any} id Proposal id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public createManyMeasurementPeriods( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/measurementPeriods"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in attachments of this model. - * - * @param {any} id Proposal id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Proposal` object.) - * - */ - public createManyAttachments( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Proposals/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `Proposal`. - */ - public getModelName() { - return "Proposal"; - } -} diff --git a/src/app/shared/sdk/services/custom/PublishedData.ts b/src/app/shared/sdk/services/custom/PublishedData.ts deleted file mode 100644 index b5ebbea84..000000000 --- a/src/app/shared/sdk/services/custom/PublishedData.ts +++ /dev/null @@ -1,712 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable } from "rxjs"; -import { SocketConnection } from "../../sockets/socket.connections"; - -/** - * Api services for the `PublishedData` model. - * - * **Details** - * - * Stores the meta data information for an accessible, published and DOI-identified collection of datasets. It defines a list of mandatory and optional metadata fields to be included. DataCite mandatory fields, a full URL to the landing page and modification times are included. - */ -@Injectable() -export class PublishedDataApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Find a related item by id for datasets. - * - * @param {any} id PublishedData id - * - * @param {any} fk Foreign key for datasets - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `PublishedData` object.) - * - */ - public findByIdDatasets( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id/datasets/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for datasets. - * - * @param {any} id PublishedData id - * - * @param {any} fk Foreign key for datasets - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdDatasets( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id/datasets/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for datasets. - * - * @param {any} id PublishedData id - * - * @param {any} fk Foreign key for datasets - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `PublishedData` object.) - * - */ - public updateByIdDatasets( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id/datasets/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries datasets of PublishedData. - * - * @param {any} id PublishedData id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `PublishedData` object.) - * - */ - public getDatasets( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id/datasets"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datasets of this model. - * - * @param {any} id PublishedData id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `PublishedData` object.) - * - */ - public createDatasets( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id/datasets"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all datasets of this model. - * - * @param {any} id PublishedData id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteDatasets(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id/datasets"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts datasets of PublishedData. - * - * @param {any} id PublishedData id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countDatasets( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id/datasets/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `PublishedData` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id PublishedData id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `PublishedData` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `PublishedData` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `PublishedData` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * - * (The remote method definition does not provide any description.) - * - * - * @param {string} pid - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `PublishedData` object.) - * - */ - public formPopulate(pid: any, customHeaders?: Function): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/formPopulate"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof pid !== "undefined" && pid !== null) _urlParams.pid = pid; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * - * (The remote method definition does not provide any description.) - * - * - * @param {object} data Request data. - * - * - `id` – `{string}` - - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `doi` – `{string}` - - */ - public register(id: any, customHeaders?: Function): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id/register"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * - * (The remote method definition does not provide any description.) - * - * - * @param {object} data Request data. - * - * - `id` – `{string}` - - * - * - `data` – `{object}` - - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `doi` – `{string}` - - */ - public resync(id: any, data: any, customHeaders?: Function): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id/resync"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datasets of this model. - * - * @param {any} id PublishedData id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `PublishedData` object.) - * - */ - public createManyDatasets( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/PublishedData/:id/datasets"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `PublishedData`. - */ - public getModelName() { - return "PublishedData"; - } -} diff --git a/src/app/shared/sdk/services/custom/RawDataset.ts b/src/app/shared/sdk/services/custom/RawDataset.ts deleted file mode 100644 index 1999d852b..000000000 --- a/src/app/shared/sdk/services/custom/RawDataset.ts +++ /dev/null @@ -1,3082 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { RawDataset } from "../../models/RawDataset"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { PublishedData } from "../../models/PublishedData"; -import { Sample } from "../../models/Sample"; -import { Proposal } from "../../models/Proposal"; -import { Datablock } from "../../models/Datablock"; -import { OrigDatablock } from "../../models/OrigDatablock"; -import { Attachment } from "../../models/Attachment"; -import { Instrument } from "../../models/Instrument"; - -/** - * Api services for the `RawDataset` model. - * - * **Details** - * - * Contains the information for datasets which are the result of measurements or of simulations. Often raw datasets are automatically added as part of an automated ingest step as part of the data acquisition chain at an instrument. This schema inherits the fields from the generic Dataset collection and adds specific fields as defined below. - */ -@Injectable() -export class RawDatasetApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Find a related item by id for historyList. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for historyList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public findByIdHistoryList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/historyList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for historyList. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for historyList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdHistoryList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/historyList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for historyList. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for historyList - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public updateByIdHistoryList( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/historyList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches hasOne relation datasetLifecycle. - * - * @param {any} id RawDataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getDatasetLifecycle( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datasetLifecycle of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createDatasetLifecycle( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update datasetLifecycle of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public updateDatasetLifecycle( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes datasetLifecycle of this model. - * - * @param {any} id RawDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyDatasetLifecycle( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches belongsTo relation publisheddata. - * - * @param {any} id RawDataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getPublisheddata( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/publisheddata"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for techniquesList. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for techniquesList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public findByIdTechniquesList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/techniquesList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for techniquesList. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for techniquesList - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdTechniquesList( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/techniquesList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for techniquesList. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for techniquesList - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public updateByIdTechniquesList( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/techniquesList/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for samples. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for samples - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public findByIdSamples( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/samples/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for samples. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for samples - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdSamples( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/samples/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for samples. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for samples - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public updateByIdSamples( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/samples/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches belongsTo relation sample. - * - * @param {any} id RawDataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getSample( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/sample"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches belongsTo relation proposal. - * - * @param {any} id RawDataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getProposal( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/proposal"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for datablocks. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for datablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public findByIdDatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for datablocks. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for datablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdDatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for datablocks. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for datablocks - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public updateByIdDatablocks( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for origdatablocks. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for origdatablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public findByIdOrigdatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/origdatablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for origdatablocks. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for origdatablocks - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdOrigdatablocks( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/origdatablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for origdatablocks. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for origdatablocks - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public updateByIdOrigdatablocks( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/origdatablocks/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for attachments. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for attachments - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public findByIdAttachments( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for attachments. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for attachments - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdAttachments( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for attachments. - * - * @param {any} id RawDataset id - * - * @param {any} fk Foreign key for attachments - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public updateByIdAttachments( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches belongsTo relation instrument. - * - * @param {any} id RawDataset id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getInstrument( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/instrument"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries historyList of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getHistoryList( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in historyList of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createHistoryList( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all historyList of this model. - * - * @param {any} id RawDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteHistoryList(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts historyList of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countHistoryList( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/historyList/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries techniquesList of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getTechniquesList( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in techniquesList of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createTechniquesList( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all techniquesList of this model. - * - * @param {any} id RawDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteTechniquesList( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts techniquesList of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countTechniquesList( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/techniquesList/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries samples of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getSamples( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in samples of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createSamples( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all samples of this model. - * - * @param {any} id RawDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteSamples(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts samples of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countSamples( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/samples/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries datablocks of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getDatablocks( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datablocks of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createDatablocks( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all datablocks of this model. - * - * @param {any} id RawDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteDatablocks(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts datablocks of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countDatablocks( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datablocks/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries origdatablocks of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getOrigdatablocks( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in origdatablocks of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createOrigdatablocks( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all origdatablocks of this model. - * - * @param {any} id RawDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteOrigdatablocks( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts origdatablocks of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countOrigdatablocks( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/origdatablocks/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries attachments of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public getAttachments( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in attachments of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createAttachments( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all attachments of this model. - * - * @param {any} id RawDataset id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteAttachments(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts attachments of RawDataset. - * - * @param {any} id RawDataset id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countAttachments( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/attachments/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Check if data is valid according to a schema - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public isValid( - ownableItem: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/isValid"; - let _routeParams: any = {}; - let _postBody: any = { - ownableItem: ownableItem, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Reset archive status by deleting created datablocks of dataset and resetting archiveStatusMessage and archivable flag. - * - * @param {object} data Request data. - * - * - `datasetId` – `{string}` - - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public reset(datasetId: any = {}, customHeaders?: Function): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/resetArchiveStatus"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof datasetId !== "undefined" && datasetId !== null) - _urlParams.datasetId = datasetId; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Sends a post request for Dataset reduction to OpenWhisk - * - * @param {object} data Request data. - * - * - `dataset` – `{Dataset}` - The Dataset to send for reduction - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * The response from the OpenWhisk reduce action - */ - public reduceDataset( - dataset: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/reduce"; - let _routeParams: any = {}; - let _postBody: any = { - dataset: dataset, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * updates a single record by appending data to the specified field - * - * @param {object} data Request data. - * - * - `id` – `{string}` - - * - * - `fieldName` – `{string}` - Name of field to append data to - * - * - `data` – `{any}` - An array of values to append - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public appendToArrayField( - id: any, - fieldName: any, - data: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/appendToArrayField"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fieldName !== "undefined" && fieldName !== null) - _urlParams.fieldName = fieldName; - if (typeof data !== "undefined" && data !== null) _urlParams.data = data; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return array of metadata keys from datasets corresponding to the current filters. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There is also support for a `text` search to look for strings anywhere in the dataset. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public metadataKeys( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/metadataKeys"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * - * (The remote method definition does not provide any description.) - * - * - * @param {string} id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public thumbnail(id: any, customHeaders?: Function): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/thumbnail"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datasetLifecycle of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createManyDatasetLifecycle( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datasetLifecycle"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in historyList of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createManyHistoryList( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/historyList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in techniquesList of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createManyTechniquesList( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/techniquesList"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in samples of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createManySamples( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/samples"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in datablocks of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createManyDatablocks( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/datablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in origdatablocks of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createManyOrigdatablocks( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/origdatablocks"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in attachments of this model. - * - * @param {any} id RawDataset id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public createManyAttachments( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/RawDatasets/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `RawDataset`. - */ - public getModelName() { - return "RawDataset"; - } -} diff --git a/src/app/shared/sdk/services/custom/SDKModels.ts b/src/app/shared/sdk/services/custom/SDKModels.ts deleted file mode 100644 index aec8f8250..000000000 --- a/src/app/shared/sdk/services/custom/SDKModels.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* eslint-disable */ -import { Injectable } from "@angular/core"; -import { User } from "../../models/User"; -import { UserCredential } from "../../models/UserCredential"; -import { UserIdentity } from "../../models/UserIdentity"; -import { ApplicationCredential } from "../../models/ApplicationCredential"; -import { Logbook } from "../../models/Logbook"; -import { PublishedData } from "../../models/PublishedData"; -import { Dataset } from "../../models/Dataset"; -import { RawDataset } from "../../models/RawDataset"; -import { DerivedDataset } from "../../models/DerivedDataset"; -import { Sample } from "../../models/Sample"; -import { Proposal } from "../../models/Proposal"; -import { Datablock } from "../../models/Datablock"; -import { Policy } from "../../models/Policy"; -import { OrigDatablock } from "../../models/OrigDatablock"; -import { Attachment } from "../../models/Attachment"; -import { Job } from "../../models/Job"; -import { ShareGroup } from "../../models/ShareGroup"; -import { UserSetting } from "../../models/UserSetting"; -import { Instrument } from "../../models/Instrument"; - -export interface Models { - [name: string]: any; -} - -@Injectable() -export class SDKModels { - private models: Models = { - User: User, - UserCredential: UserCredential, - UserIdentity: UserIdentity, - ApplicationCredential: ApplicationCredential, - Logbook: Logbook, - PublishedData: PublishedData, - Dataset: Dataset, - RawDataset: RawDataset, - DerivedDataset: DerivedDataset, - Sample: Sample, - Proposal: Proposal, - Datablock: Datablock, - Policy: Policy, - OrigDatablock: OrigDatablock, - Attachment: Attachment, - Job: Job, - ShareGroup: ShareGroup, - UserSetting: UserSetting, - Instrument: Instrument, - }; - - public get(modelName: string): any { - return this.models[modelName]; - } - - public getAll(): Models { - return this.models; - } - - public getModelNames(): string[] { - return Object.keys(this.models); - } -} diff --git a/src/app/shared/sdk/services/custom/Sample.ts b/src/app/shared/sdk/services/custom/Sample.ts deleted file mode 100644 index ba77b7d5a..000000000 --- a/src/app/shared/sdk/services/custom/Sample.ts +++ /dev/null @@ -1,756 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { Sample } from "../../models/Sample"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { Dataset } from "../../models/Dataset"; -import { Attachment } from "../../models/Attachment"; - -/** - * Api services for the `Sample` model. - * - * **Details** - * - * Models describing the characteristics of the samples to be investigated. Raw datasets should be linked to such sample definitions. - */ -@Injectable() -export class SampleApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Fetches belongsTo relation datasets. - * - * @param {any} id Sample id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public getDatasets( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id/datasets"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for attachments. - * - * @param {any} id Sample id - * - * @param {any} fk Foreign key for attachments - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public findByIdAttachments( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for attachments. - * - * @param {any} id Sample id - * - * @param {any} fk Foreign key for attachments - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdAttachments( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for attachments. - * - * @param {any} id Sample id - * - * @param {any} fk Foreign key for attachments - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public updateByIdAttachments( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id/attachments/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries attachments of Sample. - * - * @param {any} id Sample id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public getAttachments( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in attachments of this model. - * - * @param {any} id Sample id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public createAttachments( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all attachments of this model. - * - * @param {any} id Sample id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteAttachments(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts attachments of Sample. - * - * @param {any} id Sample id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countAttachments( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id/attachments/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id Sample id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Check if data is valid according to a schema - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public isValid( - ownableItem: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/isValid"; - let _routeParams: any = {}; - let _postBody: any = { - ownableItem: ownableItem, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * @method findByIdAccess - * @param {string} id ID of the resource - * @param {Function} [customHeaders] Optional custom headers function - * @return {Observable<{ canAccess: boolean }>} - */ - public findByIdAccess( - id: string, - customHeaders?: Function, - ): Observable<{ canAccess: boolean }> { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id/authorization"; - let _routeParams: any = { id }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Get a list of sample characteristic keys - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There is also support for a `text` search to look for strings anywhere in the sample. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Array of sample characteristic keys - */ - public metadataKeys( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/metadataKeys"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in attachments of this model. - * - * @param {any} id Sample id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Sample` object.) - * - */ - public createManyAttachments( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Samples/:id/attachments"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `Sample`. - */ - public getModelName() { - return "Sample"; - } -} diff --git a/src/app/shared/sdk/services/custom/ShareGroup.ts b/src/app/shared/sdk/services/custom/ShareGroup.ts deleted file mode 100644 index ac5510f76..000000000 --- a/src/app/shared/sdk/services/custom/ShareGroup.ts +++ /dev/null @@ -1,269 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { ShareGroup } from "../../models/ShareGroup"; -import { SocketConnection } from "../../sockets/socket.connections"; - -/** - * Api services for the `ShareGroup` model. - * - * **Details** - * - * Definition of groups to share datasets between scicat users - */ -@Injectable() -export class ShareGroupApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `ShareGroup` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/ShareGroups"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id ShareGroup id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `ShareGroup` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/ShareGroups/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `ShareGroup` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/ShareGroups/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `ShareGroup` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/ShareGroups/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * - * (The remote method definition does not provide any description.) - * - * - * @param {object} data Request data. - * - * - `id` – `{string}` - - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `groups` – `{Object}` - - */ - public getGroups(id: any, customHeaders?: Function): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/ShareGroups/:id/register"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `ShareGroup`. - */ - public getModelName() { - return "ShareGroup"; - } -} diff --git a/src/app/shared/sdk/services/custom/User.ts b/src/app/shared/sdk/services/custom/User.ts deleted file mode 100644 index 6778d4983..000000000 --- a/src/app/shared/sdk/services/custom/User.ts +++ /dev/null @@ -1,2018 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter, SDKToken, AccessToken } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { User } from "../../models/User"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { UserSetting, UserSettingInterface } from "../../models/UserSetting"; -import { UserIdentity } from "../../models/UserIdentity"; -import { UserCredential } from "../../models/UserCredential"; -import { AppConfigService } from "app-config.service"; - -/** - * Api services for the `User` model. - */ -@Injectable() -export class UserApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - private configService: AppConfigService, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Find a related item by id for accessTokens. - * - * @param {any} id User id - * - * @param {any} fk Foreign key for accessTokens - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public findByIdAccessTokens( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/accessTokens/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for accessTokens. - * - * @param {any} id User id - * - * @param {any} fk Foreign key for accessTokens - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdAccessTokens( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/accessTokens/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for accessTokens. - * - * @param {any} id User id - * - * @param {any} fk Foreign key for accessTokens - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public updateByIdAccessTokens( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/accessTokens/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Fetches hasOne relation settings. - * - * @param {any} id User id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public getSettings( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/settings"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in settings of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public createSettings( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/settings"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update settings of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public updateSettings( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/settings"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update settings of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public partialUpdateSettings( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/settings"; - let _routeParams: any = { - id: id, - }; - - let _postBody: any = { - data: data, - }; - - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update settings of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public partialUpdateExternalSettings( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/settings/external"; - let _routeParams: any = { - id: id, - }; - - let _postBody: any = { - data: data, - }; - - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes settings of this model. - * - * @param {any} id User id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroySettings(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/settings"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for identities. - * - * @param {any} id User id - * - * @param {any} fk Foreign key for identities - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public findByIdIdentities( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/identities/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for identities. - * - * @param {any} id User id - * - * @param {any} fk Foreign key for identities - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdIdentities( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/identities/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for identities. - * - * @param {any} id User id - * - * @param {any} fk Foreign key for identities - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public updateByIdIdentities( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/identities/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Find a related item by id for credentials. - * - * @param {any} id User id - * - * @param {any} fk Foreign key for credentials - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public findByIdCredentials( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/credentials/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Delete a related item by id for credentials. - * - * @param {any} id User id - * - * @param {any} fk Foreign key for credentials - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public destroyByIdCredentials( - id: any, - fk: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/credentials/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Update a related item by id for credentials. - * - * @param {any} id User id - * - * @param {any} fk Foreign key for credentials - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public updateByIdCredentials( - id: any, - fk: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PUT"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/credentials/:fk"; - let _routeParams: any = { - id: id, - fk: fk, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries accessTokens of User. - * - * @param {any} id User id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public getAccessTokens( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/accessTokens"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in accessTokens of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public createAccessTokens( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/accessTokens"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all accessTokens of this model. - * - * @param {any} id User id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteAccessTokens( - id: any, - customHeaders?: Function, - ): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/accessTokens"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts accessTokens of User. - * - * @param {any} id User id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countAccessTokens( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/accessTokens/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries identities of User. - * - * @param {any} id User id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public getIdentities( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/identities"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in identities of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public createIdentities( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/identities"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all identities of this model. - * - * @param {any} id User id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteIdentities(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/identities"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts identities of User. - * - * @param {any} id User id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countIdentities( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/identities/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Queries credentials of User. - * - * @param {any} id User id - * - * @param {object} filter - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public getCredentials( - id: any, - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/credentials"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof filter !== "undefined" && filter !== null) - _urlParams.filter = filter; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in credentials of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public createCredentials( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/credentials"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Deletes all credentials of this model. - * - * @param {any} id User id - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public deleteCredentials(id: any, customHeaders?: Function): Observable { - let _method: string = "DELETE"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/credentials"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Counts credentials of User. - * - * @param {any} id User id - * - * @param {object} where Criteria to match model instances - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `count` – `{number}` - - */ - public countCredentials( - id: any, - where: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/credentials/count"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof where !== "undefined" && where !== null) - _urlParams.where = where; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Login a user with username/email and password. - * - * @param {string} include Related objects to include in the response. See the description of return value for more details. - * Default value: `user`. - * - * - `rememberMe` - `boolean` - Whether the authentication credentials - * should be remembered in localStorage across app/browser restarts. - * Default: `true`. - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * The response body contains properties of the AccessToken created on login. - * Depending on the value of `include` parameter, the body may contain additional properties: - * - * - `user` - `U+007BUserU+007D` - Data of the currently logged in user. (`include=user`) - * - * - */ - public login( - credentials: any, - include: any = "user", - rememberMe: boolean = true, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/auth/login"; - let _routeParams: any = {}; - let _postBody: any = { - credentials: credentials, - }; - let _urlParams: any = {}; - if (typeof include !== "undefined" && include !== null) - _urlParams.include = include; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ).pipe( - map((response: any) => { - const accessTokenPrefix = - this.configService.getConfig().accessTokenPrefix; - response.id = accessTokenPrefix + response.id; - response.ttl = parseInt(response.ttl); - response.rememberMe = rememberMe; - this.auth.setToken(response); - return response; - }), - ); - return result; - } - - /** - * Logout a user with access token. - * - * @param {object} data Request data. - * - * This method does not accept any data. Supply an empty object. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public logout(customHeaders?: Function): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/logout"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - _urlParams.access_token = this.auth.getAccessTokenId(); - this.auth.clear(); - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Trigger user's identity verification with configured verifyOptions - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method does not accept any data. Supply an empty object. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public verify(id: any, customHeaders?: Function): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/verify"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Confirm a user registration with identity verification token. - * - * @param {string} uid - * - * @param {string} token - * - * @param {string} redirect - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public confirm( - uid: any, - token: any, - redirect: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/confirm"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof uid !== "undefined" && uid !== null) _urlParams.uid = uid; - if (typeof token !== "undefined" && token !== null) - _urlParams.token = token; - if (typeof redirect !== "undefined" && redirect !== null) - _urlParams.redirect = redirect; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Reset password for a user with email. - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public resetPassword( - options: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/reset"; - let _routeParams: any = {}; - let _postBody: any = { - options: options, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Change a user's password. - * - * @param {object} data Request data. - * - * - `oldPassword` – `{string}` - - * - * - `newPassword` – `{string}` - - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public changePassword( - oldPassword: any, - newPassword: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/change-password"; - let _routeParams: any = {}; - let _postBody: any = { - data: { - oldPassword: oldPassword, - newPassword: newPassword, - }, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Reset user's password via a password-reset token. - * - * @param {object} data Request data. - * - * - `newPassword` – `{string}` - - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * This method returns no data. - */ - public setPassword( - newPassword: any, - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/reset-password"; - let _routeParams: any = {}; - let _postBody: any = { - data: { - newPassword: newPassword, - }, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Returns username, email , group membership etc for the user linked with the provided accessToken. - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public userInfos(customHeaders?: Function): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/userInfos"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * - * (The remote method definition does not provide any description.) - * - * - * @param {object} data Request data. - * - * This method does not accept any data. Supply an empty object. - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * Data properties: - * - * - `jwt` – `{string}` - - */ - public jwt(customHeaders?: Function): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/jwt"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in settings of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public createManySettings( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/settings"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in accessTokens of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public createManyAccessTokens( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/accessTokens"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in identities of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public createManyIdentities( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/identities"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Creates a new instance in credentials of this model. - * - * @param {any} id User id - * - * @param {object} data Request data. - * - * This method expects a subset of model properties as request parameters. - * - * @returns {object[]} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `User` object.) - * - */ - public createManyCredentials( - id: any, - data: any[] = [], - customHeaders?: Function, - ): Observable { - let _method: string = "POST"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/:id/credentials"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - /** - * @ngdoc method - * @name sdk.User#getCurrent - * @methodOf sdk.User - * - * @description - * - * Get data of the currently logged user. Fail with HTTP result 401 - * when there is no user logged in. - * - * @returns object An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - */ - public getCurrent(filter: LoopBackFilter = {}): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users" + - "/:id"; - let id: any = this.auth.getCurrentUserId(); - if (id == null) id = "__anonymous__"; - let _routeParams: any = { id: id }; - let _urlParams: any = {}; - let _postBody: any = {}; - if (filter) _urlParams.filter = filter; - return this.request(_method, _url, _routeParams, _urlParams, _postBody); - } - /** - * Get data of the currently logged user that was returned by the last - * call to {@link sdk.User#login} or - * {@link sdk.User#getCurrent}. Return null when there - * is no user logged in or the data of the current user were not fetched - * yet. - * - * @returns object An Account instance. - */ - public getCachedCurrent() { - return this.auth.getCurrentUserData(); - } - /** - * Get data of the currently logged access tokern that was returned by the last - * call to {@link sdk.User#login} - * - * @returns object An AccessToken instance. - */ - public getCurrentToken(): AccessToken { - return this.auth.getToken(); - } - /** - * @name sdk.User#isAuthenticated - * - * @returns {boolean} True if the current user is authenticated (logged in). - */ - public isAuthenticated() { - return !( - this.getCurrentId() === "" || - this.getCurrentId() == null || - this.getCurrentId() == "null" - ); - } - - /** - * @name sdk.User#getCurrentId - * - * @returns object Id of the currently logged-in user or null. - */ - public getCurrentId() { - return this.auth.getCurrentUserId(); - } - - /** - * The name of the model represented by this $resource, - * i.e. `User`. - */ - public getModelName() { - return "User"; - } - - private defaultSettingsUrl = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/Users/settings/default"; - - getDefaultSettings(): Observable { - return this.http.get(this.defaultSettingsUrl); - } -} diff --git a/src/app/shared/sdk/services/custom/UserCredential.ts b/src/app/shared/sdk/services/custom/UserCredential.ts deleted file mode 100644 index 02a1710cf..000000000 --- a/src/app/shared/sdk/services/custom/UserCredential.ts +++ /dev/null @@ -1,175 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { UserCredential } from "../../models/UserCredential"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { User } from "../../models/User"; - -/** - * Api services for the `UserCredential` model. - */ -@Injectable() -export class UserCredentialApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Fetches belongsTo relation user. - * - * @param {any} id UserCredential id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserCredential` object.) - * - */ - public getUser( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserCredentials/:id/user"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserCredential` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserCredentials"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id UserCredential id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserCredential` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserCredentials/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `UserCredential`. - */ - public getModelName() { - return "UserCredential"; - } -} diff --git a/src/app/shared/sdk/services/custom/UserIdentity.ts b/src/app/shared/sdk/services/custom/UserIdentity.ts deleted file mode 100644 index 4e9533454..000000000 --- a/src/app/shared/sdk/services/custom/UserIdentity.ts +++ /dev/null @@ -1,203 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { UserIdentity } from "../../models/UserIdentity"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { User } from "../../models/User"; - -/** - * Api services for the `UserIdentity` model. - */ -@Injectable() -export class UserIdentityApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Fetches belongsTo relation user. - * - * @param {any} id UserIdentity id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserIdentity` object.) - * - */ - public getUser( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserIdentities/:id/user"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserIdentity` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserIdentities"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id UserIdentity id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserIdentity` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserIdentities/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `UserIdentity`. - */ - public getModelName() { - return "UserIdentity"; - } - - // NOTE: Checks if an email is connected with valid scicat user. - /** - * @method isValidEmail - * @license MIT - * @return {boolean} - * @description - * Created isValidEmail method - */ - public isValidEmail( - filter: LoopBackFilter = {}, - customHeaders?: Function, - ): Observable { - return this.request( - "GET", - [ - LoopBackConfig.getPath(), - LoopBackConfig.getApiVersion(), - this.model.getModelDefinition().path, - "isValidEmail", - ].join("/"), - undefined, - { filter }, - undefined, - null, - customHeaders, - ).pipe(map((data: boolean) => data)); - } -} diff --git a/src/app/shared/sdk/services/custom/UserSetting.ts b/src/app/shared/sdk/services/custom/UserSetting.ts deleted file mode 100644 index 0a3deeb4d..000000000 --- a/src/app/shared/sdk/services/custom/UserSetting.ts +++ /dev/null @@ -1,275 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, Optional } from "@angular/core"; -import { HttpClient, HttpResponse } from "@angular/common/http"; -import { SDKModels } from "./SDKModels"; -import { BaseLoopBackApi } from "../core/base.service"; -import { LoopBackConfig } from "../../lb.config"; -import { LoopBackAuth } from "../core/auth.service"; -import { LoopBackFilter } from "../../models/BaseModels"; -import { ErrorHandler } from "../core/error.service"; -import { Observable, Subject } from "rxjs"; -import { map } from "rxjs/operators"; -import { UserSetting } from "../../models/UserSetting"; -import { SocketConnection } from "../../sockets/socket.connections"; -import { User } from "../../models/User"; - -/** - * Api services for the `UserSetting` model. - * - * **Details** - * - * User settings such as job count and dataset count - */ -@Injectable() -export class UserSettingApi extends BaseLoopBackApi { - constructor( - @Inject(HttpClient) protected http: HttpClient, - @Inject(SocketConnection) protected connection: SocketConnection, - @Inject(SDKModels) protected models: SDKModels, - @Inject(LoopBackAuth) protected auth: LoopBackAuth, - @Optional() @Inject(ErrorHandler) protected errorHandler: ErrorHandler, - ) { - super(http, connection, models, auth, errorHandler); - } - - /** - * Fetches belongsTo relation user. - * - * @param {any} id UserSetting id - * - * @param {boolean} refresh - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserSetting` object.) - * - */ - public getUser( - id: any, - refresh: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserSettings/:id/user"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof refresh !== "undefined" && refresh !== null) - _urlParams.refresh = refresh; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch an existing model instance or insert a new one into the data source. - * - * @param {object} data Request data. - * - * - `data` – `{object}` - Model instance data - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserSetting` object.) - * - */ - public patchOrCreate( - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserSettings"; - let _routeParams: any = {}; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Patch attributes for a model instance and persist it into the data source. - * - * @param {any} id UserSetting id - * - * @param {object} data Request data. - * - * - `data` – `{object}` - An object of model property name/value pairs - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserSetting` object.) - * - */ - public patchAttributes( - id: any, - data: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "PATCH"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserSettings/:id"; - let _routeParams: any = { - id: id, - }; - let _postBody: any = { - data: data, - }; - let _urlParams: any = {}; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return facet counts relevant for the given selected subset of datasets. - * - * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. - * - * @param {any} facets Defines list of field names, for which facet counts should be calculated - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserSetting` object.) - * - */ - public fullfacet( - fields: any = {}, - facets: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserSettings/fullfacet"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof facets !== "undefined" && facets !== null) - _urlParams.facets = facets; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `UserSetting` object.) - * - */ - public fullquery( - fields: any = {}, - limits: any = {}, - customHeaders?: Function, - ): Observable { - let _method: string = "GET"; - let _url: string = - LoopBackConfig.getPath() + - "/" + - LoopBackConfig.getApiVersion() + - "/UserSettings/fullquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== "undefined" && fields !== null) - _urlParams.fields = fields; - if (typeof limits !== "undefined" && limits !== null) - _urlParams.limits = limits; - let result = this.request( - _method, - _url, - _routeParams, - _urlParams, - _postBody, - null, - customHeaders, - ); - return result; - } - - /** - * The name of the model represented by this $resource, - * i.e. `UserSetting`. - */ - public getModelName() { - return "UserSetting"; - } -} diff --git a/src/app/shared/sdk/services/custom/index.ts b/src/app/shared/sdk/services/custom/index.ts deleted file mode 100644 index cb2c10eac..000000000 --- a/src/app/shared/sdk/services/custom/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* eslint-disable */ -export * from "./User"; -export * from "./UserCredential"; -export * from "./UserIdentity"; -export * from "./ApplicationCredential"; -export * from "./Logbook"; -export * from "./PublishedData"; -export * from "./Dataset"; -export * from "./RawDataset"; -export * from "./DerivedDataset"; -export * from "./Sample"; -export * from "./Proposal"; -export * from "./Datablock"; -export * from "./Policy"; -export * from "./OrigDatablock"; -export * from "./Attachment"; -export * from "./Job"; -export * from "./ShareGroup"; -export * from "./UserSetting"; -export * from "./Instrument"; -export * from "./SDKModels"; -export * from "./logger.service"; diff --git a/src/app/shared/sdk/services/custom/logger.service.ts b/src/app/shared/sdk/services/custom/logger.service.ts deleted file mode 100644 index ecb180067..000000000 --- a/src/app/shared/sdk/services/custom/logger.service.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable */ -import { Injectable } from "@angular/core"; -import { LoopBackConfig } from "../../lb.config"; -/** - * @author Jonathan Casarrubias - * @module LoggerService - * @license MIT - * @description - * Console Log wrapper that can be disabled in production mode - **/ -@Injectable() -export class LoggerService { - log(...args: any[]) { - if (LoopBackConfig.debuggable()) console.log.apply(console, args); - } - - info(...args: any[]) { - if (LoopBackConfig.debuggable()) console.info.apply(console, args); - } - - error(...args: any[]) { - if (LoopBackConfig.debuggable()) console.error.apply(console, args); - } - - count(arg: string) { - if (LoopBackConfig.debuggable()) console.count(arg); - } - - group(arg: string) { - if (LoopBackConfig.debuggable()) console.count(arg); - } - - groupEnd() { - if (LoopBackConfig.debuggable()) console.groupEnd(); - } - - profile(arg: string) { - if (LoopBackConfig.debuggable()) console.count(arg); - } - - // profileEnd() { - // if (LoopBackConfig.debuggable()) - // console.profileEnd(); - // } - - time(arg: string) { - if (LoopBackConfig.debuggable()) console.time(arg); - } - - timeEnd(arg: string) { - if (LoopBackConfig.debuggable()) console.timeEnd(arg); - } -} diff --git a/src/app/shared/sdk/services/index.ts b/src/app/shared/sdk/services/index.ts deleted file mode 100644 index 41d25f3f7..000000000 --- a/src/app/shared/sdk/services/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -/* eslint-disable */ -export * from "./core/index"; -export * from "./custom/index"; diff --git a/src/app/shared/sdk/sockets/socket.browser.ts b/src/app/shared/sdk/sockets/socket.browser.ts deleted file mode 100644 index c307c8464..000000000 --- a/src/app/shared/sdk/sockets/socket.browser.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* eslint-disable */ -import { io } from "socket.io-client"; -/** - * @author Jonathan Casarrubias - * @module SocketBrowser - * @license MIT - * @description - * This module handle socket connections for web browsers, it will be DI Swapped - * depending on the platform environment. - * This module will be generated when the -d ng2web flag is set - **/ -export class SocketBrowser { - /** - * @method connect - * @param {string} url URL path to connect with the server. - * @param {any} options Any socket.io v1 =< valid options - * @return {any} Not currently a socket.io-client for web Typings implemented. - * @description - * This method will return a valid socket connection. - **/ - connect(url: string, options: any): any { - return io(url, options); - } -} diff --git a/src/app/shared/sdk/sockets/socket.connections.ts b/src/app/shared/sdk/sockets/socket.connections.ts deleted file mode 100644 index e0644a3cc..000000000 --- a/src/app/shared/sdk/sockets/socket.connections.ts +++ /dev/null @@ -1,218 +0,0 @@ -/* eslint-disable */ -import { Injectable, Inject, NgZone } from "@angular/core"; -import { SocketDriver } from "./socket.driver"; -import { AccessToken } from "../models"; -import { Observable, Subject } from "rxjs"; -import { share } from "rxjs/operators"; -import { LoopBackConfig } from "../lb.config"; -/** - * @author Jonathan Casarrubias - * @module SocketConnection - * @license MIT - * @description - * This module handle socket connections and return singleton instances for each - * connection, it will use the SDK Socket Driver Available currently supporting - * Angular 2 for web, NativeScript 2 and Angular Universal. - **/ -@Injectable() -export class SocketConnection { - private socket: any; - private subjects: { - onConnect: Subject; - onDisconnect: Subject; - onAuthenticated: Subject; - onUnAuthorized: Subject; - } = { - onConnect: new Subject(), - onDisconnect: new Subject(), - onAuthenticated: new Subject(), - onUnAuthorized: new Subject(), - }; - public sharedObservables: { - sharedOnConnect?: Observable; - sharedOnDisconnect?: Observable; - sharedOnAuthenticated?: Observable; - sharedOnUnAuthorized?: Observable; - } = {}; - public authenticated: boolean = false; - /** - * @method constructor - * @param {SocketDriver} driver Socket IO Driver - * @param {NgZone} zone Angular 2 Zone - * @description - * The constructor will set references for the shared hot observables from - * the class subjects. Then it will subscribe each of these observables - * that will create a channel that later will be shared between subscribers. - **/ - constructor( - @Inject(SocketDriver) private driver: SocketDriver, - @Inject(NgZone) private zone: NgZone, - ) { - this.sharedObservables = { - sharedOnConnect: this.subjects.onConnect.asObservable().pipe(share()), - sharedOnDisconnect: this.subjects.onDisconnect - .asObservable() - .pipe(share()), - sharedOnAuthenticated: this.subjects.onAuthenticated - .asObservable() - .pipe(share()), - sharedOnUnAuthorized: this.subjects.onUnAuthorized - .asObservable() - .pipe(share()), - }; - // This is needed to create the first channel, subsequents will share the connection - // We are using Hot Observables to avoid duplicating connection status events. - this.sharedObservables.sharedOnConnect.subscribe(); - this.sharedObservables.sharedOnDisconnect.subscribe(); - this.sharedObservables.sharedOnAuthenticated.subscribe(); - this.sharedObservables.sharedOnUnAuthorized.subscribe(); - } - /** - * @method connect - * @param {AccessToken} token AccesToken instance - * @return {void} - * @description - * This method will create a new socket connection when not previously established. - * If there is a broken connection it will re-connect. - **/ - public connect(token: AccessToken = null): void { - if (!this.socket) { - console.info( - "Creating a new connection with: ", - LoopBackConfig.getPath(), - ); - // Create new socket connection - this.socket = this.driver.connect(LoopBackConfig.getPath(), { - log: false, - secure: LoopBackConfig.isSecureWebSocketsSet(), - forceNew: true, - forceWebsockets: true, - transports: ["websocket"], - }); - // Listen for connection - this.on("connect", () => { - this.subjects.onConnect.next("connected"); - // Authenticate or start heartbeat now - this.emit("authentication", token); - }); - // Listen for authentication - this.on("authenticated", () => { - this.authenticated = true; - this.subjects.onAuthenticated.next("authenticated"); - this.heartbeater(); - }); - // Listen for authentication - this.on("unauthorized", (err: any) => { - this.authenticated = false; - this.subjects.onUnAuthorized.next(err); - }); - // Listen for disconnections - this.on("disconnect", (status: any) => - this.subjects.onDisconnect.next(status), - ); - } else if (this.socket && !this.socket.connected) { - if (typeof this.socket.off === "function") { - this.socket.off(); - } - if (typeof this.socket.destroy === "function") { - this.socket.destroy(); - } - delete this.socket; - this.connect(token); - } - } - /** - * @method isConnected - * @return {boolean} - * @description - * This method will return true or false depending on established connections - **/ - public isConnected(): boolean { - return this.socket && this.socket.connected; - } - /** - * @method on - * @param {string} event Event name - * @param {Function} handler Event listener handler - * @return {void} - * @description - * This method listen for server events from the current WebSocket connection. - * This method is a facade that will wrap the original "on" method and run it - * within the Angular Zone to avoid update issues. - **/ - public on(event: string, handler: Function): void { - this.socket.on(event, (data: any) => this.zone.run(() => handler(data))); - } - /** - * @method emit - * @param {string} event Event name - * @param {any=} data Any type of data - * @return {void} - * @description - * This method will send any type of data to the server according the event set. - **/ - public emit(event: string, data?: any): void { - if (data) { - this.socket.emit(event, data); - } else { - this.socket.emit(event); - } - } - /** - * @method removeListener - * @param {string} event Event name - * @param {Function} handler Event listener handler - * @return {void} - * @description - * This method will wrap the original "on" method and run it within the Angular Zone - * Note: off is being used since the nativescript socket io client does not provide - * removeListener method, but only provides with off which is provided in any platform. - **/ - public removeListener(event: string, handler: Function): void { - if (typeof this.socket.off === "function") { - this.socket.off(event, handler); - } - } - /** - * @method removeAllListeners - * @param {string} event Event name - * @param {Function} handler Event listener handler - * @return {void} - * @description - * This method will wrap the original "on" method and run it within the Angular Zone - * Note: off is being used since the nativescript socket io client does not provide - * removeListener method, but only provides with off which is provided in any platform. - **/ - public removeAllListeners(event: string): void { - if (typeof this.socket.removeAllListeners === "function") { - this.socket.removeAllListeners(event); - } - } - /** - * @method disconnect - * @return {void} - * @description - * This will disconnect the client from the server - **/ - public disconnect(): void { - this.socket.disconnect(); - } - /** - * @method heartbeater - * @return {void} - * @description - * This will keep the connection as active, even when users are not sending - * data, this avoids disconnection because of a connection not being used. - **/ - private heartbeater(): void { - let heartbeater: any = setInterval(() => { - if (this.isConnected()) { - this.socket.emit("lb-ping"); - } else { - this.socket.removeAllListeners("lb-pong"); - clearInterval(heartbeater); - } - }, 15000); - this.socket.on("lb-pong", (data: any) => console.info("Heartbeat: ", data)); - } -} diff --git a/src/app/shared/sdk/sockets/socket.driver.ts b/src/app/shared/sdk/sockets/socket.driver.ts deleted file mode 100644 index fbf241203..000000000 --- a/src/app/shared/sdk/sockets/socket.driver.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -/** - * @module SocketDriver - * @author Jonathan Casarrubias - * @license MIT - * @description - * The SocketDriver class is used for dependency injection swapping. - * It will be provided using factory method from different sources. - **/ -export class SocketDriver { - connect(url: any, options: any) {} -} diff --git a/src/app/shared/sdk/storage/cookie.browser.ts b/src/app/shared/sdk/storage/cookie.browser.ts deleted file mode 100644 index 9df79e7fc..000000000 --- a/src/app/shared/sdk/storage/cookie.browser.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* eslint-disable */ -import { Injectable } from "@angular/core"; -export interface CookieInterface { - [key: string]: any; -} -/** - * @author Jonathan Casarrubias - * @module CookieBrowser - * @license MIT - * @description - * This module handle cookies, it will be provided using DI Swapping according the - * SDK Socket Driver Available currently supporting Angular 2 for web and NativeScript 2. - **/ -@Injectable() -export class CookieBrowser { - /** - * @type {CookieInterface} - **/ - private cookies: CookieInterface = {}; - /** - * @method get - * @param {string} key Cookie key name - * @return {any} - * @description - * The getter will return any type of data persisted in cookies. - **/ - get(key: string): any { - if (!this.cookies[key]) { - let cookie = window.document.cookie - .split("; ") - .filter((item: any) => item.split("=")[0] === key) - .pop(); - if (!cookie) { - return null; - } - - this.cookies[key] = this.parse(cookie.split("=").slice(1).join("=")); - } - - return this.cookies[key]; - } - /** - * @method set - * @param {string} key Cookie key name - * @param {any} value Any value - * @param {Date=} expires The date of expiration (Optional) - * @return {void} - * @description - * The setter will return any type of data persisted in cookies. - **/ - set(key: string, value: any, expires?: Date): void { - this.cookies[key] = value; - let cookie = `${key}=${encodeURI(value)}; path=/${ - expires ? `; expires=${expires.toUTCString()}` : "" - }`; - window.document.cookie = cookie; - } - /** - * @method remove - * @param {string} key Cookie key name - * @return {void} - * @description - * This method will remove a cookie from the client. - **/ - remove(key: string) { - document.cookie = key + "=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;"; - delete this.cookies[key]; - } - /** - * @method parse - * @param {any} value Input data expected to be JSON - * @return {void} - * @description - * This method will parse the string as JSON if possible, otherwise will - * return the value itself. - **/ - private parse(value: any) { - try { - return JSON.parse(decodeURI(value)); - } catch (e) { - return value; - } - } -} diff --git a/src/app/shared/sdk/storage/storage.browser.ts b/src/app/shared/sdk/storage/storage.browser.ts deleted file mode 100644 index e891d22d6..000000000 --- a/src/app/shared/sdk/storage/storage.browser.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable */ -import { Injectable } from "@angular/core"; -/** - * @author Jonathan Casarrubias - * @module StorageBrowser - * @license MIT - * @description - * This module handle localStorage, it will be provided using DI Swapping according the - * SDK Socket Driver Available currently supporting Angular 2 for web and NativeScript 2. - **/ -@Injectable() -export class StorageBrowser { - /** - * @method get - * @param {string} key Storage key name - * @return {any} - * @description - * The getter will return any type of data persisted in localStorage. - **/ - get(key: string): any { - let data: string = localStorage.getItem(key); - return this.parse(data); - } - /** - * @method set - * @param {string} key Storage key name - * @param {any} value Any value - * @return {void} - * @description - * The setter will return any type of data persisted in localStorage. - **/ - set(key: string, value: any, expires?: Date): void { - localStorage.setItem( - key, - typeof value === "object" ? JSON.stringify(value) : value, - ); - } - /** - * @method remove - * @param {string} key Storage key name - * @return {void} - * @description - * This method will remove a localStorage item from the client. - **/ - remove(key: string): void { - if (localStorage[key]) { - localStorage.removeItem(key); - } else { - console.log("Trying to remove unexisting key: ", key); - } - } - /** - * @method parse - * @param {any} value Input data expected to be JSON - * @return {void} - * @description - * This method will parse the string as JSON if possible, otherwise will - * return the value itself. - **/ - private parse(value: any) { - try { - return JSON.parse(value); - } catch (e) { - return value; - } - } -} diff --git a/src/app/shared/sdk/storage/storage.swaps.ts b/src/app/shared/sdk/storage/storage.swaps.ts deleted file mode 100644 index fdd9491ac..000000000 --- a/src/app/shared/sdk/storage/storage.swaps.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable */ -/** - * @module Storage - * @author Jonathan Casarrubias - * @license MIT - * @description - * The InternalStorage class is used for dependency injection swapping. - * It will be provided using factory method from different sources. - **/ -export class BaseStorage { - /** - * @method get - * @param {string} key Storage key name - * @return {any} - * @description - * The getter will return any type of data persisted in storage. - **/ - get(key: string): any {} - /** - * @method set - * @param {string} key Storage key name - * @param {any} value Any value - * @return {void} - * @description - * The setter will return any type of data persisted in localStorage. - **/ - set(key: string, value: any, expires?: Date): void {} - /** - * @method remove - * @param {string} key Storage key name - * @return {void} - * @description - * This method will remove a localStorage item from the client. - **/ - remove(key: string): void {} -} -/** - * @module InternalStorage - * @author Jonathan Casarrubias - * @license MIT - * @description - * The InternalStorage class is used for dependency injection swapping. - * It will be provided using factory method from different sources. - * This is mainly required because Angular Universal integration. - * It does inject a CookieStorage instead of LocalStorage. - **/ -export class InternalStorage extends BaseStorage {} -/** - * @module SDKStorage - * @author Jonathan Casarrubias - * @license MIT - * @description - * The SDKStorage class is used for dependency injection swapping. - * It will be provided using factory method according the right environment. - * This is created for public usage, to allow persisting custom data - * Into the local storage API. - **/ -export class SDKStorage extends BaseStorage {} diff --git a/src/app/shared/services/auth/auth.service.ts b/src/app/shared/services/auth/auth.service.ts new file mode 100644 index 000000000..ea8115782 --- /dev/null +++ b/src/app/shared/services/auth/auth.service.ts @@ -0,0 +1,128 @@ +import { Injectable, Inject } from "@angular/core"; +import { InternalStorage } from "./base.storage"; +import { ReturnedUserDto } from "@scicatproject/scicat-sdk-ts"; + +export interface AccessTokenInterface { + id?: string; + ttl?: number; + scopes?: [string]; + created?: Date; + userId?: string; + user?: ReturnedUserDto; +} + +export class SDKToken implements AccessTokenInterface { + id: string = null; + ttl: number = null; + scopes: [string] = null; + created: Date = null; + userId: string = null; + user: ReturnedUserDto = null; + rememberMe: boolean = null; + constructor(data?: AccessTokenInterface) { + Object.assign(this, data); + } +} + +@Injectable() +export class AuthService { + private token = new SDKToken(); + + protected prefix = ""; + + /** + * NOTE: This was the suggestion from the ai-bot review to simplify the storage and logic here + * (might be worth checking in the future if we want to make some changes in the cookies storage structure and keep them in one encoded object): + * https://github.com/SciCatProject/frontend/pull/1632#discussion_r1824033871 + */ + constructor(@Inject(InternalStorage) protected storage: InternalStorage) { + this.token.id = this.load("id"); + this.token.user = JSON.parse(this.load("user") || null); + this.token.userId = this.load("userId"); + this.token.created = new Date(this.load("created")); + this.token.ttl = parseInt(this.load("ttl")); + this.token.rememberMe = this.load("rememberMe") === "true"; + } + + protected load(prop: string) { + return decodeURIComponent(this.storage.get(`${this.prefix}${prop}`)); + } + + protected persist( + prop: string, + value: string | number | Date | boolean, + expires?: Date, + ): void { + try { + this.storage.set( + `${this.prefix}${prop}`, + typeof value === "object" ? JSON.stringify(value) : value, + this.token.rememberMe ? expires : null, + ); + } catch (err) { + throw new Error( + `Cannot access local/session storage: ${JSON.stringify(err)}`, + ); + } + } + + public clear(): void { + Object.keys(this.token).forEach((prop: string) => + this.storage.delete(`${this.prefix}${prop}`), + ); + this.token = new SDKToken(); + } + + public setRememberMe(value: boolean): void { + this.token.rememberMe = value; + } + + public setUser(user: ReturnedUserDto) { + this.token.user = user; + this.save(); + } + + public setToken(token: SDKToken): void { + this.token = Object.assign({}, this.token, token); + this.save(); + } + + public getToken(): SDKToken { + return this.token; + } + + public getAccessTokenId(): string { + return this.token.id; + } + + public getCurrentUserId() { + return this.token.userId; + } + + public getCurrentUserData() { + return typeof this.token.user === "string" + ? JSON.parse(this.token.user) + : this.token.user; + } + + public isAuthenticated() { + return !( + this.getCurrentUserId() === "" || + this.getCurrentUserId() == null || + this.getCurrentUserId() == "null" + ); + } + + public save(): boolean { + const today = new Date(); + const expires = new Date(today.getTime() + this.token.ttl * 1000); + this.persist("id", this.token.id, expires); + this.persist("user", JSON.stringify(this.token.user), expires); + this.persist("userId", this.token.userId, expires); + this.persist("created", this.token.created, expires); + this.persist("ttl", this.token.ttl, expires); + this.persist("rememberMe", this.token.rememberMe, expires); + + return true; + } +} diff --git a/src/app/shared/services/auth/base.storage.ts b/src/app/shared/services/auth/base.storage.ts new file mode 100644 index 000000000..14d57968f --- /dev/null +++ b/src/app/shared/services/auth/base.storage.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ + +export class BaseStorage { + get(key: string): string | undefined { + return undefined; + } + + set(key: string, value: string | number | boolean, expires?: Date): void {} + + delete(key: string): void {} +} + +export class InternalStorage extends BaseStorage {} + +export class SDKStorage extends BaseStorage {} diff --git a/src/app/shared/services/auth/storage.browser.ts b/src/app/shared/services/auth/storage.browser.ts new file mode 100644 index 000000000..fe003592e --- /dev/null +++ b/src/app/shared/services/auth/storage.browser.ts @@ -0,0 +1,32 @@ +import { Injectable } from "@angular/core"; + +@Injectable() +export class LocalStorageBrowser { + private parse(value: string) { + try { + return JSON.parse(value); + } catch (e) { + return value; + } + } + + get(key: string) { + const data: string = localStorage.getItem(key); + return this.parse(data); + } + + set(key: string, value: string): void { + localStorage.setItem( + key, + typeof value === "object" ? JSON.stringify(value) : value, + ); + } + + delete(key: string): void { + if (localStorage[key]) { + localStorage.removeItem(key); + } else { + throw new Error(`Cannot remove non-existent key: ${key}`); + } + } +} diff --git a/src/app/shared/services/ownership.service.ts b/src/app/shared/services/ownership.service.ts index 421749da1..0f9e447ec 100644 --- a/src/app/shared/services/ownership.service.ts +++ b/src/app/shared/services/ownership.service.ts @@ -3,7 +3,7 @@ import { Router } from "@angular/router"; import { Store } from "@ngrx/store"; import { combineLatest, Observable } from "rxjs"; import { map } from "rxjs/operators"; -import { Dataset } from "shared/sdk"; +import { OutputDatasetObsoleteDto } from "@scicatproject/scicat-sdk-ts"; import { selectIsAdmin, selectProfile, @@ -14,7 +14,7 @@ import { }) export class OwnershipService { checkDatasetAccess( - dataset: Dataset | undefined, + dataset: OutputDatasetObsoleteDto | undefined, store: Store, router: Router, ) { diff --git a/src/app/shared/services/scicat-data-service.spec.ts b/src/app/shared/services/scicat-data-service.spec.ts index 806c95b30..5c731afb6 100644 --- a/src/app/shared/services/scicat-data-service.spec.ts +++ b/src/app/shared/services/scicat-data-service.spec.ts @@ -1,6 +1,6 @@ import { HttpClient, HttpClientModule } from "@angular/common/http"; import { TestBed } from "@angular/core/testing"; -import { LoopBackAuth } from "shared/sdk"; +import { LoopBackAuth } from "@scicatproject/scicat-sdk-ts"; import { ScicatDataService } from "./scicat-data-service"; diff --git a/src/app/shared/services/scicat-data-service.ts b/src/app/shared/services/scicat-data-service.ts index f7df10c93..40c52beee 100644 --- a/src/app/shared/services/scicat-data-service.ts +++ b/src/app/shared/services/scicat-data-service.ts @@ -1,9 +1,9 @@ import { Injectable } from "@angular/core"; import { HttpClient, HttpParams } from "@angular/common/http"; import { Observable } from "rxjs"; -import { LoopBackAuth } from "shared/sdk"; import { DateTime } from "luxon"; import { Column } from "shared/modules/shared-table/shared-table.module"; +import { AuthService } from "./auth/auth.service"; export interface FilterLimits { limit: number; @@ -17,7 +17,7 @@ export interface FilterLimits { export class ScicatDataService { constructor( private http: HttpClient, - private auth: LoopBackAuth, + private authService: AuthService, ) {} findDataById(url: string, dataId: number): Observable { @@ -153,13 +153,15 @@ export class ScicatDataService { const params = new HttpParams() .set("fields", JSON.stringify(filterFields)) .set("limits", JSON.stringify(limits)) - .append("access_token", this.auth.getToken().id); + .append("access_token", `Bearer ${this.authService.getToken().id}`); // NOTE: For published data endpoint we don't have fullquery and fullfacet and that's why it is a bit special case. if (url.includes("publishedData")) { return this.http.get(url, { params, - headers: { Authorization: this.auth.getAccessTokenId() }, + headers: { + Authorization: `Bearer ${this.authService.getAccessTokenId()}`, + }, }); } @@ -168,7 +170,9 @@ export class ScicatDataService { return this.http.get(`${url}/fullquery${origDatablocksFiles}`, { params, - headers: { Authorization: this.auth.getAccessTokenId() }, + headers: { + Authorization: `Bearer ${this.authService.getAccessTokenId()}`, + }, }); } @@ -188,13 +192,15 @@ export class ScicatDataService { const params = new HttpParams() .set("fields", JSON.stringify(filterFields)) .set("facets", JSON.stringify([])) - .append("access_token", this.auth.getToken().id); + .append("access_token", `Bearer ${this.authService.getToken().id}`); // NOTE: For published data endpoint we don't have fullquery and fullfacet and that's why it is a bit special case. if (url.includes("publishedData")) { return this.http.get(`${url}/count`, { params, - headers: { Authorization: this.auth.getAccessTokenId() }, + headers: { + Authorization: `Bearer ${this.authService.getAccessTokenId()}`, + }, }); } @@ -203,7 +209,9 @@ export class ScicatDataService { return this.http.get(`${url}/fullfacet${origDatablocksFiles}`, { params, - headers: { Authorization: this.auth.getAccessTokenId() }, + headers: { + Authorization: `Bearer ${this.authService.getAccessTokenId()}`, + }, }); } } diff --git a/src/app/shared/services/scicat.datasource.ts b/src/app/shared/services/scicat.datasource.ts index cd33197b3..17584c6e7 100644 --- a/src/app/shared/services/scicat.datasource.ts +++ b/src/app/shared/services/scicat.datasource.ts @@ -3,7 +3,6 @@ import { Observable, BehaviorSubject, of, Subscription } from "rxjs"; import { ScicatDataService } from "./scicat-data-service"; import { catchError, finalize } from "rxjs/operators"; import { ExportExcelService } from "./export-excel.service"; -import { LoopBackConfig } from "shared/sdk"; import { Column } from "shared/modules/shared-table/shared-table.module"; import { AppConfig, AppConfigService } from "app-config.service"; @@ -33,12 +32,9 @@ export class SciCatDataSource implements DataSource { private tableDefinition: any, ) { this.appConfig = this.appConfigService.getConfig(); + // TODO: Check if we can get the api version somehow or add it in the configuration instеad. this.url = - this.appConfig.lbBaseURL + - "/" + - LoopBackConfig.getApiVersion() + - "/" + - this.tableDefinition.collection; + this.appConfig.lbBaseURL + "/api/v3/" + this.tableDefinition.collection; this.collection = this.tableDefinition.collection; this.columnsdef = this.tableDefinition.columns; @@ -46,7 +42,7 @@ export class SciCatDataSource implements DataSource { // convert array of objects into array of arrays this.dataForExcel = []; if (data.length > 0) { - data.forEach((row: any) => { + data.forEach((row) => { const rowSorted = this.columnsdef.map((col) => resolvePath(row, col.id, null), ); diff --git a/src/app/shared/services/thumbnail.service.ts b/src/app/shared/services/thumbnail.service.ts index f4879b2bb..3e6d7a6b3 100644 --- a/src/app/shared/services/thumbnail.service.ts +++ b/src/app/shared/services/thumbnail.service.ts @@ -1,9 +1,9 @@ import { Injectable } from "@angular/core"; import { Store } from "@ngrx/store"; import { distinctUntilChanged, firstValueFrom } from "rxjs"; -import { DatasetApi } from "shared/sdk"; import { selectDatasetsPerPage } from "state-management/selectors/datasets.selectors"; import { AppConfigService } from "app-config.service"; +import { DatasetsService } from "@scicatproject/scicat-sdk-ts"; interface ThumbnailCache { [pid: string]: { @@ -23,7 +23,7 @@ export class ThumbnailService { private cacheTimeout = 5 * 60 * 1000; // 5 minutes in milliseconds constructor( - private datasetApi: DatasetApi, + private datasetApi: DatasetsService, private store: Store, private appConfigService: AppConfigService, ) { @@ -59,7 +59,9 @@ export class ThumbnailService { try { const encodedPid = encodeURIComponent(pid); - const res = await firstValueFrom(this.datasetApi.thumbnail(encodedPid)); + const res = await firstValueFrom( + this.datasetApi.datasetsControllerThumbnail(encodedPid), + ); const thumbnail = res?.thumbnail || null; this.thumbnailCache[pid] = { diff --git a/src/app/state-management/actions/datasets.actions.spec.ts b/src/app/state-management/actions/datasets.actions.spec.ts index 9cb46268d..d69fb4492 100644 --- a/src/app/state-management/actions/datasets.actions.spec.ts +++ b/src/app/state-management/actions/datasets.actions.spec.ts @@ -1,5 +1,9 @@ import * as fromActions from "./datasets.actions"; -import { Dataset, Attachment, DerivedDataset } from "shared/sdk"; +import { + Dataset, + Attachment, + DerivedDataset, +} from "@scicatproject/scicat-sdk-ts"; import { FacetCounts } from "state-management/state/datasets.store"; import { ArchViewMode, diff --git a/src/app/state-management/actions/datasets.actions.ts b/src/app/state-management/actions/datasets.actions.ts index 5c6ce0d93..e4f019261 100644 --- a/src/app/state-management/actions/datasets.actions.ts +++ b/src/app/state-management/actions/datasets.actions.ts @@ -1,11 +1,12 @@ import { createAction, props } from "@ngrx/store"; import { - Dataset, + DatasetClass, Attachment, - DerivedDataset, OrigDatablock, Datablock, -} from "shared/sdk"; + CreateDerivedDatasetObsoleteDto, + OutputDatasetObsoleteDto, +} from "@scicatproject/scicat-sdk-ts"; import { FacetCounts } from "state-management/state/datasets.store"; import { ArchViewMode, @@ -18,7 +19,7 @@ import { export const fetchDatasetsAction = createAction("[Dataset] Fetch Datasets"); export const fetchDatasetsCompleteAction = createAction( "[Dataset] Fetch Datasets Complete", - props<{ datasets: Dataset[] }>(), + props<{ datasets: OutputDatasetObsoleteDto[] }>(), ); export const fetchDatasetsFailedAction = createAction( "[Dataset] Fetch Datasets Failed", @@ -52,7 +53,7 @@ export const fetchDatasetAction = createAction( ); export const fetchDatasetCompleteAction = createAction( "[Dataset] Fetch Dataset Complete", - props<{ dataset: Dataset }>(), + props<{ dataset: OutputDatasetObsoleteDto }>(), ); export const fetchDatasetFailedAction = createAction( "[Dataset] Fetch Dataset Failed", @@ -97,7 +98,7 @@ export const fetchRelatedDatasetsAction = createAction( ); export const fetchRelatedDatasetsCompleteAction = createAction( "[Dataset] Fetch Related Datasets Complete", - props<{ relatedDatasets: Dataset[] }>(), + props<{ relatedDatasets: OutputDatasetObsoleteDto[] }>(), ); export const fetchRelatedDatasetsFailedAction = createAction( "[Datasets] Fetch Related Datasets Failed", @@ -119,26 +120,26 @@ export const changeRelatedDatasetsPageAction = createAction( export const prefillBatchAction = createAction("[Dataset] Prefill Batch"); export const prefillBatchCompleteAction = createAction( "[Dataset] Prefill Batch Complete", - props<{ batch: Dataset[] }>(), + props<{ batch: OutputDatasetObsoleteDto[] }>(), ); export const addToBatchAction = createAction("[Dataset] Add To Batch"); export const storeBatchAction = createAction( "[Dataset] Store To Batch", - props<{ batch: Dataset[] }>(), + props<{ batch: OutputDatasetObsoleteDto[] }>(), ); export const removeFromBatchAction = createAction( "[Dataset] Remove From Batch", - props<{ dataset: Dataset }>(), + props<{ dataset: OutputDatasetObsoleteDto }>(), ); export const clearBatchAction = createAction("[Dataset] Clear Batch"); export const addDatasetAction = createAction( "[Dataset] Add Dataset", - props<{ dataset: DerivedDataset }>(), + props<{ dataset: CreateDerivedDatasetObsoleteDto }>(), ); export const addDatasetCompleteAction = createAction( "[Dataset] Add Dataset Complete", - props<{ dataset: DerivedDataset }>(), + props<{ dataset: OutputDatasetObsoleteDto }>(), ); export const addDatasetFailedAction = createAction( "[Dataset] Add Dataset Failed", @@ -193,7 +194,7 @@ export const removeAttachmentFailedAction = createAction( export const reduceDatasetAction = createAction( "[Dataset] Reduce Dataset", - props<{ dataset: Dataset }>(), + props<{ dataset: OutputDatasetObsoleteDto }>(), ); export const reduceDatasetCompleteAction = createAction( "[Dataset] Reduce Dataset Complete", @@ -218,11 +219,11 @@ export const appendToDatasetArrayFieldFailedAction = createAction( export const selectDatasetAction = createAction( "[Dataset] Select Dataset", - props<{ dataset: Dataset }>(), + props<{ dataset: OutputDatasetObsoleteDto }>(), ); export const deselectDatasetAction = createAction( "[Dataset] Deselect Dataset", - props<{ dataset: Dataset }>(), + props<{ dataset: OutputDatasetObsoleteDto }>(), ); export const selectAllDatasetsAction = createAction( diff --git a/src/app/state-management/actions/instruments.actions.spec.ts b/src/app/state-management/actions/instruments.actions.spec.ts index 8a9a4726d..3e88003cd 100644 --- a/src/app/state-management/actions/instruments.actions.spec.ts +++ b/src/app/state-management/actions/instruments.actions.spec.ts @@ -1,5 +1,5 @@ import * as fromActions from "./instruments.actions"; -import { Instrument } from "shared/sdk"; +import { Instrument } from "@scicatproject/scicat-sdk-ts"; describe("Instrument Actions", () => { describe("fetchInstrumentsAction", () => { diff --git a/src/app/state-management/actions/instruments.actions.ts b/src/app/state-management/actions/instruments.actions.ts index 3e9ae2455..ea6c15f80 100644 --- a/src/app/state-management/actions/instruments.actions.ts +++ b/src/app/state-management/actions/instruments.actions.ts @@ -1,5 +1,5 @@ import { createAction, props } from "@ngrx/store"; -import { Instrument } from "shared/sdk"; +import { Instrument } from "@scicatproject/scicat-sdk-ts"; export const fetchInstrumentsAction = createAction( "[Instrument] Fetch Instruments", diff --git a/src/app/state-management/actions/jobs.actions.ts b/src/app/state-management/actions/jobs.actions.ts index 10c3bf025..993a05777 100644 --- a/src/app/state-management/actions/jobs.actions.ts +++ b/src/app/state-management/actions/jobs.actions.ts @@ -1,10 +1,10 @@ import { createAction, props } from "@ngrx/store"; -import { Job } from "shared/sdk"; +import { CreateJobDto, JobClass } from "@scicatproject/scicat-sdk-ts"; export const fetchJobsAction = createAction("[Job] Fetch Jobs"); export const fetchJobsCompleteAction = createAction( "[Job] Fetch Jobs Complete", - props<{ jobs: Job[] }>(), + props<{ jobs: JobClass[] }>(), ); export const fetchJobsFailedAction = createAction("[Job] Fetch Jobs Failed"); @@ -21,17 +21,17 @@ export const fetchJobAction = createAction( ); export const fetchJobCompleteAction = createAction( "[Job] Fetch Job Complete", - props<{ job: Job }>(), + props<{ job: JobClass }>(), ); export const fetchJobFailedAction = createAction("[Job] Fetch Job Failed"); export const submitJobAction = createAction( "[Job] Submit Job", - props<{ job: Job }>(), + props<{ job: CreateJobDto }>(), ); export const submitJobCompleteAction = createAction( "[Job] Submit Job Complete", - props<{ job: Job }>(), + props<{ job: JobClass }>(), ); export const submitJobFailedAction = createAction( "[Job] Submit Job Failed", diff --git a/src/app/state-management/actions/logbooks.actions.ts b/src/app/state-management/actions/logbooks.actions.ts index b8a897b82..6c87a5f6f 100644 --- a/src/app/state-management/actions/logbooks.actions.ts +++ b/src/app/state-management/actions/logbooks.actions.ts @@ -1,5 +1,5 @@ import { createAction, props } from "@ngrx/store"; -import { Logbook } from "shared/sdk"; +import { Logbook } from "@scicatproject/scicat-sdk-ts"; import { LogbookFilters } from "state-management/models"; export const fetchLogbooksAction = createAction("[Logbook] Fetch Logbooks"); diff --git a/src/app/state-management/actions/policies.actions.spec.ts b/src/app/state-management/actions/policies.actions.spec.ts index 6e7cb0d44..2826781d7 100644 --- a/src/app/state-management/actions/policies.actions.spec.ts +++ b/src/app/state-management/actions/policies.actions.spec.ts @@ -1,5 +1,5 @@ import * as fromActions from "./policies.actions"; -import { Policy } from "shared/sdk"; +import { Policy } from "@scicatproject/scicat-sdk-ts"; describe("Policies Actions", () => { describe("fetchPoliciesAction", () => { diff --git a/src/app/state-management/actions/policies.actions.ts b/src/app/state-management/actions/policies.actions.ts index e9389fb32..dc88c0138 100644 --- a/src/app/state-management/actions/policies.actions.ts +++ b/src/app/state-management/actions/policies.actions.ts @@ -1,5 +1,5 @@ import { createAction, props } from "@ngrx/store"; -import { Policy } from "state-management/models"; +import { Policy } from "@scicatproject/scicat-sdk-ts"; export const fetchPoliciesAction = createAction("[Policy] Fetch Policies"); export const fetchPoliciesCompleteAction = createAction( diff --git a/src/app/state-management/actions/proposals.actions.ts b/src/app/state-management/actions/proposals.actions.ts index f03ae0f07..c09f4cbcf 100644 --- a/src/app/state-management/actions/proposals.actions.ts +++ b/src/app/state-management/actions/proposals.actions.ts @@ -1,5 +1,9 @@ import { createAction, props } from "@ngrx/store"; -import { Proposal, Dataset, Attachment } from "shared/sdk/models"; +import { + Attachment, + OutputDatasetObsoleteDto, + ProposalClass, +} from "@scicatproject/scicat-sdk-ts"; import { ProposalFilters } from "state-management/state/proposals.store"; export const fetchProposalsAction = createAction("[Proposal] Fetch Proposals"); @@ -8,7 +12,7 @@ export const clearCurrentProposalAction = createAction( ); export const fetchProposalsCompleteAction = createAction( "[Proposal] Fetch Proposals Complete", - props<{ proposals: Proposal[] }>(), + props<{ proposals: ProposalClass[] }>(), ); export const fetchProposalsFailedAction = createAction( "[Proposal] Fetch Proposals Failed", @@ -29,7 +33,7 @@ export const fetchProposalAction = createAction( ); export const fetchProposalCompleteAction = createAction( "[Proposal] Fetch Proposal Complete", - props<{ proposal: Proposal }>(), + props<{ proposal: ProposalClass }>(), ); export const fetchProposalFailedAction = createAction( "[Proposal] Fetch Proposal Failed", @@ -44,7 +48,7 @@ export const fetchParentProposalAction = createAction( ); export const fetchParentProposalCompleteAction = createAction( "[Proposal] Fetch Parent Proposal Complete", - props<{ proposal: Proposal }>(), + props<{ proposal: ProposalClass }>(), ); export const fetchParentProposalFailedAction = createAction( "[Proposal] Fetch Parent Proposal Failed", @@ -59,7 +63,7 @@ export const fetchProposalDatasetsAction = createAction( ); export const fetchProposalDatasetsCompleteAction = createAction( "[Proposal] Fetch Datasets Complete", - props<{ datasets: Dataset[] }>(), + props<{ datasets: OutputDatasetObsoleteDto[] }>(), ); export const fetchProposalDatasetsFailedAction = createAction( "[Proposal] Fetch Datasets Failed", diff --git a/src/app/state-management/actions/published-data.actions.spec.ts b/src/app/state-management/actions/published-data.actions.spec.ts index 99f5bc57b..8ee028c29 100644 --- a/src/app/state-management/actions/published-data.actions.spec.ts +++ b/src/app/state-management/actions/published-data.actions.spec.ts @@ -1,5 +1,5 @@ import * as fromActions from "./published-data.actions"; -import { PublishedData } from "shared/sdk"; +import { PublishedData } from "@scicatproject/scicat-sdk-ts"; describe("Published Data Actions", () => { describe("fetchAllPublishedDataAction", () => { diff --git a/src/app/state-management/actions/published-data.actions.ts b/src/app/state-management/actions/published-data.actions.ts index 10aee0470..5b6b60d63 100644 --- a/src/app/state-management/actions/published-data.actions.ts +++ b/src/app/state-management/actions/published-data.actions.ts @@ -1,5 +1,8 @@ import { createAction, props } from "@ngrx/store"; -import { PublishedData } from "shared/sdk"; +import { + PublishedData, + UpdatePublishedDataDto, +} from "@scicatproject/scicat-sdk-ts"; export const fetchAllPublishedDataAction = createAction( "[PublishedData] Fetch All Published Data", @@ -59,7 +62,7 @@ export const registerPublishedDataFailedAction = createAction( export const resyncPublishedDataAction = createAction( "[PublishedData] Resync Published Data", - props<{ doi: string; data: Partial }>(), + props<{ doi: string; data: UpdatePublishedDataDto }>(), ); export const resyncPublishedDataCompleteAction = createAction( "[PublishedData] Resync Published Data Complete", diff --git a/src/app/state-management/actions/samples.actions.ts b/src/app/state-management/actions/samples.actions.ts index a5f492ac1..669ab569f 100644 --- a/src/app/state-management/actions/samples.actions.ts +++ b/src/app/state-management/actions/samples.actions.ts @@ -1,11 +1,16 @@ import { createAction, props } from "@ngrx/store"; -import { Sample, Dataset, Attachment } from "shared/sdk/models"; +import { + Attachment, + CreateAttachmentDto, + OutputDatasetObsoleteDto, + SampleClass, +} from "@scicatproject/scicat-sdk-ts"; import { SampleFilters, ScientificCondition } from "state-management/models"; export const fetchSamplesAction = createAction("[Sample] Fetch Samples"); export const fetchSamplesCompleteAction = createAction( "[Sample] Fetch Samples Complete", - props<{ samples: Sample[] }>(), + props<{ samples: SampleClass[] }>(), ); export const fetchSamplesFailedAction = createAction( "[Sample] Fetch Samples Failed", @@ -39,7 +44,7 @@ export const fetchSampleAction = createAction( ); export const fetchSampleCompleteAction = createAction( "[Sample] Fetch Sample Complete", - props<{ sample: Sample }>(), + props<{ sample: SampleClass }>(), ); export const fetchSampleFailedAction = createAction( "[Sample] Fetch Sample Failed", @@ -65,7 +70,7 @@ export const fetchSampleDatasetsAction = createAction( ); export const fetchSampleDatasetsCompleteAction = createAction( "[Sample] Fetch Datasets Complete", - props<{ datasets: Dataset[] }>(), + props<{ datasets: OutputDatasetObsoleteDto[] }>(), ); export const fetchSampleDatasetsFailedAction = createAction( "[Sample] Fetch Datasets Failed", @@ -85,11 +90,11 @@ export const fetchSampleDatasetsCountFailedAction = createAction( export const addSampleAction = createAction( "[Sample] Add Sample", - props<{ sample: Sample }>(), + props<{ sample: SampleClass }>(), ); export const addSampleCompleteAction = createAction( "[Sample] Add Sample Complete", - props<{ sample: Sample }>(), + props<{ sample: SampleClass }>(), ); export const addSampleFailedAction = createAction("[Sample] Add Sample Failed"); @@ -99,7 +104,7 @@ export const saveCharacteristicsAction = createAction( ); export const saveCharacteristicsCompleteAction = createAction( "[Sample] Save Characteristics Complete", - props<{ sample: Sample }>(), + props<{ sample: SampleClass }>(), ); export const saveCharacteristicsFailedAction = createAction( "[Sample] Save Characteristics Failed", @@ -107,7 +112,7 @@ export const saveCharacteristicsFailedAction = createAction( export const addAttachmentAction = createAction( "[Sample] Add Attachment", - props<{ attachment: Partial }>(), + props<{ attachment: CreateAttachmentDto }>(), ); export const addAttachmentCompleteAction = createAction( "[Sample] Add Attachment Complete", diff --git a/src/app/state-management/actions/user.actions.spec.ts b/src/app/state-management/actions/user.actions.spec.ts index 68fac0e3e..ea88daf7d 100644 --- a/src/app/state-management/actions/user.actions.spec.ts +++ b/src/app/state-management/actions/user.actions.spec.ts @@ -1,6 +1,6 @@ import { Message, User, Settings, UserIdentity, MessageType } from "../models"; import * as fromActions from "./user.actions"; -import { AccessToken, UserSetting } from "shared/sdk"; +import { AccessToken, UserSetting } from "@scicatproject/scicat-sdk-ts"; import { HttpErrorResponse } from "@angular/common/http"; describe("User Actions", () => { diff --git a/src/app/state-management/actions/user.actions.ts b/src/app/state-management/actions/user.actions.ts index d2afe4814..31ef00a10 100644 --- a/src/app/state-management/actions/user.actions.ts +++ b/src/app/state-management/actions/user.actions.ts @@ -1,12 +1,17 @@ import { HttpErrorResponse } from "@angular/common/http"; import { createAction, props } from "@ngrx/store"; -import { User, AccessToken, UserIdentity, UserSetting } from "shared/sdk"; +import { + ReturnedUserDto, + UserIdentity, + UserSettings, +} from "@scicatproject/scicat-sdk-ts"; import { Message, Settings, TableColumn } from "state-management/models"; import { ConditionConfig, FilterConfig, } from "../../shared/modules/filters/filters.module"; import { AppConfig } from "app-config.service"; +import { AccessTokenInterface } from "shared/services/auth/auth.service"; export const setDatasetTableColumnsAction = createAction( "[User] Set Dataset Table Columns", @@ -26,7 +31,7 @@ export const loginAction = createAction( ); export const loginCompleteAction = createAction( "[User] Login Complete", - props<{ user: User; accountType: string }>(), + props<{ user: ReturnedUserDto; accountType: string }>(), ); export const loginFailedAction = createAction( "[User] Login Failed", @@ -74,7 +79,7 @@ export const fetchUserFailedAction = createAction( export const fetchCurrentUserAction = createAction("[User] Fetch Current User"); export const fetchCurrentUserCompleteAction = createAction( "[User] Fetch Current User Complete", - props<{ user: User }>(), + props<{ user: ReturnedUserDto }>(), ); export const fetchCurrentUserFailedAction = createAction( "[User] Fetch Current User Failed", @@ -98,7 +103,7 @@ export const fetchUserSettingsAction = createAction( ); export const fetchUserSettingsCompleteAction = createAction( "[User] Fetch User Settings Complete", - props<{ userSettings: UserSetting }>(), + props<{ userSettings: UserSettings }>(), ); export const fetchUserSettingsFailedAction = createAction( "[User] Fetch User Settings Failed", @@ -110,7 +115,7 @@ export const updateUserSettingsAction = createAction( ); export const updateUserSettingsCompleteAction = createAction( "[User] Update User Settings Complete", - props<{ userSettings: UserSetting }>(), + props<{ userSettings: UserSettings }>(), ); export const updateUserSettingsFailedAction = createAction( "[User] Update User Settings Failed", @@ -119,7 +124,7 @@ export const updateUserSettingsFailedAction = createAction( export const fetchScicatTokenAction = createAction("[User] Fetch Scicat Token"); export const fetchScicatTokenCompleteAction = createAction( "[User] Fetch Scicat Token Complete", - props<{ token: AccessToken }>(), + props<{ token: AccessTokenInterface }>(), ); export const fetchScicatTokenFailedAction = createAction( "[User] Fetch Scicat Token Failed", diff --git a/src/app/state-management/effects/datasets.effects.spec.ts b/src/app/state-management/effects/datasets.effects.spec.ts index bf9563fbc..6263e95fb 100644 --- a/src/app/state-management/effects/datasets.effects.spec.ts +++ b/src/app/state-management/effects/datasets.effects.spec.ts @@ -9,7 +9,7 @@ import { Attachment, DerivedDataset, DerivedDatasetInterface, -} from "shared/sdk"; +} from "@scicatproject/scicat-sdk-ts"; import * as fromActions from "../actions/datasets.actions"; import { Observable } from "rxjs"; import { DatasetEffects } from "./datasets.effects"; diff --git a/src/app/state-management/effects/datasets.effects.ts b/src/app/state-management/effects/datasets.effects.ts index bd07d7b6f..ab321fdb1 100644 --- a/src/app/state-management/effects/datasets.effects.ts +++ b/src/app/state-management/effects/datasets.effects.ts @@ -1,14 +1,14 @@ import { Injectable } from "@angular/core"; import { Actions, concatLatestFrom, createEffect, ofType } from "@ngrx/effects"; import { - DatasetApi, - Dataset, - LoopBackFilter, - OrigDatablock, Attachment, + CreateAttachmentDto, Datablock, - DerivedDataset, -} from "shared/sdk"; + DatasetsService, + OrigDatablock, + OutputDatasetObsoleteDto, + UpdateAttachmentDto, +} from "@scicatproject/scicat-sdk-ts"; import { Store } from "@ngrx/store"; import { selectFullqueryParams, @@ -55,12 +55,14 @@ export class DatasetEffects { concatLatestFrom(() => this.fullqueryParams$), map(([action, params]) => params), mergeMap(({ query, limits }) => - this.datasetApi.fullquery(query, limits).pipe( - map((datasets) => - fromActions.fetchDatasetsCompleteAction({ datasets }), + this.datasetsService + .datasetsControllerFullquery(JSON.stringify(limits), query) + .pipe( + map((datasets) => + fromActions.fetchDatasetsCompleteAction({ datasets }), + ), + catchError(() => of(fromActions.fetchDatasetsFailedAction())), ), - catchError(() => of(fromActions.fetchDatasetsFailedAction())), - ), ), ); }); @@ -75,17 +77,22 @@ export class DatasetEffects { concatLatestFrom(() => this.fullfacetParams$), map(([action, params]) => params), mergeMap(({ fields, facets }) => - this.datasetApi.fullfacet(fields, facets).pipe( - map((res) => { - const { all, ...facetCounts } = res[0]; - const allCounts = all && all.length > 0 ? all[0].totalSets : 0; - return fromActions.fetchFacetCountsCompleteAction({ - facetCounts, - allCounts, - }); - }), - catchError(() => of(fromActions.fetchFacetCountsFailedAction())), - ), + this.datasetsService + .datasetsControllerFullfacet( + JSON.stringify(facets), + JSON.stringify(fields), + ) + .pipe( + map((res) => { + const { all, ...facetCounts } = res[0]; + const allCounts = all && all.length > 0 ? all[0].totalSets : 0; + return fromActions.fetchFacetCountsCompleteAction({ + facetCounts, + allCounts, + }); + }), + catchError(() => of(fromActions.fetchFacetCountsFailedAction())), + ), ), ); }); @@ -97,14 +104,14 @@ export class DatasetEffects { map(([action, params]) => params), mergeMap(({ query }) => { const parsedQuery = JSON.parse(query); - // TODO: remove this line below after metadataKey endpoint is refactored in the backend - // parsedQuery.metadataKey = ""; - return this.datasetApi.metadataKeys(JSON.stringify(parsedQuery)).pipe( - map((metadataKeys) => - fromActions.fetchMetadataKeysCompleteAction({ metadataKeys }), - ), - catchError(() => of(fromActions.fetchMetadataKeysFailedAction())), - ); + return this.datasetsService + .datasetsControllerMetadataKeys(JSON.stringify(parsedQuery)) + .pipe( + map((metadataKeys) => + fromActions.fetchMetadataKeysCompleteAction({ metadataKeys }), + ), + catchError(() => of(fromActions.fetchMetadataKeysFailedAction())), + ); }), ); }); @@ -133,12 +140,14 @@ export class DatasetEffects { return this.actions$.pipe( ofType(fromActions.fetchDatasetAction), switchMap(({ pid }) => { - return this.datasetApi.findById(encodeURIComponent(pid)).pipe( - map((dataset: Dataset) => - fromActions.fetchDatasetCompleteAction({ dataset }), - ), - catchError(() => of(fromActions.fetchDatasetFailedAction())), - ); + return this.datasetsService + .datasetsControllerFindById(encodeURIComponent(pid)) + .pipe( + map((dataset) => + fromActions.fetchDatasetCompleteAction({ dataset }), + ), + catchError(() => of(fromActions.fetchDatasetFailedAction())), + ); }), ); }); @@ -146,8 +155,8 @@ export class DatasetEffects { return this.actions$.pipe( ofType(fromActions.fetchDatablocksAction), switchMap(({ pid, filters }) => { - return this.datasetApi - .getDatablocks(encodeURIComponent(pid), filters) + return this.datasetsService + .datasetsControllerFindAllDatablocks(encodeURIComponent(pid), filters) .pipe( map((datablocks: Datablock[]) => fromActions.fetchDatablocksCompleteAction({ datablocks }), @@ -162,8 +171,8 @@ export class DatasetEffects { return this.actions$.pipe( ofType(fromActions.fetchOrigDatablocksAction), switchMap(({ pid, filters }) => { - return this.datasetApi - .getOrigdatablocks(encodeURIComponent(pid), {}) + return this.datasetsService + .datasetsControllerFindAllOrigDatablocks(encodeURIComponent(pid)) .pipe( map((origdatablocks: OrigDatablock[]) => fromActions.fetchOrigDatablocksCompleteAction({ origdatablocks }), @@ -178,8 +187,11 @@ export class DatasetEffects { return this.actions$.pipe( ofType(fromActions.fetchAttachmentsAction), switchMap(({ pid, filters }) => { - return this.datasetApi - .getAttachments(encodeURIComponent(pid), filters) + return this.datasetsService + .datasetsControllerFindAllAttachments( + encodeURIComponent(pid), + filters, + ) .pipe( map((attachments: Attachment[]) => fromActions.fetchAttachmentsCompleteAction({ attachments }), @@ -198,7 +210,7 @@ export class DatasetEffects { this.relatedDatasetsFilters$, ]), switchMap(([_, dataset, filters]) => { - const queryFilter: LoopBackFilter = { + const queryFilter = { where: {}, limits: { skip: filters.skip, @@ -214,15 +226,21 @@ export class DatasetEffects { } if (dataset.type === "derived") { queryFilter.where = { - pid: { $in: (dataset as unknown as DerivedDataset).inputDatasets }, + pid: { $in: dataset.inputDatasets }, }; } - return this.datasetApi.find(queryFilter).pipe( - map((relatedDatasets: Dataset[]) => - fromActions.fetchRelatedDatasetsCompleteAction({ relatedDatasets }), - ), - catchError(() => of(fromActions.fetchRelatedDatasetsFailedAction())), - ); + return this.datasetsService + .datasetsControllerFindAll(JSON.stringify(queryFilter)) + .pipe( + map((relatedDatasets) => + fromActions.fetchRelatedDatasetsCompleteAction({ + relatedDatasets, + }), + ), + catchError(() => + of(fromActions.fetchRelatedDatasetsFailedAction()), + ), + ); }), ); }); @@ -232,7 +250,7 @@ export class DatasetEffects { ofType(fromActions.fetchRelatedDatasetsAction), concatLatestFrom(() => [this.currentDataset$]), switchMap(([_, dataset]) => { - const queryFilter: LoopBackFilter = { + const queryFilter = { where: {}, }; if (dataset.type === "raw") { @@ -243,19 +261,21 @@ export class DatasetEffects { } if (dataset.type === "derived") { queryFilter.where = { - pid: { $in: (dataset as unknown as DerivedDataset).inputDatasets }, + pid: { $in: dataset.inputDatasets }, }; } - return this.datasetApi.count(queryFilter).pipe( - map(({ count }) => - fromActions.fetchRelatedDatasetsCountCompleteAction({ - count, - }), - ), - catchError(() => - of(fromActions.fetchRelatedDatasetsCountFailedAction()), - ), - ); + return this.datasetsService + .datasetsControllerCount(JSON.stringify(queryFilter)) + .pipe( + map(({ count }) => + fromActions.fetchRelatedDatasetsCountCompleteAction({ + count, + }), + ), + catchError(() => + of(fromActions.fetchRelatedDatasetsCountFailedAction()), + ), + ); }), ); }); @@ -264,9 +284,11 @@ export class DatasetEffects { return this.actions$.pipe( ofType(fromActions.addDatasetAction), mergeMap(({ dataset }) => - this.datasetApi.create(dataset).pipe( + this.datasetsService.datasetsControllerCreate(dataset).pipe( mergeMap((res) => [ - fromActions.addDatasetCompleteAction({ dataset: res }), + fromActions.addDatasetCompleteAction({ + dataset: res, + }), fromActions.fetchDatasetsAction(), fromActions.fetchDatasetAction({ pid: res.pid }), ]), @@ -280,13 +302,18 @@ export class DatasetEffects { return this.actions$.pipe( ofType(fromActions.updatePropertyAction), switchMap(({ pid, property }) => - this.datasetApi.patchAttributes(encodeURIComponent(pid), property).pipe( - switchMap(() => [ - fromActions.updatePropertyCompleteAction(), - fromActions.fetchDatasetAction({ pid }), - ]), - catchError(() => of(fromActions.updatePropertyFailedAction())), - ), + this.datasetsService + .datasetsControllerFindByIdAndUpdate( + encodeURIComponent(pid), + property, + ) + .pipe( + switchMap(() => [ + fromActions.updatePropertyCompleteAction(), + fromActions.fetchDatasetAction({ pid }), + ]), + catchError(() => of(fromActions.updatePropertyFailedAction())), + ), ), ); }); @@ -295,16 +322,12 @@ export class DatasetEffects { return this.actions$.pipe( ofType(fromActions.addAttachmentAction), switchMap(({ attachment }) => { - const { - id, - rawDatasetId, - derivedDatasetId, - proposalId, - sampleId, - ...theRest - } = attachment; - return this.datasetApi - .createAttachments(encodeURIComponent(theRest.datasetId!), theRest) + const { id, proposalId, sampleId, ...theRest } = attachment; + return this.datasetsService + .datasetsControllerCreateAttachment( + encodeURIComponent(theRest.datasetId!), + theRest as CreateAttachmentDto, + ) .pipe( map((res) => fromActions.addAttachmentCompleteAction({ attachment: res }), @@ -320,11 +343,11 @@ export class DatasetEffects { ofType(fromActions.updateAttachmentCaptionAction), switchMap(({ datasetId, attachmentId, caption }) => { const data = { caption }; - return this.datasetApi - .updateByIdAttachments( + return this.datasetsService + .datasetsControllerFindOneAttachmentAndUpdate( encodeURIComponent(datasetId), encodeURIComponent(attachmentId), - data, + data as UpdateAttachmentDto, ) .pipe( map((attachment) => @@ -342,8 +365,11 @@ export class DatasetEffects { return this.actions$.pipe( ofType(fromActions.removeAttachmentAction), switchMap(({ datasetId, attachmentId }) => - this.datasetApi - .destroyByIdAttachments(encodeURIComponent(datasetId), attachmentId) + this.datasetsService + .datasetsControllerFindOneAttachmentAndRemove( + encodeURIComponent(datasetId), + attachmentId, + ) .pipe( map(() => fromActions.removeAttachmentCompleteAction({ attachmentId }), @@ -354,28 +380,18 @@ export class DatasetEffects { ); }); - reduceDataset$ = createEffect(() => { - return this.actions$.pipe( - ofType(fromActions.reduceDatasetAction), - mergeMap(({ dataset }) => - this.datasetApi.reduceDataset(dataset).pipe( - map((result) => fromActions.reduceDatasetCompleteAction({ result })), - catchError(() => of(fromActions.reduceDatasetFailedAction())), - ), - ), - ); - }); - appendToArrayField$ = createEffect(() => { return this.actions$.pipe( ofType(fromActions.appendToDatasetArrayFieldAction), mergeMap(({ pid, fieldName, data }) => - this.datasetApi.appendToArrayField(pid, fieldName, data).pipe( - map(() => fromActions.appendToDatasetArrayFieldCompleteAction()), - catchError(() => - of(fromActions.appendToDatasetArrayFieldFailedAction()), + this.datasetsService + .datasetsControllerAppendToArrayField(pid, fieldName, data) + .pipe( + map(() => fromActions.appendToDatasetArrayFieldCompleteAction()), + catchError(() => + of(fromActions.appendToDatasetArrayFieldFailedAction()), + ), ), - ), ), ); }); @@ -472,17 +488,17 @@ export class DatasetEffects { constructor( private actions$: Actions, - private datasetApi: DatasetApi, + private datasetsService: DatasetsService, private store: Store, ) {} - private storeBatch(batch: Dataset[], userId: string) { + private storeBatch(batch: OutputDatasetObsoleteDto[], userId: string) { const json = JSON.stringify(batch); localStorage.setItem("batch", json); localStorage.setItem("batchUser", userId); } - private retrieveBatch(ofUserId: string): Dataset[] { + private retrieveBatch(ofUserId: string): OutputDatasetObsoleteDto[] { const json = localStorage.getItem("batch"); const userId = localStorage.getItem("batchUser"); diff --git a/src/app/state-management/effects/instruments.effects.spec.ts b/src/app/state-management/effects/instruments.effects.spec.ts index 4393c9a95..5a284136b 100644 --- a/src/app/state-management/effects/instruments.effects.spec.ts +++ b/src/app/state-management/effects/instruments.effects.spec.ts @@ -1,6 +1,6 @@ import { Observable } from "rxjs"; import { InstrumentEffects } from "./instruments.effects"; -import { InstrumentApi, Instrument } from "shared/sdk"; +import { InstrumentApi, Instrument } from "@scicatproject/scicat-sdk-ts"; import { TestBed } from "@angular/core/testing"; import { provideMockActions } from "@ngrx/effects/testing"; import * as fromActions from "state-management/actions/instruments.actions"; diff --git a/src/app/state-management/effects/instruments.effects.ts b/src/app/state-management/effects/instruments.effects.ts index 565e5bb26..fd300a314 100644 --- a/src/app/state-management/effects/instruments.effects.ts +++ b/src/app/state-management/effects/instruments.effects.ts @@ -1,6 +1,6 @@ import { Injectable } from "@angular/core"; import { Actions, createEffect, ofType, concatLatestFrom } from "@ngrx/effects"; -import { InstrumentApi, Instrument } from "shared/sdk"; +import { Instrument, InstrumentsService } from "@scicatproject/scicat-sdk-ts"; import * as fromActions from "state-management/actions/instruments.actions"; import { switchMap, map, catchError, mergeMap } from "rxjs/operators"; import { of } from "rxjs"; @@ -25,13 +25,15 @@ export class InstrumentEffects { concatLatestFrom(() => this.filters$), map(([action, filters]) => filters), switchMap(({ sortField: order, skip, limit }) => - this.instrumentApi.find({ order, limit, skip }).pipe( - mergeMap((instruments: Instrument[]) => [ - fromActions.fetchInstrumentsCompleteAction({ instruments }), - fromActions.fetchCountAction(), - ]), - catchError(() => of(fromActions.fetchInstrumentsFailedAction())), - ), + this.instrumentsService + .instrumentsControllerFindAll(JSON.stringify({ order, limit, skip })) + .pipe( + mergeMap((instruments: Instrument[]) => [ + fromActions.fetchInstrumentsCompleteAction({ instruments }), + fromActions.fetchCountAction(), + ]), + catchError(() => of(fromActions.fetchInstrumentsFailedAction())), + ), ), ); }); @@ -40,8 +42,8 @@ export class InstrumentEffects { return this.actions$.pipe( ofType(fromActions.fetchCountAction), switchMap(() => - this.instrumentApi.find().pipe( - map((instruments) => + this.instrumentsService.instrumentsControllerFindAll().pipe( + map((instruments: Instrument[]) => fromActions.fetchCountCompleteAction({ count: instruments.length }), ), catchError(() => of(fromActions.fetchCountFailedAction())), @@ -54,12 +56,14 @@ export class InstrumentEffects { return this.actions$.pipe( ofType(fromActions.fetchInstrumentAction), switchMap(({ pid }) => - this.instrumentApi.findById(encodeURIComponent(pid)).pipe( - map((instrument: Instrument) => - fromActions.fetchInstrumentCompleteAction({ instrument }), + this.instrumentsService + .instrumentsControllerFindById(encodeURIComponent(pid)) + .pipe( + map((instrument: Instrument) => + fromActions.fetchInstrumentCompleteAction({ instrument }), + ), + catchError(() => of(fromActions.fetchInstrumentFailedAction())), ), - catchError(() => of(fromActions.fetchInstrumentFailedAction())), - ), ), ); }); @@ -68,8 +72,10 @@ export class InstrumentEffects { return this.actions$.pipe( ofType(fromActions.saveCustomMetadataAction), switchMap(({ pid, customMetadata }) => - this.instrumentApi - .patchAttributes(encodeURIComponent(pid), { customMetadata }) + this.instrumentsService + .instrumentsControllerUpdate(encodeURIComponent(pid), { + customMetadata, + }) .pipe( map((instrument: Instrument) => fromActions.saveCustomMetadataCompleteAction({ instrument }), @@ -110,7 +116,7 @@ export class InstrumentEffects { constructor( private actions$: Actions, - private instrumentApi: InstrumentApi, + private instrumentsService: InstrumentsService, private store: Store, ) {} } diff --git a/src/app/state-management/effects/jobs.effects.spec.ts b/src/app/state-management/effects/jobs.effects.spec.ts index c67d08655..0adb529e1 100644 --- a/src/app/state-management/effects/jobs.effects.spec.ts +++ b/src/app/state-management/effects/jobs.effects.spec.ts @@ -1,4 +1,4 @@ -import { JobInterface, Job, JobApi } from "shared/sdk"; +import { JobInterface, Job, JobApi } from "@scicatproject/scicat-sdk-ts"; import { Observable } from "rxjs"; import { JobEffects } from "./jobs.effects"; import { TestBed } from "@angular/core/testing"; diff --git a/src/app/state-management/effects/jobs.effects.ts b/src/app/state-management/effects/jobs.effects.ts index a1f8ffbad..e1e32fb2f 100644 --- a/src/app/state-management/effects/jobs.effects.ts +++ b/src/app/state-management/effects/jobs.effects.ts @@ -1,6 +1,10 @@ import { Injectable } from "@angular/core"; import { Actions, createEffect, ofType, concatLatestFrom } from "@ngrx/effects"; -import { JobApi, Job } from "shared/sdk"; +import { + CreateJobDto, + JobClass, + JobsService, +} from "@scicatproject/scicat-sdk-ts"; import { Store } from "@ngrx/store"; import { selectQueryParams } from "state-management/selectors/jobs.selectors"; import * as fromActions from "state-management/actions/jobs.actions"; @@ -29,8 +33,8 @@ export class JobEffects { concatLatestFrom(() => this.queryParams$), map(([action, params]) => params), switchMap((params) => - this.jobApi.find(params).pipe( - switchMap((jobs: Job[]) => [ + this.jobsService.jobsControllerFindAll(JSON.stringify(params)).pipe( + switchMap((jobs) => [ fromActions.fetchJobsCompleteAction({ jobs }), fromActions.fetchCountAction(), ]), @@ -40,22 +44,6 @@ export class JobEffects { ); }); - fetchCount$ = createEffect(() => { - return this.actions$.pipe( - ofType(fromActions.fetchCountAction), - concatLatestFrom(() => this.queryParams$), - map(([action, params]) => params), - switchMap(({ where }) => - this.jobApi.count(where).pipe( - map((res) => - fromActions.fetchCountCompleteAction({ count: res.count }), - ), - catchError(() => of(fromActions.fetchCountFailedAction())), - ), - ), - ); - }); - updateUserJobsLimit$ = createEffect(() => { return this.actions$.pipe( ofType(fromActions.changePageAction), @@ -69,8 +57,8 @@ export class JobEffects { return this.actions$.pipe( ofType(fromActions.fetchJobAction), switchMap(({ jobId }) => - this.jobApi.findById(jobId).pipe( - map((job: Job) => fromActions.fetchJobCompleteAction({ job })), + this.jobsService.jobsControllerFindOne(jobId).pipe( + map((job: JobClass) => fromActions.fetchJobCompleteAction({ job })), catchError(() => of(fromActions.fetchJobFailedAction())), ), ), @@ -81,7 +69,7 @@ export class JobEffects { return this.actions$.pipe( ofType(fromActions.submitJobAction), switchMap(({ job }) => - this.jobApi.create(job).pipe( + this.jobsService.jobsControllerCreate(job).pipe( map((res) => fromActions.submitJobCompleteAction({ job: res })), catchError((err) => of(fromActions.submitJobFailedAction({ err }))), ), @@ -146,7 +134,7 @@ export class JobEffects { constructor( private actions$: Actions, - private jobApi: JobApi, + private jobsService: JobsService, private store: Store, ) {} } diff --git a/src/app/state-management/effects/logbooks.effects.spec.ts b/src/app/state-management/effects/logbooks.effects.spec.ts index d81e5b463..3b3390616 100644 --- a/src/app/state-management/effects/logbooks.effects.spec.ts +++ b/src/app/state-management/effects/logbooks.effects.spec.ts @@ -3,7 +3,7 @@ import { provideMockActions } from "@ngrx/effects/testing"; import { hot, cold } from "jasmine-marbles"; import { Observable } from "rxjs"; import { LogbookEffects } from "./logbooks.effects"; -import { LogbookApi, Logbook } from "shared/sdk"; +import { LogbookApi, Logbook } from "@scicatproject/scicat-sdk-ts"; import * as fromActions from "state-management/actions/logbooks.actions"; import { loadingAction, diff --git a/src/app/state-management/effects/logbooks.effects.ts b/src/app/state-management/effects/logbooks.effects.ts index 806a81b5e..eb4a56955 100644 --- a/src/app/state-management/effects/logbooks.effects.ts +++ b/src/app/state-management/effects/logbooks.effects.ts @@ -1,6 +1,10 @@ import { Injectable } from "@angular/core"; import { createEffect, Actions, ofType, concatLatestFrom } from "@ngrx/effects"; -import { LogbookApi, Logbook } from "shared/sdk"; +import { + DatasetsService, + Logbook, + LogbooksService, +} from "@scicatproject/scicat-sdk-ts"; import * as fromActions from "state-management/actions/logbooks.actions"; import { mergeMap, catchError, map, timeout } from "rxjs/operators"; import { of } from "rxjs"; @@ -20,7 +24,7 @@ export class LogbookEffects { return this.actions$.pipe( ofType(fromActions.fetchLogbooksAction), mergeMap(() => - this.logbookApi.find().pipe( + this.logbooksService.logbooksControllerFindAll().pipe( map((logbooks: Logbook[]) => fromActions.fetchLogbooksCompleteAction({ logbooks }), ), @@ -35,11 +39,14 @@ export class LogbookEffects { ofType(fromActions.fetchLogbookAction), concatLatestFrom(() => this.filters$), mergeMap(([{ name }, filters]) => { - return this.logbookApi - .findByName(encodeURIComponent(name), JSON.stringify(filters)) + return this.logbooksService + .logbooksControllerFindByName( + encodeURIComponent(name), + JSON.stringify(filters), + ) .pipe( timeout(3000), - mergeMap((logbook) => [ + mergeMap((logbook: Logbook) => [ fromActions.fetchLogbookCompleteAction({ logbook }), fromActions.fetchCountAction({ name }), ]), @@ -54,8 +61,11 @@ export class LogbookEffects { ofType(fromActions.fetchDatasetLogbookAction), concatLatestFrom(() => this.filters$), mergeMap(([{ pid }, filters]) => - this.logbookApi - .findDatasetLogbook(encodeURIComponent(pid), JSON.stringify(filters)) + this.datasetsService + .datasetsControllerFindLogbookByPid( + encodeURIComponent(pid), + JSON.stringify(filters), + ) .pipe( timeout(3000), mergeMap((logbook) => [ @@ -76,11 +86,11 @@ export class LogbookEffects { const { skip, limit, sortField, ...theRest } = filters; return ( name - ? this.logbookApi.findByName( + ? this.logbooksService.logbooksControllerFindByName( encodeURIComponent(name), JSON.stringify(theRest), ) - : this.logbookApi.findDatasetLogbook( + : this.datasetsService.datasetsControllerFindLogbookByPid( encodeURIComponent(pid), JSON.stringify(theRest), ) @@ -123,7 +133,8 @@ export class LogbookEffects { constructor( private actions$: Actions, - private logbookApi: LogbookApi, + private logbooksService: LogbooksService, + private datasetsService: DatasetsService, private store: Store, ) {} } diff --git a/src/app/state-management/effects/policies.effects.spec.ts b/src/app/state-management/effects/policies.effects.spec.ts index 4cc682368..9f05de9f2 100644 --- a/src/app/state-management/effects/policies.effects.spec.ts +++ b/src/app/state-management/effects/policies.effects.spec.ts @@ -1,6 +1,10 @@ import { Observable } from "rxjs"; import { PolicyEffects } from "./policies.effects"; -import { PolicyApi, PolicyInterface, Policy } from "shared/sdk"; +import { + PolicyApi, + PolicyInterface, + Policy, +} from "@scicatproject/scicat-sdk-ts"; import { TestBed } from "@angular/core/testing"; import { provideMockActions } from "@ngrx/effects/testing"; import { provideMockStore } from "@ngrx/store/testing"; diff --git a/src/app/state-management/effects/policies.effects.ts b/src/app/state-management/effects/policies.effects.ts index 5e4798069..327ae3d20 100644 --- a/src/app/state-management/effects/policies.effects.ts +++ b/src/app/state-management/effects/policies.effects.ts @@ -1,6 +1,9 @@ import { Injectable } from "@angular/core"; import { Actions, createEffect, ofType, concatLatestFrom } from "@ngrx/effects"; -import { PolicyApi, Policy } from "shared/sdk"; +import { + PoliciesService, + UpdateWherePolicyDto, +} from "@scicatproject/scicat-sdk-ts"; import { Store } from "@ngrx/store"; import { selectQueryParams, @@ -37,8 +40,8 @@ export class PolicyEffects { concatLatestFrom(() => this.queryParams$), map(([action, params]) => params), switchMap((params) => - this.policyApi.find(params).pipe( - mergeMap((policies: Policy[]) => [ + this.policiesService.policiesControllerFindAll(params).pipe( + mergeMap((policies) => [ fromActions.fetchPoliciesCompleteAction({ policies }), fromActions.fetchCountAction(), fromActions.fetchEditablePoliciesAction(), @@ -53,7 +56,7 @@ export class PolicyEffects { return this.actions$.pipe( ofType(fromActions.fetchCountAction), switchMap(() => - this.policyApi.count().pipe( + this.policiesService.policiesControllerCount().pipe( map(({ count }) => fromActions.fetchCountCompleteAction({ count })), catchError(() => of(fromActions.fetchCountFailedAction())), ), @@ -79,8 +82,8 @@ export class PolicyEffects { const { order, skip, limit } = params; filter = { where: { manager: email }, order, skip, limit }; } - return this.policyApi.find(filter).pipe( - mergeMap((policies: Policy[]) => [ + return this.policiesService.policiesControllerFindAll(filter).pipe( + mergeMap((policies) => [ fromActions.fetchEditablePoliciesCompleteAction({ policies }), fromActions.fetchEditableCountAction(), ]), @@ -102,7 +105,7 @@ export class PolicyEffects { const email = profile.email.toLowerCase(); filter = { manager: email }; } - return this.policyApi.count(filter).pipe( + return this.policiesService.policiesControllerCount(filter).pipe( map(({ count }) => fromActions.fetchEditableCountCompleteAction({ count }), ), @@ -116,15 +119,20 @@ export class PolicyEffects { return this.actions$.pipe( ofType(fromActions.submitPolicyAction), switchMap(({ ownerList, policy }) => - this.policyApi.updatewhere(ownerList.join(), policy).pipe( - mergeMap(({ submissionResponse }) => [ - fromActions.submitPolicyCompleteAction({ - policy: submissionResponse, - }), - fromActions.fetchPoliciesAction(), - ]), - catchError(() => of(fromActions.submitPolicyFailedAction())), - ), + this.policiesService + .policiesControllerUpdateWhere({ + data: policy, + ownerGroupList: ownerList.join(), + }) + .pipe( + mergeMap(({ submissionResponse }) => [ + fromActions.submitPolicyCompleteAction({ + policy: submissionResponse, + }), + fromActions.fetchPoliciesAction(), + ]), + catchError(() => of(fromActions.submitPolicyFailedAction())), + ), ), ); }); @@ -160,7 +168,7 @@ export class PolicyEffects { constructor( private actions$: Actions, - private policyApi: PolicyApi, + private policiesService: PoliciesService, private store: Store, ) {} } diff --git a/src/app/state-management/effects/proposals.effects.spec.ts b/src/app/state-management/effects/proposals.effects.spec.ts index 66ac4f86c..d5d93dc45 100644 --- a/src/app/state-management/effects/proposals.effects.spec.ts +++ b/src/app/state-management/effects/proposals.effects.spec.ts @@ -5,7 +5,7 @@ import { DatasetApi, Dataset, Attachment, -} from "shared/sdk"; +} from "@scicatproject/scicat-sdk-ts"; import { Observable, of, throwError } from "rxjs"; import { ProposalEffects } from "./proposals.effects"; import { TestBed } from "@angular/core/testing"; diff --git a/src/app/state-management/effects/proposals.effects.ts b/src/app/state-management/effects/proposals.effects.ts index 55fa5aeb9..18c2f06d9 100644 --- a/src/app/state-management/effects/proposals.effects.ts +++ b/src/app/state-management/effects/proposals.effects.ts @@ -1,6 +1,10 @@ import { Injectable } from "@angular/core"; import { Actions, createEffect, ofType, concatLatestFrom } from "@ngrx/effects"; -import { DatasetApi, ProposalApi, Proposal, Dataset } from "shared/sdk"; +import { + DatasetsService, + ProposalClass, + ProposalsService, +} from "@scicatproject/scicat-sdk-ts"; import { Action, Store } from "@ngrx/store"; import * as fromActions from "state-management/actions/proposals.actions"; import { @@ -30,13 +34,15 @@ export class ProposalEffects { concatLatestFrom(() => this.fullqueryParams$), map(([action, params]) => params), mergeMap(({ query, limits }) => - this.proposalApi.fullquery(query, limits).pipe( - mergeMap((proposals) => [ - fromActions.fetchProposalsCompleteAction({ proposals }), - fromActions.fetchCountAction(), - ]), - catchError(() => of(fromActions.fetchProposalsFailedAction())), - ), + this.proposalsService + .proposalsControllerFullquery(JSON.stringify(limits), query) + .pipe( + mergeMap((proposals) => [ + fromActions.fetchProposalsCompleteAction({ proposals }), + fromActions.fetchCountAction(), + ]), + catchError(() => of(fromActions.fetchProposalsFailedAction())), + ), ), ); }); @@ -47,7 +53,7 @@ export class ProposalEffects { concatLatestFrom(() => this.fullqueryParams$), map(([action, params]) => params), switchMap(({ query }) => - this.proposalApi.fullquery(query).pipe( + this.proposalsService.proposalsControllerFullfacet(query).pipe( map((proposals) => fromActions.fetchCountCompleteAction({ count: proposals.length }), ), @@ -76,15 +82,17 @@ export class ProposalEffects { ofType(fromActions.fetchProposalDatasetsAction), concatLatestFrom(() => this.datasetQueryParams$), switchMap(([{ proposalId }, { limits }]) => - this.datasetApi - .find({ - where: { proposalId }, - skip: limits.skip, - limit: limits.limit, - order: limits.order, - }) + this.datasetsService + .datasetsControllerFindAll( + JSON.stringify({ + where: { proposalId }, + skip: limits.skip, + limit: limits.limit, + order: limits.order, + }), + ) .pipe( - mergeMap((datasets: Dataset[]) => [ + mergeMap((datasets) => [ fromActions.fetchProposalDatasetsCompleteAction({ datasets }), fromActions.fetchProposalDatasetsCountAction({ proposalId }), ]), @@ -100,16 +108,18 @@ export class ProposalEffects { return this.actions$.pipe( ofType(fromActions.fetchProposalDatasetsCountAction), switchMap(({ proposalId }) => - this.datasetApi.find({ where: { proposalId } }).pipe( - map((datasets) => - fromActions.fetchProposalDatasetsCountCompleteAction({ - count: datasets.length, - }), - ), - catchError(() => - of(fromActions.fetchProposalDatasetsCountFailedAction()), + this.datasetsService + .datasetsControllerFindAll(JSON.stringify({ where: { proposalId } })) + .pipe( + map((datasets) => + fromActions.fetchProposalDatasetsCountCompleteAction({ + count: datasets.length, + }), + ), + catchError(() => + of(fromActions.fetchProposalDatasetsCountFailedAction()), + ), ), - ), ), ); }); @@ -118,10 +128,12 @@ export class ProposalEffects { return this.actions$.pipe( ofType(fromActions.addAttachmentAction), switchMap(({ attachment }) => { - const { id, rawDatasetId, derivedDatasetId, sampleId, ...theRest } = - attachment; - return this.proposalApi - .createAttachments(encodeURIComponent(theRest.proposalId), theRest) + const { id, sampleId, ...theRest } = attachment; + return this.proposalsService + .proposalsControllerCreateAttachment( + encodeURIComponent(theRest.proposalId), + theRest, + ) .pipe( map((res) => fromActions.addAttachmentCompleteAction({ attachment: res }), @@ -137,8 +149,8 @@ export class ProposalEffects { ofType(fromActions.updateAttachmentCaptionAction), switchMap(({ proposalId, attachmentId, caption }) => { const newCaption = { caption }; - return this.proposalApi - .updateByIdAttachments( + return this.proposalsService + .proposalsControllerFindOneAttachmentAndUpdate( encodeURIComponent(proposalId), encodeURIComponent(attachmentId), newCaption, @@ -161,8 +173,8 @@ export class ProposalEffects { return this.actions$.pipe( ofType(fromActions.updateProposalPropertyAction), switchMap(({ proposalId, property }) => - this.proposalApi - .patchAttributes(encodeURIComponent(proposalId), property) + this.proposalsService + .proposalsControllerUpdate(encodeURIComponent(proposalId), property) .pipe( switchMap(() => [ fromActions.updateProposalPropertyCompleteAction(), @@ -180,8 +192,8 @@ export class ProposalEffects { return this.actions$.pipe( ofType(fromActions.removeAttachmentAction), switchMap(({ proposalId, attachmentId }) => - this.proposalApi - .destroyByIdAttachments( + this.proposalsService + .proposalsControllerFindOneAttachmentAndRemove( encodeURIComponent(proposalId), encodeURIComponent(attachmentId), ) @@ -243,35 +255,35 @@ export class ProposalEffects { constructor( private actions$: Actions, - private datasetApi: DatasetApi, - private proposalApi: ProposalApi, + private datasetsService: DatasetsService, + private proposalsService: ProposalsService, private store: Store, ) {} private createProposalFetchEffect( triggerAction: string, - completeAction: (props: { proposal: Proposal }) => Action, + completeAction: (props: { proposal: ProposalClass }) => Action, failedAction: () => Action, accessFailedAction: () => Action, ) { return createEffect(() => { return this.actions$.pipe( ofType(triggerAction), - switchMap>(({ proposalId }) => - this.proposalApi.findByIdAccess(encodeURIComponent(proposalId)).pipe( - filter( - (permission: { canAccess: boolean }) => permission.canAccess, + switchMap>(({ proposalId }) => + this.proposalsService + .proposalsControllerFindByIdAccess(encodeURIComponent(proposalId)) + .pipe( + filter((permission) => permission.canAccess), + switchMap(() => + this.proposalsService + .proposalsControllerFindById(encodeURIComponent(proposalId)) + .pipe( + map((proposal) => completeAction({ proposal })), + catchError(() => of(failedAction())), + ), + ), + catchError(() => of(accessFailedAction())), ), - switchMap(() => - this.proposalApi - .findById(encodeURIComponent(proposalId)) - .pipe( - map((proposal) => completeAction({ proposal })), - catchError(() => of(failedAction())), - ), - ), - catchError(() => of(accessFailedAction())), - ), ), ); }); diff --git a/src/app/state-management/effects/published-data.effects.spec.ts b/src/app/state-management/effects/published-data.effects.spec.ts index 654be9ed2..c305a0dec 100644 --- a/src/app/state-management/effects/published-data.effects.spec.ts +++ b/src/app/state-management/effects/published-data.effects.spec.ts @@ -4,7 +4,7 @@ import { PublishedDataApi, PublishedDataInterface, PublishedData, -} from "shared/sdk"; +} from "@scicatproject/scicat-sdk-ts"; import { TestBed } from "@angular/core/testing"; import { provideMockActions } from "@ngrx/effects/testing"; import { provideMockStore } from "@ngrx/store/testing"; diff --git a/src/app/state-management/effects/published-data.effects.ts b/src/app/state-management/effects/published-data.effects.ts index 0bb79007c..f6b42979f 100644 --- a/src/app/state-management/effects/published-data.effects.ts +++ b/src/app/state-management/effects/published-data.effects.ts @@ -1,6 +1,9 @@ import { Injectable } from "@angular/core"; import { Actions, createEffect, ofType, concatLatestFrom } from "@ngrx/effects"; -import { PublishedDataApi, PublishedData } from "shared/sdk"; +import { + PublishedData, + PublishedDataService, +} from "@scicatproject/scicat-sdk-ts"; import { Store } from "@ngrx/store"; import { selectCurrentPublishedData, @@ -38,13 +41,19 @@ export class PublishedDataEffects { concatLatestFrom(() => this.queryParams$), map(([action, params]) => params), mergeMap((params) => - this.publishedDataApi.find(params).pipe( - mergeMap((publishedData: PublishedData[]) => [ - fromActions.fetchAllPublishedDataCompleteAction({ publishedData }), - fromActions.fetchCountAction(), - ]), - catchError(() => of(fromActions.fetchAllPublishedDataFailedAction())), - ), + this.publishedDataService + .publishedDataControllerFindAll("", "", JSON.stringify(params)) + .pipe( + mergeMap((publishedData) => [ + fromActions.fetchAllPublishedDataCompleteAction({ + publishedData, + }), + fromActions.fetchCountAction(), + ]), + catchError(() => + of(fromActions.fetchAllPublishedDataFailedAction()), + ), + ), ), ); }); @@ -53,7 +62,7 @@ export class PublishedDataEffects { return this.actions$.pipe( ofType(fromActions.fetchCountAction), switchMap(() => - this.publishedDataApi.count().pipe( + this.publishedDataService.publishedDataControllerCount().pipe( map(({ count }) => fromActions.fetchCountCompleteAction({ count })), catchError(() => of(fromActions.fetchCountFailedAction())), ), @@ -65,8 +74,8 @@ export class PublishedDataEffects { return this.actions$.pipe( ofType(fromActions.fetchPublishedDataAction), switchMap(({ id }) => - this.publishedDataApi - .findById(encodeURIComponent(id)) + this.publishedDataService + .publishedDataControllerFindOne(encodeURIComponent(id)) .pipe( map((publishedData: PublishedData) => fromActions.fetchPublishedDataCompleteAction({ publishedData }), @@ -97,8 +106,8 @@ export class PublishedDataEffects { return this.actions$.pipe( ofType(fromActions.publishDatasetAction), switchMap(({ data }) => - this.publishedDataApi.create(data).pipe( - mergeMap((publishedData: PublishedData) => [ + this.publishedDataService.publishedDataControllerCreate(data).pipe( + mergeMap((publishedData) => [ fromActions.publishDatasetCompleteAction({ publishedData }), fromActions.fetchPublishedDataAction({ id: publishedData.doi }), ]), @@ -140,13 +149,19 @@ export class PublishedDataEffects { return this.actions$.pipe( ofType(fromActions.registerPublishedDataAction), switchMap(({ doi }) => - this.publishedDataApi.register(encodeURIComponent(doi)).pipe( - mergeMap((publishedData) => [ - fromActions.registerPublishedDataCompleteAction({ publishedData }), - fromActions.fetchPublishedDataAction({ id: doi }), - ]), - catchError(() => of(fromActions.registerPublishedDataFailedAction())), - ), + this.publishedDataService + .publishedDataControllerRegister(encodeURIComponent(doi)) + .pipe( + mergeMap((publishedData: PublishedData) => [ + fromActions.registerPublishedDataCompleteAction({ + publishedData, + }), + fromActions.fetchPublishedDataAction({ id: doi }), + ]), + catchError(() => + of(fromActions.registerPublishedDataFailedAction()), + ), + ), ), ); }); @@ -155,13 +170,15 @@ export class PublishedDataEffects { return this.actions$.pipe( ofType(fromActions.resyncPublishedDataAction), switchMap(({ doi, data }) => - this.publishedDataApi.resync(encodeURIComponent(doi), data).pipe( - mergeMap((publishedData) => [ - fromActions.resyncPublishedDataCompleteAction(publishedData), - fromActions.fetchPublishedDataAction({ id: doi }), - ]), - catchError(() => of(fromActions.resyncPublishedDataFailedAction())), - ), + this.publishedDataService + .publishedDataControllerResync(encodeURIComponent(doi), data) + .pipe( + mergeMap((publishedData) => [ + fromActions.resyncPublishedDataCompleteAction(publishedData), + fromActions.fetchPublishedDataAction({ id: doi }), + ]), + catchError(() => of(fromActions.resyncPublishedDataFailedAction())), + ), ), ); }); @@ -216,7 +233,7 @@ export class PublishedDataEffects { constructor( private actions$: Actions, - private publishedDataApi: PublishedDataApi, + private publishedDataService: PublishedDataService, private router: Router, private store: Store, ) {} diff --git a/src/app/state-management/effects/samples.effects.spec.ts b/src/app/state-management/effects/samples.effects.spec.ts index 31b458cad..4d9bd7858 100644 --- a/src/app/state-management/effects/samples.effects.spec.ts +++ b/src/app/state-management/effects/samples.effects.spec.ts @@ -7,7 +7,7 @@ import { Sample, Dataset, Attachment, -} from "shared/sdk"; +} from "@scicatproject/scicat-sdk-ts"; import { TestBed } from "@angular/core/testing"; import { provideMockActions } from "@ngrx/effects/testing"; import { provideMockStore } from "@ngrx/store/testing"; diff --git a/src/app/state-management/effects/samples.effects.ts b/src/app/state-management/effects/samples.effects.ts index 2cd9168d2..0e70af5f2 100644 --- a/src/app/state-management/effects/samples.effects.ts +++ b/src/app/state-management/effects/samples.effects.ts @@ -1,6 +1,10 @@ import { Injectable } from "@angular/core"; import { Actions, createEffect, ofType, concatLatestFrom } from "@ngrx/effects"; -import { DatasetApi, SampleApi, Sample, Dataset, Attachment } from "shared/sdk"; +import { + CreateSubAttachmentDto, + DatasetsService, + SamplesService, +} from "@scicatproject/scicat-sdk-ts"; import { Store } from "@ngrx/store"; import { selectFullqueryParams, @@ -30,13 +34,15 @@ export class SampleEffects { concatLatestFrom(() => this.fullqueryParams$), map(([action, params]) => params), mergeMap(({ query, limits }) => - this.sampleApi.fullquery(query, limits).pipe( - mergeMap((samples) => [ - fromActions.fetchSamplesCompleteAction({ samples }), - fromActions.fetchSamplesCountAction(), - ]), - catchError(() => of(fromActions.fetchSamplesFailedAction())), - ), + this.sampleApi + .samplesControllerFullquery(JSON.stringify(limits), query) + .pipe( + mergeMap((samples) => [ + fromActions.fetchSamplesCompleteAction({ samples }), + fromActions.fetchSamplesCountAction(), + ]), + catchError(() => of(fromActions.fetchSamplesFailedAction())), + ), ), ); }); @@ -47,7 +53,7 @@ export class SampleEffects { concatLatestFrom(() => this.fullqueryParams$), map(([action, params]) => params), mergeMap(({ query }) => - this.sampleApi.fullquery(query).pipe( + this.sampleApi.samplesControllerFullquery(query).pipe( map((samples) => fromActions.fetchSamplesCountCompleteAction({ count: samples.length, @@ -67,12 +73,14 @@ export class SampleEffects { mergeMap(({ query }) => { const parsedQuery = JSON.parse(query); parsedQuery.metadataKey = ""; - return this.sampleApi.metadataKeys(JSON.stringify(parsedQuery)).pipe( - map((metadataKeys) => - fromActions.fetchMetadataKeysCompleteAction({ metadataKeys }), - ), - catchError(() => of(fromActions.fetchMetadataKeysFailedAction())), - ); + return this.sampleApi + .samplesControllerMetadataKeys(JSON.stringify(parsedQuery)) + .pipe( + map((metadataKeys) => + fromActions.fetchMetadataKeysCompleteAction({ metadataKeys }), + ), + catchError(() => of(fromActions.fetchMetadataKeysFailedAction())), + ); }), ); }); @@ -81,11 +89,11 @@ export class SampleEffects { return this.actions$.pipe( ofType(fromActions.fetchSampleAction), switchMap(({ sampleId }) => { - return this.sampleApi.findByIdAccess(sampleId).pipe( - filter((permission: { canAccess: boolean }) => permission.canAccess), + return this.sampleApi.samplesControllerFindByIdAccess(sampleId).pipe( + filter((permission) => permission.canAccess), switchMap(() => - this.sampleApi.findById(sampleId).pipe( - map((sample: Sample) => + this.sampleApi.samplesControllerFindById(sampleId).pipe( + map((sample) => fromActions.fetchSampleCompleteAction({ sample }), ), catchError(() => of(fromActions.fetchSampleFailedAction())), @@ -101,14 +109,16 @@ export class SampleEffects { return this.actions$.pipe( ofType(fromActions.fetchSampleAttachmentsAction), switchMap(({ sampleId }) => { - return this.sampleApi.getAttachments(sampleId).pipe( - map((attachments: Attachment[]) => - fromActions.fetchSampleAttachmentsCompleteAction({ attachments }), - ), - catchError(() => - of(fromActions.fetchSampleAttachmentsFailedAction()), - ), - ); + return this.sampleApi + .samplesControllerFindAllAttachments(sampleId) + .pipe( + map((attachments) => + fromActions.fetchSampleAttachmentsCompleteAction({ attachments }), + ), + catchError(() => + of(fromActions.fetchSampleAttachmentsFailedAction()), + ), + ); }), ); }); @@ -119,9 +129,16 @@ export class SampleEffects { concatLatestFrom(() => this.datasetsQueryParams$), mergeMap(([{ sampleId }, { order, skip, limit }]) => this.datasetApi - .find({ where: { sampleId }, order, skip, limit }) + .datasetsControllerFindAll( + JSON.stringify({ + where: { sampleId }, + order, + skip, + limit, + }), + ) .pipe( - mergeMap((datasets: Dataset[]) => [ + mergeMap((datasets) => [ fromActions.fetchSampleDatasetsCompleteAction({ datasets }), fromActions.fetchSampleDatasetsCountAction({ sampleId }), ]), @@ -135,16 +152,18 @@ export class SampleEffects { return this.actions$.pipe( ofType(fromActions.fetchSampleDatasetsCountAction), switchMap(({ sampleId }) => - this.datasetApi.find({ where: { sampleId } }).pipe( - map((datasets) => - fromActions.fetchSampleDatasetsCountCompleteAction({ - count: datasets.length, - }), - ), - catchError(() => - of(fromActions.fetchSampleDatasetsCountFailedAction()), + this.datasetApi + .datasetsControllerFindAll(JSON.stringify({ where: { sampleId } })) + .pipe( + map((datasets) => + fromActions.fetchSampleDatasetsCountCompleteAction({ + count: datasets.length, + }), + ), + catchError(() => + of(fromActions.fetchSampleDatasetsCountFailedAction()), + ), ), - ), ), ); }); @@ -154,11 +173,11 @@ export class SampleEffects { ofType(fromActions.saveCharacteristicsAction), switchMap(({ sampleId, characteristics }) => this.sampleApi - .patchAttributes(sampleId, { + .samplesControllerUpdate(sampleId, { sampleCharacteristics: characteristics, }) .pipe( - map((sample: Sample) => + map((sample) => fromActions.saveCharacteristicsCompleteAction({ sample }), ), catchError(() => of(fromActions.saveCharacteristicsFailedAction())), @@ -171,7 +190,7 @@ export class SampleEffects { return this.actions$.pipe( ofType(fromActions.addSampleAction), mergeMap(({ sample }) => - this.sampleApi.create(sample).pipe( + this.sampleApi.samplesControllerCreate(sample).pipe( mergeMap((res) => [ fromActions.addSampleCompleteAction({ sample: res }), fromActions.fetchSamplesAction(), @@ -186,16 +205,12 @@ export class SampleEffects { return this.actions$.pipe( ofType(fromActions.addAttachmentAction), switchMap(({ attachment }) => { - const { - id, - datasetId, - rawDatasetId, - derivedDatasetId, - proposalId, - ...theRest - } = attachment; + const { id, datasetId, proposalId, ...theRest } = attachment; return this.sampleApi - .createAttachments(encodeURIComponent(theRest.sampleId!), theRest) + .samplesControllerCreateAttachments( + encodeURIComponent(theRest.sampleId!), + theRest as CreateSubAttachmentDto, + ) .pipe( map((res) => fromActions.addAttachmentCompleteAction({ attachment: res }), @@ -206,37 +221,12 @@ export class SampleEffects { ); }); - updateAttachmentCaption$ = createEffect(() => { - return this.actions$.pipe( - ofType(fromActions.updateAttachmentCaptionAction), - switchMap(({ sampleId, attachmentId, caption }) => { - const newCaption = { caption }; - return this.sampleApi - .updateByIdAttachments( - encodeURIComponent(sampleId), - encodeURIComponent(attachmentId), - newCaption, - ) - .pipe( - map((res) => - fromActions.updateAttachmentCaptionCompleteAction({ - attachment: res, - }), - ), - catchError(() => - of(fromActions.updateAttachmentCaptionFailedAction()), - ), - ); - }), - ); - }); - removeAttachment$ = createEffect(() => { return this.actions$.pipe( ofType(fromActions.removeAttachmentAction), switchMap(({ sampleId, attachmentId }) => this.sampleApi - .destroyByIdAttachments( + .samplesControllerFindOneAttachmentAndRemove( encodeURIComponent(sampleId), encodeURIComponent(attachmentId), ) @@ -298,8 +288,8 @@ export class SampleEffects { constructor( private actions$: Actions, - private datasetApi: DatasetApi, - private sampleApi: SampleApi, + private datasetApi: DatasetsService, + private sampleApi: SamplesService, private store: Store, ) {} } diff --git a/src/app/state-management/effects/user.effects.spec.ts b/src/app/state-management/effects/user.effects.spec.ts index 47a025979..f2e0e35f4 100644 --- a/src/app/state-management/effects/user.effects.spec.ts +++ b/src/app/state-management/effects/user.effects.spec.ts @@ -9,7 +9,7 @@ import { LoopBackAuth, SDKToken, UserSetting, -} from "shared/sdk"; +} from "@scicatproject/scicat-sdk-ts"; import { ADAuthService } from "users/adauth.service"; import { TestBed } from "@angular/core/testing"; import { provideMockActions } from "@ngrx/effects/testing"; diff --git a/src/app/state-management/effects/user.effects.ts b/src/app/state-management/effects/user.effects.ts index 8a0cb9b1d..f93ea4626 100644 --- a/src/app/state-management/effects/user.effects.ts +++ b/src/app/state-management/effects/user.effects.ts @@ -1,14 +1,15 @@ import { Injectable } from "@angular/core"; import { Actions, ofType, createEffect, concatLatestFrom } from "@ngrx/effects"; import { ADAuthService } from "users/adauth.service"; +import { AuthService, SDKToken } from "shared/services/auth/auth.service"; import { - LoopBackAuth, - UserApi, - UserIdentityApi, - SDKToken, - User, - UserIdentity, -} from "shared/sdk"; + ReturnedUserDto, + UsersService, + AuthService as SharedAuthService, + UserSettings, + Configuration, + UserIdentitiesService, +} from "@scicatproject/scicat-sdk-ts"; import { Router } from "@angular/router"; import * as fromActions from "state-management/actions/user.actions"; import { @@ -67,7 +68,7 @@ export class UserEffects { adLogin$ = createEffect(() => { return this.actions$.pipe( ofType(fromActions.activeDirLoginAction), - switchMap(({ username, password, rememberMe }) => + switchMap(({ username, password }) => this.activeDirAuthService.login(username, password).pipe( switchMap(({ body }) => [ fromActions.activeDirLoginSuccessAction(), @@ -85,27 +86,28 @@ export class UserEffects { return this.actions$.pipe( ofType(fromActions.loginOIDCAction), switchMap(({ oidcLoginResponse }) => { - const accessTokenPrefix = - this.configService.getConfig().accessTokenPrefix; const token = new SDKToken({ - id: accessTokenPrefix + oidcLoginResponse.accessToken, + id: oidcLoginResponse.accessToken, userId: oidcLoginResponse.userId, ttl: oidcLoginResponse.ttl, created: oidcLoginResponse.created, }); - this.loopBackAuth.setToken(token); - return this.userApi.findById(oidcLoginResponse.userId).pipe( - switchMap((user: User) => [ - fromActions.fetchUserCompleteAction(), - fromActions.loginCompleteAction({ - user, - accountType: "external", - }), - ]), - catchError((error: HttpErrorResponse) => - of(fromActions.fetchUserFailedAction({ error })), - ), - ); + this.authService.setToken(token); + this.apiConfigService.accessToken = token.id; + return this.usersService + .usersControllerFindById(oidcLoginResponse.userId) + .pipe( + switchMap((user: ReturnedUserDto) => [ + fromActions.fetchUserCompleteAction(), + fromActions.loginCompleteAction({ + user, + accountType: "external", + }), + ]), + catchError((error: HttpErrorResponse) => + of(fromActions.fetchUserFailedAction({ error })), + ), + ); }), ); }); @@ -114,29 +116,30 @@ export class UserEffects { return this.actions$.pipe( ofType(fromActions.fetchUserAction), switchMap(({ adLoginResponse }) => { - const accessTokenPrefix = - this.configService.getConfig().accessTokenPrefix; const token = new SDKToken({ - id: accessTokenPrefix + adLoginResponse.access_token, + id: adLoginResponse.access_token, userId: adLoginResponse.userId, ttl: adLoginResponse.ttl, created: adLoginResponse.created, }); - this.loopBackAuth.setToken(token); - return this.userApi.findById(adLoginResponse.userId).pipe( - switchMap((user: User) => [ - fromActions.fetchUserCompleteAction(), - fromActions.loginCompleteAction({ - user, - accountType: "external", - }), - fromActions.fetchUserIdentityAction({ id: user.id }), - fromActions.fetchUserSettingsAction({ id: user.id }), - ]), - catchError((error: HttpErrorResponse) => - of(fromActions.fetchUserFailedAction({ error })), - ), - ); + this.authService.setToken(token); + this.apiConfigService.accessToken = token.id; + return this.usersService + .usersControllerFindById(adLoginResponse.userId) + .pipe( + switchMap((user: ReturnedUserDto) => [ + fromActions.fetchUserCompleteAction(), + fromActions.loginCompleteAction({ + user, + accountType: "external", + }), + fromActions.fetchUserIdentityAction({ id: user.id }), + fromActions.fetchUserSettingsAction({ id: user.id }), + ]), + catchError((error: HttpErrorResponse) => + of(fromActions.fetchUserFailedAction({ error })), + ), + ); }), ); }); @@ -146,16 +149,22 @@ export class UserEffects { ofType(fromActions.funcLoginAction), map((action) => action.form), switchMap(({ username, password, rememberMe }) => - this.userApi.login({ username, password, rememberMe }).pipe( - switchMap(({ user }) => [ - fromActions.funcLoginSuccessAction(), - fromActions.loginCompleteAction({ - user, - accountType: "functional", - }), - ]), - catchError((error: HttpErrorResponse) => { - return of(fromActions.funcLoginFailedAction({ error })); + this.sharedAuthService.authControllerLogin({ username, password }).pipe( + switchMap((loginResponse) => { + this.apiConfigService.accessToken = loginResponse.access_token; + this.authService.setToken({ + ...loginResponse, + created: new Date(loginResponse.created), + rememberMe, + scopes: null, + }); + return [ + fromActions.funcLoginSuccessAction(), + fromActions.loginCompleteAction({ + user: loginResponse.user, + accountType: "functional", + }), + ]; }), ), ), @@ -203,20 +212,23 @@ export class UserEffects { logout$ = createEffect(() => { return this.actions$.pipe( ofType(fromActions.logoutAction), - filter(() => this.userApi.isAuthenticated()), + filter(() => this.authService.isAuthenticated()), switchMap(() => - this.userApi.logout().pipe( - switchMap(({ logoutURL }) => [ - clearDatasetsStateAction(), - clearInstrumentsStateAction(), - clearJobsStateAction(), - clearLogbooksStateAction(), - clearPoliciesStateAction(), - clearProposalsStateAction(), - clearPublishedDataStateAction(), - clearSamplesStateAction(), - fromActions.logoutCompleteAction({ logoutURL }), - ]), + this.sharedAuthService.authControllerLogout().pipe( + switchMap(({ logoutURL }) => { + this.authService.clear(); + return [ + clearDatasetsStateAction(), + clearInstrumentsStateAction(), + clearJobsStateAction(), + clearLogbooksStateAction(), + clearPoliciesStateAction(), + clearProposalsStateAction(), + clearPublishedDataStateAction(), + clearSamplesStateAction(), + fromActions.logoutCompleteAction({ logoutURL }), + ]; + }), catchError(() => of(fromActions.logoutFailedAction())), ), ), @@ -245,7 +257,7 @@ export class UserEffects { return this.actions$.pipe( ofType(fromActions.fetchCurrentUserAction), filter(() => { - const { created, ttl, id } = this.userApi.getCurrentToken(); + const { created, ttl, id } = this.authService.getToken(); const currentTimeStamp = Math.floor(new Date().getTime()); const createdTimeStamp = Math.floor(new Date(created).getTime()); @@ -253,14 +265,14 @@ export class UserEffects { const isTokenExpired = currentTimeStamp >= expirationTimeStamp; if (id && ttl && isTokenExpired) { - this.loopBackAuth.clear(); + this.authService.clear(); } - return this.userApi.isAuthenticated(); + return this.authService.isAuthenticated(); }), switchMap(() => - this.userApi.getCurrent().pipe( - switchMap((user) => [ + this.usersService.usersControllerGetMyUser().pipe( + switchMap((user: ReturnedUserDto) => [ fromActions.fetchCurrentUserCompleteAction({ user }), fromActions.fetchUserIdentityAction({ id: user.id }), fromActions.fetchUserSettingsAction({ id: user.id }), @@ -275,10 +287,14 @@ export class UserEffects { return this.actions$.pipe( ofType(fromActions.fetchUserIdentityAction), switchMap(({ id }) => - this.userIdentityApi - .findOne({ where: { userId: id } }) + this.userIdentityService + .userIdentitiesControllerFindOne( + JSON.stringify({ + where: { userId: id }, + }), + ) .pipe( - map((userIdentity: UserIdentity) => + map((userIdentity) => fromActions.fetchUserIdentityCompleteAction({ userIdentity }), ), catchError(() => of(fromActions.fetchUserIdentityFailedAction())), @@ -291,8 +307,8 @@ export class UserEffects { return this.actions$.pipe( ofType(fromActions.fetchUserSettingsAction), switchMap(({ id }) => - this.userApi.getSettings(id, null).pipe( - map((userSettings) => { + this.usersService.usersControllerGetSettings(id, null).pipe( + map((userSettings: UserSettings) => { const config = this.configService.getConfig(); const externalSettings = userSettings.externalSettings || {}; @@ -340,7 +356,7 @@ export class UserEffects { ofType(fromActions.fetchUserSettingsCompleteAction), mergeMap(({ userSettings }) => [ fromActions.updateFilterConfigs({ - filterConfigs: userSettings.filters, + filterConfigs: (userSettings.externalSettings as any)?.filters, }), ]), ); @@ -352,7 +368,7 @@ export class UserEffects { mergeMap(({ userSettings }) => { const actions = []; - userSettings.conditions + (userSettings.externalSettings as any)?.conditions .filter((condition) => condition.enabled) .forEach((condition) => { actions.push( @@ -368,7 +384,8 @@ export class UserEffects { actions.push( fromActions.updateConditionsConfigs({ - conditionConfigs: userSettings.conditions, + conditionConfigs: (userSettings.externalSettings as any) + ?.conditions, }), ); @@ -432,20 +449,25 @@ export class UserEffects { // using the partialUpdateExternalSettings API, which does not enforce validation. const apiCall$ = useExternalSettings - ? this.userApi.partialUpdateExternalSettings( + ? this.usersService.usersControllerPatchExternalSettings( user?.id, - JSON.stringify(newProperty), + JSON.stringify(newProperty) as any, ) - : this.userApi.partialUpdateSettings( + : this.usersService.usersControllerPatchSettings( user?.id, - JSON.stringify(newProperty), + JSON.stringify(newProperty) as any, ); return apiCall$.pipe( - map((userSettings) => { - userSettings["conditions"] = - userSettings.externalSettings.conditions; - userSettings["filters"] = userSettings.externalSettings.filters; - userSettings["columns"] = userSettings.externalSettings.columns; + map((userSettings: UserSettings) => { + userSettings["conditions"] = ( + userSettings.externalSettings as any + )?.conditions; + userSettings["filters"] = ( + userSettings.externalSettings as any + )?.filters; + userSettings["columns"] = ( + userSettings.externalSettings as any + )?.columns; delete userSettings.externalSettings; return fromActions.updateUserSettingsCompleteAction({ userSettings, @@ -461,7 +483,7 @@ export class UserEffects { return this.actions$.pipe( ofType(fromActions.fetchScicatTokenAction), switchMap(() => - of(this.userApi.getCurrentToken()).pipe( + of(this.authService.getToken()).pipe( map((token) => fromActions.fetchScicatTokenCompleteAction({ token })), catchError(() => of(fromActions.fetchScicatTokenFailedAction())), ), @@ -474,16 +496,16 @@ export class UserEffects { ofType(fromActions.loadDefaultSettings), map(({ config }) => { const defaultFilters = - config.defaultDatasetsListSettings.filters || + config.defaultDatasetsListSettings?.filters || initialUserState.filters; const defaultConditions = - config.defaultDatasetsListSettings.conditions || + config.defaultDatasetsListSettings?.conditions || initialUserState.conditions; // NOTE: config.localColumns is for backward compatibility. // it should be removed once no longer needed const columns = - config.defaultDatasetsListSettings.columns || + config.defaultDatasetsListSettings?.columns || config.localColumns || initialUserState.columns; @@ -506,10 +528,12 @@ export class UserEffects { private actions$: Actions, private activeDirAuthService: ADAuthService, private configService: AppConfigService, - private loopBackAuth: LoopBackAuth, + private apiConfigService: Configuration, + private authService: AuthService, private router: Router, private store: Store, - private userApi: UserApi, - private userIdentityApi: UserIdentityApi, + private usersService: UsersService, + private sharedAuthService: SharedAuthService, + private userIdentityService: UserIdentitiesService, ) {} } diff --git a/src/app/state-management/models/index.ts b/src/app/state-management/models/index.ts index 80b06f35c..08fd5021c 100644 --- a/src/app/state-management/models/index.ts +++ b/src/app/state-management/models/index.ts @@ -1,40 +1,7 @@ -import { - User, - UserIdentity, - UserSetting, - Job, - Dataset, - RawDataset, - Proposal, - Policy, - Sample, - Logbook, - PublishedData, - Attachment, - Instrument, -} from "shared/sdk/models"; -export { - User, - UserIdentity, - UserSetting, - Job, - Dataset, - RawDataset, - Proposal, - Policy, - Sample, - Logbook, - PublishedData, - Attachment, - Instrument, -}; - -import { DatasetInterface } from "shared/sdk"; import { ConditionConfig, FilterConfig, } from "shared/modules/filters/filters.module"; -export { DatasetInterface }; export interface Settings { tapeCopies: string; diff --git a/src/app/state-management/reducers/datasets.reducer.ts b/src/app/state-management/reducers/datasets.reducer.ts index b79962278..e2e0ec8d6 100644 --- a/src/app/state-management/reducers/datasets.reducer.ts +++ b/src/app/state-management/reducers/datasets.reducer.ts @@ -4,11 +4,8 @@ import { DatasetState, } from "state-management/state/datasets.store"; import * as fromActions from "state-management/actions/datasets.actions"; -import { - ArchViewMode, - Dataset, - ScientificCondition, -} from "state-management/models"; +import { ArchViewMode, ScientificCondition } from "state-management/models"; +import { DatasetClass } from "@scicatproject/scicat-sdk-ts"; const reducer = createReducer( initialDatasetState, @@ -131,7 +128,7 @@ const reducer = createReducer( fromActions.addDatasetCompleteAction, (state, { dataset }): DatasetState => ({ ...state, - currentSet: dataset as unknown as Dataset, + currentSet: dataset, }), ), diff --git a/src/app/state-management/reducers/instruments.reducer.spec.ts b/src/app/state-management/reducers/instruments.reducer.spec.ts index c19ae08ee..876157d58 100644 --- a/src/app/state-management/reducers/instruments.reducer.spec.ts +++ b/src/app/state-management/reducers/instruments.reducer.spec.ts @@ -1,5 +1,5 @@ import * as fromActions from "state-management/actions/instruments.actions"; -import { Instrument } from "shared/sdk"; +import { Instrument } from "@scicatproject/scicat-sdk-ts"; import { instrumentsReducer } from "./instruments.reducer"; import { initialInstrumentState } from "state-management/state/instruments.store"; diff --git a/src/app/state-management/reducers/jobs.reducer.spec.ts b/src/app/state-management/reducers/jobs.reducer.spec.ts index 21460d7c7..b43996e18 100644 --- a/src/app/state-management/reducers/jobs.reducer.spec.ts +++ b/src/app/state-management/reducers/jobs.reducer.spec.ts @@ -1,5 +1,5 @@ import { jobsReducer } from "./jobs.reducer"; -import { JobInterface, Job } from "shared/sdk"; +import { JobInterface, Job } from "@scicatproject/scicat-sdk-ts"; import * as fromActions from "../actions/jobs.actions"; import { initialJobsState } from "state-management/state/jobs.store"; diff --git a/src/app/state-management/reducers/policies.reducer.spec.ts b/src/app/state-management/reducers/policies.reducer.spec.ts index 743d7e55d..9211e00c0 100644 --- a/src/app/state-management/reducers/policies.reducer.spec.ts +++ b/src/app/state-management/reducers/policies.reducer.spec.ts @@ -1,6 +1,6 @@ import * as fromActions from "state-management/actions/policies.actions"; import { policiesReducer } from "./policies.reducer"; -import { Policy } from "shared/sdk"; +import { Policy } from "@scicatproject/scicat-sdk-ts"; import { initialPolicyState } from "state-management/state/policies.store"; describe("PoliciesReducer", () => { diff --git a/src/app/state-management/reducers/policies.reducer.ts b/src/app/state-management/reducers/policies.reducer.ts index 1de8609c2..35ad7ddf1 100644 --- a/src/app/state-management/reducers/policies.reducer.ts +++ b/src/app/state-management/reducers/policies.reducer.ts @@ -41,7 +41,7 @@ const reducer = createReducer( on(fromActions.selectPolicyAction, (state, { policy }): PolicyState => { const alreadySelected = state.selectedPolicies.find( - (existing) => existing.id === policy.id, + (existing) => existing._id === policy._id, ); if (alreadySelected) { return state; @@ -52,7 +52,7 @@ const reducer = createReducer( }), on(fromActions.deselectPolicyAction, (state, { policy }): PolicyState => { const selectedPolicies = state.selectedPolicies.filter( - (selectedPolicy) => selectedPolicy.id !== policy.id, + (selectedPolicy) => selectedPolicy._id !== policy._id, ); return { ...state, selectedPolicies }; }), diff --git a/src/app/state-management/reducers/proposals.reducer.spec.ts b/src/app/state-management/reducers/proposals.reducer.spec.ts index ba07f5e73..0ff7b4176 100644 --- a/src/app/state-management/reducers/proposals.reducer.spec.ts +++ b/src/app/state-management/reducers/proposals.reducer.spec.ts @@ -5,7 +5,7 @@ import { } from "../state/proposals.store"; import * as fromActions from "../actions/proposals.actions"; import { Attachment, Dataset, DatasetInterface, Proposal } from "../models"; -import { ProposalInterface } from "shared/sdk"; +import { ProposalInterface } from "@scicatproject/scicat-sdk-ts"; const proposalData: ProposalInterface = { proposalId: "testId", diff --git a/src/app/state-management/reducers/proposals.reducer.ts b/src/app/state-management/reducers/proposals.reducer.ts index bf343e896..167d12f49 100644 --- a/src/app/state-management/reducers/proposals.reducer.ts +++ b/src/app/state-management/reducers/proposals.reducer.ts @@ -62,7 +62,7 @@ const reducer = createReducer( fromActions.addAttachmentCompleteAction, (state, { attachment }): ProposalsState => { if (state.currentProposal) { - const attachments = state.currentProposal.attachments; + const attachments = (state.currentProposal as any).attachments; attachments.push(attachment); const currentProposal = { ...state.currentProposal, attachments }; return { ...state, currentProposal }; @@ -75,7 +75,7 @@ const reducer = createReducer( fromActions.updateAttachmentCaptionCompleteAction, (state, { attachment }): ProposalsState => { if (state.currentProposal) { - const attachments = state.currentProposal.attachments.filter( + const attachments = (state.currentProposal as any).attachments.filter( (existingAttachment) => existingAttachment.id !== attachment.id, ); attachments.push(attachment); @@ -90,7 +90,7 @@ const reducer = createReducer( fromActions.removeAttachmentCompleteAction, (state, { attachmentId }): ProposalsState => { if (state.currentProposal) { - const attachments = state.currentProposal.attachments.filter( + const attachments = (state.currentProposal as any).attachments.filter( (attachment) => attachment.id !== attachmentId, ); const currentProposal = { ...state.currentProposal, attachments }; diff --git a/src/app/state-management/reducers/published-data.reducer.spec.ts b/src/app/state-management/reducers/published-data.reducer.spec.ts index c60b465ff..fbd6b7583 100644 --- a/src/app/state-management/reducers/published-data.reducer.spec.ts +++ b/src/app/state-management/reducers/published-data.reducer.spec.ts @@ -1,7 +1,10 @@ import { initialPublishedDataState } from "state-management/state/published-data.store"; import * as fromActions from "state-management/actions/published-data.actions"; import { publishedDataReducer } from "./published-data.reducer"; -import { PublishedData, PublishedDataInterface } from "shared/sdk"; +import { + PublishedData, + PublishedDataInterface, +} from "@scicatproject/scicat-sdk-ts"; const data: PublishedDataInterface = { doi: "testDOI", diff --git a/src/app/state-management/reducers/samples.reducer.spec.ts b/src/app/state-management/reducers/samples.reducer.spec.ts index 89337e827..ba45ae972 100644 --- a/src/app/state-management/reducers/samples.reducer.spec.ts +++ b/src/app/state-management/reducers/samples.reducer.spec.ts @@ -8,7 +8,7 @@ import { SampleFilters, ScientificCondition, } from "../models"; -import { SampleInterface } from "shared/sdk"; +import { SampleInterface } from "@scicatproject/scicat-sdk-ts"; const data: SampleInterface = { sampleId: "testId", diff --git a/src/app/state-management/reducers/user.reducer.spec.ts b/src/app/state-management/reducers/user.reducer.spec.ts index 720d9a3eb..b32b60adb 100644 --- a/src/app/state-management/reducers/user.reducer.spec.ts +++ b/src/app/state-management/reducers/user.reducer.spec.ts @@ -9,7 +9,7 @@ import { UserIdentity, TableColumn, } from "../models"; -import { AccessToken, UserSetting } from "shared/sdk"; +import { AccessToken, UserSetting } from "@scicatproject/scicat-sdk-ts"; import { HttpErrorResponse } from "@angular/common/http"; describe("UserReducer", () => { diff --git a/src/app/state-management/reducers/user.reducer.ts b/src/app/state-management/reducers/user.reducer.ts index 54a8db1bb..8fdfea70f 100644 --- a/src/app/state-management/reducers/user.reducer.ts +++ b/src/app/state-management/reducers/user.reducer.ts @@ -61,8 +61,9 @@ const reducer = createReducer( on( fromActions.fetchUserSettingsCompleteAction, (state, { userSettings }): UserState => { - const { datasetCount, jobCount, columns } = userSettings; + const { datasetCount, jobCount, externalSettings } = userSettings; const settings = { ...state.settings, datasetCount, jobCount }; + const columns = (externalSettings as any)?.columns || []; if (columns.length > 0) { return { ...state, settings, columns }; } else { @@ -74,8 +75,9 @@ const reducer = createReducer( on( fromActions.updateUserSettingsCompleteAction, (state, { userSettings }): UserState => { - const { datasetCount, jobCount, columns = [] } = userSettings; + const { datasetCount, jobCount, externalSettings } = userSettings; const settings = { ...state.settings, datasetCount, jobCount }; + const columns = (externalSettings as any)?.columns || []; if (columns.length > 0) { return { ...state, settings, columns }; } else { diff --git a/src/app/state-management/selectors/jobs.selectors.spec.ts b/src/app/state-management/selectors/jobs.selectors.spec.ts index c20da5203..9aa33bf3e 100644 --- a/src/app/state-management/selectors/jobs.selectors.spec.ts +++ b/src/app/state-management/selectors/jobs.selectors.spec.ts @@ -1,7 +1,7 @@ import * as fromSelectors from "./jobs.selectors"; import { JobsState } from "../state/jobs.store"; -import { JobInterface, Job } from "shared/sdk"; +import { JobInterface, Job } from "@scicatproject/scicat-sdk-ts"; const data: JobInterface = { id: "testId", diff --git a/src/app/state-management/selectors/proposals.selectors.spec.ts b/src/app/state-management/selectors/proposals.selectors.spec.ts index 9ae84a756..95449f1cc 100644 --- a/src/app/state-management/selectors/proposals.selectors.spec.ts +++ b/src/app/state-management/selectors/proposals.selectors.spec.ts @@ -63,16 +63,6 @@ describe("Proposal Selectors", () => { }); }); - describe("selectCurrentAttachments", () => { - it("should select attachments from current proposal", () => { - expect( - fromSelectors.selectCurrentAttachments.projector( - initialProposalsState.currentProposal, - ), - ).toEqual(attachments); - }); - }); - describe("selectProposalDatasets", () => { it("should select datasets belonging to current proposal", () => { expect( diff --git a/src/app/state-management/selectors/proposals.selectors.ts b/src/app/state-management/selectors/proposals.selectors.ts index 3e36a0448..51b4ce3a6 100644 --- a/src/app/state-management/selectors/proposals.selectors.ts +++ b/src/app/state-management/selectors/proposals.selectors.ts @@ -20,7 +20,8 @@ export const selectParentProposal = createSelector( export const selectCurrentAttachments = createSelector( selectCurrentProposal, - (proposal) => (proposal ? proposal.attachments : []), + // TODO: Check if this is still relevant because proposal doesn't have attachments in the schema + (proposal) => (proposal ? (proposal as any).attachments : []), ); export const selectProposalDatasets = createSelector( diff --git a/src/app/state-management/selectors/published-data.selectors.spec.ts b/src/app/state-management/selectors/published-data.selectors.spec.ts index 8ca7089c8..655664e55 100644 --- a/src/app/state-management/selectors/published-data.selectors.spec.ts +++ b/src/app/state-management/selectors/published-data.selectors.spec.ts @@ -1,4 +1,7 @@ -import { PublishedDataInterface, PublishedData } from "shared/sdk"; +import { + PublishedDataInterface, + PublishedData, +} from "@scicatproject/scicat-sdk-ts"; import { GenericFilters } from "state-management/models"; import { PublishedDataState } from "state-management/state/published-data.store"; import * as fromSelectors from "./published-data.selectors"; diff --git a/src/app/state-management/selectors/samples.selectors.spec.ts b/src/app/state-management/selectors/samples.selectors.spec.ts index 11e4fdd1b..8a3d3c5db 100644 --- a/src/app/state-management/selectors/samples.selectors.spec.ts +++ b/src/app/state-management/selectors/samples.selectors.spec.ts @@ -1,6 +1,6 @@ import * as fromSelectors from "./samples.selectors"; import { SampleState } from "state-management/state/samples.store"; -import { SampleInterface, Sample } from "shared/sdk"; +import { SampleInterface, Sample } from "@scicatproject/scicat-sdk-ts"; import { initialUserState } from "state-management/state/user.store"; const data: SampleInterface = { diff --git a/src/app/state-management/selectors/user.selectors.spec.ts b/src/app/state-management/selectors/user.selectors.spec.ts index 6bd2bc708..4f1f12d04 100644 --- a/src/app/state-management/selectors/user.selectors.spec.ts +++ b/src/app/state-management/selectors/user.selectors.spec.ts @@ -2,7 +2,7 @@ import * as fromSelectors from "./user.selectors"; import { UserState } from "../state/user.store"; import { User, UserIdentity, Settings } from "../models"; -import { AccessToken } from "shared/sdk"; +import { AccessToken } from "@scicatproject/scicat-sdk-ts"; import { LocationFilterComponent } from "../../shared/modules/filters/location-filter.component"; import { PidFilterComponent } from "../../shared/modules/filters/pid-filter.component"; import { PidFilterContainsComponent } from "../../shared/modules/filters/pid-filter-contains.component"; diff --git a/src/app/state-management/state/datasets.store.ts b/src/app/state-management/state/datasets.store.ts index ad84c0ea0..b1c9ce9b8 100644 --- a/src/app/state-management/state/datasets.store.ts +++ b/src/app/state-management/state/datasets.store.ts @@ -1,4 +1,6 @@ -import { DatasetFilters, Dataset, ArchViewMode } from "state-management/models"; +import { DatasetClass } from "@scicatproject/scicat-sdk-ts"; +import { DatasetFilters, ArchViewMode } from "state-management/models"; +import { OutputDatasetObsoleteDto } from "@scicatproject/scicat-sdk-ts"; export interface DateTriple { year: number; @@ -21,10 +23,10 @@ export interface Pagination { } export interface DatasetState { - datasets: Dataset[]; - selectedSets: Dataset[]; - currentSet: Dataset | undefined; - relatedDatasets: Dataset[]; + datasets: OutputDatasetObsoleteDto[]; + selectedSets: OutputDatasetObsoleteDto[]; + currentSet: OutputDatasetObsoleteDto | undefined; + relatedDatasets: OutputDatasetObsoleteDto[]; relatedDatasetsCount: number; totalCount: number; @@ -43,7 +45,7 @@ export interface DatasetState { sortField: string; }; - batch: Dataset[]; + batch: OutputDatasetObsoleteDto[]; openwhiskResult: Record | undefined; } diff --git a/src/app/state-management/state/instruments.store.ts b/src/app/state-management/state/instruments.store.ts index 5a261ac5c..fa1a2f16b 100644 --- a/src/app/state-management/state/instruments.store.ts +++ b/src/app/state-management/state/instruments.store.ts @@ -1,4 +1,5 @@ -import { Instrument, GenericFilters } from "../models"; +import { Instrument } from "@scicatproject/scicat-sdk-ts"; +import { GenericFilters } from "../models"; export interface InstrumentState { instruments: Instrument[]; diff --git a/src/app/state-management/state/jobs.store.ts b/src/app/state-management/state/jobs.store.ts index 82ea1b61a..365e0ede3 100644 --- a/src/app/state-management/state/jobs.store.ts +++ b/src/app/state-management/state/jobs.store.ts @@ -1,8 +1,9 @@ -import { Job, JobFilters } from "state-management/models"; +import { JobClass } from "@scicatproject/scicat-sdk-ts"; +import { JobFilters } from "state-management/models"; export interface JobsState { - jobs: Job[]; - currentJob: Job | undefined; + jobs: JobClass[]; + currentJob: JobClass | undefined; totalCount: number; diff --git a/src/app/state-management/state/logbooks.store.ts b/src/app/state-management/state/logbooks.store.ts index d3e580c4b..2f8f90210 100644 --- a/src/app/state-management/state/logbooks.store.ts +++ b/src/app/state-management/state/logbooks.store.ts @@ -1,8 +1,9 @@ -import { Logbook, LogbookFilters } from "state-management/models"; +import { Logbook } from "@scicatproject/scicat-sdk-ts"; +import { LogbookFilters } from "state-management/models"; export interface LogbookState { logbooks: Logbook[]; - currentLogbook: Logbook | undefined; + currentLogbook: any | undefined; totalCount: number; diff --git a/src/app/state-management/state/policies.store.ts b/src/app/state-management/state/policies.store.ts index 9dd018486..6c740123d 100644 --- a/src/app/state-management/state/policies.store.ts +++ b/src/app/state-management/state/policies.store.ts @@ -1,4 +1,5 @@ -import { GenericFilters, Policy } from "state-management/models"; +import { Policy } from "@scicatproject/scicat-sdk-ts"; +import { GenericFilters } from "state-management/models"; export interface PolicyState { policies: Policy[]; diff --git a/src/app/state-management/state/proposals.store.ts b/src/app/state-management/state/proposals.store.ts index d079192f9..ce4de4254 100644 --- a/src/app/state-management/state/proposals.store.ts +++ b/src/app/state-management/state/proposals.store.ts @@ -1,4 +1,7 @@ -import { Proposal, Dataset } from "../models"; +import { + OutputDatasetObsoleteDto, + ProposalClass, +} from "@scicatproject/scicat-sdk-ts"; export interface DateRange { begin: string; @@ -21,10 +24,10 @@ export interface ProposalDatesetFilters { } export interface ProposalsState { - proposals: Proposal[]; - currentProposal: Proposal | undefined; - parentProposal: Proposal | undefined; - datasets: Dataset[]; + proposals: ProposalClass[]; + currentProposal: ProposalClass | undefined; + parentProposal: ProposalClass | undefined; + datasets: OutputDatasetObsoleteDto[]; proposalsCount: number; datasetsCount: number; diff --git a/src/app/state-management/state/published-data.store.ts b/src/app/state-management/state/published-data.store.ts index a79b3cd3a..94f1fda50 100644 --- a/src/app/state-management/state/published-data.store.ts +++ b/src/app/state-management/state/published-data.store.ts @@ -1,4 +1,5 @@ -import { PublishedData, GenericFilters } from "state-management/models"; +import { PublishedData } from "@scicatproject/scicat-sdk-ts"; +import { GenericFilters } from "state-management/models"; export interface PublishedDataState { publishedData: PublishedData[]; diff --git a/src/app/state-management/state/samples.store.ts b/src/app/state-management/state/samples.store.ts index 139f9bb5a..56f394cbd 100644 --- a/src/app/state-management/state/samples.store.ts +++ b/src/app/state-management/state/samples.store.ts @@ -1,16 +1,15 @@ import { - Sample, - SampleFilters, - Dataset, - GenericFilters, Attachment, -} from "state-management/models"; + OutputDatasetObsoleteDto, + SampleClass, +} from "@scicatproject/scicat-sdk-ts"; +import { SampleFilters, GenericFilters } from "state-management/models"; export interface SampleState { - samples: Sample[]; + samples: SampleClass[]; attachments: Attachment[]; - currentSample: Sample | undefined; - datasets: Dataset[]; + currentSample: SampleClass | undefined; + datasets: OutputDatasetObsoleteDto[]; metadataKeys: string[]; samplesCount: number; diff --git a/src/app/state-management/state/user.store.ts b/src/app/state-management/state/user.store.ts index 664bf7dde..c159b9283 100644 --- a/src/app/state-management/state/user.store.ts +++ b/src/app/state-management/state/user.store.ts @@ -1,5 +1,6 @@ -import { Settings, Message, User, TableColumn } from "../models"; -import { AccessToken } from "shared/sdk"; +import { Settings, Message, TableColumn } from "../models"; +import { AccessTokenInterface } from "shared/services/auth/auth.service"; +import { ReturnedUserDto } from "@scicatproject/scicat-sdk-ts"; import { ConditionConfig, FilterConfig, @@ -7,11 +8,11 @@ import { // NOTE It IS ok to make up a state of other sub states export interface UserState { - currentUser: User | undefined; + currentUser: ReturnedUserDto | undefined; accountType?: string; profile?: any; - scicatToken: AccessToken; + scicatToken: AccessTokenInterface; settings: Settings; @@ -39,7 +40,7 @@ export const initialUserState: UserState = { scopes: ["string"], created: new Date(), userId: "", - user: {}, + user: { id: "", username: "", email: "", authStrategy: "" }, }, settings: { diff --git a/src/app/users/adauth.service.ts b/src/app/users/adauth.service.ts index c7c1a08eb..932379f8a 100644 --- a/src/app/users/adauth.service.ts +++ b/src/app/users/adauth.service.ts @@ -1,9 +1,9 @@ import { Injectable } from "@angular/core"; import { HttpClient, HttpResponse, HttpHeaders } from "@angular/common/http"; -import { LoopBackConfig } from "shared/sdk/lb.config"; import { Observable } from "rxjs"; import { timeout } from "rxjs/operators"; import { AppConfigService } from "app-config.service"; +import { Configuration } from "@scicatproject/scicat-sdk-ts"; export interface Credentials { username: string; @@ -24,6 +24,7 @@ export interface AccessToken { export class ADAuthService { constructor( private appConfigService: AppConfigService, + private apiConfig: Configuration, private http: HttpClient, ) {} @@ -46,7 +47,7 @@ export class ADAuthService { }; const appConfig = this.appConfigService.getConfig(); const headers = new HttpHeaders(); - const url = LoopBackConfig.getPath() + appConfig.externalAuthEndpoint; + const url = this.apiConfig.basePath + appConfig.externalAuthEndpoint; headers.append("Content-Type", "application/x-www-form-urlencoded"); return this.http .post(url, creds, { observe: "response" }) diff --git a/src/app/users/user-settings/user-settings.component.ts b/src/app/users/user-settings/user-settings.component.ts index 6ca694a00..270f2b1f4 100644 --- a/src/app/users/user-settings/user-settings.component.ts +++ b/src/app/users/user-settings/user-settings.component.ts @@ -41,10 +41,9 @@ export class UserSettingsComponent implements OnInit { } ngOnInit() { - this.vm$.subscribe( - (settings) => - (this.tokenValue = settings.scicatToken.replace("Bearer ", "")), - ); + this.vm$.subscribe((settings) => { + this.tokenValue = settings.scicatToken; + }); this.store.dispatch(fetchCurrentUserAction()); this.store.dispatch(fetchScicatTokenAction());