feat(editor): Add missing documentation to autocomplete items for inline code editor (#5560)

*  Added documentation for extension functions with arguments

*  Adding custom autocomplete item types. This enables us to show different items with same labels.

* 📚 Adding missing info for extensions autocomplete items

*  Added Luxon autocomplete docs

* 💡 Completing Luxon static methods autocomplete documentation

*  Refactoring Luxon autocomplete logic

*  Handling the case when autocomplete item doesn't have defined inline documentation

*  Added correct doc info to Luxon instance properties

*  Added missing documentation and notice footer for autocomplete popup.

* 👕 Fixing lint error

* ✔️ Removing `Object.hasOwn` function, since it's not supported in node v14
This commit is contained in:
Milorad FIlipović
2023-02-28 05:34:03 +01:00
committed by GitHub
parent bb4db58819
commit ae634407a4
15 changed files with 1281 additions and 181 deletions

View File

@@ -82,48 +82,71 @@ export function urlEncode(value: object) {
isEmpty.doc = {
name: 'isEmpty',
description: 'Checks if the Object has no key-value pairs',
description: 'Checks if the Object has no key-value pairs.',
returnType: 'boolean',
docURL:
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-isEmpty',
};
isNotEmpty.doc = {
name: 'isNotEmpty',
description: 'Checks if the Object has key-value pairs',
description: 'Checks if the Object has key-value pairs.',
returnType: 'boolean',
docURL:
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-isNotEmpty',
};
compact.doc = {
name: 'compact',
description: 'Removes empty values from an Object',
description: 'Removes empty values from an Object.',
returnType: 'boolean',
docURL:
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-compact',
};
urlEncode.doc = {
name: 'urlEncode',
description: 'Transforms an Object into a URL parameter list. Only top-level keys are supported.',
returnType: 'string',
docURL:
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-urlEncode',
};
// @TODO_NEXT_PHASE: Surface extensions below which take args
hasField.doc = {
name: 'hasField',
description: 'Checks if the Object has a given field. Only top-level keys are supported.',
returnType: 'boolean',
args: [{ name: 'fieldName', type: 'string' }],
docURL:
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-hasField',
};
removeField.doc = {
name: 'removeField',
description: 'Removes a given field from the Object. Only top-level fields are supported.',
returnType: 'object',
args: [{ name: 'key', type: 'string' }],
docURL:
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-removeField',
};
removeFieldsContaining.doc = {
name: 'removeFieldsContaining',
description:
'Removes fields with a given value from the Object. Only top-level values are supported.',
returnType: 'object',
args: [{ name: 'value', type: 'string' }],
docURL:
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-removeFieldsContaining',
};
keepFieldsContaining.doc = {
name: 'keepFieldsContaining',
description: 'Removes fields that do not match the given value from the Object.',
returnType: 'object',
args: [{ name: 'value', type: 'string' }],
docURL:
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-keepFieldsContaining',
};
export const objectExtensions: ExtensionMap = {