mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-25 09:23:17 +01:00
fix: collection import (#2353)
This commit is contained in:
parent
4f11da12af
commit
4f64c2d59b
61
package-lock.json
generated
61
package-lock.json
generated
@ -19729,7 +19729,7 @@
|
|||||||
},
|
},
|
||||||
"packages/bruno-electron": {
|
"packages/bruno-electron": {
|
||||||
"name": "bruno",
|
"name": "bruno",
|
||||||
"version": "v1.17.0",
|
"version": "v1.18.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/credential-providers": "3.525.0",
|
"@aws-sdk/credential-providers": "3.525.0",
|
||||||
"@usebruno/common": "0.1.0",
|
"@usebruno/common": "0.1.0",
|
||||||
@ -20762,21 +20762,6 @@
|
|||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/bruno-electron/node_modules/ajv": {
|
|
||||||
"version": "8.13.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz",
|
|
||||||
"integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==",
|
|
||||||
"dependencies": {
|
|
||||||
"fast-deep-equal": "^3.1.3",
|
|
||||||
"json-schema-traverse": "^1.0.0",
|
|
||||||
"require-from-string": "^2.0.2",
|
|
||||||
"uri-js": "^4.4.1"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/epoberezkin"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"packages/bruno-electron/node_modules/fs-extra": {
|
"packages/bruno-electron/node_modules/fs-extra": {
|
||||||
"version": "10.1.0",
|
"version": "10.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -20789,11 +20774,6 @@
|
|||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/bruno-electron/node_modules/json-schema-traverse": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
|
|
||||||
},
|
|
||||||
"packages/bruno-graphql-docs": {
|
"packages/bruno-graphql-docs": {
|
||||||
"name": "@usebruno/graphql-docs",
|
"name": "@usebruno/graphql-docs",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
@ -27012,40 +26992,6 @@
|
|||||||
"tslib": "^2.5.0"
|
"tslib": "^2.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@usebruno/js": {
|
|
||||||
"version": "https://registry.npmjs.org/@usebruno/js/-/js-0.11.0.tgz",
|
|
||||||
"integrity": "sha512-csbKAnFtLTupG46aMIahRWeNW8/rdDeaZPtvr4kIzcHDPNmKNowcFcrIR4VSpceh47Ltpm8n0sgzrHzw8P8Yjg==",
|
|
||||||
"requires": {
|
|
||||||
"@usebruno/query": "0.1.0",
|
|
||||||
"ajv": "^8.12.0",
|
|
||||||
"ajv-formats": "^2.1.1",
|
|
||||||
"atob": "^2.1.2",
|
|
||||||
"axios": "^1.5.1",
|
|
||||||
"btoa": "^1.2.1",
|
|
||||||
"chai": "^4.3.7",
|
|
||||||
"chai-string": "^1.5.0",
|
|
||||||
"crypto-js": "^4.1.1",
|
|
||||||
"handlebars": "^4.7.8",
|
|
||||||
"json-query": "^2.2.2",
|
|
||||||
"lodash": "^4.17.21",
|
|
||||||
"moment": "^2.29.4",
|
|
||||||
"nanoid": "3.3.4",
|
|
||||||
"node-fetch": "2.*",
|
|
||||||
"node-vault": "^0.10.2",
|
|
||||||
"uuid": "^9.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ajv": {
|
|
||||||
"version": "8.13.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz",
|
|
||||||
"integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==",
|
|
||||||
"requires": {
|
|
||||||
"fast-deep-equal": "^3.1.3",
|
|
||||||
"json-schema-traverse": "^1.0.0",
|
|
||||||
"require-from-string": "^2.0.2",
|
|
||||||
"uri-js": "^4.4.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"fs-extra": {
|
"fs-extra": {
|
||||||
"version": "10.1.0",
|
"version": "10.1.0",
|
||||||
"requires": {
|
"requires": {
|
||||||
@ -27053,11 +26999,6 @@
|
|||||||
"jsonfile": "^6.0.1",
|
"jsonfile": "^6.0.1",
|
||||||
"universalify": "^2.0.0"
|
"universalify": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"json-schema-traverse": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -17,32 +17,32 @@ const ImportCollection = ({ onClose, handleSubmit }) => {
|
|||||||
});
|
});
|
||||||
const handleImportBrunoCollection = () => {
|
const handleImportBrunoCollection = () => {
|
||||||
importBrunoCollection()
|
importBrunoCollection()
|
||||||
.then((collection) => {
|
.then(({ collection }) => {
|
||||||
handleSubmit(collection);
|
handleSubmit({ collection });
|
||||||
})
|
})
|
||||||
.catch((err) => toastError(err, 'Import collection failed'));
|
.catch((err) => toastError(err, 'Import collection failed'));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleImportPostmanCollection = () => {
|
const handleImportPostmanCollection = () => {
|
||||||
importPostmanCollection(options)
|
importPostmanCollection(options)
|
||||||
.then((collection) => {
|
.then(({ collection, translationLog }) => {
|
||||||
handleSubmit(collection);
|
handleSubmit({ collection, translationLog });
|
||||||
})
|
})
|
||||||
.catch((err) => toastError(err, 'Postman Import collection failed'));
|
.catch((err) => toastError(err, 'Postman Import collection failed'));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleImportInsomniaCollection = () => {
|
const handleImportInsomniaCollection = () => {
|
||||||
importInsomniaCollection()
|
importInsomniaCollection()
|
||||||
.then((collection) => {
|
.then(({ collection }) => {
|
||||||
handleSubmit(collection);
|
handleSubmit({ collection });
|
||||||
})
|
})
|
||||||
.catch((err) => toastError(err, 'Insomnia Import collection failed'));
|
.catch((err) => toastError(err, 'Insomnia Import collection failed'));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleImportOpenapiCollection = () => {
|
const handleImportOpenapiCollection = () => {
|
||||||
importOpenapiCollection()
|
importOpenapiCollection()
|
||||||
.then((collection) => {
|
.then(({ collection }) => {
|
||||||
handleSubmit(collection);
|
handleSubmit({ collection });
|
||||||
})
|
})
|
||||||
.catch((err) => toastError(err, 'OpenAPI v3 Import collection failed'));
|
.catch((err) => toastError(err, 'OpenAPI v3 Import collection failed'));
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,9 @@ const TitleBar = () => {
|
|||||||
|
|
||||||
const handleImportCollection = ({ collection, translationLog }) => {
|
const handleImportCollection = ({ collection, translationLog }) => {
|
||||||
setImportedCollection(collection);
|
setImportedCollection(collection);
|
||||||
setImportedTranslationLog(translationLog);
|
if (translationLog) {
|
||||||
|
setImportedTranslationLog(translationLog);
|
||||||
|
}
|
||||||
setImportCollectionModalOpen(false);
|
setImportCollectionModalOpen(false);
|
||||||
setImportCollectionLocationModalOpen(true);
|
setImportCollectionLocationModalOpen(true);
|
||||||
};
|
};
|
||||||
|
@ -24,9 +24,11 @@ const Welcome = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleImportCollection = (collection, translationLog) => {
|
const handleImportCollection = ({ collection, translationLog }) => {
|
||||||
setImportedCollection(collection);
|
setImportedCollection(collection);
|
||||||
setImportedTranslationLog(translationLog);
|
if (translationLog) {
|
||||||
|
setImportedTranslationLog(translationLog);
|
||||||
|
}
|
||||||
setImportCollectionModalOpen(false);
|
setImportCollectionModalOpen(false);
|
||||||
setImportCollectionLocationModalOpen(true);
|
setImportCollectionLocationModalOpen(true);
|
||||||
};
|
};
|
||||||
@ -53,7 +55,7 @@ const Welcome = () => {
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div className="">
|
<div>
|
||||||
<Bruno width={50} />
|
<Bruno width={50} />
|
||||||
</div>
|
</div>
|
||||||
<div className="text-xl font-semibold select-none">bruno</div>
|
<div className="text-xl font-semibold select-none">bruno</div>
|
||||||
|
@ -32,7 +32,7 @@ const importCollection = () => {
|
|||||||
.then(updateUidsInCollection)
|
.then(updateUidsInCollection)
|
||||||
.then(transformItemsInCollection)
|
.then(transformItemsInCollection)
|
||||||
.then(validateSchema)
|
.then(validateSchema)
|
||||||
.then((collection) => resolve(collection))
|
.then((collection) => resolve({ collection }))
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
reject(new BrunoError('Import collection failed'));
|
reject(new BrunoError('Import collection failed'));
|
||||||
|
@ -237,7 +237,7 @@ const importCollection = () => {
|
|||||||
.then(transformItemsInCollection)
|
.then(transformItemsInCollection)
|
||||||
.then(hydrateSeqInCollection)
|
.then(hydrateSeqInCollection)
|
||||||
.then(validateSchema)
|
.then(validateSchema)
|
||||||
.then((collection) => resolve(collection))
|
.then((collection) => resolve({ collection }))
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
reject(new BrunoError('Import collection failed: ' + err.message));
|
reject(new BrunoError('Import collection failed: ' + err.message));
|
||||||
|
@ -378,7 +378,7 @@ const importCollection = () => {
|
|||||||
.then(transformItemsInCollection)
|
.then(transformItemsInCollection)
|
||||||
.then(hydrateSeqInCollection)
|
.then(hydrateSeqInCollection)
|
||||||
.then(validateSchema)
|
.then(validateSchema)
|
||||||
.then((collection) => resolve(collection))
|
.then((collection) => resolve({ collection }))
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
reject(new BrunoError('Import collection failed: ' + err.message));
|
reject(new BrunoError('Import collection failed: ' + err.message));
|
||||||
|
@ -431,7 +431,7 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
|
|||||||
// Handle items of type 'js'
|
// Handle items of type 'js'
|
||||||
if (item.type === 'js') {
|
if (item.type === 'js') {
|
||||||
const filePath = path.join(currentPath, `${item.name}.js`);
|
const filePath = path.join(currentPath, `${item.name}.js`);
|
||||||
fs.writeFileSync(filePath, item.raw);
|
fs.writeFileSync(filePath, item.fileContent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user