feat: add Function (FunctionRegistry) client#1618
Merged
Merged
Conversation
Adds PreviewFunctionClient for managing Momento Functions (putFunction, deleteFunction, listFunctions, listFunctionVersions), mirroring PreviewLeaderboardClient (a preview, data-plane client on the cache endpoint). Requires @gomomento/generated-types 0.133.0, the first release that includes the FunctionRegistry service. nodejs only for now (no web parity yet).
There was a problem hiding this comment.
Pull request overview
Adds a new preview, Node.js-only client for managing Momento Functions via the new FunctionRegistry data-plane service on the cache endpoint, along with the corresponding core response types and metadata models.
Changes:
- Introduces core Function response types/enums and
FunctionInfo/FunctionVersionInfomodels, plus an internalIFunctionClientinterface. - Adds
PreviewFunctionClient+ internal gRPC implementation (streaming list operations, 32MB message size override, Function-specific configuration defaults). - Adds unit + live integration tests and bumps
@gomomento/generated-typesto0.133.0.
Reviewed changes
Copilot reviewed 22 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/messages/responses/function/put-function.ts | Adds PutFunction response types (Success/Error). |
| packages/core/src/messages/responses/function/list-functions.ts | Adds ListFunctions response types (Success/Error) returning FunctionInfo[]. |
| packages/core/src/messages/responses/function/list-function-versions.ts | Adds ListFunctionVersions response types (Success/Error) returning FunctionVersionInfo[]. |
| packages/core/src/messages/responses/function/delete-function.ts | Adds DeleteFunction response types (Success/Error). |
| packages/core/src/messages/responses/function/index.ts | Barrels Function response exports. |
| packages/core/src/messages/responses/enums/function/index.ts | Adds enums for Function response type discrimination. |
| packages/core/src/messages/responses/enums/index.ts | Exposes Function enums alongside existing response enums. |
| packages/core/src/messages/function-info.ts | Adds FunctionInfo / FunctionVersionInfo metadata models used by list operations. |
| packages/core/src/internal/clients/function/IFunctionClient.ts | Defines internal function client interface + options (PutFunctionOptions). |
| packages/core/src/internal/clients/function/index.ts | Barrels internal function client exports. |
| packages/core/src/internal/clients/index.ts | Exposes function client module from internal clients index. |
| packages/core/src/index.ts | Exposes Function response types and metadata models from sdk-core entrypoint. |
| packages/client-sdk-nodejs/src/config/function-configuration.ts | Introduces FunctionClient configuration interface + implementation. |
| packages/client-sdk-nodejs/src/config/function-configurations.ts | Adds default “Laptop” Function configuration (60s deadline). |
| packages/client-sdk-nodejs/src/function-client-props.ts | Adds Node SDK props type for Function client construction. |
| packages/client-sdk-nodejs/src/internal/function-client-all-props.ts | Adds internal “all props” type for Function client instantiation. |
| packages/client-sdk-nodejs/src/internal/function-client.ts | Implements gRPC client for FunctionRegistry (put/delete unary, list streaming). |
| packages/client-sdk-nodejs/src/preview-function-client.ts | Adds public PreviewFunctionClient wrapper that mirrors PreviewLeaderboardClient pattern. |
| packages/client-sdk-nodejs/src/index.ts | Re-exports Function client, configuration, and core response/model types from Node SDK entrypoint. |
| packages/client-sdk-nodejs/test/unit/function-client.test.ts | Adds constructor + basic argument-validation unit tests. |
| packages/client-sdk-nodejs/test/integration/function/function-client.test.ts | Adds live integration test (put → list → list versions → delete). |
| packages/client-sdk-nodejs/package.json | Bumps generated-types dependency and adds integration-test-function script. |
| packages/client-sdk-nodejs/package-lock.json | Locks generated-types bump to 0.133.0 with resolved tarball metadata. |
Files not reviewed (1)
- packages/client-sdk-nodejs/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses code review feedback: putFunction/deleteFunction now validate the function name (and putFunction rejects empty wasm) like other resource APIs; listFunctionVersions validates the function id; and a ListFunctionVersions row missing id/wasm_id is now surfaced as an error instead of a degraded result. Adds validateFunctionName/validateFunctionId to core.
Code review round 2: import IFunctionClient/PutFunctionOptions from the public @gomomento/sdk-core entrypoint instead of the internal dist path; fix the addMiddleware JSDoc (it prepends, not appends).
… from putFunction FunctionInfo now exposes getCurrentVersion() (resolves the pinned/latest oneof, as the Rust SDK does) and getLastUpdatedAt(). PutFunction.Success now carries the full FunctionInfo the server already returns (getFunction()) instead of only id+name.
Code review round 3: public client interfaces belong under core/src/clients (like ILeaderboardClient), so move IFunctionClient + PutFunctionOptions out of internal/clients/function. Correct the function-configuration JSDoc @returns to FunctionConfiguration.
Code review round 4: the shared CacheServiceErrorMapper renders a NOT_FOUND as a cache-flavored CacheNotFoundError. Add FunctionNotFoundError (+ a FUNCTION_NOT_FOUND_ERROR code) and remap NOT_FOUND in the function client so a missing function surfaces the correct error. Verified live.
Code review round 5: FunctionInfo is now returned by putFunction (PutFunction.Success) as well as listFunctions; update the class docstring.
Copilot stopped reviewing on behalf of
eaddingtonwhite due to an error
June 17, 2026 23:54
tylerburdsall
approved these changes
Jun 18, 2026
malandis
reviewed
Jun 18, 2026
malandis
left a comment
Contributor
There was a problem hiding this comment.
No blockers from me. I wasn't aware the various functions lifecycle methods were data plane? Seems like control plane but 👍
Comment on lines
+50
to
+51
| // Deploying a function uploads the wasm artifact inline, so the deadline is more generous than the | ||
| // cache-data defaults. |
Comment on lines
+65
to
+67
| // Wasm artifacts ship inline in the PutFunction request and can be large, so raise the gRPC message-size | ||
| // caps above the data-plane defaults (which are tuned for small cache items). | ||
| const MAX_MESSAGE_SIZE_BYTES = 32 * 1024 * 1024; |
Comment on lines
+27
to
+29
| public getFunction(): FunctionInfo { | ||
| return this._function; | ||
| } |
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.
Adds a
PreviewFunctionClientfor managing Momento Functions, mirroringPreviewLeaderboardClient(a preview, data-plane client on the cache endpoint).Requires
@gomomento/generated-types0.133.0 — the first release that includes theFunctionRegistryservice (added in momentohq/client-protos#340).Notes / decisions worth a look:
client-sdk-webimplementation if we want parity before release.listFunctions/listFunctionVersionsare server-streaming; they use streaming interceptors without the retry interceptor.putFunction/deleteFunctionaren't in the retry allowlist, so mutations are never auto-retried.deleteFunctionon a missing function returnsError(NOT_FOUND), likedeleteCache— not idempotent.putFunctionsends a 32 MB max-message override (wasm ships inline) and uses a 60s deadline.test/integration/function/) runs in the normal sweep whenMOMENTO_API_KEYis set, viaCredentialProvider.fromEnvVarV2(). It puts/lists/deletes a real function using a small committed wasm-component fixture.Tested: unit tests for construction + validation; a live integration test against the alpha cell (put → list → listFunctionVersions → delete) passes.
Opening as a draft to get feedback on the web-parity question and the design notes above before finalizing.