{"id":15586259,"url":"https://github.com/estebgonza/ts-pg-interceptor","last_synced_at":"2025-09-07T01:32:55.843Z","repository":{"id":160470665,"uuid":"601831983","full_name":"estebgonza/ts-pg-interceptor","owner":"estebgonza","description":"A TCP proxy server with the ability to intercept and manipulate PostgreSQL requests.","archived":false,"fork":false,"pushed_at":"2023-12-15T05:22:58.000Z","size":23485,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-10T12:38:44.878Z","etag":null,"topics":["postgres","postgresql","postgresql-database","proxy","proxy-server","queries","sql","tcp-proxy","tcp-server","typescript"],"latest_commit_sha":null,"homepage":"","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/estebgonza.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-14T23:12:14.000Z","updated_at":"2024-07-10T19:36:50.000Z","dependencies_parsed_at":"2025-02-03T23:41:12.318Z","dependency_job_id":"fe0cc6f1-2040-4b6c-8f0a-1e3e2aea16b8","html_url":"https://github.com/estebgonza/ts-pg-interceptor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/estebgonza/ts-pg-interceptor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estebgonza%2Fts-pg-interceptor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estebgonza%2Fts-pg-interceptor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estebgonza%2Fts-pg-interceptor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estebgonza%2Fts-pg-interceptor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estebgonza","download_url":"https://codeload.github.com/estebgonza/ts-pg-interceptor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estebgonza%2Fts-pg-interceptor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273986612,"owners_count":25202704,"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-09-06T02:00:13.247Z","response_time":2576,"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":["postgres","postgresql","postgresql-database","proxy","proxy-server","queries","sql","tcp-proxy","tcp-server","typescript"],"created_at":"2024-10-02T21:21:31.896Z","updated_at":"2025-09-07T01:32:55.797Z","avatar_url":"https://github.com/estebgonza.png","language":"TypeScript","readme":"# PostgreSQL Request Interceptor\n\n![alt text](https://img.shields.io/github/actions/workflow/status/estebgonza/ts-pg-interceptor/tests.yml?branch=main\u0026label=Build)\n\nA TCP proxy server with the ability to intercept and manipulate PostgreSQL requests. This package provides an event-driven approach to data handling, making it easy to listen for and modify incoming requests.\n\n## Create an interceptor instance\n\n----------------\n\n```ts\n// Create a new PostgresQueryInterceptor instance with the desired options\nconst interceptor = new PostgresQueryInterceptor({\n  // Interceptor server options\n  listenPort: 6432,\n  // Target Postgres connection options\n  targetHost: 'localhost',\n  targetPort: 5432\n});\n\n// Start the interceptor and begin intercepting incoming requests\ninterceptor.start()\n```\n\n## Modify incoming requests\n\n----------------\n\n```ts\ninterceptor.onQuery = (query: Buffer, socket: net.Socket) =\u003e {\n    const modifiedQuery = query\n    // Your logic to modify the query as desired\n    // Use the socket as needed to manage the connection\n    // The returned query will be sent to the target Postgres server\n    return modifiedQuery\n}\n```\n\n## Modify outgoing results\n\n----------------\n\n```ts\ninterceptor.onResult = (result: Buffer, socket: net.Socket) =\u003e {\n    const modifiedResult = result\n    // Your logic to modify the result as desired\n    // Use the socket as needed to manage the connection\n    // The returned result will be sent to the client\n    return modifiedResult\n}\n```\n\n## Stop the interceptor\n\n----------------\n\n```ts\ninterceptor.stop()\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festebgonza%2Fts-pg-interceptor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festebgonza%2Fts-pg-interceptor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festebgonza%2Fts-pg-interceptor/lists"}