@equinor/fusion
Advanced tools
Comparing version 0.1.88 to 0.1.89
@@ -1,16 +0,10 @@ | ||
import { HttpResponse } from "../HttpClient"; | ||
import BaseApiClient from "./BaseApiClient"; | ||
import { HandoverItem, HandoverMcpkg, HandoverDetails, HandoverNCR, HandoverPunch, HandoverSWCR, HandoverUnsignedAction, HandoverUnsignedTask, HandoverWorkOrder, HandoverQuery } from "./models/dataProxy"; | ||
export { HandoverItem, HandoverMcpkg, HandoverDetails, HandoverNCR, HandoverPunch, HandoverSWCR, HandoverUnsignedAction, HandoverUnsignedTask, HandoverWorkOrder, HandoverQuery, }; | ||
import BaseApiClient from './BaseApiClient'; | ||
import { HandoverItem, HandoverMcpkg, HandoverDetails, HandoverNCR, HandoverPunch, HandoverSWCR, HandoverUnsignedAction, HandoverUnsignedTask, HandoverWorkOrder, HandoverQuery, AccumulatedContainer } from './models/dataProxy'; | ||
import { HandoverActions, AccumulatedActions } from '../resourceCollections/DataProxyResourceCollection'; | ||
import { HttpResponse } from '../HttpClient'; | ||
export { HandoverItem, HandoverMcpkg, HandoverDetails, HandoverNCR, HandoverPunch, HandoverSWCR, HandoverUnsignedAction, HandoverUnsignedTask, HandoverWorkOrder, HandoverQuery, AccumulatedContainer, HandoverActions, AccumulatedActions, }; | ||
export default class DataProxyClient extends BaseApiClient { | ||
getHandoverAsync(siteCode: string, projectIdentifier: string): Promise<HttpResponse<HandoverItem[]>>; | ||
getHandoverMcpkgAsync(siteCode: string, projectIdentifier: string, commpkgId: string): Promise<HttpResponse<HandoverMcpkg[]>>; | ||
getHandoverWorkOrdersAsync(siteCode: string, projectIdentifier: string, commpkgId: string): Promise<HttpResponse<HandoverWorkOrder[]>>; | ||
getHandoverUnsignedTasksAsync(siteCode: string, projectIdentifier: string, commpkgId: string): Promise<HttpResponse<HandoverUnsignedTask[]>>; | ||
getHandoverUnsignedActionsAsync(siteCode: string, projectIdentifier: string, commpkgId: string): Promise<HttpResponse<HandoverUnsignedAction[]>>; | ||
getHandoverPunchAsync(siteCode: string, projectIdentifier: string, commpkgId: string): Promise<HttpResponse<HandoverPunch[]>>; | ||
getHandoverSWCRAsync(siteCode: string, projectIdentifier: string, commpkgId: string): Promise<HttpResponse<HandoverSWCR[]>>; | ||
getHandoverDetailsAsync(siteCode: string, projectIdentifier: string, commpkgId: string): Promise<HttpResponse<HandoverDetails[]>>; | ||
getHandoverNCRAsync(siteCode: string, projectIdentifier: string, commpkgId: string): Promise<HttpResponse<HandoverNCR[]>>; | ||
getHandoverQueryAsync(siteCode: string, projectIdentifier: string, commpkgId: string): Promise<HttpResponse<HandoverQuery[]>>; | ||
getHandoverChildrenAsync<TKey extends keyof HandoverActions, T = HandoverActions[TKey]>(siteCode: string, projectIdentifier: string, commpkgId: string, action: TKey): Promise<HttpResponse<T[]>>; | ||
getAccumulatedItemAsync<TKey extends keyof AccumulatedActions, T = AccumulatedActions[TKey]>(siteCode: string, projectIdentifier: string, action: TKey): Promise<HttpResponse<T[]>>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import BaseApiClient from "./BaseApiClient"; | ||
import BaseApiClient from './BaseApiClient'; | ||
export default class DataProxyClient extends BaseApiClient { | ||
@@ -7,38 +7,10 @@ async getHandoverAsync(siteCode, projectIdentifier) { | ||
} | ||
async getHandoverMcpkgAsync(siteCode, projectIdentifier, commpkgId) { | ||
const url = this.resourceCollections.dataProxy.handoverMcpkgs(siteCode, projectIdentifier, commpkgId); | ||
async getHandoverChildrenAsync(siteCode, projectIdentifier, commpkgId, action) { | ||
const url = this.resourceCollections.dataProxy.handoverChildren(siteCode, projectIdentifier, commpkgId, action); | ||
return await this.httpClient.getAsync(url); | ||
} | ||
async getHandoverWorkOrdersAsync(siteCode, projectIdentifier, commpkgId) { | ||
const url = this.resourceCollections.dataProxy.handoverWorkOrders(siteCode, projectIdentifier, commpkgId); | ||
async getAccumulatedItemAsync(siteCode, projectIdentifier, action) { | ||
const url = this.resourceCollections.dataProxy.accumulatedItem(siteCode, projectIdentifier, action); | ||
return await this.httpClient.getAsync(url); | ||
} | ||
async getHandoverUnsignedTasksAsync(siteCode, projectIdentifier, commpkgId) { | ||
const url = this.resourceCollections.dataProxy.handoverUnsignedTasks(siteCode, projectIdentifier, commpkgId); | ||
return await this.httpClient.getAsync(url); | ||
} | ||
async getHandoverUnsignedActionsAsync(siteCode, projectIdentifier, commpkgId) { | ||
const url = this.resourceCollections.dataProxy.handoverUnsignedActions(siteCode, projectIdentifier, commpkgId); | ||
return await this.httpClient.getAsync(url); | ||
} | ||
async getHandoverPunchAsync(siteCode, projectIdentifier, commpkgId) { | ||
const url = this.resourceCollections.dataProxy.handoverPunch(siteCode, projectIdentifier, commpkgId); | ||
return await this.httpClient.getAsync(url); | ||
} | ||
async getHandoverSWCRAsync(siteCode, projectIdentifier, commpkgId) { | ||
const url = this.resourceCollections.dataProxy.handoverSWCR(siteCode, projectIdentifier, commpkgId); | ||
return await this.httpClient.getAsync(url); | ||
} | ||
async getHandoverDetailsAsync(siteCode, projectIdentifier, commpkgId) { | ||
const url = this.resourceCollections.dataProxy.handoverDetails(siteCode, projectIdentifier, commpkgId); | ||
return await this.httpClient.getAsync(url); | ||
} | ||
async getHandoverNCRAsync(siteCode, projectIdentifier, commpkgId) { | ||
const url = this.resourceCollections.dataProxy.handoverNCR(siteCode, projectIdentifier, commpkgId); | ||
return await this.httpClient.getAsync(url); | ||
} | ||
async getHandoverQueryAsync(siteCode, projectIdentifier, commpkgId) { | ||
const url = this.resourceCollections.dataProxy.handoverQuery(siteCode, projectIdentifier, commpkgId); | ||
return await this.httpClient.getAsync(url); | ||
} | ||
} |
@@ -11,1 +11,2 @@ export { HandoverItem } from "./handover/HandoverItem"; | ||
export { HandoverQuery } from "./handover/HandoverQuery"; | ||
export { AccumulatedContainer } from "./AccumulatedContainer"; |
@@ -1,11 +0,4 @@ | ||
import { HandoverItem, HandoverMcpkg, HandoverWorkOrder, HandoverDetails, HandoverNCR, HandoverPunch, HandoverQuery, HandoverSWCR, HandoverUnsignedAction, HandoverUnsignedTask } from "../../apiClients/DataProxyClient"; | ||
import { ApiClientHookResult } from '../useApiClient'; | ||
import { HandoverItem, HandoverActions } from '../../apiClients/DataProxyClient'; | ||
export declare const useHandover: (siteCode: string, projectIdentifier: string) => [import("../../HttpClient").HttpClientError | null, boolean, HandoverItem[] | null]; | ||
export declare const useHandoverMcpkgs: (siteCode: string, projectIdentifier: string, commpkgId: string) => [import("../../HttpClient").HttpClientError | null, boolean, HandoverMcpkg[] | null]; | ||
export declare const useHandoverWorkOrders: (siteCode: string, projectIdentifier: string, commpkgId: string) => [import("../../HttpClient").HttpClientError | null, boolean, HandoverWorkOrder[] | null]; | ||
export declare const useHandoverUnsignedTasks: (siteCode: string, projectIdentifier: string, commpkgId: string) => [import("../../HttpClient").HttpClientError | null, boolean, HandoverUnsignedTask[] | null]; | ||
export declare const useHandoverUnsignedActions: (siteCode: string, projectIdentifier: string, commpkgId: string) => [import("../../HttpClient").HttpClientError | null, boolean, HandoverUnsignedAction[] | null]; | ||
export declare const useHandoverPunch: (siteCode: string, projectIdentifier: string, commpkgId: string) => [import("../../HttpClient").HttpClientError | null, boolean, HandoverPunch[] | null]; | ||
export declare const useHandoverSWCR: (siteCode: string, projectIdentifier: string, commpkgId: string) => [import("../../HttpClient").HttpClientError | null, boolean, HandoverSWCR[] | null]; | ||
export declare const useHandoverDetails: (siteCode: string, projectIdentifier: string, commpkgId: string) => [import("../../HttpClient").HttpClientError | null, boolean, HandoverDetails | null]; | ||
export declare const useHandoverNCR: (siteCode: string, projectIdentifier: string, commpkgId: string) => [import("../../HttpClient").HttpClientError | null, boolean, HandoverNCR[] | null]; | ||
export declare const useHandoverQuery: (siteCode: string, projectIdentifier: string, commpkgId: string) => [import("../../HttpClient").HttpClientError | null, boolean, HandoverQuery[] | null]; | ||
export declare function useHanoverChild<TKey extends keyof HandoverActions, T = HandoverActions[TKey]>(siteCode: string, projectIdentifier: string, commpkgId: string, action: TKey): ApiClientHookResult<T[]>; |
@@ -1,2 +0,2 @@ | ||
import useApiClient from "../useApiClient"; | ||
import useApiClient from '../useApiClient'; | ||
export const useHandover = (siteCode, projectIdentifier) => { | ||
@@ -8,55 +8,7 @@ return useApiClient(async (apiClients) => { | ||
}; | ||
export const useHandoverMcpkgs = (siteCode, projectIdentifier, commpkgId) => { | ||
export function useHanoverChild(siteCode, projectIdentifier, commpkgId, action) { | ||
return useApiClient(async (apiClients) => { | ||
const response = await apiClients.dataProxy.getHandoverMcpkgAsync(siteCode, projectIdentifier, commpkgId); | ||
const response = await apiClients.dataProxy.getHandoverChildrenAsync(siteCode, projectIdentifier, commpkgId, action); | ||
return response.data; | ||
}, [siteCode, projectIdentifier]); | ||
}; | ||
export const useHandoverWorkOrders = (siteCode, projectIdentifier, commpkgId) => { | ||
return useApiClient(async (apiClients) => { | ||
const response = await apiClients.dataProxy.getHandoverWorkOrdersAsync(siteCode, projectIdentifier, commpkgId); | ||
return response.data; | ||
}, [siteCode, projectIdentifier]); | ||
}; | ||
export const useHandoverUnsignedTasks = (siteCode, projectIdentifier, commpkgId) => { | ||
return useApiClient(async (apiClients) => { | ||
const response = await apiClients.dataProxy.getHandoverUnsignedTasksAsync(siteCode, projectIdentifier, commpkgId); | ||
return response.data; | ||
}, [siteCode, projectIdentifier]); | ||
}; | ||
export const useHandoverUnsignedActions = (siteCode, projectIdentifier, commpkgId) => { | ||
return useApiClient(async (apiClients) => { | ||
const response = await apiClients.dataProxy.getHandoverUnsignedActionsAsync(siteCode, projectIdentifier, commpkgId); | ||
return response.data; | ||
}, [siteCode, projectIdentifier]); | ||
}; | ||
export const useHandoverPunch = (siteCode, projectIdentifier, commpkgId) => { | ||
return useApiClient(async (apiClients) => { | ||
const response = await apiClients.dataProxy.getHandoverPunchAsync(siteCode, projectIdentifier, commpkgId); | ||
return response.data; | ||
}, [siteCode, projectIdentifier]); | ||
}; | ||
export const useHandoverSWCR = (siteCode, projectIdentifier, commpkgId) => { | ||
return useApiClient(async (apiClients) => { | ||
const response = await apiClients.dataProxy.getHandoverSWCRAsync(siteCode, projectIdentifier, commpkgId); | ||
return response.data; | ||
}, [siteCode, projectIdentifier]); | ||
}; | ||
export const useHandoverDetails = (siteCode, projectIdentifier, commpkgId) => { | ||
return useApiClient(async (apiClients) => { | ||
const response = await apiClients.dataProxy.getHandoverDetailsAsync(siteCode, projectIdentifier, commpkgId); | ||
return response.data[0]; | ||
}, [siteCode, projectIdentifier]); | ||
}; | ||
export const useHandoverNCR = (siteCode, projectIdentifier, commpkgId) => { | ||
return useApiClient(async (apiClients) => { | ||
const response = await apiClients.dataProxy.getHandoverNCRAsync(siteCode, projectIdentifier, commpkgId); | ||
return response.data; | ||
}, [siteCode, projectIdentifier]); | ||
}; | ||
export const useHandoverQuery = (siteCode, projectIdentifier, commpkgId) => { | ||
return useApiClient(async (apiClients) => { | ||
const response = await apiClients.dataProxy.getHandoverQueryAsync(siteCode, projectIdentifier, commpkgId); | ||
return response.data; | ||
}, [siteCode, projectIdentifier]); | ||
}; | ||
} |
@@ -1,14 +0,28 @@ | ||
import BaseResourceCollection from "./BaseResourceCollection"; | ||
import BaseResourceCollection from './BaseResourceCollection'; | ||
import { AccumulatedContainer, HandoverMcpkg, HandoverWorkOrder, HandoverUnsignedTask, HandoverUnsignedAction, HandoverPunch, HandoverSWCR, HandoverDetails, HandoverNCR, HandoverQuery } from '../apiClients/models/dataProxy'; | ||
export declare type AccumulatedActions = { | ||
mccr: AccumulatedContainer; | ||
punch: AccumulatedContainer; | ||
commpkg: AccumulatedContainer; | ||
productivity: AccumulatedContainer; | ||
womaterial: AccumulatedContainer; | ||
installation: AccumulatedContainer; | ||
earnedplanned: AccumulatedContainer; | ||
}; | ||
export declare type HandoverActions = { | ||
mcpkg: HandoverMcpkg; | ||
'work-orders': HandoverWorkOrder; | ||
'unsigned-tasks': HandoverUnsignedTask; | ||
'unsigned-actions': HandoverUnsignedAction; | ||
punch: HandoverPunch; | ||
swcr: HandoverSWCR; | ||
details: HandoverDetails; | ||
ncr: HandoverNCR; | ||
query: HandoverQuery; | ||
}; | ||
export default class DataProxyResourceCollection extends BaseResourceCollection { | ||
protected getBaseUrl(): string; | ||
handover(siteCode: string, projectIdentifier: string): string; | ||
handoverMcpkgs(siteCode: string, projectIdentifier: string, commpkgId: string): string; | ||
handoverWorkOrders(siteCode: string, projectIdentifier: string, commpkgId: string): string; | ||
handoverUnsignedTasks(siteCode: string, projectIdentifier: string, commpkgId: string): string; | ||
handoverUnsignedActions(siteCode: string, projectIdentifier: string, commpkgId: string): string; | ||
handoverPunch(siteCode: string, projectIdentifier: string, commpkgId: string): string; | ||
handoverSWCR(siteCode: string, projectIdentifier: string, commpkgId: string): string; | ||
handoverDetails(siteCode: string, projectIdentifier: string, commpkgId: string): string; | ||
handoverNCR(siteCode: string, projectIdentifier: string, commpkgId: string): string; | ||
handoverQuery(siteCode: string, projectIdentifier: string, commpkgId: string): string; | ||
handoverChildren(siteCode: string, projectIdentifier: string, commpkgId: string, action: keyof HandoverActions): string; | ||
accumulatedItem(siteCode: string, projectIdentifier: string, action: keyof AccumulatedActions): string; | ||
} |
@@ -1,2 +0,2 @@ | ||
import BaseResourceCollection from "./BaseResourceCollection"; | ||
import BaseResourceCollection from './BaseResourceCollection'; | ||
export default class DataProxyResourceCollection extends BaseResourceCollection { | ||
@@ -7,31 +7,10 @@ getBaseUrl() { | ||
handover(siteCode, projectIdentifier) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, "handover"); | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, 'handover'); | ||
} | ||
handoverMcpkgs(siteCode, projectIdentifier, commpkgId) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `handover/${commpkgId}/mcpkg/`); | ||
handoverChildren(siteCode, projectIdentifier, commpkgId, action) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `handover/${commpkgId}/${action}/`); | ||
} | ||
handoverWorkOrders(siteCode, projectIdentifier, commpkgId) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `handover/${commpkgId}/work-orders/`); | ||
accumulatedItem(siteCode, projectIdentifier, action) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `${action}-accumulated`); | ||
} | ||
handoverUnsignedTasks(siteCode, projectIdentifier, commpkgId) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `handover/${commpkgId}/unsigned-tasks/`); | ||
} | ||
handoverUnsignedActions(siteCode, projectIdentifier, commpkgId) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `handover/${commpkgId}/unsigned-actions/`); | ||
} | ||
handoverPunch(siteCode, projectIdentifier, commpkgId) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `handover/${commpkgId}/punch/`); | ||
} | ||
handoverSWCR(siteCode, projectIdentifier, commpkgId) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `handover/${commpkgId}/swcr/`); | ||
} | ||
handoverDetails(siteCode, projectIdentifier, commpkgId) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `handover/${commpkgId}/details/`); | ||
} | ||
handoverNCR(siteCode, projectIdentifier, commpkgId) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `handover/${commpkgId}/ncr/`); | ||
} | ||
handoverQuery(siteCode, projectIdentifier, commpkgId) { | ||
return this.getSiteAndProjectUrl(siteCode, projectIdentifier, `handover/${commpkgId}/query/`); | ||
} | ||
} |
{ | ||
"name": "@equinor/fusion", | ||
"version": "0.1.88", | ||
"version": "0.1.89", | ||
"description": "Everything a Fusion app needs to communicate with the core", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
174
159314
3836