Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chained Server Fn Syntax, ServerFn Middleware #2513

Open
wants to merge 39 commits into
base: main
Choose a base branch
from

Conversation

tannerlinsley
Copy link
Collaborator

@tannerlinsley tannerlinsley commented Oct 11, 2024

Todo:

  • Remove any "search" param specific terms/functionality from the validations utilities (including types and adapters)
  • Publish new validation packages (without the router- prefix)
  • Middleware Documentation

Nice To Have:

  • registerServerMiddleware([a, b, c]) to add global middleware
  • Companion declaration merging for the above to allow global middleware to also be type-safe
  • Move all validation adapter packages into a new monorepo, e.g. TanStack Validate

Maybe?

  • Middleware registry so middleware and server functions can simply reference middleware dependencies (type safe autocomplete too) by ID instead of importing them. However, this would essentially make any registered middleware global and un-treeshakable. TBH I'm not sure how tree shaking would work as is, if it does, and if it even makes a difference since it's on the server.

@tannerlinsley tannerlinsley changed the title Server Functions 0.0.2, Middleware Chained Server Fn Syntax, ServerFn Middleware Oct 11, 2024
@ssijak
Copy link

ssijak commented Oct 15, 2024

Let's goooo 🚀

} as ServerMiddleware<TId, TMiddlewares, TValidator, TContext>
}

const middleware1 = createServerMiddleware({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

>
}

const middleware1 = createMiddleware().server(async ({ context, next }) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleanup

path: babel.NodePath<t.CallExpression>,
opts: ParseAstOptions,
) {
// const firstArg = path.node.arguments[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleanup

packages/start/src/config/index.ts Outdated Show resolved Hide resolved
{
name: 'custom-hot-update-client',
handleHotUpdate(ctx) {
console.log('server hot', ctx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link

nx-cloud bot commented Oct 31, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit dbf1c95. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


🟥 Failed Commands
nx affected --targets=test:eslint,test:unit,test:e2e,test:types,test:build,build --parallel=3
✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants