mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +01:00
Merge branch 'main' into feature/environment-color
This commit is contained in:
commit
6facbe9214
@ -48,7 +48,7 @@ Bruno is being developed as a desktop app. You need to load the app by running t
|
|||||||
### Local Development
|
### Local Development
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# use nodejs 18 version
|
# use nodejs 20 version
|
||||||
nvm use
|
nvm use
|
||||||
|
|
||||||
# install deps
|
# install deps
|
||||||
|
3294
package-lock.json
generated
3294
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -42,14 +42,14 @@
|
|||||||
"jshint": "^2.13.6",
|
"jshint": "^2.13.6",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"jsonc-parser": "^3.2.1",
|
"jsonc-parser": "^3.2.1",
|
||||||
"jsonpath-plus": "10.0.0",
|
"jsonpath-plus": "10.1.0",
|
||||||
"know-your-http-well": "^0.5.0",
|
"know-your-http-well": "^0.5.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"markdown-it": "^13.0.2",
|
"markdown-it": "^13.0.2",
|
||||||
"markdown-it-replace-link": "^1.2.0",
|
"markdown-it-replace-link": "^1.2.0",
|
||||||
"mousetrap": "^1.6.5",
|
"mousetrap": "^1.6.5",
|
||||||
"nanoid": "3.3.4",
|
"nanoid": "3.3.4",
|
||||||
"next": "14.2.15",
|
"next": "14.2.16",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"pdfjs-dist": "4.4.168",
|
"pdfjs-dist": "4.4.168",
|
||||||
"platform": "^1.3.6",
|
"platform": "^1.3.6",
|
||||||
|
@ -7,6 +7,7 @@ import StyledWrapper from './StyledWrapper';
|
|||||||
import ConfirmSwitchEnv from './ConfirmSwitchEnv';
|
import ConfirmSwitchEnv from './ConfirmSwitchEnv';
|
||||||
import ManageSecrets from 'components/Environments/EnvironmentSettings/ManageSecrets/index';
|
import ManageSecrets from 'components/Environments/EnvironmentSettings/ManageSecrets/index';
|
||||||
import ImportEnvironment from '../ImportEnvironment';
|
import ImportEnvironment from '../ImportEnvironment';
|
||||||
|
import { isEqual } from 'lodash';
|
||||||
|
|
||||||
const EnvironmentList = ({ environments, activeEnvironmentUid, selectedEnvironment, setSelectedEnvironment, isModified, setIsModified }) => {
|
const EnvironmentList = ({ environments, activeEnvironmentUid, selectedEnvironment, setSelectedEnvironment, isModified, setIsModified }) => {
|
||||||
const [openCreateModal, setOpenCreateModal] = useState(false);
|
const [openCreateModal, setOpenCreateModal] = useState(false);
|
||||||
@ -26,7 +27,18 @@ const EnvironmentList = ({ environments, activeEnvironmentUid, selectedEnvironme
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selectedEnvironment) {
|
||||||
|
const _selectedEnvironment = environments?.find(env => env?.uid === selectedEnvironment?.uid);
|
||||||
|
const hasSelectedEnvironmentChanged = !isEqual(selectedEnvironment, _selectedEnvironment);
|
||||||
|
if (hasSelectedEnvironmentChanged) {
|
||||||
|
setSelectedEnvironment(_selectedEnvironment);
|
||||||
|
}
|
||||||
|
setOriginalEnvironmentVariables(selectedEnvironment.variables);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const environment = environments?.find(env => env.uid === activeEnvironmentUid) || environments?.[0];
|
const environment = environments?.find(env => env.uid === activeEnvironmentUid) || environments?.[0];
|
||||||
|
|
||||||
setSelectedEnvironment(environment);
|
setSelectedEnvironment(environment);
|
||||||
setOriginalEnvironmentVariables(environment?.variables || []);
|
setOriginalEnvironmentVariables(environment?.variables || []);
|
||||||
}, [environments, activeEnvironmentUid]);
|
}, [environments, activeEnvironmentUid]);
|
||||||
|
@ -184,7 +184,7 @@ const Sidebar = () => {
|
|||||||
Star
|
Star
|
||||||
</GitHubButton> */}
|
</GitHubButton> */}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-grow items-center justify-end text-xs mr-2">v1.33.1</div>
|
<div className="flex flex-grow items-center justify-end text-xs mr-2">v1.34.0</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -60,7 +60,7 @@ const trackStart = () => {
|
|||||||
event: 'start',
|
event: 'start',
|
||||||
properties: {
|
properties: {
|
||||||
os: platformLib.os.family,
|
os: platformLib.os.family,
|
||||||
version: '1.33.1'
|
version: '1.34.0'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "v1.33.1",
|
"version": "v1.34.0",
|
||||||
"name": "bruno",
|
"name": "bruno",
|
||||||
"description": "Opensource API Client for Exploring and Testing APIs",
|
"description": "Opensource API Client for Exploring and Testing APIs",
|
||||||
"homepage": "https://www.usebruno.com",
|
"homepage": "https://www.usebruno.com",
|
||||||
@ -63,6 +63,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "31.2.1",
|
"electron": "31.2.1",
|
||||||
"electron-builder": "24.13.3"
|
"electron-builder": "25.1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,14 +65,20 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
|
|||||||
try {
|
try {
|
||||||
const dirPath = path.join(collectionLocation, collectionFolderName);
|
const dirPath = path.join(collectionLocation, collectionFolderName);
|
||||||
if (fs.existsSync(dirPath)) {
|
if (fs.existsSync(dirPath)) {
|
||||||
throw new Error(`collection: ${dirPath} already exists`);
|
const files = fs.readdirSync(dirPath);
|
||||||
|
|
||||||
|
if (files.length > 0) {
|
||||||
|
throw new Error(`collection: ${dirPath} already exists and is not empty`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isValidPathname(dirPath)) {
|
if (!isValidPathname(dirPath)) {
|
||||||
throw new Error(`collection: invalid pathname - ${dir}`);
|
throw new Error(`collection: invalid pathname - ${dir}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await createDirectory(dirPath);
|
if (!fs.existsSync(dirPath)) {
|
||||||
|
await createDirectory(dirPath);
|
||||||
|
}
|
||||||
|
|
||||||
const uid = generateUidBasedOnHash(dirPath);
|
const uid = generateUidBasedOnHash(dirPath);
|
||||||
const brunoConfig = {
|
const brunoConfig = {
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
const { marshallToVm } = require('../utils');
|
const { marshallToVm } = require('../utils');
|
||||||
|
|
||||||
const addBrunoResponseShimToContext = (vm, res) => {
|
const addBrunoResponseShimToContext = (vm, res) => {
|
||||||
const resObject = vm.newObject();
|
let resFn = vm.newFunction('res', function (exprStr) {
|
||||||
|
return marshallToVm(res(vm.dump(exprStr)), vm);
|
||||||
|
});
|
||||||
|
|
||||||
const status = marshallToVm(res?.status, vm);
|
const status = marshallToVm(res?.status, vm);
|
||||||
const headers = marshallToVm(res?.headers, vm);
|
const headers = marshallToVm(res?.headers, vm);
|
||||||
const body = marshallToVm(res?.body, vm);
|
const body = marshallToVm(res?.body, vm);
|
||||||
const responseTime = marshallToVm(res?.responseTime, vm);
|
const responseTime = marshallToVm(res?.responseTime, vm);
|
||||||
|
|
||||||
vm.setProp(resObject, 'status', status);
|
vm.setProp(resFn, 'status', status);
|
||||||
vm.setProp(resObject, 'headers', headers);
|
vm.setProp(resFn, 'headers', headers);
|
||||||
vm.setProp(resObject, 'body', body);
|
vm.setProp(resFn, 'body', body);
|
||||||
vm.setProp(resObject, 'responseTime', responseTime);
|
vm.setProp(resFn, 'responseTime', responseTime);
|
||||||
|
|
||||||
status.dispose();
|
status.dispose();
|
||||||
headers.dispose();
|
headers.dispose();
|
||||||
@ -21,41 +23,41 @@ const addBrunoResponseShimToContext = (vm, res) => {
|
|||||||
let getStatus = vm.newFunction('getStatus', function () {
|
let getStatus = vm.newFunction('getStatus', function () {
|
||||||
return marshallToVm(res.getStatus(), vm);
|
return marshallToVm(res.getStatus(), vm);
|
||||||
});
|
});
|
||||||
vm.setProp(resObject, 'getStatus', getStatus);
|
vm.setProp(resFn, 'getStatus', getStatus);
|
||||||
getStatus.dispose();
|
getStatus.dispose();
|
||||||
|
|
||||||
let getHeader = vm.newFunction('getHeader', function (name) {
|
let getHeader = vm.newFunction('getHeader', function (name) {
|
||||||
return marshallToVm(res.getHeader(vm.dump(name)), vm);
|
return marshallToVm(res.getHeader(vm.dump(name)), vm);
|
||||||
});
|
});
|
||||||
vm.setProp(resObject, 'getHeader', getHeader);
|
vm.setProp(resFn, 'getHeader', getHeader);
|
||||||
getHeader.dispose();
|
getHeader.dispose();
|
||||||
|
|
||||||
let getHeaders = vm.newFunction('getHeaders', function () {
|
let getHeaders = vm.newFunction('getHeaders', function () {
|
||||||
return marshallToVm(res.getHeaders(), vm);
|
return marshallToVm(res.getHeaders(), vm);
|
||||||
});
|
});
|
||||||
vm.setProp(resObject, 'getHeaders', getHeaders);
|
vm.setProp(resFn, 'getHeaders', getHeaders);
|
||||||
getHeaders.dispose();
|
getHeaders.dispose();
|
||||||
|
|
||||||
let getBody = vm.newFunction('getBody', function () {
|
let getBody = vm.newFunction('getBody', function () {
|
||||||
return marshallToVm(res.getBody(), vm);
|
return marshallToVm(res.getBody(), vm);
|
||||||
});
|
});
|
||||||
vm.setProp(resObject, 'getBody', getBody);
|
vm.setProp(resFn, 'getBody', getBody);
|
||||||
getBody.dispose();
|
getBody.dispose();
|
||||||
|
|
||||||
let getResponseTime = vm.newFunction('getResponseTime', function () {
|
let getResponseTime = vm.newFunction('getResponseTime', function () {
|
||||||
return marshallToVm(res.getResponseTime(), vm);
|
return marshallToVm(res.getResponseTime(), vm);
|
||||||
});
|
});
|
||||||
vm.setProp(resObject, 'getResponseTime', getResponseTime);
|
vm.setProp(resFn, 'getResponseTime', getResponseTime);
|
||||||
getResponseTime.dispose();
|
getResponseTime.dispose();
|
||||||
|
|
||||||
let setBody = vm.newFunction('setBody', function (data) {
|
let setBody = vm.newFunction('setBody', function (data) {
|
||||||
res.setBody(vm.dump(data));
|
res.setBody(vm.dump(data));
|
||||||
});
|
});
|
||||||
vm.setProp(resObject, 'setBody', setBody);
|
vm.setProp(resFn, 'setBody', setBody);
|
||||||
setBody.dispose();
|
setBody.dispose();
|
||||||
|
|
||||||
vm.setProp(vm.global, 'res', resObject);
|
vm.setProp(vm.global, 'res', resFn);
|
||||||
resObject.dispose();
|
resFn.dispose();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = addBrunoResponseShimToContext;
|
module.exports = addBrunoResponseShimToContext;
|
||||||
|
Loading…
Reference in New Issue
Block a user