diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68c61c7..287f155 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,6 +61,40 @@ jobs: - name: Run type check run: pnpm run typecheck + # No CI job used to run `pnpm run generate`, so when TypeScript 7 broke the + # openapi-ts codegen (2026-08-27) CI stayed green while the Generate SDK + # workflow failed 10 dispatches in a row and the published SDK silently froze + # at API 1.109.0. This job regenerates from the committed spec and fails on + # any drift. + codegen: + name: Codegen + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup pnpm + uses: pnpm/action-setup@v5 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: '22' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Regenerate client from the committed spec + run: pnpm run generate + + - name: Fail on generated-client drift + run: | + if ! git diff --exit-code -- src/client; then + echo "::error::src/client is out of sync with public-openapi.json. Run 'pnpm run generate' and commit the result." + exit 1 + fi + test: name: Test (Node ${{ matrix.node-version }}) runs-on: ubuntu-latest @@ -182,7 +216,7 @@ jobs: # Summary job that other jobs can depend on ci-success: name: CI Success - needs: [lint, typecheck, test, test-bun, test-deno, build] + needs: [lint, typecheck, codegen, test, test-bun, test-deno, build] runs-on: ubuntu-latest if: always() steps: @@ -190,6 +224,7 @@ jobs: run: | if [[ "${{ needs.lint.result }}" != "success" ]] || \ [[ "${{ needs.typecheck.result }}" != "success" ]] || \ + [[ "${{ needs.codegen.result }}" != "success" ]] || \ [[ "${{ needs.test.result }}" != "success" ]] || \ [[ "${{ needs.test-bun.result }}" != "success" ]] || \ [[ "${{ needs.test-deno.result }}" != "success" ]] || \ diff --git a/.gitignore b/.gitignore index 3293a23..b764811 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ coverage/ .direnv/ result + +# Git worktrees +.worktrees/ diff --git a/.prettierignore b/.prettierignore index 13f3bba..76db8c9 100644 --- a/.prettierignore +++ b/.prettierignore @@ -15,3 +15,6 @@ coverage/ # Nix flake.lock + +# Git worktrees +.worktrees/ diff --git a/README.md b/README.md index 703d4e1..6671d56 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ The SDK provides several services to interact with different parts of the Abby A - `abby.opportunity`: CRM and opportunities management. - `abby.asset`: Manage business assets. - `abby.advance`: Manage advance payments. +- `abby.customerPortal`: Customer portal payments and billing themes. ### Basic Example @@ -360,16 +361,15 @@ The client automatically includes your API key and SDK headers in all requests. ## Validation -The SDK includes built-in [Zod](https://zod.dev) validation for all API requests and responses, ensuring type safety at runtime. +The SDK includes built-in [Zod](https://zod.dev) validation for API requests, catching malformed payloads before they leave your process. ### Automatic Validation -All SDK methods automatically validate: +All SDK methods automatically validate **request data**: parameters, query strings, and request bodies are checked before sending. -- **Request data**: Parameters, query strings, and request bodies are validated before sending -- **Response data**: API responses are validated to ensure they match the expected schema +**Responses are not validated.** Response schemas are generated and exported (see below), but the SDK does not run them — a spec/API mismatch would otherwise turn a successful call into a thrown error. Types on responses remain compile-time only; parse with the exported `z*Dto` schemas yourself if you need a runtime guarantee. -If validation fails, a `ZodError` is thrown with detailed information about what went wrong: +If request validation fails, a `ZodError` is thrown with detailed information about what went wrong: ```typescript import Abby from '@abby-inc/node'; diff --git a/package.json b/package.json index 1be51cb..3e950a2 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "prettier": "^3.9.6", "rollup": "^4.63.0", "rollup-plugin-esbuild": "6.2.1", - "typescript": "^7.0.2", + "typescript": "^5.9.3", "vitest": "^4.1.11" }, "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 33ac7f4..f28aac5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,13 +18,13 @@ importers: devDependencies: '@commitlint/cli': specifier: ^21.2.2 - version: 21.2.2(@types/node@25.9.5)(conventional-commits-parser@7.1.2)(typescript@7.0.2) + version: 21.2.2(@types/node@25.9.5)(conventional-commits-parser@7.1.2)(typescript@5.9.3) '@commitlint/config-conventional': specifier: ^21.2.2 version: 21.2.2 '@hey-api/openapi-ts': specifier: ~0.97.3 - version: 0.97.3(magicast@0.5.4)(typescript@7.0.2) + version: 0.97.3(magicast@0.5.4)(typescript@5.9.3) '@rollup/plugin-commonjs': specifier: ^29.0.3 version: 29.0.3(rollup@4.63.0) @@ -65,8 +65,8 @@ importers: specifier: 6.2.1 version: 6.2.1(esbuild@0.28.1)(rollup@4.63.0)(supports-color@7.2.0) typescript: - specifier: ^7.0.2 - version: 7.0.2 + specifier: ^5.9.3 + version: 5.9.3 vitest: specifier: ^4.1.11 version: 4.1.11(@types/node@25.9.5)(@vitest/coverage-v8@4.1.11)(vite@7.3.6(@types/node@25.9.5)(jiti@2.7.0)(yaml@2.9.0)) @@ -722,126 +722,6 @@ packages: '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} - '@typescript/typescript-aix-ppc64@7.0.2': - resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==} - engines: {node: '>=16.20.0'} - cpu: [ppc64] - os: [aix] - - '@typescript/typescript-darwin-arm64@7.0.2': - resolution: {integrity: sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==} - engines: {node: '>=16.20.0'} - cpu: [arm64] - os: [darwin] - - '@typescript/typescript-darwin-x64@7.0.2': - resolution: {integrity: sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==} - engines: {node: '>=16.20.0'} - cpu: [x64] - os: [darwin] - - '@typescript/typescript-freebsd-arm64@7.0.2': - resolution: {integrity: sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==} - engines: {node: '>=16.20.0'} - cpu: [arm64] - os: [freebsd] - - '@typescript/typescript-freebsd-x64@7.0.2': - resolution: {integrity: sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==} - engines: {node: '>=16.20.0'} - cpu: [x64] - os: [freebsd] - - '@typescript/typescript-linux-arm64@7.0.2': - resolution: {integrity: sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==} - engines: {node: '>=16.20.0'} - cpu: [arm64] - os: [linux] - - '@typescript/typescript-linux-arm@7.0.2': - resolution: {integrity: sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==} - engines: {node: '>=16.20.0'} - cpu: [arm] - os: [linux] - - '@typescript/typescript-linux-loong64@7.0.2': - resolution: {integrity: sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==} - engines: {node: '>=16.20.0'} - cpu: [loong64] - os: [linux] - - '@typescript/typescript-linux-mips64el@7.0.2': - resolution: {integrity: sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==} - engines: {node: '>=16.20.0'} - cpu: [mips64el] - os: [linux] - - '@typescript/typescript-linux-ppc64@7.0.2': - resolution: {integrity: sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==} - engines: {node: '>=16.20.0'} - cpu: [ppc64] - os: [linux] - - '@typescript/typescript-linux-riscv64@7.0.2': - resolution: {integrity: sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==} - engines: {node: '>=16.20.0'} - cpu: [riscv64] - os: [linux] - - '@typescript/typescript-linux-s390x@7.0.2': - resolution: {integrity: sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==} - engines: {node: '>=16.20.0'} - cpu: [s390x] - os: [linux] - - '@typescript/typescript-linux-x64@7.0.2': - resolution: {integrity: sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==} - engines: {node: '>=16.20.0'} - cpu: [x64] - os: [linux] - - '@typescript/typescript-netbsd-arm64@7.0.2': - resolution: {integrity: sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==} - engines: {node: '>=16.20.0'} - cpu: [arm64] - os: [netbsd] - - '@typescript/typescript-netbsd-x64@7.0.2': - resolution: {integrity: sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==} - engines: {node: '>=16.20.0'} - cpu: [x64] - os: [netbsd] - - '@typescript/typescript-openbsd-arm64@7.0.2': - resolution: {integrity: sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==} - engines: {node: '>=16.20.0'} - cpu: [arm64] - os: [openbsd] - - '@typescript/typescript-openbsd-x64@7.0.2': - resolution: {integrity: sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==} - engines: {node: '>=16.20.0'} - cpu: [x64] - os: [openbsd] - - '@typescript/typescript-sunos-x64@7.0.2': - resolution: {integrity: sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==} - engines: {node: '>=16.20.0'} - cpu: [x64] - os: [sunos] - - '@typescript/typescript-win32-arm64@7.0.2': - resolution: {integrity: sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==} - engines: {node: '>=16.20.0'} - cpu: [arm64] - os: [win32] - - '@typescript/typescript-win32-x64@7.0.2': - resolution: {integrity: sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==} - engines: {node: '>=16.20.0'} - cpu: [x64] - os: [win32] - '@vitest/coverage-v8@4.1.11': resolution: {integrity: sha512-8MVGEFnJIcdGjcbfKmeq8z0pZHH0JlVtoVZH9Q/qwUp6wyFnEJUBMrw9DCaj+ra3vShGmhavjalMIhPNxZAUcw==} peerDependencies: @@ -1415,9 +1295,9 @@ packages: resolution: {integrity: sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==} engines: {node: '>=14.0.0'} - typescript@7.0.2: - resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==} - engines: {node: '>=16.20.0'} + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} hasBin: true undici-types@7.24.6: @@ -1569,12 +1449,12 @@ snapshots: '@bcoe/v8-coverage@1.0.2': {} - '@commitlint/cli@21.2.2(@types/node@25.9.5)(conventional-commits-parser@7.1.2)(typescript@7.0.2)': + '@commitlint/cli@21.2.2(@types/node@25.9.5)(conventional-commits-parser@7.1.2)(typescript@5.9.3)': dependencies: '@commitlint/config-conventional': 21.2.2 '@commitlint/format': 21.2.2 '@commitlint/lint': 21.2.2 - '@commitlint/load': 21.2.2(@types/node@25.9.5)(typescript@7.0.2) + '@commitlint/load': 21.2.2(@types/node@25.9.5)(typescript@5.9.3) '@commitlint/read': 21.2.1(conventional-commits-parser@7.1.2) '@commitlint/types': 21.2.0 tinyexec: 1.3.0 @@ -1619,14 +1499,14 @@ snapshots: '@commitlint/rules': 21.2.2 '@commitlint/types': 21.2.0 - '@commitlint/load@21.2.2(@types/node@25.9.5)(typescript@7.0.2)': + '@commitlint/load@21.2.2(@types/node@25.9.5)(typescript@5.9.3)': dependencies: '@commitlint/config-validator': 21.2.0 '@commitlint/execute-rule': 21.0.1 '@commitlint/resolve-extends': 21.2.2 '@commitlint/types': 21.2.0 - cosmiconfig: 9.0.2(typescript@7.0.2) - cosmiconfig-typescript-loader: 6.3.0(@types/node@25.9.5)(cosmiconfig@9.0.2(typescript@7.0.2))(typescript@7.0.2) + cosmiconfig: 9.0.2(typescript@5.9.3) + cosmiconfig-typescript-loader: 6.3.0(@types/node@25.9.5)(cosmiconfig@9.0.2(typescript@5.9.3))(typescript@5.9.3) es-toolkit: 1.51.0 is-plain-obj: 4.1.0 picocolors: 1.1.1 @@ -1781,7 +1661,7 @@ snapshots: '@types/json-schema': 7.0.15 js-yaml: 4.3.2 - '@hey-api/openapi-ts@0.97.3(magicast@0.5.4)(typescript@7.0.2)': + '@hey-api/openapi-ts@0.97.3(magicast@0.5.4)(typescript@5.9.3)': dependencies: '@hey-api/codegen-core': 0.8.2(magicast@0.5.4) '@hey-api/json-schema-ref-parser': 1.4.2 @@ -1793,7 +1673,7 @@ snapshots: color-support: 1.1.3 commander: 14.0.3 get-tsconfig: 4.14.0 - typescript: 7.0.2 + typescript: 5.9.3 transitivePeerDependencies: - magicast @@ -2032,66 +1912,6 @@ snapshots: '@types/resolve@1.20.2': {} - '@typescript/typescript-aix-ppc64@7.0.2': - optional: true - - '@typescript/typescript-darwin-arm64@7.0.2': - optional: true - - '@typescript/typescript-darwin-x64@7.0.2': - optional: true - - '@typescript/typescript-freebsd-arm64@7.0.2': - optional: true - - '@typescript/typescript-freebsd-x64@7.0.2': - optional: true - - '@typescript/typescript-linux-arm64@7.0.2': - optional: true - - '@typescript/typescript-linux-arm@7.0.2': - optional: true - - '@typescript/typescript-linux-loong64@7.0.2': - optional: true - - '@typescript/typescript-linux-mips64el@7.0.2': - optional: true - - '@typescript/typescript-linux-ppc64@7.0.2': - optional: true - - '@typescript/typescript-linux-riscv64@7.0.2': - optional: true - - '@typescript/typescript-linux-s390x@7.0.2': - optional: true - - '@typescript/typescript-linux-x64@7.0.2': - optional: true - - '@typescript/typescript-netbsd-arm64@7.0.2': - optional: true - - '@typescript/typescript-netbsd-x64@7.0.2': - optional: true - - '@typescript/typescript-openbsd-arm64@7.0.2': - optional: true - - '@typescript/typescript-openbsd-x64@7.0.2': - optional: true - - '@typescript/typescript-sunos-x64@7.0.2': - optional: true - - '@typescript/typescript-win32-arm64@7.0.2': - optional: true - - '@typescript/typescript-win32-x64@7.0.2': - optional: true - '@vitest/coverage-v8@4.1.11(vitest@4.1.11)': dependencies: '@bcoe/v8-coverage': 1.0.2 @@ -2230,21 +2050,21 @@ snapshots: convert-source-map@2.0.0: {} - cosmiconfig-typescript-loader@6.3.0(@types/node@25.9.5)(cosmiconfig@9.0.2(typescript@7.0.2))(typescript@7.0.2): + cosmiconfig-typescript-loader@6.3.0(@types/node@25.9.5)(cosmiconfig@9.0.2(typescript@5.9.3))(typescript@5.9.3): dependencies: '@types/node': 25.9.5 - cosmiconfig: 9.0.2(typescript@7.0.2) + cosmiconfig: 9.0.2(typescript@5.9.3) jiti: 2.6.1 - typescript: 7.0.2 + typescript: 5.9.3 - cosmiconfig@9.0.2(typescript@7.0.2): + cosmiconfig@9.0.2(typescript@5.9.3): dependencies: env-paths: 2.2.1 import-fresh: 3.3.1 js-yaml: 4.3.2 parse-json: 5.2.0 optionalDependencies: - typescript: 7.0.2 + typescript: 5.9.3 cross-spawn@7.0.6: dependencies: @@ -2654,28 +2474,7 @@ snapshots: tinyrainbow@3.1.1: {} - typescript@7.0.2: - optionalDependencies: - '@typescript/typescript-aix-ppc64': 7.0.2 - '@typescript/typescript-darwin-arm64': 7.0.2 - '@typescript/typescript-darwin-x64': 7.0.2 - '@typescript/typescript-freebsd-arm64': 7.0.2 - '@typescript/typescript-freebsd-x64': 7.0.2 - '@typescript/typescript-linux-arm': 7.0.2 - '@typescript/typescript-linux-arm64': 7.0.2 - '@typescript/typescript-linux-loong64': 7.0.2 - '@typescript/typescript-linux-mips64el': 7.0.2 - '@typescript/typescript-linux-ppc64': 7.0.2 - '@typescript/typescript-linux-riscv64': 7.0.2 - '@typescript/typescript-linux-s390x': 7.0.2 - '@typescript/typescript-linux-x64': 7.0.2 - '@typescript/typescript-netbsd-arm64': 7.0.2 - '@typescript/typescript-netbsd-x64': 7.0.2 - '@typescript/typescript-openbsd-arm64': 7.0.2 - '@typescript/typescript-openbsd-x64': 7.0.2 - '@typescript/typescript-sunos-x64': 7.0.2 - '@typescript/typescript-win32-arm64': 7.0.2 - '@typescript/typescript-win32-x64': 7.0.2 + typescript@5.9.3: {} undici-types@7.24.6: {}