Function metadata API: getAvailableFunctions / getFunctionDetails (HF-249)#1692
Open
marcin-kordas-hoc wants to merge 17 commits into
Open
Function metadata API: getAvailableFunctions / getFunctionDetails (HF-249)#1692marcin-kordas-hoc wants to merge 17 commits into
marcin-kordas-hoc wants to merge 17 commits into
Conversation
…c API (HF-249) Add static and instance getAvailableFunctions and getFunctionDetails to HyperFormula, backed by the function metadata catalogue. Instance methods delegate to the static ones using the configured language. Re-export the public catalogue types from the package entry point.
Replace the seeded catalogue with all 363 canonical built-ins, generated from docs/guide/built-in-functions.md by scripts/hf249-migrate-function-docs.ts (dev-only, not shipped). Parameter names come from the Syntax column but their count and optionality follow the implementation arity; repeating groups collapse and duplicate names are disambiguated. Also fall back to the canonical id when a language pack leaves a function name empty (e.g. SWITCH in several locales).
…-249) Add a CHANGELOG entry for the new built-in function metadata API, and a "Function metadata" section to the custom functions guide clarifying that the catalogue covers built-ins only — custom functions are absent from getAvailableFunctions() and getFunctionDetails() returns undefined for them.
Performance comparison of head (c98e9b1) vs base (d4195b5) |
✅ Deploy Preview for hyperformula-dev-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
8983d26 to
3f8857b
Compare
…ith getFunctionDetails (HF-249) getAvailableFunctions derived its id set from each plugin class's static implementedFunctions, so an unregistered built-in (or a registry mutation) could still appear in the list while getFunctionDetails returned undefined for it. Gate the list on FunctionRegistry.getFunctionPlugin(id) — the same resolution getFunctionDetails uses — so list and details never disagree. (Cursor Bugbot, #1692.)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4078a56. Configure here.
…tFunctionDetails agree (HF-249) getAvailableFunctions filtered on documented+registered but not the catalogue-vs-implementation arity check that getFunctionDetails applies, so a drifted function could appear in the list yet return undefined from details. Extract resolveListableMetadata (documented + registered + arity-consistent) and use it in both. (Cursor, #1692.)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1692 +/- ##
===========================================
+ Coverage 97.16% 97.17% +0.01%
===========================================
Files 176 192 +16
Lines 15322 15412 +90
Branches 3356 3401 +45
===========================================
+ Hits 14887 14977 +90
- Misses 427 435 +8
+ Partials 8 0 -8
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds a two-tier public API for retrieving built-in function metadata, intended for a Formula Builder / function picker:
HyperFormula.getAvailableFunctions(code)(static) /hfInstance.getAvailableFunctions()(instance) →FunctionListEntry[]— a short, sorted list: translated name, canonical name, category, short description.HyperFormula.getFunctionDetails(canonicalName, code)(static) /hfInstance.getFunctionDetails(canonicalName)(instance) →FunctionDetails | undefined— full details including generated syntax and per-parameter optionality/repeatability.Instance methods delegate to the static ones using the configured language. The catalogue covers built-in functions only — custom functions are not listed and
getFunctionDetailsreturnsundefinedfor them.Catalogue
The 363-function catalogue is generated from
docs/guide/built-in-functions.mdbyscripts/hf249-migrate-function-docs.ts(dev-only; not shipped —tsconfigincludeis["src"]). Parameter names come from the Syntax column; their count and optionality follow the implementation arity inimplementedFunctions. Repeating groups collapse onto the arity and duplicate names are disambiguated.Tests
Paired tests PR: handsontable/hyperformula-tests#14 (branch
feature/hf-249-function-metadata-api):FUNCTION_DOCSkeys == canonical set (both directions)repeatLastArgsMVP scope
parameters[].description,documentationUrl, andexamplesare present but empty; authored in a later phase.Notes
SWITCHin several locales).Note
Medium Risk
Large additive public API and generated catalogue; runtime behavior is read-only metadata, but list/detail consistency depends on doc vs implementation arity staying in sync.
Overview
Adds a two-tier public API for built-in function metadata (formula pickers / builders):
getAvailableFunctions()returns a sorted short list (translated name, canonical id, category, description), andgetFunctionDetails(canonicalName)returns full details including generated syntax and per-parameter optional/repeatable flags. Both exist as static methods (with language code) and instance helpers (instance language).Introduces a
FUNCTION_DOCScatalogue (~363 functions) undersrc/interpreter/functionMetadata/, composed from per-category files and regenerated fromdocs/guide/built-in-functions.mdvia dev-onlyscripts/hf249-migrate-function-docs.ts. Listing is gated so only documented, registered functions with catalogue arity matchingimplementedFunctionsappear—custom functions are excluded (getFunctionDetails→undefined).Exports new types (
FunctionListEntry,FunctionDetails, etc.) from the package entry. MVP leavesparameters[].description,documentationUrl, andexamplesempty for a later phase.Reviewed by Cursor Bugbot for commit c98e9b1. Bugbot is set up for automated code reviews on this repo. Configure here.