fix: properties not inherited while importing from postman (#4725)

Update collection-level platform definitions

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
Anwarul Islam 2025-02-07 15:15:51 +06:00 committed by GitHub
parent 43f168c2f6
commit ede275425b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 17 deletions

View file

@ -200,7 +200,7 @@ const getVariableValue = (defs: VariableDefinition[], key: string) =>
const getHoppReqAuth = ( const getHoppReqAuth = (
hoppAuth: Item["request"]["auth"] | null hoppAuth: Item["request"]["auth"] | null
): HoppRESTAuth => { ): HoppRESTAuth => {
if (!hoppAuth) return { authType: "inherit", authActive: false } if (!hoppAuth) return { authType: "inherit", authActive: true }
const auth = hoppAuth as unknown as PMRequestAuthDef const auth = hoppAuth as unknown as PMRequestAuthDef

View file

@ -128,13 +128,13 @@ function exportedCollectionToHoppCollection(
restCollection.data && restCollection.data !== "null" restCollection.data && restCollection.data !== "null"
? JSON.parse(restCollection.data) ? JSON.parse(restCollection.data)
: { : {
auth: { authType: "inherit", authActive: false }, auth: { authType: "inherit", authActive: true },
headers: [], headers: [],
} }
return { return {
id: restCollection.id, id: restCollection.id,
v: 4, v: 6,
name: restCollection.name, name: restCollection.name,
folders: restCollection.folders.map((folder) => folders: restCollection.folders.map((folder) =>
exportedCollectionToHoppCollection(folder, collectionType) exportedCollectionToHoppCollection(folder, collectionType)
@ -190,13 +190,13 @@ function exportedCollectionToHoppCollection(
gqlCollection.data && gqlCollection.data !== "null" gqlCollection.data && gqlCollection.data !== "null"
? JSON.parse(gqlCollection.data) ? JSON.parse(gqlCollection.data)
: { : {
auth: { authType: "inherit", authActive: false }, auth: { authType: "inherit", authActive: true },
headers: [], headers: [],
} }
return { return {
id: gqlCollection.id, id: gqlCollection.id,
v: 4, v: 6,
name: gqlCollection.name, name: gqlCollection.name,
folders: gqlCollection.folders.map((folder) => folders: gqlCollection.folders.map((folder) =>
exportedCollectionToHoppCollection(folder, collectionType) exportedCollectionToHoppCollection(folder, collectionType)
@ -364,7 +364,7 @@ function setupUserCollectionCreatedSubscription() {
res.right.userCollectionCreated.data != "null" res.right.userCollectionCreated.data != "null"
? JSON.parse(res.right.userCollectionCreated.data) ? JSON.parse(res.right.userCollectionCreated.data)
: { : {
auth: { authType: "inherit", authActive: false }, auth: { authType: "inherit", authActive: true },
headers: [], headers: [],
} }
@ -374,7 +374,7 @@ function setupUserCollectionCreatedSubscription() {
name: res.right.userCollectionCreated.title, name: res.right.userCollectionCreated.title,
folders: [], folders: [],
requests: [], requests: [],
v: 4, v: 6,
auth: data.auth, auth: data.auth,
headers: addDescriptionField(data.headers), headers: addDescriptionField(data.headers),
}) })
@ -382,7 +382,7 @@ function setupUserCollectionCreatedSubscription() {
name: res.right.userCollectionCreated.title, name: res.right.userCollectionCreated.title,
folders: [], folders: [],
requests: [], requests: [],
v: 4, v: 6,
auth: data.auth, auth: data.auth,
headers: addDescriptionField(data.headers), headers: addDescriptionField(data.headers),
}) })
@ -591,7 +591,7 @@ function setupUserCollectionDuplicatedSubscription() {
data && data != "null" data && data != "null"
? JSON.parse(data) ? JSON.parse(data)
: { : {
auth: { authType: "inherit", authActive: false }, auth: { authType: "inherit", authActive: true },
headers: [], headers: [],
} }
@ -607,7 +607,7 @@ function setupUserCollectionDuplicatedSubscription() {
name, name,
folders, folders,
requests, requests,
v: 4, v: 6,
auth, auth,
headers: addDescriptionField(headers), headers: addDescriptionField(headers),
} }
@ -1026,7 +1026,7 @@ function transformDuplicatedCollections(
const { auth, headers } = const { auth, headers } =
data && data !== "null" data && data !== "null"
? JSON.parse(data) ? JSON.parse(data)
: { auth: { authType: "inherit", authActive: false }, headers: [] } : { auth: { authType: "inherit", authActive: true }, headers: [] }
const folders = transformDuplicatedCollections(childCollectionsJSONStr) const folders = transformDuplicatedCollections(childCollectionsJSONStr)
@ -1037,7 +1037,7 @@ function transformDuplicatedCollections(
name, name,
folders, folders,
requests, requests,
v: 4, v: 6,
auth, auth,
headers: addDescriptionField(headers), headers: addDescriptionField(headers),
} }

View file

@ -132,7 +132,7 @@ function exportedCollectionToHoppCollection(
restCollection.data && restCollection.data !== "null" restCollection.data && restCollection.data !== "null"
? JSON.parse(restCollection.data) ? JSON.parse(restCollection.data)
: { : {
auth: { authType: "inherit", authActive: false }, auth: { authType: "inherit", authActive: true },
headers: [], headers: [],
_ref_id: generateUniqueRefId("coll"), _ref_id: generateUniqueRefId("coll"),
} }
@ -196,7 +196,7 @@ function exportedCollectionToHoppCollection(
gqlCollection.data && gqlCollection.data !== "null" gqlCollection.data && gqlCollection.data !== "null"
? JSON.parse(gqlCollection.data) ? JSON.parse(gqlCollection.data)
: { : {
auth: { authType: "inherit", authActive: false }, auth: { authType: "inherit", authActive: true },
headers: [], headers: [],
_ref_id: generateUniqueRefId("coll"), _ref_id: generateUniqueRefId("coll"),
} }
@ -372,7 +372,7 @@ function setupUserCollectionCreatedSubscription() {
res.right.userCollectionCreated.data != "null" res.right.userCollectionCreated.data != "null"
? JSON.parse(res.right.userCollectionCreated.data) ? JSON.parse(res.right.userCollectionCreated.data)
: { : {
auth: { authType: "inherit", authActive: false }, auth: { authType: "inherit", authActive: true },
headers: [], headers: [],
_ref_id: generateUniqueRefId("coll"), _ref_id: generateUniqueRefId("coll"),
} }
@ -602,7 +602,7 @@ function setupUserCollectionDuplicatedSubscription() {
data && data != "null" data && data != "null"
? JSON.parse(data) ? JSON.parse(data)
: { : {
auth: { authType: "inherit", authActive: false }, auth: { authType: "inherit", authActive: true },
headers: [], headers: [],
} }
// Duplicated collection will have a unique ref id // Duplicated collection will have a unique ref id
@ -1040,7 +1040,7 @@ function transformDuplicatedCollections(
const { auth, headers } = const { auth, headers } =
data && data !== "null" data && data !== "null"
? JSON.parse(data) ? JSON.parse(data)
: { auth: { authType: "inherit", authActive: false }, headers: [] } : { auth: { authType: "inherit", authActive: true }, headers: [] }
const _ref_id = generateUniqueRefId("coll") const _ref_id = generateUniqueRefId("coll")