Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ui/src/Services/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* limitations under the License.
*
*/
import type { Settings, UserProfile, KGCoreResult, UUID, Stage, StructureOfType, InstanceFull, InstanceSummary, SuggestionStructure, Neighbor, Scope, UserSummary, IncomingLink, InstanceRawStructure, InstanceLabelData, InstanceSummaryData, InstanceFullData } from '../types';
import type { Settings, UserProfile, KGCoreResult, UUID, Stage, StructureOfType, InstanceFull, InstanceSummary, SuggestionStructure, Neighbor, Scope, UserSummary, IncomingLink, InstanceRawStructure, InstancesData, InstanceLabel } from '../types';

interface APIErrorResponse {
status: number;
Expand Down Expand Up @@ -79,11 +79,11 @@ interface API {

getInstanceScope(instanceId: UUID): Promise<KGCoreResult<Scope>>;

getInstancesLabel(stage: Stage | undefined, instanceIds: UUID[]): Promise<KGCoreResult<InstanceLabelData>>;
getInstancesLabel(stage: Stage | undefined, instanceIds: UUID[]): Promise<KGCoreResult<InstancesData<InstanceLabel>>>;

getInstancesSummary(stage: Stage|undefined, instanceIds: UUID[]): Promise<KGCoreResult<InstanceSummaryData>>;
getInstancesSummary(stage: Stage|undefined, instanceIds: UUID[]): Promise<KGCoreResult<InstancesData<InstanceSummary>>>;

getInstancesList(stage: Stage | undefined, instanceIds: UUID[]): Promise<KGCoreResult<InstanceFullData>>;
getInstancesList(stage: Stage | undefined, instanceIds: UUID[]): Promise<KGCoreResult<InstancesData<InstanceFull>>>;

getInvitedUsers(instanceId: UUID): Promise<KGCoreResult<UserSummary[]>>;

Expand Down
8 changes: 4 additions & 4 deletions ui/src/Services/APIBackendAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
*/
import type API from './API';
import type { UUID, Stage, Settings, UserProfile, KGCoreResult, StructureOfType, InstanceFull, InstanceSummary, SuggestionStructure, Neighbor, Scope, UserSummary, IncomingLink, InstanceRawStructure, InstanceSummaryData, InstanceLabelData, InstanceFullData } from '../types';
import type { UUID, Stage, Settings, UserProfile, KGCoreResult, StructureOfType, InstanceFull, InstanceSummary, SuggestionStructure, Neighbor, Scope, UserSummary, IncomingLink, InstanceRawStructure, InstancesData, InstanceLabel } from '../types';
import type { AxiosInstance } from 'axios';

const RELATIVE_ROOT_PATH = '/editor/api';
Expand Down Expand Up @@ -180,17 +180,17 @@ class APIBackendAdapter implements API {
return data;
}

async getInstancesLabel(stage: Stage, instanceIds: UUID[]): Promise<KGCoreResult<InstanceLabelData>> {
async getInstancesLabel(stage: Stage, instanceIds: UUID[]): Promise<KGCoreResult<InstancesData<InstanceLabel>>> {
const { data } = await this._axios.post(endpoints.instancesLabel(stage), instanceIds);
return data;
}

async getInstancesSummary(stage: Stage | undefined, instanceIds: UUID[]): Promise<KGCoreResult<InstanceSummaryData>> {
async getInstancesSummary(stage: Stage | undefined, instanceIds: UUID[]): Promise<KGCoreResult<InstancesData<InstanceSummary>>> {
const { data } = await this._axios.post(endpoints.instancesSummary(stage), instanceIds);
return data;
}

async getInstancesList(stage: Stage, instanceIds: UUID[]): Promise<KGCoreResult<InstanceFullData>> {
async getInstancesList(stage: Stage, instanceIds: UUID[]): Promise<KGCoreResult<InstancesData<InstanceFull>>> {
const { data } = await this._axios.post(endpoints.instancesList(stage), instanceIds);
return data;
}
Expand Down
6 changes: 1 addition & 5 deletions ui/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,7 @@ export type InstanceRawData = {
[fieldName:string]: unknown;
}

export type InstanceLabelData = Record<UUID,InstanceLabel>; // by instanceId

export type InstanceSummaryData = Record<UUID,InstanceSummary>; // by instanceId

export type InstanceFullData = Record<UUID,InstanceFull>; // by instanceId
export type InstancesData<T extends InstanceLabel> = Record<UUID,T>; // by instanceId

export interface InstanceRawStructure {
data: InstanceRawData;
Expand Down