import * as TE from "fp-ts/TaskEither" import { HoppRESTRequest } from "@hoppscotch/data" import { Collection } from "~/newstore/collections" /** * The error state to be used when the file formats do not match */ export const IMPORTER_INVALID_FILE_FORMAT = "importer_invalid_file_format" as const export type HoppImporterError = typeof IMPORTER_INVALID_FILE_FORMAT export type HoppImporter = ( content: string ) => TE.TaskEither /** * Definition for importers */ export type HoppImporterDefintion = { /** * Name of the importer, shown on the Select Importer dropdown */ name: string /** * The importer function, It is a Promise because its supposed to be loaded in lazily (dynamic imports ?) */ importer: () => Promise> } export const RESTCollectionImporters: HoppImporterDefintion< Collection[] >[] = [ { name: "Hoppscotch REST Collection", importer: () => import("./hopp").then((m) => m.default), }, ]