Skip to content

@electric-sql/[email protected]

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 19 Dec 20:26
· 23 commits to main since this release
712241a

Patch Changes

  • dd5aeab: This PR adds support for function-based options in the TypeScript client's params and headers. Functions can be either synchronous or asynchronous and are resolved in parallel when needed.

    const stream = new ShapeStream({
      url: "http://localhost:3000/v1/shape",
      params: {
        table: "items",
        userId: () => getCurrentUserId(),
        filter: async () => await getUserPreferences(),
      },
      headers: {
        Authorization: async () => `Bearer ${await getAccessToken()}`,
      },
    })

    Common Use Cases

    • Authentication tokens that need to be refreshed
    • User-specific parameters that may change
    • Dynamic filtering based on current state
    • Multi-tenant applications where context determines the request