Skip to content

Commit

Permalink
Release v2.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
xkcm authored Jun 12, 2023
2 parents 7b94274 + ec405e6 commit af1a0cc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
9 changes: 6 additions & 3 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function generatePluginMethod(method) {
throw shouldRedactSecrets ? redaction.redactSecrets(error, secrets) : error;
}

if (!allowEmptyResult && (_.isNil(result) || _.isEmpty(result))) {
if (!allowEmptyResult && helpers.isResultEmpty(result)) {
return consts.OPERATION_FINISHED_SUCCESSFULLY_MESSAGE;
}

Expand All @@ -56,13 +56,16 @@ function generatePluginMethod(method) {

function generateAutocompleteFunction(autocompleteFunction, functionName) {
return async (query, settings, params) => {
const parsedParams = await autocomplete.readAutocompleteFunctionArguments(
const {
params: parsedParams,
settings: parsedSettings,
} = await autocomplete.readAutocompleteFunctionArguments(
params,
settings,
functionName,
);

return autocompleteFunction(query, parsedParams, { settings, params });
return autocompleteFunction(query, parsedParams, { settings, params, parsedSettings });
};
}

Expand Down
10 changes: 10 additions & 0 deletions helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ function generateRandomString() {
return Math.random().toString(36).slice(2);
}

function isResultEmpty(result) {
return (
_.isNil(result) // null or undefined
|| (_.isArray(result) && result.length === 0) // empty arrays
|| (_.isPlainObject(result) && _.keys(result).length === 0) // empty objects
|| (_.isString(result) && result.length === 0) // empty strings
);
}

module.exports = {
readActionArguments,
temporaryFileSentinel,
Expand All @@ -210,4 +219,5 @@ module.exports = {
generateRandomTemporaryPath,
generateRandomEnvironmentVariableName,
analyzePath: parsers.filePath,
isResultEmpty,
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kaholo/plugin-library",
"version": "2.3.0",
"version": "2.3.1",
"description": "Kaholo library for plugins",
"main": "kaholo-plugin-library.js",
"scripts": {
Expand Down

0 comments on commit af1a0cc

Please sign in to comment.