refactor: update all hoppCollection type to remove generic pattern

This commit is contained in:
nivedin
2023-12-11 17:41:02 +05:30
committed by Andrew Bastin
parent 9d2b7cc03f
commit 95953557de
38 changed files with 201 additions and 257 deletions

View File

@@ -103,7 +103,7 @@ type ExportedUserCollectionGQL = {
function exportedCollectionToHoppCollection(
collection: ExportedUserCollectionREST | ExportedUserCollectionGQL,
collectionType: "REST" | "GQL"
): HoppCollection<HoppRESTRequest | HoppGQLRequest> {
): HoppCollection {
if (collectionType == "REST") {
const restCollection = collection as ExportedUserCollectionREST
const data =
@@ -203,7 +203,7 @@ async function loadUserCollections(collectionType: "REST" | "GQL") {
exportedCollectionToHoppCollection(
collection,
"REST"
) as HoppCollection<HoppRESTRequest>
) as HoppCollection
)
)
: setGraphqlCollections(
@@ -212,7 +212,7 @@ async function loadUserCollections(collectionType: "REST" | "GQL") {
exportedCollectionToHoppCollection(
collection,
"GQL"
) as HoppCollection<HoppGQLRequest>
) as HoppCollection
)
)
})
@@ -748,7 +748,7 @@ export const def: CollectionsPlatformDef = {
function getCollectionPathFromCollectionID(
collectionID: string,
collections: HoppCollection<HoppRESTRequest | HoppGQLRequest>[],
collections: HoppCollection[],
parentPath?: string
): string | null {
for (const collectionIndex in collections) {
@@ -772,7 +772,7 @@ function getCollectionPathFromCollectionID(
function getRequestPathFromRequestID(
requestID: string,
collections: HoppCollection<HoppRESTRequest | HoppGQLRequest>[],
collections: HoppCollection[],
parentPath?: string
): { collectionPath: string; requestIndex: number } | null {
for (const collectionIndex in collections) {
@@ -804,7 +804,7 @@ function getRequestPathFromRequestID(
function getRequestIndex(
requestID: string,
parentCollectionPath: string,
collections: HoppCollection<HoppRESTRequest | HoppGQLRequest>[]
collections: HoppCollection[]
) {
const collection = navigateToFolderWithIndexPath(
collections,

View File

@@ -39,7 +39,7 @@ export const restRequestsMapper = createMapper<string, string>()
// temp implementation untill the backend implements an endpoint that accepts an entire collection
// TODO: use importCollectionsJSON to do this
const recursivelySyncCollections = async (
collection: HoppCollection<HoppRESTRequest>,
collection: HoppCollection,
collectionPath: string,
parentUserCollectionID?: string
) => {

View File

@@ -36,7 +36,7 @@ export const gqlRequestsMapper = createMapper<string, string>()
// temp implementation untill the backend implements an endpoint that accepts an entire collection
// TODO: use importCollectionsJSON to do this
const recursivelySyncCollections = async (
collection: HoppCollection<HoppRESTRequest>,
collection: HoppCollection,
collectionPath: string,
parentUserCollectionID?: string
) => {