@equinor/fusion
Advanced tools
Comparing version 3.2.2 to 3.2.3
import BaseApiClient from './BaseApiClient'; | ||
import { HandoverItem, HandoverMcpkg, HandoverDetails, HandoverNCR, HandoverPunch, HandoverSWCR, HandoverUnsignedAction, HandoverUnsignedTask, HandoverWorkOrder, HandoverQuery, AccumulatedContainer, WorkOrder, WorkOrderMaterial, WorkOrderMccr, Milestone, McPackage, McPunchItem, McWorkOrder, McNcr, OperationItem } from './models/dataProxy'; | ||
import { HandoverItem, HandoverMcpkg, HandoverDetails, HandoverNCR, HandoverPunch, HandoverSWCR, HandoverUnsignedAction, HandoverUnsignedTask, HandoverWorkOrder, HandoverQuery, AccumulatedContainer, WorkOrder, WorkOrderMaterial, WorkOrderMccr, Milestone, McPackage, McPunchItem, McWorkOrder, McNcr, OperationItem, SwcrPackage, SwcrSignature } from './models/dataProxy'; | ||
import { HandoverActions, AccumulatedActions } from '../resourceCollections/DataProxyResourceCollection'; | ||
@@ -21,2 +21,4 @@ import { HttpResponse } from '../HttpClient'; | ||
getMcNcrAsync(contextId: string, workOrderId: string): Promise<HttpResponse<McNcr[]>>; | ||
getSwcrAsync(context: string, invalidateCache: boolean): Promise<HttpResponse<SwcrPackage[]>>; | ||
getSwcrSignaturesAsync(context: string, swcrId: string): Promise<HttpResponse<SwcrSignature[]>>; | ||
} |
@@ -62,2 +62,11 @@ import BaseApiClient from './BaseApiClient'; | ||
} | ||
async getSwcrAsync(context, invalidateCache) { | ||
const url = this.resourceCollections.dataProxy.swcrPackages(context); | ||
const options = invalidateCache ? { headers: { 'x-pp-cache-policy': 'no-cache' } } : {}; | ||
return await this.httpClient.getAsync(url, options); | ||
} | ||
async getSwcrSignaturesAsync(context, swcrId) { | ||
const url = this.resourceCollections.dataProxy.swcrSignatures(context, swcrId); | ||
return await this.httpClient.getAsync(url); | ||
} | ||
} |
@@ -21,1 +21,3 @@ export { HandoverItem } from './handover/HandoverItem'; | ||
export { McWorkOrder } from './mcPackage/McWorkOrder'; | ||
export { SwcrPackage, SwcrStatus } from './swcr/SwcrPackage'; | ||
export { SwcrSignature } from './swcr/SwcrSignature'; |
@@ -11,2 +11,9 @@ import BaseApiClient from './BaseApiClient'; | ||
newProjectAsync(newProject: CreateOrgProject): Promise<HttpResponse<OrgProject>>; | ||
getProjectImageAsync(args: { | ||
projectId: string; | ||
}): Promise<File>; | ||
updateProjectImageAsync(args: { | ||
projectId: string; | ||
file: File; | ||
}): Promise<Response>; | ||
getPositionsAsync(projectId: string, expandProperties?: string[], snapshotId?: string): Promise<HttpResponse<Position[]>>; | ||
@@ -13,0 +20,0 @@ getPositionsAllowHeaders(projectId: string, draftId?: string): Promise<string | null>; |
@@ -32,2 +32,19 @@ import BaseApiClient from './BaseApiClient'; | ||
} | ||
async getProjectImageAsync(args) { | ||
const { projectId } = args; | ||
const orgResources = this.resourceCollections.org; | ||
const url = orgResources.project(projectId + '/image'); | ||
return this.httpClient.getFileAsync(url); | ||
} | ||
async updateProjectImageAsync(args) { | ||
const { projectId, file } = args; | ||
const orgResources = this.resourceCollections.org; | ||
const url = orgResources.project(projectId + '/image'); | ||
const requestInit = { | ||
headers: { | ||
'api-version': '2.0', | ||
}, | ||
}; | ||
return this.httpClient.uploadFileAsync(url, file, 'PUT', requestInit); | ||
} | ||
async getPositionsAsync(projectId, expandProperties, snapshotId) { | ||
@@ -34,0 +51,0 @@ const orgResources = this.resourceCollections.org; |
@@ -73,2 +73,10 @@ import { HttpResponse } from './HttpResponse'; | ||
getFileAsync<TExpectedErrorResponse>(url: string): Promise<File>; | ||
/** | ||
* Performs a request to upload file with choise of method | ||
* @param url Request url | ||
* @param file File to upload | ||
* @param method Request method | ||
* @param init Optional request init object | ||
*/ | ||
uploadFileAsync<TExpectedErrorResponse>(url: string, file: File, method: 'PUT' | 'PATCH' | 'POST', init?: RequestInit | null): Promise<Response>; | ||
} |
@@ -31,2 +31,3 @@ import { IAuthContainer } from '../../auth/AuthContainer'; | ||
getFileAsync<TExpectedErrorResponse>(url: string, init?: RequestInit | null): Promise<File>; | ||
uploadFileAsync<TExpectedErrorResponse>(url: string, file: File, method: 'PUT' | 'PATCH' | 'POST', init?: RequestInit | null): Promise<Response>; | ||
protected responseIsRetriable(response: Response, retryTimeout: number): boolean; | ||
@@ -33,0 +34,0 @@ protected retryRequestAsync<TExpectedErrorResponse>(url: string, init: RequestInit, retryTimeout: number): Promise<Response>; |
@@ -144,2 +144,12 @@ import { v1 as uuidv1 } from 'uuid'; | ||
} | ||
async uploadFileAsync(url, file, method, init) { | ||
const body = new FormData(); | ||
body.append('file', file); | ||
const requestInit = ensureRequestInit(Object.assign(Object.assign({}, init), { method, | ||
body }), (input) => { | ||
input.headers.delete('Content-Type'); | ||
return input; | ||
}); | ||
return this.performFetchAsync(url, requestInit); | ||
} | ||
responseIsRetriable(response, retryTimeout) { | ||
@@ -146,0 +156,0 @@ if (retryTimeout > 20000 || response.headers.get('x-fusion-retriable') === 'false') { |
@@ -38,2 +38,4 @@ import BaseResourceCollection from './BaseResourceCollection'; | ||
mcPunch(contextId: string, mcPackageId: string): string; | ||
swcrPackages(context: string): string; | ||
swcrSignatures(context: string, swcrId: string): string; | ||
} |
@@ -46,2 +46,8 @@ import BaseResourceCollection from './BaseResourceCollection'; | ||
} | ||
swcrPackages(context) { | ||
return combineUrls(this.getBaseUrl(), 'api', 'contexts', context, 'swcr'); | ||
} | ||
swcrSignatures(context, swcrId) { | ||
return combineUrls(this.swcrPackages(context), swcrId, 'signatures'); | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
declare const _default: "3.2.2"; | ||
declare const _default: "3.2.3"; | ||
export default _default; |
@@ -1,1 +0,1 @@ | ||
export default '3.2.2'; | ||
export default '3.2.3'; |
{ | ||
"name": "@equinor/fusion", | ||
"version": "3.2.2", | ||
"version": "3.2.3", | ||
"description": "Everything a Fusion app needs to communicate with the core", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
384702
434
9210