{"_id":"nexus-rpc","_rev":"4-03a4dbc780a5dc22452d7ef9a79b56ca","name":"nexus-rpc","dist-tags":{"latest":"0.0.3","next":"0.0.3-rc.0"},"versions":{"0.0.1":{"name":"nexus-rpc","version":"0.0.1","keywords":["rpc","service","async"],"author":{"name":"Temporal Technologies Inc.","email":"sdk@temporal.io"},"license":"MIT","_id":"nexus-rpc@0.0.1","maintainers":[{"name":"temporal-sdk-team","email":"sdk@temporal.io"}],"homepage":"https://github.com/nexus-rpc/sdk-typescript/tree/main","bugs":{"url":"https://github.com/nexus-rpc/sdk-typescript/issues"},"dist":{"shasum":"9f3ffbf23e644b2908025a3bd1cb08d5484fab41","tarball":"https://registry.npmjs.org/nexus-rpc/-/nexus-rpc-0.0.1.tgz","fileCount":95,"integrity":"sha512-hAWn8Hh2eewpB5McXR5EW81R3pR/ziuGhKCF3wFyUVCklanPqrIgMNr7jKCbzXeNVad0nUDfWpFRqh2u+zxQtw==","signatures":[{"sig":"MEUCIQD+60AOJhSOQikoo2XKyODM9GBReXjnh8aTjEnwXXiFdwIgas8sss9qmOKHOKi5zwGsyma34iU5WfyPGlrqUXArVXE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":114332},"main":"lib/index.js","types":"lib/index.d.ts","engines":{"node":">= 18.0.0"},"gitHead":"f594a7fd9e33bd14e5ce1ed04c5225fc708e7866","scripts":{"lint":"eslint src --ext .ts","test":"node --test --enable-source-maps","build":"tsc --build","clean":"shx rm -rf lib tsconfig.tsbuildinfo","format":"prettier --check .","prepare":"npm run build","lint:fix":"eslint src --ext .ts --fix","build:docs":"typedoc src --plugin typedoc-github-theme","format:fix":"prettier --write .","build:watch":"tsc --build --watch"},"_npmUser":{"name":"temporal-sdk-team","email":"sdk@temporal.io"},"repository":{"url":"git+https://github.com/nexus-rpc/sdk-typescript.git","type":"git"},"_npmVersion":"10.8.2","description":"Nexus TypeScript SDK","directories":{},"_nodeVersion":"20.18.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"^0.4.0","eslint":"^9.31.0","typedoc":"^0.28.7","prettier":"^3.6.2","@eslint/js":"^9.31.0","typescript":"^5.8.3","@types/node":"^18.0.0","typescript-eslint":"^8.37.0","typedoc-github-theme":"^0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/nexus-rpc_0.0.1_1754598308131_0.44842351587741947","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"nexus-rpc","version":"0.0.2","keywords":["rpc","service","async"],"author":{"name":"Temporal Technologies Inc.","email":"sdk@temporal.io"},"license":"MIT","_id":"nexus-rpc@0.0.2","maintainers":[{"name":"temporal-sdk-team","email":"sdk@temporal.io"}],"homepage":"https://github.com/nexus-rpc/sdk-typescript/tree/main","bugs":{"url":"https://github.com/nexus-rpc/sdk-typescript/issues"},"dist":{"shasum":"aca21411faa861b4324df17889e846b1811159c4","tarball":"https://registry.npmjs.org/nexus-rpc/-/nexus-rpc-0.0.2.tgz","fileCount":75,"integrity":"sha512-IWjIExdVYlmwXuzHdY/Q3lXCv1gbqoAXPazQhy2w4Xgtgha3H0OOujEESVPQcFUFMWm+pAk2gKnb57g8S41JZg==","signatures":[{"sig":"MEQCICOda4/qbj6DRM///Glb56zYv/adXXJlnKAVYgDVn5rcAiBve8Thy13cYGUQ4b0KXUouMLjs0TYk4LR0dLtrXp6i1w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":106237},"main":"lib/index.js","_from":"file:nexus-rpc-0.0.2.tgz","types":"lib/index.d.ts","engines":{"node":">= 20.0.0"},"scripts":{"lint":"eslint src --ext .ts","test":"node --enable-source-maps --test lib/**/*.test.js","build":"tsc --build","clean":"shx rm -rf lib tsconfig.tsbuildinfo","format":"prettier --check .","lint:fix":"eslint src --ext .ts --fix","build:docs":"typedoc src --plugin typedoc-github-theme","format:fix":"prettier --write .","build:watch":"tsc --build --watch"},"_npmUser":{"name":"temporal-sdk-team","email":"sdk@temporal.io"},"_resolved":"/private/var/folders/xb/kdpsymqs5fjdm2zj0tscgd0c0000gn/T/b16da2b3e875a902c236a68cc22dc3b3/nexus-rpc-0.0.2.tgz","_integrity":"sha512-IWjIExdVYlmwXuzHdY/Q3lXCv1gbqoAXPazQhy2w4Xgtgha3H0OOujEESVPQcFUFMWm+pAk2gKnb57g8S41JZg==","devEngines":{"packageManager":{"name":"pnpm","onFail":"warn","version":"10.27.0"}},"repository":{"url":"git+https://github.com/nexus-rpc/sdk-typescript.git","type":"git"},"_npmVersion":"11.6.0","description":"Nexus TypeScript SDK","directories":{},"_nodeVersion":"24.8.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"^0.4.0","eslint":"^9.31.0","typedoc":"^0.28.7","prettier":"^3.6.2","@eslint/js":"^9.31.0","typescript":"^5.8.3","@types/node":"^20.0.0","typescript-eslint":"^8.37.0","typedoc-github-theme":"^0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/nexus-rpc_0.0.2_1775161121567_0.639851542997637","host":"s3://npm-registry-packages-npm-production"}},"0.0.3-rc.0":{"name":"nexus-rpc","version":"0.0.3-rc.0","keywords":["rpc","service","async"],"author":"Temporal Technologies Inc. <sdk@temporal.io>","license":"MIT","_id":"nexus-rpc@0.0.3-rc.0","maintainers":[{"name":"temporal-sdk-team","email":"sdk@temporal.io"}],"homepage":"https://github.com/nexus-rpc/sdk-typescript/tree/main","bugs":{"url":"https://github.com/nexus-rpc/sdk-typescript/issues"},"dist":{"shasum":"88bbad9a7456f6d4b6241104b56d5e80ec11657d","tarball":"https://registry.npmjs.org/nexus-rpc/-/nexus-rpc-0.0.3-rc.0.tgz","fileCount":79,"integrity":"sha512-yWC1bT0n0OZEWCXD+MlZpwV6g0BwI0ujLRrN7ZJNJyDhj6Otjs2bqBpzAjghQK94cVuaf2KMJ0o1TqdMUZHidA==","signatures":[{"sig":"MEUCIGn9PZr7N6duIxj+cEfz9iAe98XgKVXgqN461wxwooVYAiEA7u0dpfW1lOf8BdmUrcjOOCj55itWIvxlYs8qisg1Xb8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDvzMOOQTI2o5BbsBm+tfJpqw0xs0PaS6oPlkM7ZzfB4wIgQbnNT2zo117N9WHEygpKn82Cd9stooZrWvnnmPBPdqc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":109131},"main":"lib/index.js","types":"lib/index.d.ts","engines":{"node":">= 20.0.0"},"scripts":{"lint":"eslint src --ext .ts","test":"node --enable-source-maps --test lib/**/*.test.js","build":"tsc --build","clean":"shx rm -rf lib tsconfig.tsbuildinfo","format":"prettier --check .","lint:fix":"eslint src --ext .ts --fix","build:docs":"typedoc src --plugin typedoc-github-theme","format:fix":"prettier --write .","build:watch":"tsc --build --watch"},"_npmUser":{"name":"temporal-sdk-team","email":"sdk@temporal.io"},"devEngines":{"packageManager":{"name":"pnpm","onFail":"warn","version":"10.27.0"}},"repository":{"url":"git+https://github.com/nexus-rpc/sdk-typescript.git","type":"git"},"description":"Nexus TypeScript SDK","directories":{},"_nodeVersion":"26.4.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"^0.4.0","eslint":"^9.31.0","typedoc":"^0.28.7","prettier":"^3.6.2","@eslint/js":"^9.31.0","typescript":"^5.8.3","@types/node":"^20.0.0","typescript-eslint":"^8.37.0","typedoc-github-theme":"^0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/nexus-rpc_0.0.3-rc.0_1787238726175_0.04734884850245091","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"_id":"nexus-rpc@0.0.3","bugs":{"url":"https://github.com/nexus-rpc/sdk-typescript/issues"},"dist":{"shasum":"d1a091ce884e77fe134f178c2b1187fc2d3379e3","tarball":"https://registry.npmjs.org/nexus-rpc/-/nexus-rpc-0.0.3.tgz","fileCount":79,"integrity":"sha512-ksIBeYHDv6FHAR1h3Vwk0kQ6REhdo1STqDHXMzu/yn/VN/XzgOor2IUjewG6paoA7IgxlIPZoOU/PD78PC6HTg==","signatures":[{"sig":"MEYCIQDQGWs2BKfssY9CQRCZdukLhRfC+7hPaf6AXjSrnHORmwIhAOJxlHwOtvOw+e0s7Mt9Z1OwJ9j9k4CObRw/VGWdDlKj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFf23gqhHQLl1eh18HrXuTFIbQfSXInQgWMhjvG57v50AiAHwCGLKgbToHpvGCGMeDX8Ub5utu52ZJQhZWbOzmNp1w=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/nexus-rpc@0.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":109126},"main":"lib/index.js","name":"nexus-rpc","_from":"file:dist/nexus-rpc-0.0.3.tgz","types":"lib/index.d.ts","author":{"name":"Temporal Technologies Inc.","email":"sdk@temporal.io"},"engines":{"node":">= 20.0.0"},"license":"MIT","scripts":{"lint":"eslint src --ext .ts","test":"node --enable-source-maps --test lib/**/*.test.js","build":"tsc --build","clean":"shx rm -rf lib tsconfig.tsbuildinfo","format":"prettier --check .","lint:fix":"eslint src --ext .ts --fix","build:docs":"typedoc src --plugin typedoc-github-theme","format:fix":"prettier --write .","build:watch":"tsc --build --watch"},"version":"0.0.3","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:81c69583-0bce-42b3-a8db-eb5d6b9b1f2d"}},"homepage":"https://github.com/nexus-rpc/sdk-typescript/tree/main","keywords":["rpc","service","async"],"_resolved":"/home/runner/work/sdk-typescript/sdk-typescript/dist/nexus-rpc-0.0.3.tgz","_integrity":"sha512-ksIBeYHDv6FHAR1h3Vwk0kQ6REhdo1STqDHXMzu/yn/VN/XzgOor2IUjewG6paoA7IgxlIPZoOU/PD78PC6HTg==","devEngines":{"packageManager":{"name":"pnpm","onFail":"warn","version":"10.27.0"}},"repository":{"url":"git+https://github.com/nexus-rpc/sdk-typescript.git","type":"git"},"_npmVersion":"11.17.0","description":"Nexus TypeScript SDK","directories":{},"maintainers":[{"name":"temporal-sdk-team","email":"sdk@temporal.io"}],"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"^0.4.0","eslint":"^9.31.0","typedoc":"^0.28.7","prettier":"^3.6.2","@eslint/js":"^9.31.0","typescript":"^5.8.3","@types/node":"^20.0.0","typescript-eslint":"^8.37.0","typedoc-github-theme":"^0.3.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nexus-rpc_0.0.3_1787330115959_0.13955033210396084"}}},"time":{"created":"2025-08-07T20:25:08.051Z","modified":"2026-08-21T16:35:16.416Z","0.0.1":"2025-08-07T20:25:08.326Z","0.0.2":"2026-04-02T20:18:41.707Z","0.0.3-rc.0":"2026-08-20T15:12:06.278Z","0.0.3":"2026-08-21T16:35:16.060Z"},"bugs":{"url":"https://github.com/nexus-rpc/sdk-typescript/issues"},"author":{"name":"Temporal Technologies Inc.","email":"sdk@temporal.io"},"license":"MIT","homepage":"https://github.com/nexus-rpc/sdk-typescript/tree/main","keywords":["rpc","service","async"],"repository":{"url":"git+https://github.com/nexus-rpc/sdk-typescript.git","type":"git"},"description":"Nexus TypeScript SDK","maintainers":[{"name":"temporal-sdk-team","email":"sdk@temporal.io"}],"readme":"# Nexus TypeScript SDK\n\n[![CI](https://github.com/nexus-rpc/sdk-typescript/actions/workflows/ci.yml/badge.svg)](https://github.com/nexus-rpc/sdk-typescript/actions/workflows/ci.yml)\n[![API Docs](https://img.shields.io/badge/API_docs-blue)](https://nexus-rpc.github.io/sdk-typescript/)\n\n**This SDK is currently at an experimental release stage. Backwards-incompatible changes are anticipated until a stable release is announced.**\n\nTypeScript SDK for working with [Nexus RPC](https://github.com/nexus-rpc/api). See\n[API documentation](https://nexus-rpc.github.io/sdk-typescript/).\n\n## What is Nexus?\n\nNexus is a synchronous RPC protocol. Arbitrary duration operations are modeled on top of a set of pre-defined\nsynchronous RPCs.\n\nA Nexus caller calls a handler. The handler may respond inline (synchronous response) or return a token referencing the\nongoing operation (asynchronous response). The caller can cancel an asynchronous operation, check for its outcome, or\nfetch its current state. The caller can also specify a callback URL, which the handler uses to deliver the result of an\nasynchronous operation when it is ready.\n\nThis SDK provides the core primitives for defining and implementing Nexus services in TypeScript.\n\n## Protocol Implementations\n\n- [Temporal](https://docs.temporal.io/nexus) — builds on this SDK to provide a full implementation of the Nexus protocol, backed by Durable Execution.\n\n## Installation\n\n```shell\nnpm install nexus-rpc\n```\n\n## Usage\n\n### Define a Service\n\nUse the `service` and `operation` helpers to define a typed service contract. Operations are generic in their input and\noutput types.\n\n```typescript\nimport { service, operation } from \"nexus-rpc\";\n\ninterface MyInput {\n  name: string;\n}\n\ninterface MyOutput {\n  greeting: string;\n}\n\nconst myService = service(\"my-service\", {\n  sayHello: operation<MyInput, MyOutput>(),\n});\n```\n\n### Implement a Sync Operation\n\nA sync operation handler is a function that receives a context and an input, and returns the output directly.\n\n```typescript\nimport { serviceHandler } from \"nexus-rpc\";\n\nconst handler = serviceHandler(myService, {\n  async sayHello(ctx, input) {\n    return { greeting: `Hello, ${input.name}!` };\n  },\n});\n```\n\n### Implement an Async Operation\n\nFor operations that may take an arbitrary amount of time, return a `HandlerStartOperationResult.async` with a token\nthat can be used to track, cancel, or deliver the result of the operation later.\n\n```typescript\nimport { HandlerStartOperationResult, serviceHandler } from \"nexus-rpc\";\n\nconst handler = serviceHandler(myService, {\n  sayHello: {\n    async start(ctx, input) {\n      const token = await startBackgroundWork(input);\n      return HandlerStartOperationResult.async(token);\n    },\n    async cancel(ctx, token) {\n      await cancelBackgroundWork(token);\n    },\n  },\n});\n```\n\n### Resolve an Operation as Failed\n\nThrow an `OperationError` from a start handler to indicate that the operation completed unsuccessfully.\n\n```typescript\nimport { OperationError } from \"nexus-rpc\";\n\n// Failed operation\nthrow new OperationError(\"failed\", \"Not enough inventory\");\n\n// Canceled operation\nthrow new OperationError(\"canceled\", \"User canceled the operation\");\n```\n\n### Fail a Handler Request\n\nThrow a `HandlerError` to fail a request with a specific error type. Returning an unrecognized error from any handler\nmethod will result in a generic internal server error response.\n\n```typescript\nimport { HandlerError } from \"nexus-rpc\";\n\n// Bad request\nthrow new HandlerError(\"BAD_REQUEST\", \"Invalid input\");\n\n// Retryable internal error\nthrow new HandlerError(\"INTERNAL\", \"Database unavailable\", {\n  retryableOverride: true,\n});\n```\n\n## Contributing\n\n### Prerequisites\n\n- [Node.js >= 20](https://nodejs.org/)\n\n### Build\n\n```shell\npnpm install --frozen-lockfile\npnpm run build\n```\n\n### Test\n\n```shell\npnpm test\n```\n\n### Lint\n\n```shell\npnpm run lint\n```\n\n### Format\n\n```shell\npnpm run format\n```\n","readmeFilename":"README.md"}