Improve callCloudCode mutation to receive a CloudCodeFunction enum instead of a String (#6029)

* Add listing test

* Improvements

* Fixinf package.json

* Fix package.json

* Fix tests
This commit is contained in:
Antonio Davi Macedo Coelho de Castro
2019-09-09 15:07:22 -07:00
committed by GitHub
parent 33d2b16476
commit a754b883b2
6 changed files with 245 additions and 54 deletions

View File

@@ -148,6 +148,29 @@ export function getFunction(functionName, applicationId) {
return get(Category.Functions, functionName, applicationId);
}
export function getFunctionNames(applicationId) {
const store =
(_triggerStore[applicationId] &&
_triggerStore[applicationId][Category.Functions]) ||
{};
const functionNames = [];
const extractFunctionNames = (namespace, store) => {
Object.keys(store).forEach(name => {
const value = store[name];
if (namespace) {
name = `${namespace}.${name}`;
}
if (typeof value === 'function') {
functionNames.push(name);
} else {
extractFunctionNames(name, value);
}
});
};
extractFunctionNames(null, store);
return functionNames;
}
export function getJob(jobName, applicationId) {
return get(Category.Jobs, jobName, applicationId);
}