{"_id":"@amp-labs/sdk-node-write","_rev":"5-873fb17f41b8783c14fa22a6841c7f5d","name":"@amp-labs/sdk-node-write","dist-tags":{"latest":"0.2.4"},"versions":{"0.1.3":{"name":"@amp-labs/sdk-node-write","version":"0.1.3","author":{"name":"Speakeasy"},"_id":"@amp-labs/sdk-node-write@0.1.3","maintainers":[{"name":"laurenzlong","email":"laurenzlong@gmail.com"},{"name":"ampersand-ops","email":"devops@withampersand.com"}],"homepage":"https://github.com/amp-labs/sdk-node-write#readme","bugs":{"url":"https://github.com/amp-labs/sdk-node-write/issues"},"bin":{"mcp":"bin/mcp-server.js"},"dist":{"shasum":"403f80a6c0f1e6169f5f83985250e882387cc060","tarball":"https://registry.npmjs.org/@amp-labs/sdk-node-write/-/sdk-node-write-0.1.3.tgz","fileCount":295,"integrity":"sha512-dySNIhISPsF4+91JO8ncDZRllcwYtrLmLOn1dsN4834+Q6HaeE0IfWJdG8DRVYz1G1WwxJX22Ce0y8xC+n7jAQ==","signatures":[{"sig":"MEQCIE3W7pDzNFqzmKSyQ+2MTBAeudbEtukeqOIBMbEKquwaAiAHBCW8nib7t8eNgqZGOW8dD6p2/GHigpWNAOqWrnKSRg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4013640},"main":"./index.js","types":"./index.d.ts","gitHead":"44342a831bcd44fd4849099bf37b5fc78489e5c3","scripts":{"lint":"eslint --cache --max-warnings=0 src","build":"npm run build:mcp && tsc","build:mcp":"bun src/mcp-server/build.mts","prepublishOnly":"npm run build"},"_npmUser":{"name":"ampersand-ops","email":"devops@withampersand.com"},"repository":{"url":"git+https://github.com/amp-labs/sdk-node-write.git","type":"git"},"_npmVersion":"8.19.4","description":"Developer-friendly & type-safe Typescript SDK specifically catered to leverage *sdk-node-write* API.","directories":{},"sideEffects":false,"_nodeVersion":"16.20.2","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"bun":"^1.2.2","zod":"^3.23.4","eslint":"^9.19.0","express":"^4.21.2","globals":"^15.14.0","bun-types":"^1.2.2","@eslint/js":"^9.19.0","typescript":"^5.4.5","@stricli/core":"^1.1.1","@types/express":"^4.17.21","typescript-eslint":"^8.22.0","@modelcontextprotocol/sdk":"^1.5.0"},"peerDependencies":{"zod":">= 3","@modelcontextprotocol/sdk":"^1.5.0"},"peerDependenciesMeta":{"@modelcontextprotocol/sdk":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk-node-write_0.1.3_1744382838525_0.6421225311234238","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@amp-labs/sdk-node-write","version":"0.2.0","author":{"name":"Speakeasy"},"_id":"@amp-labs/sdk-node-write@0.2.0","maintainers":[{"name":"laurenzlong","email":"laurenzlong@gmail.com"},{"name":"ampersand-ops","email":"devops@withampersand.com"}],"homepage":"https://github.com/amp-labs/sdk-node-write#readme","bugs":{"url":"https://github.com/amp-labs/sdk-node-write/issues"},"bin":{"mcp":"bin/mcp-server.js"},"dist":{"shasum":"db12ba8b8c4fada8a93e30030af6eede914a8562","tarball":"https://registry.npmjs.org/@amp-labs/sdk-node-write/-/sdk-node-write-0.2.0.tgz","fileCount":295,"integrity":"sha512-A8yd5q0KYKbTbL9xNPUpkiQ1z1VwHUExdY/JySlAnIPivxTNESWSYyFVwpnnmPmsHNyKzuLl71fVYhWZXn3jKw==","signatures":[{"sig":"MEUCIALYHuVL1BhAn+jicSC/mfsulwIkbs2y/W0dtQwaRuO8AiEAqzpA8qE2FysVOrlfezmOh9sH/MpNi0p9Tk9jQu8ipps=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4014146},"main":"./index.js","types":"./index.d.ts","gitHead":"0f2000cf521ee85195282dd343f8c2798ca3ae54","scripts":{"lint":"eslint --cache --max-warnings=0 src","build":"npm run build:mcp && tsc","build:mcp":"bun src/mcp-server/build.mts","prepublishOnly":"npm run build"},"_npmUser":{"name":"ampersand-ops","email":"devops@withampersand.com"},"repository":{"url":"git+https://github.com/amp-labs/sdk-node-write.git","type":"git"},"_npmVersion":"8.19.4","description":"<br/> <div align=\"center\">     <a href=\"https://www.withampersand.com/?utm_source=github&utm_medium=readme&utm_campaign=connectors-repo&utm_content=logo\">     <img src=\"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg","directories":{},"sideEffects":false,"_nodeVersion":"16.20.2","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"bun":"^1.2.2","zod":"^3.23.4","eslint":"^9.19.0","express":"^4.21.2","globals":"^15.14.0","bun-types":"^1.2.2","@eslint/js":"^9.19.0","typescript":"^5.4.5","@stricli/core":"^1.1.1","@types/express":"^4.17.21","typescript-eslint":"^8.22.0","@modelcontextprotocol/sdk":"^1.5.0"},"peerDependencies":{"zod":">= 3","@modelcontextprotocol/sdk":"^1.5.0"},"peerDependenciesMeta":{"@modelcontextprotocol/sdk":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk-node-write_0.2.0_1744384149877_0.580760613911389","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@amp-labs/sdk-node-write","version":"0.2.1","author":{"name":"Speakeasy"},"_id":"@amp-labs/sdk-node-write@0.2.1","maintainers":[{"name":"laurenzlong","email":"laurenzlong@gmail.com"},{"name":"ampersand-ops","email":"devops@withampersand.com"}],"homepage":"https://github.com/amp-labs/sdk-node-write#readme","bugs":{"url":"https://github.com/amp-labs/sdk-node-write/issues"},"bin":{"mcp":"bin/mcp-server.js"},"dist":{"shasum":"6ec58c4e405ec1e473ab3acd462ad34ed175c9b9","tarball":"https://registry.npmjs.org/@amp-labs/sdk-node-write/-/sdk-node-write-0.2.1.tgz","fileCount":295,"integrity":"sha512-JpE/BndtkBoUGBVh/BOeJ8Ta3d79AhHHncawXIZXUs0HnSQAEQZITQmKkVLv0d6Y5ntV8uBt9w8f8v9OS++3HQ==","signatures":[{"sig":"MEUCIQCWvbEHhiJ5USwLsqDccdqe2HsdzUEqEwH0KLh52Ks4MQIgYV1Uvucc3n0KjoR1OegXQ/ktrLcusiINv7aJLzekGoI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4012915},"main":"./index.js","types":"./index.d.ts","gitHead":"0a3712ec5717c6ccbd84a83bc5af67169c767a32","scripts":{"lint":"eslint --cache --max-warnings=0 src","build":"npm run build:mcp && tsc","build:mcp":"bun src/mcp-server/build.mts","prepublishOnly":"npm run build"},"_npmUser":{"name":"ampersand-ops","email":"devops@withampersand.com"},"repository":{"url":"git+https://github.com/amp-labs/sdk-node-write.git","type":"git"},"_npmVersion":"8.19.4","description":"<br/> <div align=\"center\">     <a href=\"https://www.withampersand.com/?utm_source=github&utm_medium=readme&utm_campaign=connectors-repo&utm_content=logo\">     <img src=\"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg","directories":{},"sideEffects":false,"_nodeVersion":"16.20.2","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"bun":"^1.2.2","zod":"^3.23.4","eslint":"^9.19.0","express":"^4.21.2","globals":"^15.14.0","bun-types":"^1.2.2","@eslint/js":"^9.19.0","typescript":"^5.4.5","@stricli/core":"^1.1.1","@types/express":"^4.17.21","typescript-eslint":"^8.22.0","@modelcontextprotocol/sdk":"^1.5.0"},"peerDependencies":{"zod":">= 3","@modelcontextprotocol/sdk":"^1.5.0"},"peerDependenciesMeta":{"@modelcontextprotocol/sdk":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk-node-write_0.2.1_1744838318348_0.4761781608170954","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@amp-labs/sdk-node-write","version":"0.2.3","author":{"name":"Speakeasy"},"_id":"@amp-labs/sdk-node-write@0.2.3","maintainers":[{"name":"laurenzlong","email":"laurenzlong@gmail.com"},{"name":"ampersand-ops","email":"devops@withampersand.com"}],"homepage":"https://github.com/amp-labs/sdk-node-write#readme","bugs":{"url":"https://github.com/amp-labs/sdk-node-write/issues"},"bin":{"mcp":"bin/mcp-server.js"},"dist":{"shasum":"9ca46d5fd43db60cea32c9890a2264eabdb81504","tarball":"https://registry.npmjs.org/@amp-labs/sdk-node-write/-/sdk-node-write-0.2.3.tgz","fileCount":295,"integrity":"sha512-47vycGtWS1W5PpJUhdvkUPua9/+rApiL85HJ+zzAJauDiKqH4wqbDwwPJrerGzCn4aDqYQVdggQwkoOzNOnVMA==","signatures":[{"sig":"MEYCIQDAQ2lKQJz5acZv9s6YmuDYgfJEuHpMAbtcLHkeGmQqngIhANotJd02ho8fDE7haC4nC3K0kOgIXhFZkCeRtNB2hUNX","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4012915},"main":"./index.js","types":"./index.d.ts","gitHead":"7a7f79da2a3e8f6adc4d11e080ba59d50d936c8d","scripts":{"lint":"eslint --cache --max-warnings=0 src","build":"npm run build:mcp && tsc","build:mcp":"bun src/mcp-server/build.mts","prepublishOnly":"npm run build"},"_npmUser":{"name":"ampersand-ops","email":"devops@withampersand.com"},"repository":{"url":"git+https://github.com/amp-labs/sdk-node-write.git","type":"git"},"_npmVersion":"8.19.4","description":"<br/> <div align=\"center\">     <a href=\"https://www.withampersand.com/?utm_source=github&utm_medium=readme&utm_campaign=connectors-repo&utm_content=logo\">     <img src=\"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg","directories":{},"sideEffects":false,"_nodeVersion":"16.20.2","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"bun":"^1.2.2","zod":"^3.23.4","eslint":"^9.19.0","express":"^4.21.2","globals":"^15.14.0","bun-types":"^1.2.2","@eslint/js":"^9.19.0","typescript":"^5.4.5","@stricli/core":"^1.1.1","@types/express":"^4.17.21","typescript-eslint":"^8.22.0","@modelcontextprotocol/sdk":"^1.5.0"},"peerDependencies":{"zod":">= 3","@modelcontextprotocol/sdk":"^1.5.0"},"peerDependenciesMeta":{"@modelcontextprotocol/sdk":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk-node-write_0.2.3_1744838583776_0.369037272403703","host":"s3://npm-registry-packages-npm-production"}},"0.2.4":{"name":"@amp-labs/sdk-node-write","version":"0.2.4","author":{"name":"Speakeasy"},"bin":{"mcp":"bin/mcp-server.js"},"main":"./index.js","sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/amp-labs/sdk-node-write.git"},"scripts":{"lint":"eslint --cache --max-warnings=0 src","build:mcp":"bun src/mcp-server/build.mts","build":"npm run build:mcp && tsc","prepublishOnly":"npm run build"},"peerDependencies":{"@modelcontextprotocol/sdk":">=1.5.0 <1.10.0","zod":">= 3"},"peerDependenciesMeta":{"@modelcontextprotocol/sdk":{"optional":true}},"devDependencies":{"@eslint/js":"^9.19.0","@modelcontextprotocol/sdk":">=1.5.0 <1.10.0","@stricli/core":"^1.1.1","@types/express":"^4.17.21","bun":"^1.2.2","bun-types":"^1.2.2","eslint":"^9.19.0","express":"^4.21.2","globals":"^15.14.0","typescript":"^5.4.5","typescript-eslint":"^8.22.0","zod":"^3.23.4"},"dependencies":{},"types":"./index.d.ts","gitHead":"b0166a76a2a1c2cc09567271199c95a9ef475f3f","description":"<br/> <div align=\"center\">     <a href=\"https://www.withampersand.com/?utm_source=github&utm_medium=readme&utm_campaign=connectors-repo&utm_content=logo\">     <img src=\"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg","bugs":{"url":"https://github.com/amp-labs/sdk-node-write/issues"},"homepage":"https://github.com/amp-labs/sdk-node-write#readme","_id":"@amp-labs/sdk-node-write@0.2.4","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-JU2nnhGs0tcLIxJ+Jv9qrgo+aGtWq8Pzlt9A4W+0FhXxfjpjAOYnVEMjw94JG71RI1n1tRe3/YQSalVxJko2WA==","shasum":"8210492b95ab4b83b45c2dc81e252ad2490f775d","tarball":"https://registry.npmjs.org/@amp-labs/sdk-node-write/-/sdk-node-write-0.2.4.tgz","fileCount":295,"unpackedSize":4012382,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDIsUiEhTm6zUbWqXvwImp+OZFegx/hYQgzdmx5cSBx9gIhAPz8Wt4tQy5dMsA65NFadT9/WO9LdpWvHJX//4QrO+0d"}]},"_npmUser":{"name":"ampersand-ops","email":"devops@withampersand.com"},"directories":{},"maintainers":[{"name":"laurenzlong","email":"laurenzlong@gmail.com"},{"name":"ampersand-ops","email":"devops@withampersand.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk-node-write_0.2.4_1746120800994_0.9690659973482727"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-11T14:47:18.472Z","modified":"2025-05-01T17:33:21.547Z","0.1.3":"2025-04-11T14:47:18.711Z","0.2.0":"2025-04-11T15:09:10.127Z","0.2.1":"2025-04-16T21:18:38.646Z","0.2.3":"2025-04-16T21:23:04.050Z","0.2.4":"2025-05-01T17:33:21.302Z"},"bugs":{"url":"https://github.com/amp-labs/sdk-node-write/issues"},"author":{"name":"Speakeasy"},"homepage":"https://github.com/amp-labs/sdk-node-write#readme","repository":{"type":"git","url":"git+https://github.com/amp-labs/sdk-node-write.git"},"description":"<br/> <div align=\"center\">     <a href=\"https://www.withampersand.com/?utm_source=github&utm_medium=readme&utm_campaign=connectors-repo&utm_content=logo\">     <img src=\"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg","maintainers":[{"name":"laurenzlong","email":"laurenzlong@gmail.com"},{"name":"ampersand-ops","email":"devops@withampersand.com"}],"readme":"# Ampersand write SDK\n\n<br/>\n<div align=\"center\">\n    <a href=\"https://www.withampersand.com/?utm_source=github&utm_medium=readme&utm_campaign=connectors-repo&utm_content=logo\">\n    <img src=\"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg\" height=\"30\" align=\"center\" alt=\"Ampersand logo\" >\n    </a>\n<br/>\n<br/>\n\n<div align=\"center\">\n\n[![Star us on GitHub](https://img.shields.io/github/stars/amp-labs/connectors?color=FFD700&label=Stars&logo=Github)](https://github.com/amp-labs/sdk-node-write) [![Discord](https://img.shields.io/badge/Join%20The%20Community-black?logo=discord)](https://discord.gg/BWP4BpKHvf) [![Documentation](https://img.shields.io/badge/Read%20our%20Documentation-black?logo=book)](https://docs.withampersand.com) ![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg) <img src=\"https://img.shields.io/static/v1?label=license&message=MIT&color=white\" alt=\"License\">\n</div>\n\n</div>\n\n# Overview\n\n[Ampersand](https://withampersand.com?trk=readme-github) is a declarative platform for SaaS builders who are creating product integrations. It allows you to:\n\n* Read data from your customer’s SaaS\n* Write data to your customer’s SaaS\n* Subscribe to events (creates, deletes, and field changes) in your customer’s SaaS\n\n<!-- Start Summary [summary] -->\n## Summary\n\n\n<!-- End Summary [summary] -->\n\n<!-- Start Table of Contents [toc] -->\n## Table of Contents\n<!-- $toc-max-depth=2 -->\n* [Ampersand write SDK](#ampersand-write-sdk)\n* [Overview](#overview)\n  * [SDK Installation](#sdk-installation)\n  * [Requirements](#requirements)\n  * [SDK Example Usage](#sdk-example-usage)\n  * [Authentication](#authentication)\n  * [Available Resources and Operations](#available-resources-and-operations)\n  * [Standalone functions](#standalone-functions)\n  * [Retries](#retries)\n  * [Error Handling](#error-handling)\n  * [Server Selection](#server-selection)\n  * [Custom HTTP Client](#custom-http-client)\n  * [Debugging](#debugging)\n* [Development](#development)\n  * [Maturity](#maturity)\n  * [Contributions](#contributions)\n\n<!-- End Table of Contents [toc] -->\n\n<!-- Start SDK Installation [installation] -->\n## SDK Installation\n\nThe SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.\n\n### NPM\n\n```bash\nnpm add @amp-labs/sdk-node-write\n```\n\n### PNPM\n\n```bash\npnpm add @amp-labs/sdk-node-write\n```\n\n### Bun\n\n```bash\nbun add @amp-labs/sdk-node-write\n```\n\n### Yarn\n\n```bash\nyarn add @amp-labs/sdk-node-write zod\n\n# Note that Yarn does not install peer dependencies automatically. You will need\n# to install zod as shown above.\n```\n\n\n\n### Model Context Protocol (MCP) Server\n\nThis SDK is also an installable MCP server where the various SDK methods are\nexposed as tools that can be invoked by AI applications.\n\n> Node.js v20 or greater is required to run the MCP server from npm.\n\n<details>\n<summary>Claude installation steps</summary>\n\nAdd the following server definition to your `claude_desktop_config.json` file:\n\n```json\n{\n  \"mcpServers\": {\n    \"Ampersand\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\", \"--package\", \"@amp-labs/sdk-node-write\",\n        \"--\",\n        \"mcp\", \"start\",\n        \"--api-key-header\", \"...\"\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary>Cursor installation steps</summary>\n\nCreate a `.cursor/mcp.json` file in your project root with the following content:\n\n```json\n{\n  \"mcpServers\": {\n    \"Ampersand\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\", \"--package\", \"@amp-labs/sdk-node-write\",\n        \"--\",\n        \"mcp\", \"start\",\n        \"--api-key-header\", \"...\"\n      ]\n    }\n  }\n}\n```\n\n</details>\n\nYou can also run MCP servers as a standalone binary with no additional dependencies. You must pull these binaries from available Github releases:\n\n```bash\ncurl -L -o mcp-server \\\n    https://github.com/{org}/{repo}/releases/download/{tag}/mcp-server-bun-darwin-arm64 && \\\nchmod +x mcp-server\n```\n\nIf the repo is a private repo you must add your Github PAT to download a release `-H \"Authorization: Bearer {GITHUB_PAT}\"`.\n\n\n```json\n{\n  \"mcpServers\": {\n    \"Todos\": {\n      \"command\": \"./DOWNLOAD/PATH/mcp-server\",\n      \"args\": [\n        \"start\"\n      ]\n    }\n  }\n}\n```\n\nFor a full list of server arguments, run:\n\n```sh\nnpx -y --package @amp-labs/sdk-node-write -- mcp start --help\n```\n<!-- End SDK Installation [installation] -->\n\n<!-- Start Requirements [requirements] -->\n## Requirements\n\nFor supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).\n<!-- End Requirements [requirements] -->\n\n<!-- Start SDK Example Usage [usage] -->\n## SDK Example Usage\n\n### Example\n\n```typescript\nimport { Ampersand } from \"@amp-labs/sdk-node-write\";\n\nconst ampersand = new Ampersand({\n  apiKeyHeader: process.env[\"SDKNODEWRITE_API_KEY_HEADER\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await ampersand.write.records({\n    projectIdOrName: \"<value>\",\n    integrationId: \"<id>\",\n    objectName: \"<value>\",\n    requestBody: {\n      groupRef: \"<value>\",\n      type: \"create\",\n      mode: \"synchronous\",\n      record: {\n        \"email\": \"david@withampersand.com\",\n        \"warmthScore\": \"ready-for-close\",\n      },\n      associations: [\n        {},\n      ],\n    },\n  });\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n<!-- End SDK Example Usage [usage] -->\n\n<!-- Start Authentication [security] -->\n## Authentication\n\n### Per-Client Security Schemes\n\nThis SDK supports the following security scheme globally:\n\n| Name           | Type   | Scheme  | Environment Variable          |\n| -------------- | ------ | ------- | ----------------------------- |\n| `apiKeyHeader` | apiKey | API key | `SDKNODEWRITE_API_KEY_HEADER` |\n\nTo authenticate with the API the `apiKeyHeader` parameter must be set when initializing the SDK client instance. For example:\n```typescript\nimport { Ampersand } from \"@amp-labs/sdk-node-write\";\n\nconst ampersand = new Ampersand({\n  apiKeyHeader: process.env[\"SDKNODEWRITE_API_KEY_HEADER\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await ampersand.write.records({\n    projectIdOrName: \"<value>\",\n    integrationId: \"<id>\",\n    objectName: \"<value>\",\n    requestBody: {\n      groupRef: \"<value>\",\n      type: \"create\",\n      mode: \"synchronous\",\n      record: {\n        \"email\": \"david@withampersand.com\",\n        \"warmthScore\": \"ready-for-close\",\n      },\n      associations: [\n        {},\n      ],\n    },\n  });\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n<!-- End Authentication [security] -->\n\n<!-- Start Available Resources and Operations [operations] -->\n## Available Resources and Operations\n\n<details open>\n<summary>Available methods</summary>\n\n\n### [write](docs/sdks/write/README.md)\n\n* [records](docs/sdks/write/README.md#records) - Write records\n\n</details>\n<!-- End Available Resources and Operations [operations] -->\n\n<!-- Start Standalone functions [standalone-funcs] -->\n## Standalone functions\n\nAll the methods listed above are available as standalone functions. These\nfunctions are ideal for use in applications running in the browser, serverless\nruntimes or other environments where application bundle size is a primary\nconcern. When using a bundler to build your application, all unused\nfunctionality will be either excluded from the final bundle or tree-shaken away.\n\nTo read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).\n\n<details>\n\n<summary>Available standalone functions</summary>\n\n- [`writeRecords`](docs/sdks/write/README.md#records) - Write records\n\n</details>\n<!-- End Standalone functions [standalone-funcs] -->\n\n<!-- Start Retries [retries] -->\n## Retries\n\nSome of the endpoints in this SDK support retries.  If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API.  However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.\n\nTo change the default retry strategy for a single API call, simply provide a retryConfig object to the call:\n```typescript\nimport { Ampersand } from \"@amp-labs/sdk-node-write\";\n\nconst ampersand = new Ampersand({\n  apiKeyHeader: process.env[\"SDKNODEWRITE_API_KEY_HEADER\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await ampersand.write.records({\n    projectIdOrName: \"<value>\",\n    integrationId: \"<id>\",\n    objectName: \"<value>\",\n    requestBody: {\n      groupRef: \"<value>\",\n      type: \"create\",\n      mode: \"synchronous\",\n      record: {\n        \"email\": \"david@withampersand.com\",\n        \"warmthScore\": \"ready-for-close\",\n      },\n      associations: [\n        {},\n      ],\n    },\n  }, {\n    retries: {\n      strategy: \"backoff\",\n      backoff: {\n        initialInterval: 1,\n        maxInterval: 50,\n        exponent: 1.1,\n        maxElapsedTime: 100,\n      },\n      retryConnectionErrors: false,\n    },\n  });\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n\nIf you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:\n```typescript\nimport { Ampersand } from \"@amp-labs/sdk-node-write\";\n\nconst ampersand = new Ampersand({\n  retryConfig: {\n    strategy: \"backoff\",\n    backoff: {\n      initialInterval: 1,\n      maxInterval: 50,\n      exponent: 1.1,\n      maxElapsedTime: 100,\n    },\n    retryConnectionErrors: false,\n  },\n  apiKeyHeader: process.env[\"SDKNODEWRITE_API_KEY_HEADER\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await ampersand.write.records({\n    projectIdOrName: \"<value>\",\n    integrationId: \"<id>\",\n    objectName: \"<value>\",\n    requestBody: {\n      groupRef: \"<value>\",\n      type: \"create\",\n      mode: \"synchronous\",\n      record: {\n        \"email\": \"david@withampersand.com\",\n        \"warmthScore\": \"ready-for-close\",\n      },\n      associations: [\n        {},\n      ],\n    },\n  });\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n<!-- End Retries [retries] -->\n\n<!-- Start Error Handling [errors] -->\n## Error Handling\n\nSome methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `records` method may throw the following errors:\n\n| Error Type                                  | Status Code | Content Type     |\n| ------------------------------------------- | ----------- | ---------------- |\n| errors.WriteRecordsSyncWriteResponseFailure | 422         | application/json |\n| errors.APIError                             | 4XX, 5XX    | \\*/\\*            |\n\nIf the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.\n\n```typescript\nimport { Ampersand } from \"@amp-labs/sdk-node-write\";\nimport {\n  SDKValidationError,\n  WriteRecordsSyncWriteResponseFailure,\n} from \"@amp-labs/sdk-node-write/models/errors\";\n\nconst ampersand = new Ampersand({\n  apiKeyHeader: process.env[\"SDKNODEWRITE_API_KEY_HEADER\"] ?? \"\",\n});\n\nasync function run() {\n  let result;\n  try {\n    result = await ampersand.write.records({\n      projectIdOrName: \"<value>\",\n      integrationId: \"<id>\",\n      objectName: \"<value>\",\n      requestBody: {\n        groupRef: \"<value>\",\n        type: \"create\",\n        mode: \"synchronous\",\n        record: {\n          \"email\": \"david@withampersand.com\",\n          \"warmthScore\": \"ready-for-close\",\n        },\n        associations: [\n          {},\n        ],\n      },\n    });\n\n    // Handle the result\n    console.log(result);\n  } catch (err) {\n    switch (true) {\n      // The server response does not match the expected SDK schema\n      case (err instanceof SDKValidationError): {\n        // Pretty-print will provide a human-readable multi-line error message\n        console.error(err.pretty());\n        // Raw value may also be inspected\n        console.error(err.rawValue);\n        return;\n      }\n      case (err instanceof WriteRecordsSyncWriteResponseFailure): {\n        // Handle err.data$: WriteRecordsSyncWriteResponseFailureData\n        console.error(err);\n        return;\n      }\n      default: {\n        // Other errors such as network errors, see HTTPClientErrors for more details\n        throw err;\n      }\n    }\n  }\n}\n\nrun();\n\n```\n\nValidation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.\n\nIn some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:\n\n| HTTP Client Error                                    | Description                                          |\n| ---------------------------------------------------- | ---------------------------------------------------- |\n| RequestAbortedError                                  | HTTP request was aborted by the client               |\n| RequestTimeoutError                                  | HTTP request timed out due to an AbortSignal signal  |\n| ConnectionError                                      | HTTP client was unable to make a request to a server |\n| InvalidRequestError                                  | Any input used to create a request is invalid        |\n| UnexpectedClientError                                | Unrecognised or unexpected error                     |\n<!-- End Error Handling [errors] -->\n\n<!-- Start Server Selection [server] -->\n## Server Selection\n\n### Override Server URL Per-Client\n\nThe default server can be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:\n```typescript\nimport { Ampersand } from \"@amp-labs/sdk-node-write\";\n\nconst ampersand = new Ampersand({\n  serverURL: \"https://write.withampersand.com/v1\",\n  apiKeyHeader: process.env[\"SDKNODEWRITE_API_KEY_HEADER\"] ?? \"\",\n});\n\nasync function run() {\n  const result = await ampersand.write.records({\n    projectIdOrName: \"<value>\",\n    integrationId: \"<id>\",\n    objectName: \"<value>\",\n    requestBody: {\n      groupRef: \"<value>\",\n      type: \"create\",\n      mode: \"synchronous\",\n      record: {\n        \"email\": \"david@withampersand.com\",\n        \"warmthScore\": \"ready-for-close\",\n      },\n      associations: [\n        {},\n      ],\n    },\n  });\n\n  // Handle the result\n  console.log(result);\n}\n\nrun();\n\n```\n<!-- End Server Selection [server] -->\n\n<!-- Start Custom HTTP Client [http-client] -->\n## Custom HTTP Client\n\nThe TypeScript SDK makes API calls using an `HTTPClient` that wraps the native\n[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This\nclient is a thin wrapper around `fetch` and provides the ability to attach hooks\naround the request lifecycle that can be used to modify the request or handle\nerrors and response.\n\nThe `HTTPClient` constructor takes an optional `fetcher` argument that can be\nused to integrate a third-party HTTP client or when writing tests to mock out\nthe HTTP client and feed in fixtures.\n\nThe following example shows how to use the `\"beforeRequest\"` hook to to add a\ncustom header and a timeout to requests and how to use the `\"requestError\"` hook\nto log errors:\n\n```typescript\nimport { Ampersand } from \"@amp-labs/sdk-node-write\";\nimport { HTTPClient } from \"@amp-labs/sdk-node-write/lib/http\";\n\nconst httpClient = new HTTPClient({\n  // fetcher takes a function that has the same signature as native `fetch`.\n  fetcher: (request) => {\n    return fetch(request);\n  }\n});\n\nhttpClient.addHook(\"beforeRequest\", (request) => {\n  const nextRequest = new Request(request, {\n    signal: request.signal || AbortSignal.timeout(5000)\n  });\n\n  nextRequest.headers.set(\"x-custom-header\", \"custom value\");\n\n  return nextRequest;\n});\n\nhttpClient.addHook(\"requestError\", (error, request) => {\n  console.group(\"Request Error\");\n  console.log(\"Reason:\", `${error}`);\n  console.log(\"Endpoint:\", `${request.method} ${request.url}`);\n  console.groupEnd();\n});\n\nconst sdk = new Ampersand({ httpClient });\n```\n<!-- End Custom HTTP Client [http-client] -->\n\n<!-- Start Debugging [debug] -->\n## Debugging\n\nYou can setup your SDK to emit debug logs for SDK requests and responses.\n\nYou can pass a logger that matches `console`'s interface as an SDK option.\n\n> [!WARNING]\n> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.\n\n```typescript\nimport { Ampersand } from \"@amp-labs/sdk-node-write\";\n\nconst sdk = new Ampersand({ debugLogger: console });\n```\n\nYou can also enable a default debug logger by setting an environment variable `SDKNODEWRITE_DEBUG` to true.\n<!-- End Debugging [debug] -->\n\n<!-- Placeholder for Future Speakeasy SDK Sections -->\n\n# Development\n\n## Maturity\n\nThis SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage\nto a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally\nlooking for the latest version.\n\n## Contributions\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. \nWe look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release. \n\n### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=sdk-node-write&utm_campaign=typescript)\n","readmeFilename":"README.md"}