{"id":22367689,"url":"https://github.com/hugojosefson/rpc-proxy","last_synced_at":"2025-03-26T15:53:12.506Z","repository":{"id":66830259,"uuid":"393780256","full_name":"hugojosefson/rpc-proxy","owner":"hugojosefson","description":"RPC for TS/JS using Proxy","archived":false,"fork":false,"pushed_at":"2021-08-07T20:19:28.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-31T17:48:15.817Z","etag":null,"topics":["deno","proxy","rpc","typescript","web"],"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/hugojosefson.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":"2021-08-07T19:59:51.000Z","updated_at":"2021-11-21T05:46:35.000Z","dependencies_parsed_at":"2023-02-23T01:30:43.221Z","dependency_job_id":null,"html_url":"https://github.com/hugojosefson/rpc-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Frpc-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Frpc-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Frpc-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Frpc-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hugojosefson","download_url":"https://codeload.github.com/hugojosefson/rpc-proxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245689481,"owners_count":20656416,"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","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":["deno","proxy","rpc","typescript","web"],"created_at":"2024-12-04T18:20:17.447Z","updated_at":"2025-03-26T15:53:12.486Z","avatar_url":"https://github.com/hugojosefson.png","language":"TypeScript","readme":"# rpc-proxy\n\n## Overview\n\nRPC implementation for TypeScript / JavaScript, where these conditions are true:\n\n- Two processes run in different runtime contexts (JS instances).\n- Two processes can communicate with each other:\n  - bi-directionally\n  - asynchronously\n  - ordered\n  - through messages that each is one string.\n- All accessible methods on the target object, or on any object given to it, are\n  `async` (return a `Promise`).\n- All accessible properties on the target object, or on any object given to it,\n  are `readonly`.\n- All accessible properties on the target object, or on any object given to it,\n  have a `Promise` assigned.\n\nThe two processes are free to:\n\n- Run as the same or different users.\n- Run in the same or different machines.\n- Have access to the same source code for typing and API purposes.\n\n## Use\n\n### Example\n\n```typescript\nimport { createRpcProxy } from \"https://deno.land/x/rpc-proxy/mod.ts\";\n\nclass Person {\n  readonly name: Promise\u003cstring\u003e;\n\n  constructor(name: string) {\n    this.name = Promise.resolve(name);\n  }\n\n  async greet(greeting: string): Promise\u003cstring\u003e {\n    return `Why, hello to you too! Thank you for saying \"${greeting}\" to me :)`;\n  }\n}\n\nclass MyService {\n  async sayHelloTo(whom: Person): Promise\u003cstring\u003e {\n    const name: string = await whom.name;\n    const theirResponse: string = await whom.greet(`Hello, ${name}!`);\n    return `I said hello to ${name}, and they responded:\\n\\n${theirResponse}`;\n  }\n}\n\nconst myService: MyService = createRpcProxy\u003cMyService\u003e({\n  typeTemplate: {} as MyService,\n  StringReader:  // TODO: simple way to obtain them in a way that shows their versatility. TCP sockets?\n});\n\nconst myFriend: Person = new Person(\"Ada\");\nconst outcome: string = await myService.sayHelloTo(myFriend);\nconsole.log(outcome);\n```\n\n...results in this on your console:\n\n```\nI said hello to Ada, and they responded:\n\nWhy, hello to you too! Thank you for saying \"Hello, Ada!\" to me :)\n```\n\n### API\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugojosefson%2Frpc-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugojosefson%2Frpc-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugojosefson%2Frpc-proxy/lists"}