{"id":24764457,"url":"https://github.com/seamapi/wrappers","last_synced_at":"2026-02-23T02:02:25.075Z","repository":{"id":44726686,"uuid":"430292294","full_name":"seamapi/wrappers","owner":"seamapi","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-17T22:21:14.000Z","size":217,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-01T15:56:20.341Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seamapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-21T06:36:11.000Z","updated_at":"2022-12-22T01:58:55.000Z","dependencies_parsed_at":"2022-08-02T14:00:50.205Z","dependency_job_id":null,"html_url":"https://github.com/seamapi/wrappers","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/seamapi/wrappers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fwrappers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fwrappers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fwrappers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fwrappers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seamapi","download_url":"https://codeload.github.com/seamapi/wrappers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fwrappers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007457,"owners_count":26084313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-28T22:31:21.709Z","updated_at":"2025-10-11T14:30:39.337Z","avatar_url":"https://github.com/seamapi.png","language":"TypeScript","readme":"# (NextJS) Middleware Wrappers\n\nFor the common use case of wrapping a NextJS endpoint with methods that act as middleware.\n\n## Installation\n\n```\nyarn install nextjs-middleware-wrappers\n```\n\n### Usage\n\nWraps a function in layers of other functions, while preserving the input/output\ntype. The output of wrappers will always have the type of its last parameter\n(the wrapped function)\n\nThis function turns this type of composition...\n\n```ts\nwithDatabase(\n  logger.withContext(\"somecontext\")(async (req, res) =\u003e {\n    res.status(200).end(\"...\")\n  })\n)\n```\n\nInto...\n\n```ts\nwrappers(\n  withDatabase,\n  logger.withContext(\"somecontext\"),\n  async (req, res) =\u003e {\n    res.status(200).end(\"...\")\n  }\n)\n```\n\nHaving this as a utility method helps preserve types, which otherwise can get\nmessed up by the middlewares. It also can make the code cleaner where there are\nmultiple wrappers.\n\n## EXAMPLES\n\nIn the context of request middleware you might write something like this...\n\n```ts\nconst withRequestLoggingMiddleware = (next) =\u003e async (req, res) =\u003e {\n  console.log(`GOT REQUEST ${req.method} ${req.path}`)\n  return next(req, res)\n}\n```\n\nHere's an example of a wrapper that takes some parameters...\n\n```ts\nconst withLoggedArguments =\n  (logPrefix: string) =\u003e\n  (next) =\u003e\n  async (...funcArgs) =\u003e {\n    console.log(logPrefix, ...funcArgs)\n    return next(...funcArgs)\n  }\n```\n\n## Installation\n\n## Automatic Deploy to NPM\n\nTo have your PR be automatically deployed to NPM, make sure to tag your commit messages with the [Angular JS commit message format](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#heading=h.t7ifoyph8bd3).\n\ni.e.\n| Commit message | Release type |\n| -------------- | ------------ |\n| fix(pencil): stop graphite breaking when too much pressure applied | Fix Release |\n| feat(pencil): add 'graphiteWidth' option\t| Feature Release |\n| perf(pencil): remove graphiteWidth option\n| BREAKING CHANGE: The graphiteWidth option has been removed. The default graphite width of 10mm is always used for performance reasons. | Breaking Release (Note that the BREAKING CHANGE: token must be in the footer of the commit) |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseamapi%2Fwrappers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseamapi%2Fwrappers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseamapi%2Fwrappers/lists"}