refactor: update provider method signatures
This commit is contained in:
@@ -479,7 +479,7 @@ export class NewWorkspaceService extends Service {
|
|||||||
|
|
||||||
public async reorderRESTCollection(
|
public async reorderRESTCollection(
|
||||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||||
destinationCollectionIndex: string | null
|
destinationCollectionID: string | null
|
||||||
): Promise<
|
): Promise<
|
||||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||||
> {
|
> {
|
||||||
@@ -497,7 +497,7 @@ export class NewWorkspaceService extends Service {
|
|||||||
|
|
||||||
const result = await provider.reorderRESTCollection(
|
const result = await provider.reorderRESTCollection(
|
||||||
collectionHandle,
|
collectionHandle,
|
||||||
destinationCollectionIndex
|
destinationCollectionID
|
||||||
)
|
)
|
||||||
|
|
||||||
if (E.isLeft(result)) {
|
if (E.isLeft(result)) {
|
||||||
@@ -509,7 +509,7 @@ export class NewWorkspaceService extends Service {
|
|||||||
|
|
||||||
public async moveRESTCollection(
|
public async moveRESTCollection(
|
||||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||||
destinationCollectionIndex: string | null
|
destinationCollectionID: string | null
|
||||||
): Promise<
|
): Promise<
|
||||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||||
> {
|
> {
|
||||||
@@ -527,7 +527,7 @@ export class NewWorkspaceService extends Service {
|
|||||||
|
|
||||||
const result = await provider.moveRESTCollection(
|
const result = await provider.moveRESTCollection(
|
||||||
collectionHandle,
|
collectionHandle,
|
||||||
destinationCollectionIndex
|
destinationCollectionID
|
||||||
)
|
)
|
||||||
|
|
||||||
if (E.isLeft(result)) {
|
if (E.isLeft(result)) {
|
||||||
@@ -539,8 +539,8 @@ export class NewWorkspaceService extends Service {
|
|||||||
|
|
||||||
public async reorderRESTRequest(
|
public async reorderRESTRequest(
|
||||||
requestHandle: HandleRef<WorkspaceRequest>,
|
requestHandle: HandleRef<WorkspaceRequest>,
|
||||||
destinationCollectionIndex: string,
|
destinationCollectionID: string,
|
||||||
destinationRequestIndex: string | null
|
destinationRequestID: string | null
|
||||||
): Promise<
|
): Promise<
|
||||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||||
> {
|
> {
|
||||||
@@ -558,8 +558,8 @@ export class NewWorkspaceService extends Service {
|
|||||||
|
|
||||||
const result = await provider.reorderRESTRequest(
|
const result = await provider.reorderRESTRequest(
|
||||||
requestHandle,
|
requestHandle,
|
||||||
destinationCollectionIndex,
|
destinationCollectionID,
|
||||||
destinationRequestIndex
|
destinationRequestID
|
||||||
)
|
)
|
||||||
|
|
||||||
if (E.isLeft(result)) {
|
if (E.isLeft(result)) {
|
||||||
@@ -571,7 +571,7 @@ export class NewWorkspaceService extends Service {
|
|||||||
|
|
||||||
public async moveRESTRequest(
|
public async moveRESTRequest(
|
||||||
requestHandle: HandleRef<WorkspaceRequest>,
|
requestHandle: HandleRef<WorkspaceRequest>,
|
||||||
destinationCollectionIndex: string
|
destinationCollectionID: string
|
||||||
): Promise<
|
): Promise<
|
||||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||||
> {
|
> {
|
||||||
@@ -589,7 +589,7 @@ export class NewWorkspaceService extends Service {
|
|||||||
|
|
||||||
const result = await provider.moveRESTRequest(
|
const result = await provider.moveRESTRequest(
|
||||||
requestHandle,
|
requestHandle,
|
||||||
destinationCollectionIndex
|
destinationCollectionID
|
||||||
)
|
)
|
||||||
|
|
||||||
if (E.isLeft(result)) {
|
if (E.isLeft(result)) {
|
||||||
|
|||||||
@@ -89,19 +89,19 @@ export interface WorkspaceProvider {
|
|||||||
|
|
||||||
reorderRESTCollection(
|
reorderRESTCollection(
|
||||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||||
destinationCollectionIndex: string | null
|
destinationCollectionID: string | null
|
||||||
): Promise<E.Either<unknown, void>>
|
): Promise<E.Either<unknown, void>>
|
||||||
moveRESTCollection(
|
moveRESTCollection(
|
||||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||||
destinationCollectionIndex: string | null
|
destinationCollectionID: string | null
|
||||||
): Promise<E.Either<unknown, void>>
|
): Promise<E.Either<unknown, void>>
|
||||||
reorderRESTRequest(
|
reorderRESTRequest(
|
||||||
requestHandle: HandleRef<WorkspaceRequest>,
|
requestHandle: HandleRef<WorkspaceRequest>,
|
||||||
destinationCollectionIndex: string,
|
destinationCollectionID: string,
|
||||||
destinationRequestIndex: string | null
|
destinationRequestID: string | null
|
||||||
): Promise<E.Either<unknown, void>>
|
): Promise<E.Either<unknown, void>>
|
||||||
moveRESTRequest(
|
moveRESTRequest(
|
||||||
requestHandle: HandleRef<WorkspaceRequest>,
|
requestHandle: HandleRef<WorkspaceRequest>,
|
||||||
destinationCollectionIndex: string
|
destinationCollectionID: string
|
||||||
): Promise<E.Either<unknown, void>>
|
): Promise<E.Either<unknown, void>>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ export class PersonalWorkspaceProviderService
|
|||||||
|
|
||||||
public reorderRESTCollection(
|
public reorderRESTCollection(
|
||||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||||
destinationCollectionIndex: string | null
|
destinationCollectionID: string | null
|
||||||
): Promise<E.Either<unknown, void>> {
|
): Promise<E.Either<unknown, void>> {
|
||||||
if (
|
if (
|
||||||
collectionHandle.value.type !== "ok" ||
|
collectionHandle.value.type !== "ok" ||
|
||||||
@@ -502,17 +502,14 @@ export class PersonalWorkspaceProviderService
|
|||||||
|
|
||||||
const draggedCollectionIndex = collectionHandle.value.data.collectionID
|
const draggedCollectionIndex = collectionHandle.value.data.collectionID
|
||||||
|
|
||||||
updateRESTCollectionOrder(
|
updateRESTCollectionOrder(draggedCollectionIndex, destinationCollectionID)
|
||||||
draggedCollectionIndex,
|
|
||||||
destinationCollectionIndex
|
|
||||||
)
|
|
||||||
|
|
||||||
return Promise.resolve(E.right(undefined))
|
return Promise.resolve(E.right(undefined))
|
||||||
}
|
}
|
||||||
|
|
||||||
public moveRESTCollection(
|
public moveRESTCollection(
|
||||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||||
destinationCollectionIndex: string | null
|
destinationCollectionID: string | null
|
||||||
): Promise<E.Either<unknown, void>> {
|
): Promise<E.Either<unknown, void>> {
|
||||||
if (
|
if (
|
||||||
collectionHandle.value.type !== "ok" ||
|
collectionHandle.value.type !== "ok" ||
|
||||||
@@ -524,7 +521,7 @@ export class PersonalWorkspaceProviderService
|
|||||||
|
|
||||||
moveRESTFolder(
|
moveRESTFolder(
|
||||||
collectionHandle.value.data.collectionID,
|
collectionHandle.value.data.collectionID,
|
||||||
destinationCollectionIndex
|
destinationCollectionID
|
||||||
)
|
)
|
||||||
|
|
||||||
return Promise.resolve(E.right(undefined))
|
return Promise.resolve(E.right(undefined))
|
||||||
@@ -532,8 +529,8 @@ export class PersonalWorkspaceProviderService
|
|||||||
|
|
||||||
public reorderRESTRequest(
|
public reorderRESTRequest(
|
||||||
requestHandle: HandleRef<WorkspaceRequest>,
|
requestHandle: HandleRef<WorkspaceRequest>,
|
||||||
destinationCollectionIndex: string,
|
destinationCollectionID: string,
|
||||||
destinationRequestIndex: string | null
|
destinationRequestID: string | null
|
||||||
): Promise<E.Either<unknown, void>> {
|
): Promise<E.Either<unknown, void>> {
|
||||||
if (
|
if (
|
||||||
requestHandle.value.type !== "ok" ||
|
requestHandle.value.type !== "ok" ||
|
||||||
@@ -547,10 +544,8 @@ export class PersonalWorkspaceProviderService
|
|||||||
|
|
||||||
updateRESTRequestOrder(
|
updateRESTRequestOrder(
|
||||||
this.pathToLastIndex(draggedRequestIndex),
|
this.pathToLastIndex(draggedRequestIndex),
|
||||||
destinationRequestIndex
|
destinationRequestID ? this.pathToLastIndex(destinationRequestID) : null,
|
||||||
? this.pathToLastIndex(destinationRequestIndex)
|
destinationCollectionID
|
||||||
: null,
|
|
||||||
destinationCollectionIndex
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return Promise.resolve(E.right(undefined))
|
return Promise.resolve(E.right(undefined))
|
||||||
@@ -558,7 +553,7 @@ export class PersonalWorkspaceProviderService
|
|||||||
|
|
||||||
public moveRESTRequest(
|
public moveRESTRequest(
|
||||||
requestHandle: HandleRef<WorkspaceRequest>,
|
requestHandle: HandleRef<WorkspaceRequest>,
|
||||||
destinationCollectionIndex: string
|
destinationCollectionID: string
|
||||||
): Promise<E.Either<unknown, void>> {
|
): Promise<E.Either<unknown, void>> {
|
||||||
if (
|
if (
|
||||||
requestHandle.value.type !== "ok" ||
|
requestHandle.value.type !== "ok" ||
|
||||||
@@ -577,7 +572,7 @@ export class PersonalWorkspaceProviderService
|
|||||||
moveRESTRequest(
|
moveRESTRequest(
|
||||||
parentCollectionIndexPath,
|
parentCollectionIndexPath,
|
||||||
this.pathToLastIndex(requestIndex),
|
this.pathToLastIndex(requestIndex),
|
||||||
destinationCollectionIndex
|
destinationCollectionID
|
||||||
)
|
)
|
||||||
|
|
||||||
return Promise.resolve(E.right(undefined))
|
return Promise.resolve(E.right(undefined))
|
||||||
|
|||||||
Reference in New Issue
Block a user