Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
feat: aggregated environment variable stream
Andrew Bastinc23a4bf75d0e
diff --git a/newstore/environments.ts b/newstore/environments.tsindex 0004147fe..ebb26f50a 100644--- a/newstore/environments.ts+++ b/newstore/environments.ts@@ -259,6 +259,29 @@ export const currentEnvironment$ = combineLatest([}))+/**+ * Stream returning all the environment variables accessible in+ * the current state (Global + The Selected Environment).+ * NOTE: The source environment attribute will be "global" for Global Env as source.+ */+export const aggregateEnvs$ = combineLatest([+ currentEnvironment$,+ globalEnv$,+]).pipe(+ map(([selectedEnv, globalVars]) => {+ const results: { key: string; value: string; sourceEnv: string }[] = []++ selectedEnv.variables.forEach(({ key, value }) =>+ results.push({ key, value, sourceEnv: selectedEnv.name })+ )+ globalVars.forEach(({ key, value }) =>+ results.push({ key, value, sourceEnv: "global" })+ )++ return results+ })+)+export function getCurrentEnvironment(): Environment {if (environmentsStore.value.currentEnvironmentIndex === -1) {return {