refactor: api dto

This commit is contained in:
scarqin 2023-03-27 18:39:59 +08:00
parent 5650597e05
commit 1833c77689
89 changed files with 349 additions and 666 deletions

View File

@ -1,4 +1,4 @@
const baseUrl = './src/browser/src/app/shared/services/storage/';
const baseUrl = './src/browser/src/app/services/storage/';
module.exports = {
entry: {
// target: ["./test/apiData.ts", "./test/env.ts"]

View File

@ -7,7 +7,7 @@ import { TabOperateService } from 'pc/browser/src/app/components/eo-ui/tab/tab-o
import { TabStorageService } from 'pc/browser/src/app/components/eo-ui/tab/tab-storage.service';
import { TabItem, TabOperate } from 'pc/browser/src/app/components/eo-ui/tab/tab.model';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { filter, Subscription } from 'rxjs';
import { ModalService } from '../../../services/modal.service';

View File

@ -7,8 +7,8 @@ import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { EXPORT_API } from 'pc/browser/src/app/shared/constans/featureName';
import { ExtensionChange } from 'pc/browser/src/app/shared/decorators';
import { FeatureInfo } from 'pc/browser/src/app/shared/models/extension-manager';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import StorageUtil from 'pc/browser/src/app/shared/utils/storage/storage.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { Subject, takeUntil } from 'rxjs';
// shit angular-cli 配不明白

View File

@ -9,7 +9,7 @@ import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { IMPORT_API } from 'pc/browser/src/app/shared/constans/featureName';
import { ExtensionChange } from 'pc/browser/src/app/shared/decorators';
import { FeatureInfo } from 'pc/browser/src/app/shared/models/extension-manager';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

View File

@ -8,8 +8,8 @@ import { EoSchemaFormComponent } from 'pc/browser/src/app/shared/components/sche
import { PULL_API } from 'pc/browser/src/app/shared/constans/featureName';
import { ExtensionChange } from 'pc/browser/src/app/shared/decorators';
import { FeatureInfo } from 'pc/browser/src/app/shared/models/extension-manager';
import { EffectService } from 'pc/browser/src/app/store/effect.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { EffectService } from 'pc/browser/src/app/shared/store/effect.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { Subject } from 'rxjs';
import { eoDeepCopy } from '../../../shared/utils/index.utils';

View File

@ -3,7 +3,7 @@ import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { autorun, reaction } from 'mobx';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { StoreService } from '../../store/state.service';
import { StoreService } from '../../shared/store/state.service';
import { MemberService } from './member.service';
@Component({

View File

@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { NpsPositionDirective } from 'pc/browser/src/app/components/nps-mask/nps-mask-postion.directive';
import { APP_CONFIG } from 'pc/browser/src/environments/environment';
import { StoreService } from '../../../store/state.service';
import { StoreService } from '../../../shared/store/state.service';
@Component({
selector: 'pc-nps-mask',

View File

@ -3,7 +3,7 @@ import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators }
import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { MessageService } from 'pc/browser/src/app/services/message/message.service';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
@Component({
selector: 'eo-account',

View File

@ -1,6 +1,6 @@
import { Component, Input } from '@angular/core';
import { AccountComponent } from 'pc/browser/src/app/components/system-setting/common/account.component';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { SettingItem } from '../eo-ui/setting/setting.component';
import { AboutComponent, LanguageSwticherComponent, SelectThemeComponent, TokenComponent } from './common';

View File

@ -7,9 +7,9 @@ import { PROTOCOL } from 'pc/browser/src/app/shared/models/protocol.constant';
import { APP_CONFIG } from 'pc/browser/src/environments/environment';
import packageJson from '../../../../../../../package.json';
import { StoreService } from '../../../shared/store/state.service';
import { getBrowserType } from '../../../shared/utils/browser-type';
import StorageUtil from '../../../shared/utils/storage/storage.utils';
import { StoreService } from '../../../store/state.service';
type DescriptionsItem = {
readonly id: string;

View File

@ -3,8 +3,8 @@ import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { autorun } from 'mobx';
import { MessageService } from 'pc/browser/src/app/services/message';
import { IS_SHOW_REMOTE_SERVER_NOTIFICATION } from 'pc/browser/src/app/shared/models/storageKeys.constant';
import { EffectService } from 'pc/browser/src/app/store/effect.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { EffectService } from 'pc/browser/src/app/shared/store/effect.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { StorageUtil } from '../../shared/utils/storage/storage.utils';

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { autorun } from 'mobx';
import { StoreService } from '../../../store/state.service';
import { StoreService } from '../../../shared/store/state.service';
@Component({
selector: 'eo-nav-breadcrumb',

View File

@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { EffectService } from 'pc/browser/src/app/store/effect.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { EffectService } from 'pc/browser/src/app/shared/store/effect.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { FeatureControlService } from '../../../../core/services/feature-control/feature-control.service';
import { DataSourceService } from '../../../../services/data-source/data-source.service';

View File

@ -6,7 +6,7 @@ import { FeatureControlService } from '../../../core/services/feature-control/fe
import { DataSourceService } from '../../../services/data-source/data-source.service';
import { MessageService } from '../../../services/message';
import { ApiService } from '../../../services/storage/api.service';
import { StoreService } from '../../../store/state.service';
import { StoreService } from '../../../shared/store/state.service';
@Component({
selector: 'pc-btn-user',

View File

@ -1,8 +1,8 @@
import { Component } from '@angular/core';
import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { EffectService } from 'pc/browser/src/app/shared/store/effect.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { copy } from 'pc/browser/src/app/shared/utils/index.utils';
import { EffectService } from 'pc/browser/src/app/store/effect.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { interval } from 'rxjs';
import { DataSourceService } from '../../services/data-source/data-source.service';

View File

@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
import { NzModalService } from 'ng-zorro-antd/modal';
import { ExtensionComponent } from 'pc/browser/src/app/pages/components/extension/extension.component';
import { MessageService } from 'pc/browser/src/app/services/message';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { APP_CONFIG } from 'pc/browser/src/environments/environment';
import { interval, Subject, takeUntil } from 'rxjs';
import { distinct } from 'rxjs/operators';

View File

@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { APP_CONFIG } from 'pc/browser/src/environments/environment';
import { ApiService } from '../../../services/storage/api.service';
import { StoreService } from '../../../store/state.service';
import { StoreService } from '../../../shared/store/state.service';
@Component({
selector: 'pc-share-navbar',

View File

@ -6,7 +6,7 @@ import { Message, MessageService } from 'pc/browser/src/app/services/message';
import { SIDEBAR_VIEW } from 'pc/browser/src/app/shared/constans/featureName';
import { ExtensionChange, ExtensionMessage } from 'pc/browser/src/app/shared/decorators';
import { ExtensionInfo } from 'pc/browser/src/app/shared/models/extension-manager';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { Subscription } from 'rxjs';
import { filter } from 'rxjs/operators';

View File

@ -10,8 +10,8 @@ import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { FEATURE_CONTROL } from 'pc/browser/src/app/shared/constans/featureName';
import { ExtensionChange, ExtensionMessage } from 'pc/browser/src/app/shared/decorators';
import { ExtensionInfo } from 'pc/browser/src/app/shared/models/extension-manager';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import StorageUtil from 'pc/browser/src/app/shared/utils/storage/storage.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { APP_CONFIG } from 'pc/browser/src/environments/environment';
import { ChatRobotModule } from '../../../components/chat-robot/chat-robot.module';

View File

@ -3,7 +3,7 @@ import { autorun, reaction } from 'mobx';
import { WebService } from 'pc/browser/src/app/core/services';
import { LanguageService } from 'pc/browser/src/app/core/services/language/language.service';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { APP_CONFIG } from 'pc/browser/src/environments/environment';
// * type(0=wechat, 1=qq, 2=github, 3=feishu, 4=corp_wechat, 5=ding_talk, 6=oauth2)

View File

@ -9,8 +9,8 @@ import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { LocalService } from 'pc/browser/src/app/services/storage/local.service';
import { RemoteService } from 'pc/browser/src/app/services/storage/remote.service';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { EffectService } from 'pc/browser/src/app/store/effect.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { EffectService } from 'pc/browser/src/app/shared/store/effect.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { interval, Subject } from 'rxjs';
import { distinct, takeUntil } from 'rxjs/operators';

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
import { Observable } from 'rxjs';
import { StoreService } from '../../store/state.service';
import { StoreService } from '../../shared/store/state.service';
@Injectable()
export class RedirectSharedID implements CanActivate {

View File

@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
@Component({
selector: 'eo-share',

View File

@ -5,8 +5,8 @@ import { autorun } from 'mobx';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { ModalService } from '../../../../services/modal.service';
import { EffectService } from '../../../../store/effect.service';
import { StoreService } from '../../../../store/state.service';
import { EffectService } from '../../../../shared/store/effect.service';
import { StoreService } from '../../../../shared/store/state.service';
@Component({
selector: 'eo-workspace-setting',

View File

@ -7,7 +7,7 @@ import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { MemberListComponent } from '../../../../components/member-list/member-list.component';
import { MessageService } from '../../../../services/message/message.service';
import { StoreService } from '../../../../store/state.service';
import { StoreService } from '../../../../shared/store/state.service';
@Component({
selector: 'eo-workspace-member',

View File

@ -2,8 +2,8 @@ import { Injectable } from '@angular/core';
import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { autorun, toJS } from 'mobx';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { EffectService } from 'pc/browser/src/app/store/effect.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { EffectService } from 'pc/browser/src/app/shared/store/effect.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { Role, ROLE_TITLE_BY_ID } from '../../../../shared/models/member.model';

View File

@ -4,8 +4,8 @@ import { OperateProjectFormComponent } from 'pc/browser/src/app/pages/workspace/
import { ModalService } from 'pc/browser/src/app/services/modal.service';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { EffectService } from '../../../../store/effect.service';
import { StoreService } from '../../../../store/state.service';
import { EffectService } from '../../../../shared/store/effect.service';
import { StoreService } from '../../../../shared/store/state.service';
import { ProjectListService } from './project-list.service';
@Component({

View File

@ -4,8 +4,8 @@ import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { SettingService } from '../../../../components/system-setting/settings.service';
import { ModalService } from '../../../../services/modal.service';
import { EffectService } from '../../../../store/effect.service';
import { StoreService } from '../../../../store/state.service';
import { EffectService } from '../../../../shared/store/effect.service';
import { StoreService } from '../../../../shared/store/state.service';
import { OperateProjectFormComponent } from '../../project/components/operate-project-form.compoent';
type ListType = 'list' | 'card';
@Injectable({

View File

@ -6,7 +6,7 @@ import { MessageService } from 'pc/browser/src/app/services/message';
import { waitNextTick } from 'pc/browser/src/app/shared/utils/index.utils';
import { FeatureControlService } from '../../../core/services/feature-control/feature-control.service';
import { StoreService } from '../../../store/state.service';
import { StoreService } from '../../../shared/store/state.service';
import { ProjectListService } from './project-list/project-list.service';
@Component({

View File

@ -6,8 +6,8 @@ import { requestMethodMap } from 'pc/browser/src/app/pages/workspace/project/api
import { ApiStoreService } from 'pc/browser/src/app/pages/workspace/project/api/store/api-state.service';
import { Message } from 'pc/browser/src/app/services/message';
import { GroupModuleType, GroupType } from 'pc/browser/src/app/services/storage/db/dto/group.dto';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { flatTree } from 'pc/browser/src/app/shared/utils/tree/tree.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { debounceTime, Subject } from 'rxjs';
import { EoTabComponent } from '../../../../components/eo-ui/tab/tab.component';

View File

@ -7,7 +7,7 @@ import { ExtensionService } from 'pc/browser/src/app/services/extensions/extensi
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { API_PREVIEW_TAB } from 'pc/browser/src/app/shared/constans/featureName';
import { ExtensionChange } from 'pc/browser/src/app/shared/decorators';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { filter, Subject, takeUntil } from 'rxjs';
import { SidebarService } from '../../../../layouts/sidebar/sidebar.service';

View File

@ -1,10 +1,10 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { ApiService } from '../../../../services/storage/api.service';
import { ApiData } from '../../../../services/storage/db/models/apiData';
import { StoreService } from '../../../../store/state.service';
import { StoreService } from '../../../../shared/store/state.service';
import { ApiEffectService } from './store/api-effect.service';
@Injectable()

View File

@ -3,11 +3,10 @@ import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { ApiMockService } from 'pc/browser/src/app/pages/workspace/project/api/http/mock/api-mock.service';
import { ApiMockEditComponent } from 'pc/browser/src/app/pages/workspace/project/api/http/mock/edit/api-mock-edit.component';
import { ModalService } from 'pc/browser/src/app/services/modal.service';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { Mock } from 'pc/browser/src/app/services/storage/db/models';
import { eoDeepCopy, copy } from 'pc/browser/src/app/shared/utils/index.utils';
import { ApiData } from '../../../../../services/storage/db/models/apiData';
@Component({
selector: 'eo-api-mock-table',
template: ` <eo-ng-table-pro [columns]="mockListColumns" [nzData]="mockList"></eo-ng-table-pro>

View File

@ -1,8 +1,8 @@
import { Component, OnInit, Input, Output, EventEmitter, OnChanges, OnDestroy } from '@angular/core';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { Subject, takeUntil } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
import { BodyParam } from '../../../../../../services/storage/db/models/apiData';
import { ApiTableConf } from '../../constants/api.model';
import { ApiTableService } from '../../service/api-table.service';
@Component({

View File

@ -7,9 +7,9 @@ import { ImportApiComponent } from 'pc/browser/src/app/components/extension-sele
import { SyncApiComponent } from 'pc/browser/src/app/components/extension-select/sync-api/sync-api.component';
import { requestMethodMap } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { ModalService } from 'pc/browser/src/app/services/modal.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { eoDeepCopy, waitNextTick } from 'pc/browser/src/app/shared/utils/index.utils';
import { genComponentTree, getExpandGroupByKey } from 'pc/browser/src/app/shared/utils/tree/tree.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { ElectronService } from '../../../../../../core/services';
import { ProjectApiService } from '../../api.service';

View File

@ -1,13 +1,13 @@
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { cloneDeep, toArray, merge, isEmpty } from 'lodash-es';
import { cloneDeep, isEmpty } from 'lodash-es';
import { computed, observable, makeObservable, reaction } from 'mobx';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { pcMerge } from 'pc/browser/src/app/shared/utils/pc-merge';
import qs from 'qs';
import { BodyParam } from '../../../../../../services/storage/db/models/apiData';
import { form2json, xml2json, isXML, json2Table } from '../../../../../../shared/utils/data-transfer/data-transfer.utils';
import { eoDeepCopy, whatType } from '../../../../../../shared/utils/index.utils';
import { whatType } from '../../../../../../shared/utils/index.utils';
import { ApiParamsTypeJsonOrXml } from '../../constants/api.model';
const titleHash = new Map()

View File

@ -6,7 +6,7 @@ import { EditTabViewComponent } from 'pc/browser/src/app/components/eo-ui/tab/ta
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { Environment } from 'pc/browser/src/app/services/storage/db/models';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { fromEvent, Subject, takeUntil } from 'rxjs';
import { ColumnItem } from '../../../../../../components/eo-ui/table-pro/table-pro.model';

View File

@ -1,7 +1,7 @@
import { Component, OnDestroy, Output, EventEmitter } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { autorun, reaction, values } from 'mobx';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { filter, Subject } from 'rxjs';
import { ApiEffectService } from '../../store/api-effect.service';

View File

@ -4,7 +4,7 @@ import { SidebarService } from 'pc/browser/src/app/layouts/sidebar/sidebar.servi
import { ApiTestUtilService } from 'pc/browser/src/app/pages/workspace/project/api/service/api-test-util.service';
import { Environment } from 'pc/browser/src/app/services/storage/db/models';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { ApiEffectService } from '../../store/api-effect.service';
import { ApiStoreService } from '../../store/api-state.service';

View File

@ -8,7 +8,7 @@ import { AuthInfo, INHERIT_AUTH_OPTION } from 'pc/browser/src/app/pages/workspac
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { Group } from 'pc/browser/src/app/services/storage/db/models';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { fromEvent, Subject, takeUntil } from 'rxjs';
import { eoDeepCopy, JSONParse } from '../../../../../shared/utils/index.utils';

View File

@ -6,8 +6,8 @@ import { PreviewTabViewComponent } from 'pc/browser/src/app/components/eo-ui/tab
import { ElectronService } from 'pc/browser/src/app/core/services';
import { ApiBodyType } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { ApiStoreService } from 'pc/browser/src/app/pages/workspace/project/api/store/api-state.service';
import { ApiData } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { enumsToObject } from '../../../../../../shared/utils/index.utils';
import { ProjectApiService } from '../../api.service';

View File

@ -1,7 +1,7 @@
import { Component, OnInit, Input, OnChanges, OnDestroy } from '@angular/core';
import { ApiBodyType, ApiTableConf } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { ApiTableService } from 'pc/browser/src/app/pages/workspace/project/api/service/api-table.service';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { Subject } from 'rxjs';
@Component({

View File

@ -1,7 +1,7 @@
import { Component, OnInit, Input } from '@angular/core';
import { ApiTableConf } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { ApiTableService } from 'pc/browser/src/app/pages/workspace/project/api/service/api-table.service';
import { HeaderParam } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { HeaderParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
@Component({
selector: 'eo-api-detail-form',

View File

@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { ApiBodyType } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { BodyParam, ParamTypeEnum } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { ApiData } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { BodyParam, ApiData, ParamTypeEnum } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { eoDeepCopy } from 'pc/browser/src/app/shared/utils/index.utils';
import { filterTableData } from '../../../../../../shared/utils/tree/tree.utils';

View File

@ -9,10 +9,10 @@ import { EditTabViewComponent } from 'pc/browser/src/app/components/eo-ui/tab/ta
import { ApiBodyType, IMPORT_MUI, RequestMethod } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { ApiEditService } from 'pc/browser/src/app/pages/workspace/project/api/http/edit/api-edit.service';
import { generateRestFromUrl, syncUrlAndQuery } from 'pc/browser/src/app/pages/workspace/project/api/utils/api.utils';
import { ApiData } from 'pc/browser/src/app/services/storage/db/models';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { getExpandGroupByKey, PCTree } from 'pc/browser/src/app/shared/utils/tree/tree.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { Subject } from 'rxjs';
import { isEmptyObj, enumsToArr, waitNextTick } from '../../../../../../shared/utils/index.utils';

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { ProjectApiService } from 'pc/browser/src/app/pages/workspace/project/api/api.service';
import { ApiBodyType, Protocol, RequestMethod } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { ApiData } from 'pc/browser/src/app/services/storage/db/models';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import StorageUtil from 'pc/browser/src/app/shared/utils/storage/storage.utils';
import { ApiEditUtilService } from './api-edit-util.service';

View File

@ -9,7 +9,7 @@ import {
JsonRootType
} from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { ApiTableService } from 'pc/browser/src/app/pages/workspace/project/api/service/api-table.service';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { enumsToArr, eoDeepCopy } from 'pc/browser/src/app/shared/utils/index.utils';
import { Subject } from 'rxjs';
import { takeUntil, debounceTime, pairwise } from 'rxjs/operators';

View File

@ -5,8 +5,6 @@ import { ParamsEnum, ApiParamsTypeByNumber, ApiParamsType } from 'pc/browser/src
import { BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { REQURIED_ENUMS } from 'pc/browser/src/app/shared/models/shared.model';
import { cpSync } from 'fs';
@Component({
selector: 'eo-api-edit-params-extra-setting',
templateUrl: './api-params-extra-setting.component.html',
@ -141,7 +139,7 @@ export class ApiParamsExtraSettingComponent implements OnInit {
} else {
this.showLengthTable = !isNil(this.model.paramAttr.minLength || this.model.paramAttr.maxLength);
this.showValueTable = !isNil(this.model.paramAttr.minValue || this.model.paramAttr.maxValue);
this.showEnums = this.model.paramAttr?.paramValueList?.length;
this.showEnums = !!this.model.paramAttr?.paramValueList?.length;
}
}
}

View File

@ -1,7 +1,7 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { ApiTableConf } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { ApiTableService } from 'pc/browser/src/app/pages/workspace/project/api/service/api-table.service';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
@Component({
selector: 'eo-api-edit-form',

View File

@ -7,10 +7,10 @@ import { ApiMockTableComponent } from 'pc/browser/src/app/pages/workspace/projec
import { ApiMockService } from 'pc/browser/src/app/pages/workspace/project/api/http/mock/api-mock.service';
import { ApiMockEditComponent } from 'pc/browser/src/app/pages/workspace/project/api/http/mock/edit/api-mock-edit.component';
import { ModalService } from 'pc/browser/src/app/services/modal.service';
import { ApiData } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { PROTOCOL } from 'pc/browser/src/app/shared/models/protocol.constant';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
@Component({
selector: 'eo-api-mock',

View File

@ -3,9 +3,9 @@ import { ApiBodyType } from 'pc/browser/src/app/pages/workspace/project/api/cons
import { ApiTestUtilService } from 'pc/browser/src/app/pages/workspace/project/api/service/api-test-util.service';
import { syncUrlAndQuery } from 'pc/browser/src/app/pages/workspace/project/api/utils/api.utils';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { ApiData } from 'pc/browser/src/app/services/storage/db/models';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { json2xml, table2json } from 'pc/browser/src/app/shared/utils/data-transfer/data-transfer.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
@Injectable({
providedIn: 'root'

View File

@ -5,7 +5,7 @@ import { ProjectApiService } from 'pc/browser/src/app/pages/workspace/project/ap
import { ApiMockService } from 'pc/browser/src/app/pages/workspace/project/api/http/mock/api-mock.service';
import { MockService } from 'pc/browser/src/app/services/mock.service';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { ApiData } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { eoDeepCopy } from 'pc/browser/src/app/shared/utils/index.utils';
interface ModelType {

View File

@ -4,8 +4,8 @@ import { ApiTestUtilService } from 'pc/browser/src/app/pages/workspace/project/a
import { syncUrlAndQuery } from 'pc/browser/src/app/pages/workspace/project/api/utils/api.utils';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { ApiData } from 'pc/browser/src/app/services/storage/db/models';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { json2xml, table2json } from 'pc/browser/src/app/shared/utils/data-transfer/data-transfer.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
@Injectable()
export class MockService {

View File

@ -37,8 +37,8 @@ import { ApiTestResultResponseComponent } from 'pc/browser/src/app/pages/workspa
import { ApiTestResData, TestServerRes } from 'pc/browser/src/app/pages/workspace/project/api/service/test-server/test-server.model';
import { generateRestFromUrl, syncUrlAndQuery } from 'pc/browser/src/app/pages/workspace/project/api/utils/api.utils';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import StorageUtil from 'pc/browser/src/app/shared/utils/storage/storage.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { interval, Subscription, Subject } from 'rxjs';
import { takeUntil, distinctUntilChanged, takeWhile, finalize } from 'rxjs/operators';

View File

@ -1,5 +1,5 @@
import { ApiTestResData } from 'pc/browser/src/app/pages/workspace/project/api/service/test-server/test-server.model';
import { ApiData } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
export enum ApiTestParamsTypeFormData {
text = 'string',

View File

@ -11,7 +11,7 @@ import {
IMPORT_MUI
} from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { ApiTableService } from 'pc/browser/src/app/pages/workspace/project/api/service/api-table.service';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { transferFileToDataUrl, whatTextType, whatType } from 'pc/browser/src/app/shared/utils/index.utils';
import { Observable, Observer, pairwise, Subject, takeUntil } from 'rxjs';

View File

@ -1,6 +1,6 @@
import { Pipe, PipeTransform } from '@angular/core';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { BodyParam } from '../../../../../services/storage/db/models/apiData';
@Pipe({
name: 'apiParamsNum'
})

View File

@ -1,9 +1,9 @@
import { Injectable } from '@angular/core';
import { has, omit } from 'lodash-es';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { ColumnItem, TableProSetting } from '../../../../../components/eo-ui/table-pro/table-pro.model';
import { EoModalOptions, ModalService } from '../../../../../services/modal.service';
import { BodyParam } from '../../../../../services/storage/db/models/apiData';
import { REQURIED_ENUMS } from '../../../../../shared/models/shared.model';
import { enumsToArr, eoDeepCopy, JSONParse } from '../../../../../shared/utils/index.utils';
import { filterTableData } from '../../../../../shared/utils/tree/tree.utils';

View File

@ -1,9 +1,8 @@
import { Injectable } from '@angular/core';
import { ApiBodyType, ApiParamsType, JsonRootType, Protocol } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { syncUrlAndQuery } from 'pc/browser/src/app/pages/workspace/project/api/utils/api.utils';
import { ApiData, BodyParam, HeaderParam, RestParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { ApiData } from '../../../../../services/storage/db/models';
import { BodyParam, HeaderParam, RestParam } from '../../../../../services/storage/db/models/apiData';
import { table2json, text2table, json2xml } from '../../../../../shared/utils/data-transfer/data-transfer.utils';
import { eoDeepCopy, JSONParse } from '../../../../../shared/utils/index.utils';
import { ApiEditUtilService } from '../http/edit/api-edit-util.service';

View File

@ -13,7 +13,7 @@ import {
TestServer,
TestServerRes
} from 'pc/browser/src/app/pages/workspace/project/api/service/test-server/test-server.model';
import { ApiData, BodyParam } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { ApiData, BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { whatType } from 'pc/browser/src/app/shared/utils/index.utils';
import { TestLocalNodeData } from './local-node/api-server-data.model';

View File

@ -2,9 +2,9 @@ import { Injectable } from '@angular/core';
import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { Group } from 'pc/browser/src/app/services/storage/db/models';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { JSONParse } from 'pc/browser/src/app/shared/utils/index.utils';
import { PCTree } from 'pc/browser/src/app/shared/utils/tree/tree.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { ApiStoreService } from './api-state.service';

View File

@ -1,6 +1,4 @@
import { method } from 'lodash-es';
import { QueryParam, RestParam } from '../../../../../services/storage/db/models/apiData';
import { QueryParam, RestParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
/**
* get rest param from url,format like {restName}

View File

@ -10,11 +10,11 @@ import { ElectronService } from 'pc/browser/src/app/core/services';
import { Protocol, ApiBodyType } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { ApiParamsNumPipe } from 'pc/browser/src/app/pages/workspace/project/api/pipe/api-param-num.pipe';
import { syncUrlAndQuery } from 'pc/browser/src/app/pages/workspace/project/api/utils/api.utils';
import { ApiData } from 'pc/browser/src/app/services/storage/db/models';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { isEmptyObj } from 'pc/browser/src/app/shared/utils/index.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { APP_CONFIG } from 'pc/browser/src/environments/environment';
import { fromEvent, Subject, takeUntil } from 'rxjs';
import { Subject, takeUntil } from 'rxjs';
import { io } from 'socket.io-client';
import { ModalService } from '../../../../../services/modal.service';

View File

@ -7,7 +7,7 @@ import { DataSourceService } from 'pc/browser/src/app/services/data-source/data-
import { MessageService } from 'pc/browser/src/app/services/message/message.service';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { MemberListComponent } from '../../../../components/member-list/member-list.component';

View File

@ -2,8 +2,8 @@ import { Injectable } from '@angular/core';
import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { autorun } from 'mobx';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { EffectService } from 'pc/browser/src/app/store/effect.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { EffectService } from 'pc/browser/src/app/shared/store/effect.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { Role, ROLE_TITLE_BY_ID } from '../../../../shared/models/member.model';

View File

@ -5,8 +5,8 @@ import { autorun, reaction, toJS } from 'mobx';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { ExtensionService } from 'pc/browser/src/app/services/extensions/extension.service';
import { TraceService } from 'pc/browser/src/app/services/trace.service';
import { EffectService } from 'pc/browser/src/app/store/effect.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { EffectService } from 'pc/browser/src/app/shared/store/effect.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { ExportApiComponent } from '../../../../components/extension-select/export-api/export-api.component';
import { ImportApiComponent } from '../../../../components/extension-select/import-api/import-api.component';

View File

@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { EoNgFeedbackDrawerService } from 'eo-ng-feedback';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
@Component({
selector: 'eo-workspace',

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { SettingService } from 'pc/browser/src/app/components/system-setting/settings.service';
import { WebService } from 'pc/browser/src/app/core/services';
import { MessageService } from 'pc/browser/src/app/services/message/message.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
/**
* Client need min fontend version

View File

@ -7,8 +7,8 @@ import { extensionMessageSubject } from 'pc/browser/src/app/shared/decorators';
import { defaultExtensions } from 'pc/browser/src/app/shared/models/extension';
import { FeatureInfo, ExtensionInfo, SidebarView } from 'pc/browser/src/app/shared/models/extension-manager';
import { DISABLE_EXTENSION_NAMES } from 'pc/browser/src/app/shared/models/storageKeys.constant';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import StorageUtil from 'pc/browser/src/app/shared/utils/storage/storage.utils';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { APP_CONFIG } from 'pc/browser/src/environments/environment';
import { lastValueFrom, Subscription } from 'rxjs';

View File

@ -3,7 +3,7 @@ import { NavigationExtras, Router } from '@angular/router';
import { SettingService } from 'pc/browser/src/app/components/system-setting/settings.service';
import { ModalService } from 'pc/browser/src/app/services/modal.service';
import { parseAndCheckCollections } from 'pc/browser/src/app/services/storage/db/validate/validate';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { MessageService } from './message';
import { ApiService } from './storage/api.service';

View File

@ -2,10 +2,10 @@ import { Injectable } from '@angular/core';
import { toJS } from 'mobx';
import { SettingService } from 'pc/browser/src/app/components/system-setting/settings.service';
import { RequestMethod } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { uniqueSlash } from 'pc/browser/src/app/pages/workspace/project/api/utils/api.utils';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import type { ApiData, Mock } from 'pc/browser/src/app/services/storage/db/models';
import { ApiDataFromList, BodyParam } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { ApiData, BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import type { Mock } from 'pc/browser/src/app/services/storage/db/models';
import { ApiDataFromList } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { ElectronService } from '../core/services';
import { ApiStoreService } from '../pages/workspace/project/api/store/api-state.service';

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { LocalService } from './local.service';
import { RemoteService } from './remote.service';
@ -43,7 +43,7 @@ export class ApiService {
workSpaceUuid?: any;
[key: string]: any;
}) {
return this.remote.api_mockCreate<T>(params);
return this.store.isLocal ? this.local.api_mockCreate<T>(params) : this.remote.api_mockCreate<T>(params);
}
api_mockUpdate<T = any>(params: { id: any; projectUuid?: any; workSpaceUuid?: any; [key: string]: any }) {
@ -55,7 +55,7 @@ export class ApiService {
}
api_mockDetail<T = any>(params: { id: any; projectUuid?: any; workSpaceUuid?: any }) {
return this.remote.api_mockDetail<T>(params);
return this.store.isLocal ? this.local.api_mockDetail<T>(params) : this.remote.api_mockDetail<T>(params);
}
api_mockDelete<T = any>(params: { id: any; projectUuid?: any; workSpaceUuid?: any }) {

View File

@ -1,8 +1,8 @@
import { ApiParamsType, BodyContentType, RequestMethod } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { mui } from 'pc/browser/src/app/pages/workspace/project/api/http/edit/api-edit-util.service';
import { ApiData, BodyParam } from 'pc/browser/src/app/services/storage/db/models/apiData';
import { ApiData, BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { ApiData as OldApiData, Environment as OldEnvironment, BasiApiEditParams, ApiEditBody } from './oldApiData';
import { OldApiData, Environment as OldEnvironment, ApiEditBody } from './oldApiData';
export const convertApiData = (apiData: OldApiData): ApiData => {
const {

View File

@ -1,11 +1,11 @@
import Dexie, { Table } from 'dexie';
import { merge } from 'lodash-es';
import { setupVersions } from 'pc/browser/src/app/services/storage/db/dataSource/versions';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import {
Workspace,
Project,
Group,
ApiData,
Environment,
ApiTestHistory,
Mock,

View File

@ -3,7 +3,7 @@ export type eoAPIType = {
environment: string;
group: Array<{ name: string; uuid: number }>;
project: { name: string };
apiData: ApiData[];
apiData: OldApiData[];
};
export type ValueOf<T> = T[keyof T];
@ -15,7 +15,7 @@ export type ApiGroup = {
children?: Child[];
};
export type Child = ApiGroup | ApiData;
export type Child = ApiGroup | OldApiData;
export type EnvParameters = {
name: string;
@ -184,7 +184,7 @@ export type ApiEditHeaders = BasiApiEditParams;
export type ApiEditQuery = BasiApiEditParams;
export type ApiEditRest = BasiApiEditParams;
export interface ApiData {
export interface OldApiData {
groupID?: number;
/**
* name

View File

@ -1,11 +1,13 @@
import { ApiBodyType, RequestMethod } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
export interface ApiDataBulkCreateDto {
apiList: Partial<ApiList[]>;
apiList: Partial<ApiData[]>;
projectUuid: string;
workSpaceUuid: string;
}
export interface ApiDataUpdateDto {
api: Partial<ApiList>;
api: Partial<ApiData>;
projectUuid: string;
workSpaceUuid: string;
}
@ -40,333 +42,256 @@ export interface ApiDataDeleteDto {
workSpaceUuid: string;
}
export interface ApiList {
export interface ApiData {
id?: number;
apiUuid?: string;
groupId: number;
groupName: string;
projectId: number;
lifecycle: number;
projectUuid?: string;
workSpaceUuid?: string;
groupId?: number;
groupName?: string;
projectId?: number;
lifecycle?: number;
name: string;
uri: string;
protocol: number;
status: number;
starred: number;
encoding: string;
isShared: number;
tag: string;
orderNum: number;
hashkey: string;
managerId: number;
managerName: string;
updateUserId: number;
updateUserName: string;
createUserId: number;
createUserName: string;
createTime: number;
updateTime: number;
introduction: Introduction;
relation: Relation;
status?: number;
starred?: number;
encoding?: string;
isShared?: number;
tag?: string;
orderNum?: number;
/** 这个仅用于分组排序 */
sort?: number;
hashkey?: string;
managerId?: number;
managerName?: string;
updateUserId?: number;
updateUserName?: string;
createUserId?: number;
createUserName?: string;
createTime?: number;
updateTime?: number;
introduction?: Introduction;
relation?: Relation;
apiAttrInfo: ApiAttrInfo;
dubboApiAttrInfo: DubboApiAttrInfo;
soapApiAttrInfo: SoapApiAttrInfo;
grpcApiAttrInfo: GrpcApiAttrInfo;
dubboApiAttrInfo?: DubboApiAttrInfo;
soapApiAttrInfo?: SoapApiAttrInfo;
grpcApiAttrInfo?: GrpcApiAttrInfo;
requestParams: RequestParams;
responseList: ResponseList[];
resultList: ResultList[];
writeHistory: number;
historyInfo: HistoryInfo;
resultList?: ResultList[];
writeHistory?: number;
historyInfo?: HistoryInfo;
authInfo?: any;
script?: {
beforeScript: '';
afterScript: '';
};
}
export interface Introduction {
apiUuid: string;
noteType: number;
noteRaw: string;
note: string;
createTime: number;
updateTime: number;
apiUuid?: string;
noteType?: number;
noteRaw?: string;
note?: string;
createTime?: number;
updateTime?: number;
}
export interface Relation {
apiUuid: string;
bindAmtApiId: number;
swaggerId: string;
fileName: string;
fileUrl: string;
fileId: string;
apiUuid?: string;
bindAmtApiId?: number;
swaggerId?: string;
fileName?: string;
fileUrl?: string;
fileId?: string;
}
export interface ApiAttrInfo {
beforeInject: string;
afterInject: string;
authInfo: string;
requestMethod: number;
contentType: number;
createTime: number;
updateTime: number;
contentType: ApiBodyType | number;
requestMethod?: RequestMethod;
beforeInject?: string;
afterInject?: string;
authInfo?: string;
createTime?: number;
updateTime?: number;
}
export interface DubboApiAttrInfo {
serverHost: string;
interfaceName: string;
methodName: string;
appName: string;
group: string;
version: string;
apiNumber: number;
createTime: number;
updateTime: number;
serverHost?: string;
interfaceName?: string;
methodName?: string;
appName?: string;
group?: string;
version?: string;
apiNumber?: number;
createTime?: number;
updateTime?: number;
}
export interface SoapApiAttrInfo {
beforeInject: string;
afterInject: string;
authInfo: string;
requestMethod: number;
contentType: number;
wsdlContent: string;
testData: string;
soapOperation: string;
soapAction: string;
soapBinding: string;
soapService: string;
createTime: number;
updateTime: number;
beforeInject?: string;
afterInject?: string;
authInfo?: string;
requestMethod?: number;
contentType?: number;
wsdlContent?: string;
testData?: string;
soapOperation?: string;
soapAction?: string;
soapBinding?: string;
soapService?: string;
createTime?: number;
updateTime?: number;
}
export interface GrpcApiAttrInfo {
authInfo: string;
serverHost: string;
interfaceName: string;
methodName: string;
appName: string;
group: string;
version: string;
proto: string;
apiRequestMetadata: string;
responseMetadata: string;
responseTrailingMetadata: string;
createTime: number;
updateTime: number;
authInfo?: string;
serverHost?: string;
interfaceName?: string;
methodName?: string;
appName?: string;
group?: string;
version?: string;
proto?: string;
apiRequestMetadata?: string;
responseMetadata?: string;
responseTrailingMetadata?: string;
createTime?: number;
updateTime?: number;
}
export interface RequestParams {
headerParams: HeaderParam[];
bodyParams: BodyParam[];
queryParams: QueryParam[];
restParams: RestParam[];
headerParams?: HeaderParam[];
bodyParams?: BodyParam[];
queryParams?: QueryParam[];
restParams?: RestParam[];
}
export interface HeaderParam {
responseUuid: string;
name: string;
paramType: number;
partType: number;
dataType: number;
dataTypeValue: string;
structureId: number;
structureParamId: string;
contentType: string;
isRequired: number;
binaryRawData: string;
description: string;
orderNo: number;
createTime: number;
updateTime: number;
paramAttr: ParamAttr;
childList: any[];
responseUuid?: string;
name?: string;
partType?: number;
structureId?: number;
structureParamId?: string;
contentType?: string;
isRequired?: number;
binaryRawData?: string;
description?: string;
orderNo?: number;
createTime?: number;
updateTime?: number;
paramAttr?: ParamAttr | ViewParamAttr;
}
export interface ParamAttr {
minLength: number;
maxLength: number;
minValue: number;
maxValue: number;
paramLimit: string;
/**
* Params value list (JSON format)
*/
paramValueList: string | any;
paramMock: string;
attr: string;
structureIsHide: number;
example: string;
createTime: number;
updateTime: number;
dbArr: string;
paramNote: string;
interface ParamAttr {
minLength?: number;
maxLength?: number;
minValue?: number;
maxValue?: number;
paramLimit?: string;
paramValueList?: string;
paramMock?: string;
attr?: string;
structureIsHide?: number;
example?: string;
createTime?: number;
updateTime?: number;
dbArr?: string;
paramNote?: string;
}
export interface ViewParamAttr extends ParamAttr {
//string[]
paramValueList?: any;
}
export interface MinValue {}
export interface MaxValue {}
export interface BodyParam {
responseUuid: string;
name: string;
paramType: ParamTypeEnum;
partType: number;
dataType: number;
dataTypeValue: string;
structureId: number;
structureParamId: string;
contentType: string;
isRequired: number;
binaryRawData: string;
description: string;
orderNo: number;
createTime: number;
updateTime: number;
paramAttr: ParamAttr;
childList: any[];
}
export enum ParamTypeEnum {
REQUEST = 0,
RESPONSE = 1
}
export interface BodyParam {
responseUuid?: string;
name?: string;
paramType?: ParamTypeEnum;
partType?: number;
dataType?: number;
dataTypeValue?: string;
structureId?: number;
structureParamId?: string;
isRequired?: number;
binaryRawData?: string;
description?: string;
orderNo?: number;
createTime?: number;
updateTime?: number;
paramAttr?: ParamAttr | ViewParamAttr;
childList?: BodyParam[];
}
export interface QueryParam {
responseUuid: string;
name: string;
paramType: number;
partType: number;
dataType: number;
dataTypeValue: string;
structureId: number;
structureParamId: string;
contentType: string;
isRequired: number;
binaryRawData: string;
description: string;
orderNo: number;
createTime: number;
updateTime: number;
paramAttr: ParamAttr3;
childList: any[];
responseUuid?: string;
name?: string;
paramType?: ParamTypeEnum;
partType?: number;
structureId?: number;
structureParamId?: string;
contentType?: string;
isRequired?: number;
binaryRawData?: string;
description?: string;
orderNo?: number;
createTime?: number;
updateTime?: number;
paramAttr?: ParamAttr | ViewParamAttr;
childList?: QueryParam[];
}
export interface ParamAttr3 {
minLength: number;
maxLength: number;
minValue: number;
maxValue: number;
paramLimit: string;
paramValueList: string;
paramMock: string;
attr: string;
structureIsHide: number;
example: string;
createTime: number;
updateTime: number;
dbArr: string;
paramNote: string;
}
export interface MinValue3 {}
export interface MaxValue3 {}
export interface RestParam {
responseUuid: string;
name: string;
paramType: number;
partType: number;
dataType: number;
dataTypeValue: string;
structureId: number;
structureParamId: string;
contentType: string;
isRequired: number;
binaryRawData: string;
description: string;
orderNo: number;
createTime: number;
updateTime: number;
paramAttr: ParamAttr4;
childList: any[];
}
export interface ParamAttr4 {
minLength: number;
maxLength: number;
minValue: number;
maxValue: number;
paramLimit: string;
paramValueList: string;
paramMock: string;
attr: string;
structureIsHide: number;
example: string;
createTime: number;
updateTime: number;
dbArr: string;
paramNote: string;
responseUuid?: string;
name?: string;
paramType?: ParamTypeEnum;
partType?: number;
dataTypeValue?: string;
structureId?: number;
structureParamId?: string;
contentType?: string;
isRequired?: number;
binaryRawData?: string;
description?: string;
orderNo?: number;
createTime?: number;
updateTime?: number;
paramAttr?: ParamAttr | ViewParamAttr;
childList?: RestParam[];
}
export interface ResponseList {
responseUuid: string;
apiUuid: string;
name: string;
httpCode: string;
contentType: number;
responseUuid?: string;
apiUuid?: string;
name?: string;
httpCode?: string;
contentType?: number;
isDefault: number;
createTime: number;
updateTime: number;
createTime?: number;
updateTime?: number;
responseParams: ResponseParams;
}
export interface ResponseParams {
headerParams: HeaderParam[];
bodyParams: BodyParam[];
queryParams: QueryParam[];
restParams: RestParam[];
}
export interface RestParam2 {
responseUuid: string;
name: string;
paramType: number;
partType: number;
dataType: number;
dataTypeValue: string;
structureId: number;
structureParamId: string;
contentType: string;
isRequired: number;
binaryRawData: string;
description: string;
orderNo: number;
createTime: number;
updateTime: number;
paramAttr: ParamAttr8;
childList: any[];
}
export interface ParamAttr8 {
minLength: number;
maxLength: number;
minValue: number;
maxValue: number;
paramLimit: string;
paramValueList: string;
paramMock: string;
attr: string;
structureIsHide: number;
example: string;
createTime: number;
updateTime: number;
dbArr: string;
paramNote: string;
headerParams?: HeaderParam[];
bodyParams?: BodyParam[];
}
export interface ResultList {
id: number;
name: string;
httpCode: string;
httpContentType: string;
type: number;
content: string;
createTime: number;
updateTime: number;
id?: number;
name?: string;
httpCode?: string;
httpContentType?: string;
type?: number;
content?: string;
createTime?: number;
updateTime?: number;
}
export interface HistoryInfo {

View File

@ -1,4 +1,4 @@
import { ApiList } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { PageDto } from 'pc/browser/src/app/services/storage/db/dto/common.dto';
import { Environment, Group } from 'pc/browser/src/app/services/storage/db/models';
@ -32,7 +32,8 @@ export interface ImportProjectDto {
projectUuid?: string;
workSpaceUuid?: string;
}
export type Collection = (ApiList | Group) & {
export type Collection = ApiData | Group;
export type ImportCollection = Collection & {
/**
* 0group
* 1: apiData

View File

@ -1,4 +1,4 @@
import { ApiBodyType, RequestMethod } from '../../../../pages/workspace/project/api/constants/api.model';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
/**
* Group list api data
@ -6,252 +6,3 @@ import { ApiBodyType, RequestMethod } from '../../../../pages/workspace/project/
export interface ApiDataFromList extends ApiData {
requestMethod?: number;
}
export interface ApiData {
id?: number;
apiUuid?: string;
projectUuid?: string;
workSpaceUuid?: string;
groupId?: number;
groupName?: string;
projectId?: number;
lifecycle?: number;
name: string;
uri: string;
protocol: number;
status?: number;
starred?: number;
encoding?: string;
isShared?: number;
tag?: string;
orderNum?: number;
/** 这个仅用于分组排序 */
sort?: number;
hashkey?: string;
managerId?: number;
managerName?: string;
updateUserId?: number;
updateUserName?: string;
createUserId?: number;
createUserName?: string;
createTime?: number;
updateTime?: number;
introduction?: Introduction;
relation?: Relation;
apiAttrInfo: ApiAttrInfo;
dubboApiAttrInfo?: DubboApiAttrInfo;
soapApiAttrInfo?: SoapApiAttrInfo;
grpcApiAttrInfo?: GrpcApiAttrInfo;
requestParams: RequestParams;
responseList: ResponseList[];
resultList?: ResultList[];
writeHistory?: number;
historyInfo?: HistoryInfo;
authInfo?: any;
script?: {
beforeScript: '';
afterScript: '';
};
}
export interface Introduction {
apiUuid?: string;
noteType?: number;
noteRaw?: string;
note?: string;
createTime?: number;
updateTime?: number;
}
export interface Relation {
apiUuid?: string;
bindAmtApiId?: number;
swaggerId?: string;
fileName?: string;
fileUrl?: string;
fileId?: string;
}
export interface ApiAttrInfo {
contentType: ApiBodyType | number;
requestMethod?: RequestMethod;
beforeInject?: string;
afterInject?: string;
authInfo?: string;
createTime?: number;
updateTime?: number;
}
export interface DubboApiAttrInfo {
serverHost?: string;
interfaceName?: string;
methodName?: string;
appName?: string;
group?: string;
version?: string;
apiNumber?: number;
createTime?: number;
updateTime?: number;
}
export interface SoapApiAttrInfo {
beforeInject?: string;
afterInject?: string;
authInfo?: string;
requestMethod?: number;
contentType?: number;
wsdlContent?: string;
testData?: string;
soapOperation?: string;
soapAction?: string;
soapBinding?: string;
soapService?: string;
createTime?: number;
updateTime?: number;
}
export interface GrpcApiAttrInfo {
authInfo?: string;
serverHost?: string;
interfaceName?: string;
methodName?: string;
appName?: string;
group?: string;
version?: string;
proto?: string;
apiRequestMetadata?: string;
responseMetadata?: string;
responseTrailingMetadata?: string;
createTime?: number;
updateTime?: number;
}
export interface RequestParams {
headerParams?: HeaderParam[];
bodyParams?: BodyParam[];
queryParams?: QueryParam[];
restParams?: RestParam[];
}
export interface HeaderParam {
responseUuid?: string;
name?: string;
partType?: number;
structureId?: number;
structureParamId?: string;
contentType?: string;
isRequired?: number;
binaryRawData?: string;
description?: string;
orderNo?: number;
createTime?: number;
updateTime?: number;
paramAttr?: ParamAttr;
}
export interface ParamAttr {
minLength?: number;
maxLength?: number;
minValue?: number;
maxValue?: number;
paramLimit?: string;
paramValueList?: string;
paramMock?: string;
attr?: string;
structureIsHide?: number;
example?: string;
createTime?: number;
updateTime?: number;
dbArr?: string;
paramNote?: string;
}
export interface BodyParam {
responseUuid?: string;
name?: string;
paramType?: number;
partType?: number;
dataType?: number;
dataTypeValue?: string;
structureId?: number;
structureParamId?: string;
isRequired?: number;
binaryRawData?: string;
description?: string;
orderNo?: number;
createTime?: number;
updateTime?: number;
paramAttr?: ParamAttr;
childList?: BodyParam[];
}
export interface QueryParam {
responseUuid?: string;
name?: string;
paramType?: number;
partType?: number;
structureId?: number;
structureParamId?: string;
contentType?: string;
isRequired?: number;
binaryRawData?: string;
description?: string;
orderNo?: number;
createTime?: number;
updateTime?: number;
paramAttr?: ParamAttr;
childList?: QueryParam[];
}
export interface RestParam {
responseUuid?: string;
name?: string;
paramType?: number;
partType?: number;
dataTypeValue?: string;
structureId?: number;
structureParamId?: string;
contentType?: string;
isRequired?: number;
binaryRawData?: string;
description?: string;
orderNo?: number;
createTime?: number;
updateTime?: number;
paramAttr?: ParamAttr;
childList?: RestParam[];
}
export interface ResponseList {
responseUuid?: string;
apiUuid?: string;
name?: string;
httpCode?: string;
contentType?: number;
isDefault: number;
createTime?: number;
updateTime?: number;
responseParams: ResponseParams;
}
export interface ResponseParams {
headerParams?: HeaderParam[];
bodyParams?: BodyParam[];
}
export interface ResultList {
id?: number;
name?: string;
httpCode?: string;
httpContentType?: string;
type?: number;
content?: string;
createTime?: number;
updateTime?: number;
}
export interface HistoryInfo {
oldId: number;
updateDesc: string;
versionId: number;
projectVersionId: number;
}

View File

@ -1,9 +1,6 @@
import { AuthInfo } from 'pc/browser/src/app/pages/workspace/project/api/constants/auth.model';
import { ApiTestResData } from 'pc/browser/src/app/pages/workspace/project/api/service/test-server/test-server.model';
import { ApiData } from './apiData';
export type { ApiData } from './apiData';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
interface Base {
id?: number;

View File

@ -7,7 +7,7 @@ import {
ApiDataPageDto,
ApiDataUpdateDto
} from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import type { ApiData } from 'pc/browser/src/app/services/storage/db/models';
import type { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { BaseService } from 'pc/browser/src/app/services/storage/db/services/base.service';
import { GroupService } from 'pc/browser/src/app/services/storage/db/services/group.service';

View File

@ -35,6 +35,7 @@ const genFileGroup = apiData => {
export class GroupService extends BaseService<Group> {
baseService = new BaseService(dataSource.group);
apiDataService = new BaseService(dataSource.apiData);
mockDataService = new BaseService(dataSource.mock);
apiDataTable = dataSource.apiData;
apiGroupTable = dataSource.group;
@ -171,6 +172,7 @@ export class GroupService extends BaseService<Group> {
const result = await this.baseService.bulkRead(params);
//! Warning case/mock/group id may dupublicate in local
const { data: apiDataList } = await this.apiDataService.bulkRead({ projectUuid: params.projectUuid });
const { data: mockDataList } = await this.mockDataService.bulkRead({ projectUuid: params.projectUuid });
const genGroupTree = (groups: Group[], paranId) => {
const apiFilters = apiDataList.filter(n => n.groupId === paranId);
const groupFilters = groups.filter(n => n.parentId === paranId);
@ -193,6 +195,7 @@ export class GroupService extends BaseService<Group> {
const rootGroup = result.data?.find(n => n.depth === 0);
rootGroup.children = genGroupTree(result.data, rootGroup?.id);
result.data = [rootGroup];
console.log(rootGroup.children);
return result;
}

View File

@ -1,7 +1,8 @@
import Ajv from 'ajv';
import { safeStringify } from 'ajv/dist/compile/codegen/code';
import { ApiData } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { CollectionTypeEnum } from 'pc/browser/src/app/services/storage/db/dto/project.dto';
import { ApiData, Environment } from 'pc/browser/src/app/services/storage/db/models';
import { Environment } from 'pc/browser/src/app/services/storage/db/models';
import apiDataSchema from '../schema/apiData.schema.json';
import envSchema from '../schema/env.schema.json';

View File

@ -1,7 +1,7 @@
import { HttpErrorResponse, HttpEvent, HttpHandler, HttpHeaders, HttpInterceptor, HttpRequest, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { MessageService } from 'pc/browser/src/app/services/message';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { filter, map, tap, Observable, catchError } from 'rxjs';
// implements StorageInterface

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { db } from './db';

View File

@ -1,6 +1,6 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
const ErrorStyle = 'background-color: #a73836; color: #fff;padding:3px;box-sizing: border-box;border-radius: 3px;';

View File

@ -5,12 +5,12 @@ import { reaction } from 'mobx';
import { WebService } from 'pc/browser/src/app/core/services';
import { LanguageService } from 'pc/browser/src/app/core/services/language/language.service';
import { ApiService } from 'pc/browser/src/app/services/storage/api.service';
import { StoreService } from 'pc/browser/src/app/store/state.service';
import { StoreService } from 'pc/browser/src/app/shared/store/state.service';
import { APP_CONFIG } from 'pc/browser/src/environments/environment';
import { ApiStoreService } from '../pages/workspace/project/api/store/api-state.service';
import { db } from '../services/storage/db';
import { waitNextTick } from '../shared/utils/index.utils';
import { ApiStoreService } from '../../pages/workspace/project/api/store/api-state.service';
import { db } from '../../services/storage/db';
import { waitNextTick } from '../utils/index.utils';
@Injectable({
providedIn: 'root'

View File

@ -7,7 +7,7 @@ import { Project } from 'pc/browser/src/app/services/storage/db/models';
import { StorageUtil } from 'pc/browser/src/app/shared/utils/storage/storage.utils';
import { filter } from 'rxjs/operators';
import { Role } from '../shared/models/member.model';
import { Role } from '../models/member.model';
/** is show switch success tips */
export const IS_SHOW_DATA_SOURCE_TIP = 'IS_SHOW_DATA_SOURCE_TIP';

View File

@ -1,7 +1,7 @@
import isXml from 'is-xml';
import { BodyParam } from 'pc/browser/src/app/services/storage/db/dto/apiData.dto';
import { ApiBodyType, ApiParamsType, JsonRootType } from '../../../pages/workspace/project/api/constants/api.model';
import { BodyParam } from '../../../services/storage/db/models/apiData';
import { whatType, whatTextType, JSONParse } from '../index.utils';
export const isXML = data => isXml(data);

View File

@ -5,6 +5,7 @@ import { NzTreeSelectComponent } from 'ng-zorro-antd/tree-select';
import omitDeep from 'omit-deep-lodash';
import { ApiParamsType } from 'pc/browser/src/app/pages/workspace/project/api/constants/api.model';
import { GroupModuleType, GroupType } from 'pc/browser/src/app/services/storage/db/dto/group.dto';
import { Collection } from 'pc/browser/src/app/services/storage/db/dto/project.dto';
import { Group } from 'pc/browser/src/app/services/storage/db/models';
import { eoDeepCopy, whatType } from '../index.utils';
@ -167,12 +168,28 @@ export const fieldTypeMap = new Map<number, any>([
*/
export const parseGroupDataToViewTree = list => {
return list.map(it => {
const isAPI = it.type === GroupType.virtual && it.module === GroupModuleType.api;
if (isAPI) {
const apiItem = it.relationInfo || it;
//* Group
if (it.type === GroupType.userCreated) {
return {
...apiItem,
id: apiItem.apiUuid,
...it,
children: parseGroupDataToViewTree(it.children || [])
};
}
if (it.type !== GroupType.virtual) return;
//* Resource
//it.type===GroupType.virtual
let resouceItem: Collection;
switch (it.module) {
case GroupModuleType.mock:
case GroupModuleType.case:
case GroupModuleType.api: {
resouceItem = it.relationInfo || it;
// resouceItem.id = resouceItem.apiUuid;
}
}
return {
...resouceItem,
id: resouceItem.id,
isLeaf: true,
parentId: it.parentId,
type: it.type,
@ -183,11 +200,6 @@ export const parseGroupDataToViewTree = list => {
sort: it.sort
}
};
}
return {
...it,
children: parseGroupDataToViewTree(it.children || [])
};
});
};
/**