-
-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Feature request
Is your feature request related to a problem? Please describe.
This feature request is to propose a breaking change to the prototype of invoke()
that would:
- reduce boilerplate for newer folks
- be opinionated by default but still provide full-powered low-level access on option
- be syntactically consistent with the
from
,rpc
,storage
, andauth
APIs
Describe the solution you'd like
The invoke()
prototype would look like:
const { data: any, error: FunctionsError } = await invoke(functionName: string, input: any, options?: {requestTransform, responseTransform})
Describe alternatives you've considered
The alternatives are described in greater detail in the conversation of PR #21, but in summary:
- The first option would be to move the behavior of
invoke
closer to that offetch
, but the issue would then be to increase the amount of boilerplate necessary to use the function. - The second option would be to move the behavior of
invoke
closer to that of Firebase'shttpsCallable
, but the issue would then be to limit the type of data that can be sent and received to only JSON objects (therefore excluding Files and Blobs for instance).
This proposal is a tentative for a best of both worlds approach, where common data types can be automatically serialized and de-serialized by invoke
and therefore reduces the boilerplate for the most common use cases, while also allowing to have full low-level access to the underlying Fetch
API if required, via the options
parameter callbacks.
Additional context
An implementation proposal is linked to this feature as PR #23
A detailed explanation of the new behavior of invoke
is provided in the README.md file of the PR.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request