"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/hoppscotch-data/src/collection/index.ts" between
hoppscotch-2.2.1.tar.gz and hoppscotch-3.0.0.tar.gz

About: Hoppscotch is a light-weight, web based API development suite.

index.ts  (hoppscotch-2.2.1):index.ts  (hoppscotch-3.0.0)
import { HoppGQLRequest, translateToGQLRequest } from "../graphql"; import { GQL_REQ_SCHEMA_VERSION, HoppGQLRequest, translateToGQLRequest } from ". ./graphql";
import { HoppRESTRequest, translateToNewRequest } from "../rest"; import { HoppRESTRequest, translateToNewRequest } from "../rest";
const CURRENT_COLL_SCHEMA_VER = 1 const CURRENT_COLL_SCHEMA_VER = 1
type SupportedReqTypes = type SupportedReqTypes =
| HoppRESTRequest | HoppRESTRequest
| HoppGQLRequest | HoppGQLRequest
export type HoppCollection<T extends SupportedReqTypes> = { export type HoppCollection<T extends SupportedReqTypes> = {
v: number v: number
skipping to change at line 68 skipping to change at line 68
} }
/** /**
* Translates an old collection to a new collection * Translates an old collection to a new collection
* @param x The collection object to load * @param x The collection object to load
* @returns The proper new collection format * @returns The proper new collection format
*/ */
export function translateToNewGQLCollection( export function translateToNewGQLCollection(
x: any x: any
): HoppCollection<HoppGQLRequest> { ): HoppCollection<HoppGQLRequest> {
if (x.v && x.v === 1) return x if (x.v && x.v === GQL_REQ_SCHEMA_VERSION) return x
// Legacy // Legacy
const name = x.name ?? "Untitled" const name = x.name ?? "Untitled"
const folders = (x.folders ?? []).map(translateToNewGQLCollection) const folders = (x.folders ?? []).map(translateToNewGQLCollection)
const requests = (x.requests ?? []).map(translateToGQLRequest) const requests = (x.requests ?? []).map(translateToGQLRequest)
const obj = makeCollection<HoppGQLRequest>({ const obj = makeCollection<HoppGQLRequest>({
name, name,
folders, folders,
requests, requests,
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)