├── .devcontainer └── devcontainer.json ├── .eslintrc.js ├── .github └── workflows │ ├── ci.yml │ ├── publish-npm.yml │ └── release-doctor.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.json ├── .release-please-manifest.json ├── .stats.yml ├── Brewfile ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── api.md ├── bin ├── check-release-environment └── publish-npm ├── examples ├── .keep ├── dispute_evidence.txt ├── transactions.ts └── upload_evidence.ts ├── integrations └── pagination.ts ├── jest.config.ts ├── package.json ├── release-please-config.json ├── scripts ├── bootstrap ├── build ├── format ├── lint ├── mock ├── test └── utils │ ├── check-is-in-git-install.sh │ ├── check-version.cjs │ ├── fix-index-exports.cjs │ ├── git-swap.sh │ ├── make-dist-package-json.cjs │ ├── postprocess-files.cjs │ └── upload-artifact.sh ├── src ├── _shims │ ├── MultipartBody.ts │ ├── README.md │ ├── auto │ │ ├── runtime-bun.ts │ │ ├── runtime-deno.ts │ │ ├── runtime-node.ts │ │ ├── runtime.ts │ │ ├── types-deno.ts │ │ ├── types-node.ts │ │ ├── types.d.ts │ │ ├── types.js │ │ └── types.mjs │ ├── bun-runtime.ts │ ├── index-deno.ts │ ├── index.d.ts │ ├── index.js │ ├── index.mjs │ ├── manual-types.d.ts │ ├── manual-types.js │ ├── manual-types.mjs │ ├── node-runtime.ts │ ├── node-types.d.ts │ ├── node-types.js │ ├── node-types.mjs │ ├── registry.ts │ ├── web-runtime.ts │ ├── web-types.d.ts │ ├── web-types.js │ └── web-types.mjs ├── core.ts ├── error.ts ├── index.ts ├── internal │ └── qs │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── formats.ts │ │ ├── index.ts │ │ ├── stringify.ts │ │ ├── types.ts │ │ └── utils.ts ├── lib │ └── .keep ├── pagination.ts ├── resource.ts ├── resources.ts ├── resources │ ├── account-holders.ts │ ├── accounts.ts │ ├── aggregate-balances.ts │ ├── auth-rules.ts │ ├── auth-rules │ │ ├── auth-rules.ts │ │ ├── index.ts │ │ ├── v2.ts │ │ └── v2 │ │ │ ├── backtests.ts │ │ │ ├── index.ts │ │ │ └── v2.ts │ ├── auth-stream-enrollment.ts │ ├── balances.ts │ ├── book-transfers.ts │ ├── card-programs.ts │ ├── cards.ts │ ├── cards │ │ ├── aggregate-balances.ts │ │ ├── balances.ts │ │ ├── cards.ts │ │ ├── financial-transactions.ts │ │ └── index.ts │ ├── credit-products.ts │ ├── credit-products │ │ ├── credit-products.ts │ │ ├── extended-credit.ts │ │ ├── index.ts │ │ └── prime-rates.ts │ ├── digital-card-art.ts │ ├── disputes.ts │ ├── events.ts │ ├── events │ │ ├── event-subscriptions.ts │ │ ├── events.ts │ │ ├── index.ts │ │ └── subscriptions.ts │ ├── external-bank-accounts.ts │ ├── external-bank-accounts │ │ ├── external-bank-accounts.ts │ │ ├── index.ts │ │ └── micro-deposits.ts │ ├── external-payments.ts │ ├── financial-accounts.ts │ ├── financial-accounts │ │ ├── balances.ts │ │ ├── credit-configuration.ts │ │ ├── financial-accounts.ts │ │ ├── financial-transactions.ts │ │ ├── index.ts │ │ ├── loan-tapes.ts │ │ ├── statements.ts │ │ └── statements │ │ │ ├── index.ts │ │ │ ├── line-items.ts │ │ │ └── statements.ts │ ├── fraud.ts │ ├── fraud │ │ ├── fraud.ts │ │ ├── index.ts │ │ └── transactions.ts │ ├── funding-events.ts │ ├── index.ts │ ├── management-operations.ts │ ├── payments.ts │ ├── reports.ts │ ├── reports │ │ ├── index.ts │ │ ├── reports.ts │ │ ├── settlement.ts │ │ └── settlement │ │ │ ├── index.ts │ │ │ ├── network-totals.ts │ │ │ └── settlement.ts │ ├── responder-endpoints.ts │ ├── shared.ts │ ├── three-ds.ts │ ├── three-ds │ │ ├── authentication.ts │ │ ├── decisioning.ts │ │ ├── index.ts │ │ └── three-ds.ts │ ├── tokenization-decisioning.ts │ ├── tokenizations.ts │ ├── top-level.ts │ ├── transactions.ts │ ├── transactions │ │ ├── enhanced-commercial-data.ts │ │ ├── events.ts │ │ ├── events │ │ │ ├── enhanced-commercial-data.ts │ │ │ ├── events.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ └── transactions.ts │ ├── transfers.ts │ └── webhooks.ts ├── shims │ ├── node.ts │ └── web.ts ├── uploads.ts └── version.ts ├── tests ├── api-resources │ ├── account-holders.test.ts │ ├── accounts.test.ts │ ├── aggregate-balances.test.ts │ ├── auth-rules │ │ └── v2 │ │ │ ├── backtests.test.ts │ │ │ └── v2.test.ts │ ├── auth-stream-enrollment.test.ts │ ├── balances.test.ts │ ├── book-transfers.test.ts │ ├── card-programs.test.ts │ ├── cards │ │ ├── aggregate-balances.test.ts │ │ ├── balances.test.ts │ │ ├── cards.test.ts │ │ └── financial-transactions.test.ts │ ├── credit-products │ │ ├── extended-credit.test.ts │ │ └── prime-rates.test.ts │ ├── digital-card-art.test.ts │ ├── disputes.test.ts │ ├── events │ │ ├── event-subscriptions.test.ts │ │ ├── events.test.ts │ │ └── subscriptions.test.ts │ ├── external-bank-accounts │ │ ├── external-bank-accounts.test.ts │ │ └── micro-deposits.test.ts │ ├── external-payments.test.ts │ ├── financial-accounts │ │ ├── balances.test.ts │ │ ├── credit-configuration.test.ts │ │ ├── financial-accounts.test.ts │ │ ├── financial-transactions.test.ts │ │ ├── loan-tapes.test.ts │ │ └── statements │ │ │ ├── line-items.test.ts │ │ │ └── statements.test.ts │ ├── fraud │ │ └── transactions.test.ts │ ├── funding-events.test.ts │ ├── management-operations.test.ts │ ├── payments.test.ts │ ├── reports │ │ └── settlement │ │ │ ├── network-totals.test.ts │ │ │ └── settlement.test.ts │ ├── responder-endpoints.test.ts │ ├── three-ds │ │ ├── authentication.test.ts │ │ └── decisioning.test.ts │ ├── tokenization-decisioning.test.ts │ ├── tokenizations.test.ts │ ├── top-level.test.ts │ ├── transactions │ │ ├── enhanced-commercial-data.test.ts │ │ ├── events │ │ │ └── enhanced-commercial-data.test.ts │ │ └── transactions.test.ts │ ├── transfers.test.ts │ └── webhooks.test.ts ├── form.test.ts ├── index.test.ts ├── qs │ ├── empty-keys-cases.ts │ ├── stringify.test.ts │ └── utils.test.ts ├── responses.test.ts ├── stringifyQuery.test.ts └── uploads.test.ts ├── tsc-multi.json ├── tsconfig.build.json ├── tsconfig.deno.json ├── tsconfig.dist-src.json ├── tsconfig.json └── yarn.lock /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/debian 3 | { 4 | "name": "Development", 5 | "image": "mcr.microsoft.com/devcontainers/typescript-node:latest", 6 | "features": { 7 | "ghcr.io/devcontainers/features/node:1": {} 8 | }, 9 | "postCreateCommand": "yarn install", 10 | "customizations": { 11 | "vscode": { 12 | "extensions": [ 13 | "esbenp.prettier-vscode" 14 | ] 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', 3 | plugins: ['@typescript-eslint', 'unused-imports', 'prettier'], 4 | rules: { 5 | 'no-unused-vars': 'off', 6 | 'prettier/prettier': 'error', 7 | 'unused-imports/no-unused-imports': 'error', 8 | }, 9 | root: true, 10 | }; 11 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches-ignore: 5 | - 'generated' 6 | - 'codegen/**' 7 | - 'integrated/**' 8 | - 'stl-preview-head/**' 9 | - 'stl-preview-base/**' 10 | pull_request: 11 | branches-ignore: 12 | - 'stl-preview-head/**' 13 | - 'stl-preview-base/**' 14 | 15 | jobs: 16 | lint: 17 | timeout-minutes: 10 18 | name: lint 19 | runs-on: ${{ github.repository == 'stainless-sdks/lithic-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} 20 | if: github.event_name == 'push' || github.event.pull_request.head.repo.fork 21 | steps: 22 | - uses: actions/checkout@v4 23 | 24 | - name: Set up Node 25 | uses: actions/setup-node@v4 26 | with: 27 | node-version: '18' 28 | 29 | - name: Bootstrap 30 | run: ./scripts/bootstrap 31 | 32 | - name: Check types 33 | run: ./scripts/lint 34 | 35 | build: 36 | timeout-minutes: 5 37 | name: build 38 | runs-on: ${{ github.repository == 'stainless-sdks/lithic-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} 39 | if: github.event_name == 'push' || github.event.pull_request.head.repo.fork 40 | permissions: 41 | contents: read 42 | id-token: write 43 | steps: 44 | - uses: actions/checkout@v4 45 | 46 | - name: Set up Node 47 | uses: actions/setup-node@v4 48 | with: 49 | node-version: '18' 50 | 51 | - name: Bootstrap 52 | run: ./scripts/bootstrap 53 | 54 | - name: Check build 55 | run: ./scripts/build 56 | 57 | - name: Get GitHub OIDC Token 58 | if: github.repository == 'stainless-sdks/lithic-node' 59 | id: github-oidc 60 | uses: actions/github-script@v6 61 | with: 62 | script: core.setOutput('github_token', await core.getIDToken()); 63 | 64 | - name: Upload tarball 65 | if: github.repository == 'stainless-sdks/lithic-node' 66 | env: 67 | URL: https://pkg.stainless.com/s 68 | AUTH: ${{ steps.github-oidc.outputs.github_token }} 69 | SHA: ${{ github.sha }} 70 | run: ./scripts/utils/upload-artifact.sh 71 | test: 72 | timeout-minutes: 10 73 | name: test 74 | runs-on: ${{ github.repository == 'stainless-sdks/lithic-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} 75 | if: github.event_name == 'push' || github.event.pull_request.head.repo.fork 76 | steps: 77 | - uses: actions/checkout@v4 78 | 79 | - name: Set up Node 80 | uses: actions/setup-node@v4 81 | with: 82 | node-version: '20' 83 | 84 | - name: Bootstrap 85 | run: ./scripts/bootstrap 86 | 87 | - name: Run tests 88 | run: ./scripts/test 89 | examples: 90 | timeout-minutes: 10 91 | name: examples 92 | runs-on: ${{ github.repository == 'stainless-sdks/lithic-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} 93 | if: github.repository == 'lithic-com/lithic-node' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) 94 | 95 | steps: 96 | - uses: actions/checkout@v4 97 | 98 | - name: Set up Node 99 | uses: actions/setup-node@v4 100 | with: 101 | node-version: '20' 102 | - name: Install dependencies 103 | run: | 104 | yarn install 105 | 106 | - env: 107 | LITHIC_API_KEY: ${{ secrets.LITHIC_API_KEY }} 108 | run: | 109 | yarn tsn ./examples/transactions.ts 110 | -------------------------------------------------------------------------------- /.github/workflows/publish-npm.yml: -------------------------------------------------------------------------------- 1 | # This workflow is triggered when a GitHub release is created. 2 | # It can also be run manually to re-publish to NPM in case it failed for some reason. 3 | # You can run this workflow by navigating to https://www.github.com/lithic-com/lithic-node/actions/workflows/publish-npm.yml 4 | name: Publish NPM 5 | on: 6 | workflow_dispatch: 7 | 8 | release: 9 | types: [published] 10 | 11 | jobs: 12 | publish: 13 | name: publish 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - name: Set up Node 20 | uses: actions/setup-node@v3 21 | with: 22 | node-version: '20' 23 | 24 | - name: Install dependencies 25 | run: | 26 | yarn install 27 | 28 | - name: Publish to NPM 29 | run: | 30 | bash ./bin/publish-npm 31 | env: 32 | NPM_TOKEN: ${{ secrets.LITHIC_NPM_TOKEN || secrets.NPM_TOKEN }} 33 | -------------------------------------------------------------------------------- /.github/workflows/release-doctor.yml: -------------------------------------------------------------------------------- 1 | name: Release Doctor 2 | on: 3 | pull_request: 4 | branches: 5 | - main 6 | workflow_dispatch: 7 | 8 | jobs: 9 | release_doctor: 10 | name: release doctor 11 | runs-on: ubuntu-latest 12 | if: github.repository == 'lithic-com/lithic-node' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') 13 | 14 | steps: 15 | - uses: actions/checkout@v4 16 | 17 | - name: Check release environment 18 | run: | 19 | bash ./bin/check-release-environment 20 | env: 21 | NPM_TOKEN: ${{ secrets.LITHIC_NPM_TOKEN || secrets.NPM_TOKEN }} 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .prism.log 2 | node_modules 3 | yarn-error.log 4 | codegen.log 5 | Brewfile.lock.json 6 | dist 7 | dist-deno 8 | /*.tgz 9 | .idea/ 10 | 11 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | CHANGELOG.md 2 | /ecosystem-tests/*/** 3 | /node_modules 4 | /deno 5 | 6 | # don't format tsc output, will break source maps 7 | /dist 8 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "always", 3 | "experimentalTernaries": true, 4 | "printWidth": 110, 5 | "singleQuote": true, 6 | "trailingComma": "all" 7 | } 8 | -------------------------------------------------------------------------------- /.release-please-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | ".": "0.109.0" 3 | } 4 | -------------------------------------------------------------------------------- /.stats.yml: -------------------------------------------------------------------------------- 1 | configured_endpoints: 165 2 | openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-1aaf1d9d9aea1bfa14a48559f01d539aa1449d65f252dc9c3b606c7bca300af1.yml 3 | openapi_spec_hash: 3327246caf3bcbd3504ce99c81062075 4 | config_hash: a5d12cd64a37624cbe350cd7b2380693 5 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | brew "node" 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Setting up the environment 2 | 3 | This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install). 4 | Other package managers may work but are not officially supported for development. 5 | 6 | To set up the repository, run: 7 | 8 | ```sh 9 | $ yarn 10 | $ yarn build 11 | ``` 12 | 13 | This will install all the required dependencies and build output files to `dist/`. 14 | 15 | ## Modifying/Adding code 16 | 17 | Most of the SDK is generated code. Modifications to code will be persisted between generations, but may 18 | result in merge conflicts between manual patches and changes from the generator. The generator will never 19 | modify the contents of the `src/lib/` and `examples/` directories. 20 | 21 | ## Adding and running examples 22 | 23 | All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. 24 | 25 | ```ts 26 | // add an example to examples/.ts 27 | 28 | #!/usr/bin/env -S npm run tsn -T 29 | … 30 | ``` 31 | 32 | ```sh 33 | $ chmod +x examples/.ts 34 | # run the example against your api 35 | $ yarn tsn -T examples/.ts 36 | ``` 37 | 38 | ## Using the repository from source 39 | 40 | If you’d like to use the repository from source, you can either install from git or link to a cloned repository: 41 | 42 | To install via git: 43 | 44 | ```sh 45 | $ npm install git+ssh://git@github.com:lithic-com/lithic-node.git 46 | ``` 47 | 48 | Alternatively, to link a local copy of the repo: 49 | 50 | ```sh 51 | # Clone 52 | $ git clone https://www.github.com/lithic-com/lithic-node 53 | $ cd lithic-node 54 | 55 | # With yarn 56 | $ yarn link 57 | $ cd ../my-package 58 | $ yarn link lithic 59 | 60 | # With pnpm 61 | $ pnpm link --global 62 | $ cd ../my-package 63 | $ pnpm link -—global lithic 64 | ``` 65 | 66 | ## Running tests 67 | 68 | Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. 69 | 70 | ```sh 71 | $ npx prism mock path/to/your/openapi.yml 72 | ``` 73 | 74 | ```sh 75 | $ yarn run test 76 | ``` 77 | 78 | ## Linting and formatting 79 | 80 | This repository uses [prettier](https://www.npmjs.com/package/prettier) and 81 | [eslint](https://www.npmjs.com/package/eslint) to format the code in the repository. 82 | 83 | To lint: 84 | 85 | ```sh 86 | $ yarn lint 87 | ``` 88 | 89 | To format and fix all lint issues automatically: 90 | 91 | ```sh 92 | $ yarn fix 93 | ``` 94 | 95 | ## Publishing and releases 96 | 97 | Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If 98 | the changes aren't made through the automated pipeline, you may want to make releases manually. 99 | 100 | ### Publish with a GitHub workflow 101 | 102 | You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/lithic-com/lithic-node/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up. 103 | 104 | ### Publish manually 105 | 106 | If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on 107 | the environment. 108 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting Security Issues 4 | 5 | This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. 6 | 7 | To report a security issue, please contact the Stainless team at security@stainless.com. 8 | 9 | ## Responsible Disclosure 10 | 11 | We appreciate the efforts of security researchers and individuals who help us maintain the security of 12 | SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible 13 | disclosure practices by allowing us a reasonable amount of time to investigate and address the issue 14 | before making any information public. 15 | 16 | ## Reporting Non-SDK Related Security Issues 17 | 18 | If you encounter security issues that are not directly related to SDKs but pertain to the services 19 | or products provided by Lithic, please follow the respective company's security reporting guidelines. 20 | 21 | ### Lithic Terms and Policies 22 | 23 | Please contact sdk-feedback@lithic.com for any questions or concerns regarding the security of our services. 24 | 25 | --- 26 | 27 | Thank you for helping us keep the SDKs and systems they interact with secure. 28 | -------------------------------------------------------------------------------- /bin/check-release-environment: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | errors=() 4 | 5 | if [ -z "${NPM_TOKEN}" ]; then 6 | errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") 7 | fi 8 | 9 | lenErrors=${#errors[@]} 10 | 11 | if [[ lenErrors -gt 0 ]]; then 12 | echo -e "Found the following errors in the release environment:\n" 13 | 14 | for error in "${errors[@]}"; do 15 | echo -e "- $error\n" 16 | done 17 | 18 | exit 1 19 | fi 20 | 21 | echo "The environment is ready to push releases!" 22 | -------------------------------------------------------------------------------- /bin/publish-npm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eux 4 | 5 | npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN" 6 | 7 | yarn build 8 | cd dist 9 | 10 | # Get package name and version from package.json 11 | PACKAGE_NAME="$(jq -r -e '.name' ./package.json)" 12 | VERSION="$(jq -r -e '.version' ./package.json)" 13 | 14 | # Get latest version from npm 15 | # 16 | # If the package doesn't exist, npm will return: 17 | # { 18 | # "error": { 19 | # "code": "E404", 20 | # "summary": "Unpublished on 2025-06-05T09:54:53.528Z", 21 | # "detail": "'the_package' is not in this registry..." 22 | # } 23 | # } 24 | NPM_INFO="$(npm view "$PACKAGE_NAME" version --json 2>/dev/null || true)" 25 | 26 | # Check if we got an E404 error 27 | if echo "$NPM_INFO" | jq -e '.error.code == "E404"' > /dev/null 2>&1; then 28 | # Package doesn't exist yet, no last version 29 | LAST_VERSION="" 30 | elif echo "$NPM_INFO" | jq -e '.error' > /dev/null 2>&1; then 31 | # Report other errors 32 | echo "ERROR: npm returned unexpected data:" 33 | echo "$NPM_INFO" 34 | exit 1 35 | else 36 | # Success - get the version 37 | LAST_VERSION=$(echo "$NPM_INFO" | jq -r '.') # strip quotes 38 | fi 39 | 40 | # Check if current version is pre-release (e.g. alpha / beta / rc) 41 | CURRENT_IS_PRERELEASE=false 42 | if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then 43 | CURRENT_IS_PRERELEASE=true 44 | CURRENT_TAG="${BASH_REMATCH[1]}" 45 | fi 46 | 47 | # Check if last version is a stable release 48 | LAST_IS_STABLE_RELEASE=true 49 | if [[ -z "$LAST_VERSION" || "$LAST_VERSION" =~ -([a-zA-Z]+) ]]; then 50 | LAST_IS_STABLE_RELEASE=false 51 | fi 52 | 53 | # Use a corresponding alpha/beta tag if there already is a stable release and we're publishing a prerelease. 54 | if $CURRENT_IS_PRERELEASE && $LAST_IS_STABLE_RELEASE; then 55 | TAG="$CURRENT_TAG" 56 | else 57 | TAG="latest" 58 | fi 59 | 60 | # Publish with the appropriate tag 61 | yarn publish --access public --tag "$TAG" 62 | -------------------------------------------------------------------------------- /examples/.keep: -------------------------------------------------------------------------------- 1 | File generated from our OpenAPI spec by Stainless. 2 | 3 | This directory can be used to store example files demonstrating usage of this SDK. 4 | It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. 5 | -------------------------------------------------------------------------------- /examples/dispute_evidence.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /examples/transactions.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S npm run tsn -T 2 | 3 | // 4 | // Run with: LITHIC_API_KEY= ./examples/transactions.ts 5 | // 6 | 7 | import assert from 'assert'; 8 | import Lithic from '../src'; 9 | 10 | const client = new Lithic({ 11 | environment: 'sandbox', 12 | }); 13 | 14 | // Sleep function to add delays to simulate more realistic interactions with the sandbox API 15 | function sleep(ms: number) { 16 | console.log(`Waiting ${ms}ms`); 17 | return new Promise((resolve) => setTimeout(resolve, ms)); 18 | } 19 | 20 | async function simulateAuthDeclined(card: Lithic.Cards.Card) { 21 | console.log('Simulate a transaction declined...'); 22 | 23 | const authResponse = await client.transactions.simulateAuthorization({ 24 | pan: card.pan!, 25 | amount: 999999999999, 26 | descriptor: 'coffee shop', 27 | }); 28 | 29 | await sleep(5000); 30 | 31 | const transaction = await client.transactions.retrieve(authResponse.token!); 32 | assert.strictEqual(transaction.result, 'DECLINED', 'Authorization was not declined'); 33 | 34 | console.log('Done'); 35 | } 36 | 37 | async function simulateAuthClearing(card: Lithic.Cards.Card) { 38 | console.log('Simulate a transaction clearing...'); 39 | 40 | const authResponse = await client.transactions.simulateAuthorization({ 41 | pan: card.pan!, 42 | amount: 50, 43 | descriptor: 'coffee shop', 44 | }); 45 | 46 | await sleep(5000); 47 | 48 | await client.transactions.simulateClearing({ 49 | token: authResponse.token!, 50 | }); 51 | 52 | await sleep(5000); 53 | 54 | const transaction = await client.transactions.retrieve(authResponse.token!); 55 | 56 | assert.strictEqual(transaction.status, 'SETTLED', 'Transaction was not settled'); 57 | 58 | console.log('Done'); 59 | } 60 | 61 | async function simulatePaginatedTransaction(card: Lithic.Cards.Card) { 62 | console.log('Simulate a paginated transaction...'); 63 | 64 | const firstPage = await client.transactions.list({ 65 | card_token: card.token, 66 | account_token: card.account_token, 67 | }); 68 | 69 | const countItemsInFirstPage = firstPage.data.length; 70 | if (countItemsInFirstPage > 1) { 71 | const secondPage = await client.transactions.list({ 72 | card_token: card.token, 73 | account_token: card.account_token, 74 | starting_after: firstPage.data[0]!.token, 75 | }); 76 | 77 | assert.strictEqual(firstPage.data[1]!.token, secondPage.data[0]!.token); 78 | } 79 | 80 | console.log('Done'); 81 | } 82 | 83 | async function main() { 84 | const card = await client.cards.create({ type: 'VIRTUAL' }); 85 | console.log(`Created new card with token '${card.token}'`); 86 | 87 | await sleep(2000); 88 | 89 | await simulateAuthDeclined(card); 90 | await simulateAuthClearing(card); 91 | await simulatePaginatedTransaction(card); 92 | } 93 | 94 | main().catch((error) => { 95 | console.error(error); 96 | process.exit(1); 97 | }); 98 | -------------------------------------------------------------------------------- /examples/upload_evidence.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S npm run tsn -T 2 | 3 | // 4 | // Run with: LITHIC_API_KEY= ./examples/upload_evidence.ts 5 | // 6 | 7 | import fs from 'fs'; 8 | import assert from 'assert'; 9 | import Lithic from '../src'; 10 | 11 | const lithic = new Lithic({ environment: 'sandbox' }); 12 | 13 | async function main() { 14 | const transactionsPage = await lithic.transactions.list(); 15 | if (transactionsPage.data.length === 0) { 16 | console.log('No transactions found'); 17 | return; 18 | } 19 | 20 | const transaction = transactionsPage.data[0]!; 21 | assert(transaction.token, 'Transaction must have a token'); 22 | 23 | const disputesPage = await lithic.disputes.list(); 24 | 25 | let dispute = disputesPage.data[0]; 26 | if (!dispute) { 27 | dispute = await lithic.disputes.create({ 28 | amount: 42, 29 | reason: 'ATM_CASH_MISDISPENSE', 30 | transaction_token: transaction.token!, 31 | }); 32 | } 33 | 34 | assert(dispute, 'Could not find or create a dispute'); 35 | 36 | const file = fs.createReadStream('examples/dispute_evidence.txt'); 37 | const upload = await lithic.disputes.uploadEvidence(dispute.token, file); 38 | console.log(upload); 39 | 40 | console.log('Done!'); 41 | } 42 | 43 | main().catch((err) => { 44 | console.error(err); 45 | process.exit(1); 46 | }); 47 | -------------------------------------------------------------------------------- /integrations/pagination.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S yarn tsn 2 | 3 | import Lithic from 'lithic'; 4 | 5 | const lithic = new Lithic({ environment: 'sandbox' }); 6 | 7 | async function main() { 8 | const transactionsPage = await lithic.transactions.list(); 9 | if (!transactionsPage.data.length) { 10 | throw new Error('Expected multiple transactions to be present'); 11 | } 12 | 13 | if (!transactionsPage.has_more || !transactionsPage.hasNextPage()) { 14 | throw new Error(`Expected multiple pages to be present, only got ${transactionsPage.data.length} items`); 15 | } 16 | 17 | const tokens: Record = {}; 18 | 19 | for await (const transaction of transactionsPage) { 20 | const existing = tokens[transaction.token]; 21 | tokens[transaction.token] = typeof existing === 'undefined' ? 1 : existing + 1; 22 | } 23 | 24 | const duplicates = Object.entries(tokens).filter(([_, count]) => count > 1); 25 | if (duplicates.length) { 26 | console.error(Object.fromEntries(duplicates)); 27 | throw new Error(`Found ${duplicates.length} duplicate entries!`); 28 | } 29 | 30 | console.log('Success!'); 31 | } 32 | 33 | main(); 34 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | moduleNameMapper: { 7 | '^lithic$': '/src/index.ts', 8 | '^lithic/_shims/auto/(.*)$': '/src/_shims/auto/$1-node', 9 | '^lithic/(.*)$': '/src/$1', 10 | }, 11 | modulePathIgnorePatterns: [ 12 | '/ecosystem-tests/', 13 | '/dist/', 14 | '/deno/', 15 | '/deno_tests/', 16 | ], 17 | testPathIgnorePatterns: ['scripts'], 18 | }; 19 | 20 | export default config; 21 | -------------------------------------------------------------------------------- /release-please-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": { 3 | ".": {} 4 | }, 5 | "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", 6 | "include-v-in-tag": true, 7 | "include-component-in-tag": false, 8 | "versioning": "prerelease", 9 | "prerelease": true, 10 | "bump-minor-pre-major": true, 11 | "bump-patch-for-minor-pre-major": false, 12 | "pull-request-header": "Automated Release PR", 13 | "pull-request-title-pattern": "release: ${version}", 14 | "changelog-sections": [ 15 | { 16 | "type": "feat", 17 | "section": "Features" 18 | }, 19 | { 20 | "type": "fix", 21 | "section": "Bug Fixes" 22 | }, 23 | { 24 | "type": "perf", 25 | "section": "Performance Improvements" 26 | }, 27 | { 28 | "type": "revert", 29 | "section": "Reverts" 30 | }, 31 | { 32 | "type": "chore", 33 | "section": "Chores" 34 | }, 35 | { 36 | "type": "docs", 37 | "section": "Documentation" 38 | }, 39 | { 40 | "type": "style", 41 | "section": "Styles" 42 | }, 43 | { 44 | "type": "refactor", 45 | "section": "Refactors" 46 | }, 47 | { 48 | "type": "test", 49 | "section": "Tests", 50 | "hidden": true 51 | }, 52 | { 53 | "type": "build", 54 | "section": "Build System" 55 | }, 56 | { 57 | "type": "ci", 58 | "section": "Continuous Integration", 59 | "hidden": true 60 | } 61 | ], 62 | "release-type": "node", 63 | "extra-files": ["src/version.ts", "README.md"] 64 | } 65 | -------------------------------------------------------------------------------- /scripts/bootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then 8 | brew bundle check >/dev/null 2>&1 || { 9 | echo "==> Installing Homebrew dependencies…" 10 | brew bundle 11 | } 12 | fi 13 | 14 | echo "==> Installing Node dependencies…" 15 | 16 | PACKAGE_MANAGER=$(command -v yarn >/dev/null 2>&1 && echo "yarn" || echo "npm") 17 | 18 | $PACKAGE_MANAGER install 19 | -------------------------------------------------------------------------------- /scripts/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -exuo pipefail 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | node scripts/utils/check-version.cjs 8 | 9 | # Build into dist and will publish the package from there, 10 | # so that src/resources/foo.ts becomes /resources/foo.js 11 | # This way importing from `"lithic/resources/foo"` works 12 | # even with `"moduleResolution": "node"` 13 | 14 | rm -rf dist; mkdir dist 15 | # Copy src to dist/src and build from dist/src into dist, so that 16 | # the source map for index.js.map will refer to ./src/index.ts etc 17 | cp -rp src README.md dist 18 | rm dist/src/_shims/*-deno.ts dist/src/_shims/auto/*-deno.ts 19 | for file in LICENSE CHANGELOG.md; do 20 | if [ -e "${file}" ]; then cp "${file}" dist; fi 21 | done 22 | if [ -e "bin/cli" ]; then 23 | mkdir dist/bin 24 | cp -p "bin/cli" dist/bin/; 25 | fi 26 | # this converts the export map paths for the dist directory 27 | # and does a few other minor things 28 | node scripts/utils/make-dist-package-json.cjs > dist/package.json 29 | 30 | # build to .js/.mjs/.d.ts files 31 | ./node_modules/.bin/tsc-multi 32 | # copy over handwritten .js/.mjs/.d.ts files 33 | cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims 34 | cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto 35 | # we need to add exports = module.exports = Lithic to index.js; 36 | # No way to get that from index.ts because it would cause compile errors 37 | # when building .mjs 38 | node scripts/utils/fix-index-exports.cjs 39 | # with "moduleResolution": "nodenext", if ESM resolves to index.d.ts, 40 | # it'll have TS errors on the default import. But if it resolves to 41 | # index.d.mts the default import will work (even though both files have 42 | # the same export default statement) 43 | cp dist/index.d.ts dist/index.d.mts 44 | cp tsconfig.dist-src.json dist/src/tsconfig.json 45 | 46 | node scripts/utils/postprocess-files.cjs 47 | 48 | # make sure that nothing crashes when we require the output CJS or 49 | # import the output ESM 50 | (cd dist && node -e 'require("lithic")') 51 | (cd dist && node -e 'import("lithic")' --input-type=module) 52 | 53 | if [ -e ./scripts/build-deno ] 54 | then 55 | ./scripts/build-deno 56 | fi 57 | -------------------------------------------------------------------------------- /scripts/format: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | echo "==> Running eslint --fix" 8 | ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --fix --ext ts,js . 9 | -------------------------------------------------------------------------------- /scripts/lint: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | echo "==> Running eslint" 8 | ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js . 9 | 10 | echo "==> Running tsc" 11 | ./node_modules/.bin/tsc --noEmit 12 | -------------------------------------------------------------------------------- /scripts/mock: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | if [[ -n "$1" && "$1" != '--'* ]]; then 8 | URL="$1" 9 | shift 10 | else 11 | URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" 12 | fi 13 | 14 | # Check if the URL is empty 15 | if [ -z "$URL" ]; then 16 | echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" 17 | exit 1 18 | fi 19 | 20 | echo "==> Starting mock server with URL ${URL}" 21 | 22 | # Run prism mock on the given spec 23 | if [ "$1" == "--daemon" ]; then 24 | npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & 25 | 26 | # Wait for server to come online 27 | echo -n "Waiting for server" 28 | while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do 29 | echo -n "." 30 | sleep 0.1 31 | done 32 | 33 | if grep -q "✖ fatal" ".prism.log"; then 34 | cat .prism.log 35 | exit 1 36 | fi 37 | 38 | echo 39 | else 40 | npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" 41 | fi 42 | -------------------------------------------------------------------------------- /scripts/test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | RED='\033[0;31m' 8 | GREEN='\033[0;32m' 9 | YELLOW='\033[0;33m' 10 | NC='\033[0m' # No Color 11 | 12 | function prism_is_running() { 13 | curl --silent "http://localhost:4010" >/dev/null 2>&1 14 | } 15 | 16 | kill_server_on_port() { 17 | pids=$(lsof -t -i tcp:"$1" || echo "") 18 | if [ "$pids" != "" ]; then 19 | kill "$pids" 20 | echo "Stopped $pids." 21 | fi 22 | } 23 | 24 | function is_overriding_api_base_url() { 25 | [ -n "$TEST_API_BASE_URL" ] 26 | } 27 | 28 | if ! is_overriding_api_base_url && ! prism_is_running ; then 29 | # When we exit this script, make sure to kill the background mock server process 30 | trap 'kill_server_on_port 4010' EXIT 31 | 32 | # Start the dev server 33 | ./scripts/mock --daemon 34 | fi 35 | 36 | if is_overriding_api_base_url ; then 37 | echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" 38 | echo 39 | elif ! prism_is_running ; then 40 | echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" 41 | echo -e "running against your OpenAPI spec." 42 | echo 43 | echo -e "To run the server, pass in the path or url of your OpenAPI" 44 | echo -e "spec to the prism command:" 45 | echo 46 | echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" 47 | echo 48 | 49 | exit 1 50 | else 51 | echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" 52 | echo 53 | fi 54 | 55 | echo "==> Running tests" 56 | ./node_modules/.bin/jest "$@" 57 | -------------------------------------------------------------------------------- /scripts/utils/check-is-in-git-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Check if you happen to call prepare for a repository that's already in node_modules. 3 | [ "$(basename "$(dirname "$PWD")")" = 'node_modules' ] || 4 | # The name of the containing directory that 'npm` uses, which looks like 5 | # $HOME/.npm/_cacache/git-cloneXXXXXX 6 | [ "$(basename "$(dirname "$PWD")")" = 'tmp' ] || 7 | # The name of the containing directory that 'yarn` uses, which looks like 8 | # $(yarn cache dir)/.tmp/XXXXX 9 | [ "$(basename "$(dirname "$PWD")")" = '.tmp' ] 10 | -------------------------------------------------------------------------------- /scripts/utils/check-version.cjs: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | const main = () => { 5 | const pkg = require('../../package.json'); 6 | const version = pkg['version']; 7 | if (!version) throw 'The version property is not set in the package.json file'; 8 | if (typeof version !== 'string') { 9 | throw `Unexpected type for the package.json version field; got ${typeof version}, expected string`; 10 | } 11 | 12 | const versionFile = path.resolve(__dirname, '..', '..', 'src', 'version.ts'); 13 | const contents = fs.readFileSync(versionFile, 'utf8'); 14 | const output = contents.replace(/(export const VERSION = ')(.*)(')/g, `$1${version}$3`); 15 | fs.writeFileSync(versionFile, output); 16 | }; 17 | 18 | if (require.main === module) { 19 | main(); 20 | } 21 | -------------------------------------------------------------------------------- /scripts/utils/fix-index-exports.cjs: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | const indexJs = 5 | process.env['DIST_PATH'] ? 6 | path.resolve(process.env['DIST_PATH'], 'index.js') 7 | : path.resolve(__dirname, '..', '..', 'dist', 'index.js'); 8 | 9 | let before = fs.readFileSync(indexJs, 'utf8'); 10 | let after = before.replace( 11 | /^\s*exports\.default\s*=\s*(\w+)/m, 12 | 'exports = module.exports = $1;\nexports.default = $1', 13 | ); 14 | fs.writeFileSync(indexJs, after, 'utf8'); 15 | -------------------------------------------------------------------------------- /scripts/utils/git-swap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -exuo pipefail 3 | # the package is published to NPM from ./dist 4 | # we want the final file structure for git installs to match the npm installs, so we 5 | 6 | # delete everything except ./dist and ./node_modules 7 | find . -maxdepth 1 -mindepth 1 ! -name 'dist' ! -name 'node_modules' -exec rm -rf '{}' + 8 | 9 | # move everything from ./dist to . 10 | mv dist/* . 11 | 12 | # delete the now-empty ./dist 13 | rmdir dist 14 | -------------------------------------------------------------------------------- /scripts/utils/make-dist-package-json.cjs: -------------------------------------------------------------------------------- 1 | const pkgJson = require(process.env['PKG_JSON_PATH'] || '../../package.json'); 2 | 3 | function processExportMap(m) { 4 | for (const key in m) { 5 | const value = m[key]; 6 | if (typeof value === 'string') m[key] = value.replace(/^\.\/dist\//, './'); 7 | else processExportMap(value); 8 | } 9 | } 10 | processExportMap(pkgJson.exports); 11 | 12 | for (const key of ['types', 'main', 'module']) { 13 | if (typeof pkgJson[key] === 'string') pkgJson[key] = pkgJson[key].replace(/^(\.\/)?dist\//, './'); 14 | } 15 | 16 | delete pkgJson.devDependencies; 17 | delete pkgJson.scripts.prepack; 18 | delete pkgJson.scripts.prepublishOnly; 19 | delete pkgJson.scripts.prepare; 20 | 21 | console.log(JSON.stringify(pkgJson, null, 2)); 22 | -------------------------------------------------------------------------------- /scripts/utils/upload-artifact.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -exuo pipefail 3 | 4 | RESPONSE=$(curl -X POST "$URL" \ 5 | -H "Authorization: Bearer $AUTH" \ 6 | -H "Content-Type: application/json") 7 | 8 | SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') 9 | 10 | if [[ "$SIGNED_URL" == "null" ]]; then 11 | echo -e "\033[31mFailed to get signed URL.\033[0m" 12 | exit 1 13 | fi 14 | 15 | UPLOAD_RESPONSE=$(tar -cz dist | curl -v -X PUT \ 16 | -H "Content-Type: application/gzip" \ 17 | --data-binary @- "$SIGNED_URL" 2>&1) 18 | 19 | if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then 20 | echo -e "\033[32mUploaded build to Stainless storage.\033[0m" 21 | echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/lithic-node/$SHA'\033[0m" 22 | else 23 | echo -e "\033[31mFailed to upload artifact.\033[0m" 24 | exit 1 25 | fi 26 | -------------------------------------------------------------------------------- /src/_shims/MultipartBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export class MultipartBody { 5 | constructor(public body: any) {} 6 | get [Symbol.toStringTag](): string { 7 | return 'MultipartBody'; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/_shims/README.md: -------------------------------------------------------------------------------- 1 | # 👋 Wondering what everything in here does? 2 | 3 | `lithic` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various 4 | edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM). 5 | 6 | To do this, `lithic` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node. 7 | 8 | It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to 9 | automatically select the correct shims for each environment. However, conditional exports are a fairly new 10 | feature and not supported everywhere. For instance, the TypeScript `"moduleResolution": "node"` 11 | 12 | setting doesn't consult the `exports` map, compared to `"moduleResolution": "nodeNext"`, which does. 13 | Unfortunately that's still the default setting, and it can result in errors like 14 | getting the wrong raw `Response` type from `.asResponse()`, for example. 15 | 16 | The user can work around these issues by manually importing one of: 17 | 18 | - `import 'lithic/shims/node'` 19 | - `import 'lithic/shims/web'` 20 | 21 | All of the code here in `_shims` handles selecting the automatic default shims or manual overrides. 22 | 23 | ### How it works - Runtime 24 | 25 | Runtime shims get installed by calling `setShims` exported by `lithic/_shims/registry`. 26 | 27 | Manually importing `lithic/shims/node` or `lithic/shims/web`, calls `setShims` with the respective runtime shims. 28 | 29 | All client code imports shims from `lithic/_shims/index`, which: 30 | 31 | - checks if shims have been set manually 32 | - if not, calls `setShims` with the shims from `lithic/_shims/auto/runtime` 33 | - re-exports the installed shims from `lithic/_shims/registry`. 34 | 35 | `lithic/_shims/auto/runtime` exports web runtime shims. 36 | If the `node` export condition is set, the export map replaces it with `lithic/_shims/auto/runtime-node`. 37 | 38 | ### How it works - Type time 39 | 40 | All client code imports shim types from `lithic/_shims/index`, which selects the manual types from `lithic/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `lithic/_shims/auto/types`. 41 | 42 | `lithic/_shims/manual-types` exports an empty namespace. 43 | Manually importing `lithic/shims/node` or `lithic/shims/web` merges declarations into this empty namespace, so they get picked up by `lithic/_shims/index`. 44 | 45 | `lithic/_shims/auto/types` exports web type definitions. 46 | If the `node` export condition is set, the export map replaces it with `lithic/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`. 47 | -------------------------------------------------------------------------------- /src/_shims/auto/runtime-bun.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../bun-runtime'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/runtime-deno.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../web-runtime'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/runtime-node.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../node-runtime'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/runtime.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../web-runtime'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/types-deno.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../web-types'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/types-node.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../node-types'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/types.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export type Agent = any; 5 | 6 | // @ts-ignore 7 | declare const _fetch: unknown extends typeof fetch ? never : typeof fetch; 8 | export { _fetch as fetch }; 9 | 10 | // @ts-ignore 11 | type _Request = unknown extends Request ? never : Request; 12 | export { _Request as Request }; 13 | 14 | // @ts-ignore 15 | type _RequestInfo = unknown extends RequestInfo ? never : RequestInfo; 16 | export { type _RequestInfo as RequestInfo }; 17 | 18 | // @ts-ignore 19 | type _RequestInit = unknown extends RequestInit ? never : RequestInit; 20 | export { type _RequestInit as RequestInit }; 21 | 22 | // @ts-ignore 23 | type _Response = unknown extends Response ? never : Response; 24 | export { _Response as Response }; 25 | 26 | // @ts-ignore 27 | type _ResponseInit = unknown extends ResponseInit ? never : ResponseInit; 28 | export { type _ResponseInit as ResponseInit }; 29 | 30 | // @ts-ignore 31 | type _ResponseType = unknown extends ResponseType ? never : ResponseType; 32 | export { type _ResponseType as ResponseType }; 33 | 34 | // @ts-ignore 35 | type _BodyInit = unknown extends BodyInit ? never : BodyInit; 36 | export { type _BodyInit as BodyInit }; 37 | 38 | // @ts-ignore 39 | type _Headers = unknown extends Headers ? never : Headers; 40 | export { _Headers as Headers }; 41 | 42 | // @ts-ignore 43 | type _HeadersInit = unknown extends HeadersInit ? never : HeadersInit; 44 | export { type _HeadersInit as HeadersInit }; 45 | 46 | type EndingType = 'native' | 'transparent'; 47 | 48 | export interface BlobPropertyBag { 49 | endings?: EndingType; 50 | type?: string; 51 | } 52 | 53 | export interface FilePropertyBag extends BlobPropertyBag { 54 | lastModified?: number; 55 | } 56 | 57 | export type FileFromPathOptions = Omit; 58 | 59 | // @ts-ignore 60 | type _FormData = unknown extends FormData ? never : FormData; 61 | // @ts-ignore 62 | declare const _FormData: unknown extends typeof FormData ? never : typeof FormData; 63 | export { _FormData as FormData }; 64 | 65 | // @ts-ignore 66 | type _File = unknown extends File ? never : File; 67 | // @ts-ignore 68 | declare const _File: unknown extends typeof File ? never : typeof File; 69 | export { _File as File }; 70 | 71 | // @ts-ignore 72 | type _Blob = unknown extends Blob ? never : Blob; 73 | // @ts-ignore 74 | declare const _Blob: unknown extends typeof Blob ? never : typeof Blob; 75 | export { _Blob as Blob }; 76 | 77 | export declare class Readable { 78 | readable: boolean; 79 | readonly readableEnded: boolean; 80 | readonly readableFlowing: boolean | null; 81 | readonly readableHighWaterMark: number; 82 | readonly readableLength: number; 83 | readonly readableObjectMode: boolean; 84 | destroyed: boolean; 85 | read(size?: number): any; 86 | pause(): this; 87 | resume(): this; 88 | isPaused(): boolean; 89 | destroy(error?: Error): this; 90 | [Symbol.asyncIterator](): AsyncIterableIterator; 91 | } 92 | 93 | export declare class FsReadStream extends Readable { 94 | path: {}; // node type is string | Buffer 95 | } 96 | 97 | // @ts-ignore 98 | type _ReadableStream = unknown extends ReadableStream ? never : ReadableStream; 99 | // @ts-ignore 100 | declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream; 101 | export { _ReadableStream as ReadableStream }; 102 | -------------------------------------------------------------------------------- /src/_shims/auto/types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/auto/types.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/bun-runtime.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | import { type Shims } from './registry'; 5 | import { getRuntime as getWebRuntime } from './web-runtime'; 6 | import { ReadStream as FsReadStream } from 'node:fs'; 7 | 8 | export function getRuntime(): Shims { 9 | const runtime = getWebRuntime(); 10 | function isFsReadStream(value: any): value is FsReadStream { 11 | return value instanceof FsReadStream; 12 | } 13 | return { ...runtime, isFsReadStream }; 14 | } 15 | -------------------------------------------------------------------------------- /src/_shims/index-deno.ts: -------------------------------------------------------------------------------- 1 | import { MultipartBody } from './MultipartBody'; 2 | import { type RequestOptions } from '../core'; 3 | 4 | export const kind: string = 'web'; 5 | 6 | export type Agent = any; 7 | 8 | const _fetch = fetch; 9 | type _fetch = typeof fetch; 10 | export { _fetch as fetch }; 11 | 12 | const _Request = Request; 13 | type _Request = Request; 14 | export { _Request as Request }; 15 | 16 | type _RequestInfo = RequestInfo; 17 | export { type _RequestInfo as RequestInfo }; 18 | 19 | type _RequestInit = RequestInit; 20 | export { type _RequestInit as RequestInit }; 21 | 22 | const _Response = Response; 23 | type _Response = Response; 24 | export { _Response as Response }; 25 | 26 | type _ResponseInit = ResponseInit; 27 | export { type _ResponseInit as ResponseInit }; 28 | 29 | type _ResponseType = ResponseType; 30 | export { type _ResponseType as ResponseType }; 31 | 32 | type _BodyInit = BodyInit; 33 | export { type _BodyInit as BodyInit }; 34 | 35 | const _Headers = Headers; 36 | type _Headers = Headers; 37 | export { _Headers as Headers }; 38 | 39 | type _HeadersInit = HeadersInit; 40 | export { type _HeadersInit as HeadersInit }; 41 | 42 | type EndingType = 'native' | 'transparent'; 43 | 44 | export interface BlobPropertyBag { 45 | endings?: EndingType; 46 | type?: string; 47 | } 48 | 49 | export interface FilePropertyBag extends BlobPropertyBag { 50 | lastModified?: number; 51 | } 52 | 53 | export type FileFromPathOptions = Omit; 54 | 55 | const _FormData = FormData; 56 | type _FormData = FormData; 57 | export { _FormData as FormData }; 58 | 59 | const _File = File; 60 | type _File = File; 61 | export { _File as File }; 62 | 63 | const _Blob = Blob; 64 | type _Blob = Blob; 65 | export { _Blob as Blob }; 66 | 67 | export async function getMultipartRequestOptions>( 68 | form: FormData, 69 | opts: RequestOptions, 70 | ): Promise> { 71 | return { 72 | ...opts, 73 | body: new MultipartBody(form) as any, 74 | }; 75 | } 76 | 77 | export function getDefaultAgent(url: string) { 78 | return undefined; 79 | } 80 | export function fileFromPath() { 81 | throw new Error( 82 | 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/lithic-com/lithic-node#file-uploads', 83 | ); 84 | } 85 | 86 | export const isFsReadStream = (value: any) => false; 87 | 88 | export declare class Readable { 89 | readable: boolean; 90 | readonly readableEnded: boolean; 91 | readonly readableFlowing: boolean | null; 92 | readonly readableHighWaterMark: number; 93 | readonly readableLength: number; 94 | readonly readableObjectMode: boolean; 95 | destroyed: boolean; 96 | read(size?: number): any; 97 | pause(): this; 98 | resume(): this; 99 | isPaused(): boolean; 100 | destroy(error?: Error): this; 101 | [Symbol.asyncIterator](): AsyncIterableIterator; 102 | } 103 | 104 | export declare class FsReadStream extends Readable { 105 | path: {}; // node type is string | Buffer 106 | } 107 | 108 | const _ReadableStream = ReadableStream; 109 | type _ReadableStream = ReadableStream; 110 | export { _ReadableStream as ReadableStream }; 111 | 112 | export const init = () => {}; 113 | -------------------------------------------------------------------------------- /src/_shims/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | import { manual } from './manual-types'; 5 | import * as auto from 'lithic/_shims/auto/types'; 6 | import { type RequestOptions } from '../core'; 7 | 8 | type SelectType = unknown extends Manual ? Auto : Manual; 9 | 10 | export const kind: string; 11 | 12 | // @ts-ignore 13 | export type Agent = SelectType; 14 | 15 | // @ts-ignore 16 | export const fetch: SelectType; 17 | 18 | // @ts-ignore 19 | export type Request = SelectType; 20 | // @ts-ignore 21 | export type RequestInfo = SelectType; 22 | // @ts-ignore 23 | export type RequestInit = SelectType; 24 | 25 | // @ts-ignore 26 | export type Response = SelectType; 27 | // @ts-ignore 28 | export type ResponseInit = SelectType; 29 | // @ts-ignore 30 | export type ResponseType = SelectType; 31 | // @ts-ignore 32 | export type BodyInit = SelectType; 33 | // @ts-ignore 34 | export type Headers = SelectType; 35 | // @ts-ignore 36 | export const Headers: SelectType; 37 | // @ts-ignore 38 | export type HeadersInit = SelectType; 39 | 40 | // @ts-ignore 41 | export type BlobPropertyBag = SelectType; 42 | // @ts-ignore 43 | export type FilePropertyBag = SelectType; 44 | // @ts-ignore 45 | export type FileFromPathOptions = SelectType; 46 | // @ts-ignore 47 | export type FormData = SelectType; 48 | // @ts-ignore 49 | export const FormData: SelectType; 50 | // @ts-ignore 51 | export type File = SelectType; 52 | // @ts-ignore 53 | export const File: SelectType; 54 | // @ts-ignore 55 | export type Blob = SelectType; 56 | // @ts-ignore 57 | export const Blob: SelectType; 58 | 59 | // @ts-ignore 60 | export type Readable = SelectType; 61 | // @ts-ignore 62 | export type FsReadStream = SelectType; 63 | // @ts-ignore 64 | export type ReadableStream = SelectType; 65 | // @ts-ignore 66 | export const ReadableStream: SelectType; 67 | 68 | export function getMultipartRequestOptions>( 69 | form: FormData, 70 | opts: RequestOptions, 71 | ): Promise>; 72 | 73 | export function getDefaultAgent(url: string): any; 74 | 75 | // @ts-ignore 76 | export type FileFromPathOptions = SelectType; 77 | 78 | export function fileFromPath(path: string, options?: FileFromPathOptions): Promise; 79 | export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise; 80 | 81 | export function isFsReadStream(value: any): value is FsReadStream; 82 | 83 | export const init: () => void; 84 | -------------------------------------------------------------------------------- /src/_shims/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | const shims = require('./registry'); 5 | const auto = require('lithic/_shims/auto/runtime'); 6 | exports.init = () => { 7 | if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); 8 | }; 9 | for (const property of Object.keys(shims)) { 10 | Object.defineProperty(exports, property, { 11 | get() { 12 | return shims[property]; 13 | }, 14 | }); 15 | } 16 | 17 | exports.init(); 18 | -------------------------------------------------------------------------------- /src/_shims/index.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | import * as shims from './registry.mjs'; 5 | import * as auto from 'lithic/_shims/auto/runtime'; 6 | export const init = () => { 7 | if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); 8 | }; 9 | export * from './registry.mjs'; 10 | 11 | init(); 12 | -------------------------------------------------------------------------------- /src/_shims/manual-types.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | /** 5 | * Types will get added to this namespace when you import one of the following: 6 | * 7 | * import 'lithic/shims/node' 8 | * import 'lithic/shims/web' 9 | * 10 | * Importing more than one will cause type and runtime errors. 11 | */ 12 | export namespace manual {} 13 | -------------------------------------------------------------------------------- /src/_shims/manual-types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/manual-types.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/node-runtime.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | import * as nf from 'node-fetch'; 5 | import * as fd from 'formdata-node'; 6 | import { type File, type FilePropertyBag } from 'formdata-node'; 7 | import KeepAliveAgent from 'agentkeepalive'; 8 | import { AbortController as AbortControllerPolyfill } from 'abort-controller'; 9 | import { ReadStream as FsReadStream } from 'node:fs'; 10 | import { type Agent } from 'node:http'; 11 | import { FormDataEncoder } from 'form-data-encoder'; 12 | import { Readable } from 'node:stream'; 13 | import { type RequestOptions } from '../core'; 14 | import { MultipartBody } from './MultipartBody'; 15 | import { type Shims } from './registry'; 16 | import { ReadableStream } from 'node:stream/web'; 17 | 18 | type FileFromPathOptions = Omit; 19 | 20 | let fileFromPathWarned = false; 21 | 22 | /** 23 | * @deprecated use fs.createReadStream('./my/file.txt') instead 24 | */ 25 | async function fileFromPath(path: string): Promise; 26 | async function fileFromPath(path: string, filename?: string): Promise; 27 | async function fileFromPath(path: string, options?: FileFromPathOptions): Promise; 28 | async function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise; 29 | async function fileFromPath(path: string, ...args: any[]): Promise { 30 | // this import fails in environments that don't handle export maps correctly, like old versions of Jest 31 | const { fileFromPath: _fileFromPath } = await import('formdata-node/file-from-path'); 32 | 33 | if (!fileFromPathWarned) { 34 | console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`); 35 | fileFromPathWarned = true; 36 | } 37 | // @ts-ignore 38 | return await _fileFromPath(path, ...args); 39 | } 40 | 41 | const defaultHttpAgent: Agent = new KeepAliveAgent({ keepAlive: true, timeout: 5 * 60 * 1000 }); 42 | const defaultHttpsAgent: Agent = new KeepAliveAgent.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1000 }); 43 | 44 | async function getMultipartRequestOptions>( 45 | form: fd.FormData, 46 | opts: RequestOptions, 47 | ): Promise> { 48 | const encoder = new FormDataEncoder(form); 49 | const readable = Readable.from(encoder); 50 | const body = new MultipartBody(readable); 51 | const headers = { 52 | ...opts.headers, 53 | ...encoder.headers, 54 | 'Content-Length': encoder.contentLength, 55 | }; 56 | 57 | return { ...opts, body: body as any, headers }; 58 | } 59 | 60 | export function getRuntime(): Shims { 61 | // Polyfill global object if needed. 62 | if (typeof AbortController === 'undefined') { 63 | // @ts-expect-error (the types are subtly different, but compatible in practice) 64 | globalThis.AbortController = AbortControllerPolyfill; 65 | } 66 | return { 67 | kind: 'node', 68 | fetch: nf.default, 69 | Request: nf.Request, 70 | Response: nf.Response, 71 | Headers: nf.Headers, 72 | FormData: fd.FormData, 73 | Blob: fd.Blob, 74 | File: fd.File, 75 | ReadableStream, 76 | getMultipartRequestOptions, 77 | getDefaultAgent: (url: string): Agent => (url.startsWith('https') ? defaultHttpsAgent : defaultHttpAgent), 78 | fileFromPath, 79 | isFsReadStream: (value: any): value is FsReadStream => value instanceof FsReadStream, 80 | }; 81 | } 82 | -------------------------------------------------------------------------------- /src/_shims/node-types.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | import * as nf from 'node-fetch'; 5 | import * as fd from 'formdata-node'; 6 | 7 | export { type Agent } from 'node:http'; 8 | export { type Readable } from 'node:stream'; 9 | export { type ReadStream as FsReadStream } from 'node:fs'; 10 | export { ReadableStream } from 'node:stream/web'; 11 | 12 | export const fetch: typeof nf.default; 13 | 14 | export type Request = nf.Request; 15 | export type RequestInfo = nf.RequestInfo; 16 | export type RequestInit = nf.RequestInit; 17 | 18 | export type Response = nf.Response; 19 | export type ResponseInit = nf.ResponseInit; 20 | export type ResponseType = nf.ResponseType; 21 | export type BodyInit = nf.BodyInit; 22 | export type Headers = nf.Headers; 23 | export type HeadersInit = nf.HeadersInit; 24 | 25 | type EndingType = 'native' | 'transparent'; 26 | export interface BlobPropertyBag { 27 | endings?: EndingType; 28 | type?: string; 29 | } 30 | 31 | export interface FilePropertyBag extends BlobPropertyBag { 32 | lastModified?: number; 33 | } 34 | 35 | export type FileFromPathOptions = Omit; 36 | 37 | export type FormData = fd.FormData; 38 | export const FormData: typeof fd.FormData; 39 | export type File = fd.File; 40 | export const File: typeof fd.File; 41 | export type Blob = fd.Blob; 42 | export const Blob: typeof fd.Blob; 43 | -------------------------------------------------------------------------------- /src/_shims/node-types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/node-types.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/registry.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | import { type RequestOptions } from '../core'; 5 | 6 | export interface Shims { 7 | kind: string; 8 | fetch: any; 9 | Request: any; 10 | Response: any; 11 | Headers: any; 12 | FormData: any; 13 | Blob: any; 14 | File: any; 15 | ReadableStream: any; 16 | getMultipartRequestOptions: >( 17 | form: Shims['FormData'], 18 | opts: RequestOptions, 19 | ) => Promise>; 20 | getDefaultAgent: (url: string) => any; 21 | fileFromPath: 22 | | ((path: string, filename?: string, options?: {}) => Promise) 23 | | ((path: string, options?: {}) => Promise); 24 | isFsReadStream: (value: any) => boolean; 25 | } 26 | 27 | export let auto = false; 28 | export let kind: Shims['kind'] | undefined = undefined; 29 | export let fetch: Shims['fetch'] | undefined = undefined; 30 | export let Request: Shims['Request'] | undefined = undefined; 31 | export let Response: Shims['Response'] | undefined = undefined; 32 | export let Headers: Shims['Headers'] | undefined = undefined; 33 | export let FormData: Shims['FormData'] | undefined = undefined; 34 | export let Blob: Shims['Blob'] | undefined = undefined; 35 | export let File: Shims['File'] | undefined = undefined; 36 | export let ReadableStream: Shims['ReadableStream'] | undefined = undefined; 37 | export let getMultipartRequestOptions: Shims['getMultipartRequestOptions'] | undefined = undefined; 38 | export let getDefaultAgent: Shims['getDefaultAgent'] | undefined = undefined; 39 | export let fileFromPath: Shims['fileFromPath'] | undefined = undefined; 40 | export let isFsReadStream: Shims['isFsReadStream'] | undefined = undefined; 41 | 42 | export function setShims(shims: Shims, options: { auto: boolean } = { auto: false }) { 43 | if (auto) { 44 | throw new Error( 45 | `you must \`import 'lithic/shims/${shims.kind}'\` before importing anything else from lithic`, 46 | ); 47 | } 48 | if (kind) { 49 | throw new Error(`can't \`import 'lithic/shims/${shims.kind}'\` after \`import 'lithic/shims/${kind}'\``); 50 | } 51 | auto = options.auto; 52 | kind = shims.kind; 53 | fetch = shims.fetch; 54 | Request = shims.Request; 55 | Response = shims.Response; 56 | Headers = shims.Headers; 57 | FormData = shims.FormData; 58 | Blob = shims.Blob; 59 | File = shims.File; 60 | ReadableStream = shims.ReadableStream; 61 | getMultipartRequestOptions = shims.getMultipartRequestOptions; 62 | getDefaultAgent = shims.getDefaultAgent; 63 | fileFromPath = shims.fileFromPath; 64 | isFsReadStream = shims.isFsReadStream; 65 | } 66 | -------------------------------------------------------------------------------- /src/_shims/web-runtime.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | import { MultipartBody } from './MultipartBody'; 5 | import { type RequestOptions } from '../core'; 6 | import { type Shims } from './registry'; 7 | 8 | export function getRuntime({ manuallyImported }: { manuallyImported?: boolean } = {}): Shims { 9 | const recommendation = 10 | manuallyImported ? 11 | `You may need to use polyfills` 12 | : `Add one of these imports before your first \`import … from 'lithic'\`: 13 | - \`import 'lithic/shims/node'\` (if you're running on Node) 14 | - \`import 'lithic/shims/web'\` (otherwise) 15 | `; 16 | 17 | let _fetch, _Request, _Response, _Headers; 18 | try { 19 | // @ts-ignore 20 | _fetch = fetch; 21 | // @ts-ignore 22 | _Request = Request; 23 | // @ts-ignore 24 | _Response = Response; 25 | // @ts-ignore 26 | _Headers = Headers; 27 | } catch (error) { 28 | throw new Error( 29 | `this environment is missing the following Web Fetch API type: ${ 30 | (error as any).message 31 | }. ${recommendation}`, 32 | ); 33 | } 34 | 35 | return { 36 | kind: 'web', 37 | fetch: _fetch, 38 | Request: _Request, 39 | Response: _Response, 40 | Headers: _Headers, 41 | FormData: 42 | // @ts-ignore 43 | typeof FormData !== 'undefined' ? FormData : ( 44 | class FormData { 45 | // @ts-ignore 46 | constructor() { 47 | throw new Error( 48 | `file uploads aren't supported in this environment yet as 'FormData' is undefined. ${recommendation}`, 49 | ); 50 | } 51 | } 52 | ), 53 | Blob: 54 | typeof Blob !== 'undefined' ? Blob : ( 55 | class Blob { 56 | constructor() { 57 | throw new Error( 58 | `file uploads aren't supported in this environment yet as 'Blob' is undefined. ${recommendation}`, 59 | ); 60 | } 61 | } 62 | ), 63 | File: 64 | // @ts-ignore 65 | typeof File !== 'undefined' ? File : ( 66 | class File { 67 | // @ts-ignore 68 | constructor() { 69 | throw new Error( 70 | `file uploads aren't supported in this environment yet as 'File' is undefined. ${recommendation}`, 71 | ); 72 | } 73 | } 74 | ), 75 | ReadableStream: 76 | // @ts-ignore 77 | typeof ReadableStream !== 'undefined' ? ReadableStream : ( 78 | class ReadableStream { 79 | // @ts-ignore 80 | constructor() { 81 | throw new Error( 82 | `streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${recommendation}`, 83 | ); 84 | } 85 | } 86 | ), 87 | getMultipartRequestOptions: async >( 88 | // @ts-ignore 89 | form: FormData, 90 | opts: RequestOptions, 91 | ): Promise> => ({ 92 | ...opts, 93 | body: new MultipartBody(form) as any, 94 | }), 95 | getDefaultAgent: (url: string) => undefined, 96 | fileFromPath: () => { 97 | throw new Error( 98 | 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/lithic-com/lithic-node#file-uploads', 99 | ); 100 | }, 101 | isFsReadStream: (value: any) => false, 102 | }; 103 | } 104 | -------------------------------------------------------------------------------- /src/_shims/web-types.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export type Agent = any; 5 | 6 | declare const _fetch: typeof fetch; 7 | export { _fetch as fetch }; 8 | 9 | type _Request = Request; 10 | export { _Request as Request }; 11 | 12 | type _RequestInfo = RequestInfo; 13 | export { type _RequestInfo as RequestInfo }; 14 | 15 | type _RequestInit = RequestInit; 16 | export { type _RequestInit as RequestInit }; 17 | 18 | type _Response = Response; 19 | export { _Response as Response }; 20 | 21 | type _ResponseInit = ResponseInit; 22 | export { type _ResponseInit as ResponseInit }; 23 | 24 | type _ResponseType = ResponseType; 25 | export { type _ResponseType as ResponseType }; 26 | 27 | type _BodyInit = BodyInit; 28 | export { type _BodyInit as BodyInit }; 29 | 30 | type _Headers = Headers; 31 | export { _Headers as Headers }; 32 | 33 | type _HeadersInit = HeadersInit; 34 | export { type _HeadersInit as HeadersInit }; 35 | 36 | type EndingType = 'native' | 'transparent'; 37 | 38 | export interface BlobPropertyBag { 39 | endings?: EndingType; 40 | type?: string; 41 | } 42 | 43 | export interface FilePropertyBag extends BlobPropertyBag { 44 | lastModified?: number; 45 | } 46 | 47 | export type FileFromPathOptions = Omit; 48 | 49 | type _FormData = FormData; 50 | declare const _FormData: typeof FormData; 51 | export { _FormData as FormData }; 52 | 53 | type _File = File; 54 | declare const _File: typeof File; 55 | export { _File as File }; 56 | 57 | type _Blob = Blob; 58 | declare const _Blob: typeof Blob; 59 | export { _Blob as Blob }; 60 | 61 | export declare class Readable { 62 | readable: boolean; 63 | readonly readableEnded: boolean; 64 | readonly readableFlowing: boolean | null; 65 | readonly readableHighWaterMark: number; 66 | readonly readableLength: number; 67 | readonly readableObjectMode: boolean; 68 | destroyed: boolean; 69 | read(size?: number): any; 70 | pause(): this; 71 | resume(): this; 72 | isPaused(): boolean; 73 | destroy(error?: Error): this; 74 | [Symbol.asyncIterator](): AsyncIterableIterator; 75 | } 76 | 77 | export declare class FsReadStream extends Readable { 78 | path: {}; // node type is string | Buffer 79 | } 80 | 81 | type _ReadableStream = ReadableStream; 82 | declare const _ReadableStream: typeof ReadableStream; 83 | export { _ReadableStream as ReadableStream }; 84 | -------------------------------------------------------------------------------- /src/_shims/web-types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/web-types.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/internal/qs/LICENSE.md: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/puruvj/neoqs/graphs/contributors) All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | -------------------------------------------------------------------------------- /src/internal/qs/README.md: -------------------------------------------------------------------------------- 1 | # qs 2 | 3 | This is a vendored version of [neoqs](https://github.com/PuruVJ/neoqs) which is a TypeScript rewrite of [qs](https://github.com/ljharb/qs), a query string library. 4 | -------------------------------------------------------------------------------- /src/internal/qs/formats.ts: -------------------------------------------------------------------------------- 1 | import type { Format } from './types'; 2 | 3 | export const default_format: Format = 'RFC3986'; 4 | export const formatters: Record string> = { 5 | RFC1738: (v: PropertyKey) => String(v).replace(/%20/g, '+'), 6 | RFC3986: (v: PropertyKey) => String(v), 7 | }; 8 | export const RFC1738 = 'RFC1738'; 9 | export const RFC3986 = 'RFC3986'; 10 | -------------------------------------------------------------------------------- /src/internal/qs/index.ts: -------------------------------------------------------------------------------- 1 | import { default_format, formatters, RFC1738, RFC3986 } from './formats'; 2 | 3 | const formats = { 4 | formatters, 5 | RFC1738, 6 | RFC3986, 7 | default: default_format, 8 | }; 9 | 10 | export { stringify } from './stringify'; 11 | export { formats }; 12 | 13 | export type { DefaultDecoder, DefaultEncoder, Format, ParseOptions, StringifyOptions } from './types'; 14 | -------------------------------------------------------------------------------- /src/internal/qs/types.ts: -------------------------------------------------------------------------------- 1 | export type Format = 'RFC1738' | 'RFC3986'; 2 | 3 | export type DefaultEncoder = (str: any, defaultEncoder?: any, charset?: string) => string; 4 | export type DefaultDecoder = (str: string, decoder?: any, charset?: string) => string; 5 | 6 | export type BooleanOptional = boolean | undefined; 7 | 8 | export type StringifyBaseOptions = { 9 | delimiter?: string; 10 | allowDots?: boolean; 11 | encodeDotInKeys?: boolean; 12 | strictNullHandling?: boolean; 13 | skipNulls?: boolean; 14 | encode?: boolean; 15 | encoder?: ( 16 | str: any, 17 | defaultEncoder: DefaultEncoder, 18 | charset: string, 19 | type: 'key' | 'value', 20 | format?: Format, 21 | ) => string; 22 | filter?: Array | ((prefix: PropertyKey, value: any) => any); 23 | arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma'; 24 | indices?: boolean; 25 | sort?: ((a: PropertyKey, b: PropertyKey) => number) | null; 26 | serializeDate?: (d: Date) => string; 27 | format?: 'RFC1738' | 'RFC3986'; 28 | formatter?: (str: PropertyKey) => string; 29 | encodeValuesOnly?: boolean; 30 | addQueryPrefix?: boolean; 31 | charset?: 'utf-8' | 'iso-8859-1'; 32 | charsetSentinel?: boolean; 33 | allowEmptyArrays?: boolean; 34 | commaRoundTrip?: boolean; 35 | }; 36 | 37 | export type StringifyOptions = StringifyBaseOptions; 38 | 39 | export type ParseBaseOptions = { 40 | comma?: boolean; 41 | delimiter?: string | RegExp; 42 | depth?: number | false; 43 | decoder?: (str: string, defaultDecoder: DefaultDecoder, charset: string, type: 'key' | 'value') => any; 44 | arrayLimit?: number; 45 | parseArrays?: boolean; 46 | plainObjects?: boolean; 47 | allowPrototypes?: boolean; 48 | allowSparse?: boolean; 49 | parameterLimit?: number; 50 | strictDepth?: boolean; 51 | strictNullHandling?: boolean; 52 | ignoreQueryPrefix?: boolean; 53 | charset?: 'utf-8' | 'iso-8859-1'; 54 | charsetSentinel?: boolean; 55 | interpretNumericEntities?: boolean; 56 | allowEmptyArrays?: boolean; 57 | duplicates?: 'combine' | 'first' | 'last'; 58 | allowDots?: boolean; 59 | decodeDotInKeys?: boolean; 60 | }; 61 | 62 | export type ParseOptions = ParseBaseOptions; 63 | 64 | export type ParsedQs = { 65 | [key: string]: undefined | string | string[] | ParsedQs | ParsedQs[]; 66 | }; 67 | 68 | // Type to remove null or undefined union from each property 69 | export type NonNullableProperties = { 70 | [K in keyof T]-?: Exclude; 71 | }; 72 | -------------------------------------------------------------------------------- /src/lib/.keep: -------------------------------------------------------------------------------- 1 | File generated from our OpenAPI spec by Stainless. 2 | 3 | This directory can be used to store custom files to expand the SDK. 4 | It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. 5 | -------------------------------------------------------------------------------- /src/pagination.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from './core'; 4 | 5 | export interface CursorPageResponse { 6 | data: Array; 7 | 8 | has_more: boolean; 9 | } 10 | 11 | export interface CursorPageParams { 12 | page_size?: number; 13 | 14 | /** 15 | * A cursor representing an item's token after which a page of results should 16 | * begin. Used to retrieve the next page of results after this item. 17 | */ 18 | starting_after?: string; 19 | 20 | /** 21 | * A cursor representing an item's token before which a page of results should end. 22 | * Used to retrieve the previous page of results before this item. 23 | */ 24 | ending_before?: string; 25 | } 26 | 27 | export class CursorPage 28 | extends AbstractPage 29 | implements CursorPageResponse 30 | { 31 | data: Array; 32 | 33 | has_more: boolean; 34 | 35 | constructor( 36 | client: APIClient, 37 | response: Response, 38 | body: CursorPageResponse, 39 | options: FinalRequestOptions, 40 | ) { 41 | super(client, response, body, options); 42 | 43 | this.data = body.data || []; 44 | this.has_more = body.has_more; 45 | } 46 | 47 | getPaginatedItems(): Item[] { 48 | return this.data ?? []; 49 | } 50 | 51 | override hasNextPage(): boolean { 52 | return this.has_more && super.hasNextPage(); 53 | } 54 | 55 | // @deprecated Please use `nextPageInfo()` instead 56 | nextPageParams(): Partial | null { 57 | const info = this.nextPageInfo(); 58 | if (!info) return null; 59 | if ('params' in info) return info.params; 60 | const params = Object.fromEntries(info.url.searchParams); 61 | if (!Object.keys(params).length) return null; 62 | return params; 63 | } 64 | 65 | nextPageInfo(): PageInfo | null { 66 | const data = this.getPaginatedItems(); 67 | if (!data.length) { 68 | return null; 69 | } 70 | 71 | const isForwards = !( 72 | typeof this.options.query === 'object' && 'ending_before' in (this.options.query || {}) 73 | ); 74 | if (isForwards) { 75 | const token = data[data.length - 1]?.token; 76 | if (!token) { 77 | return null; 78 | } 79 | 80 | return { params: { starting_after: token } }; 81 | } 82 | 83 | const token = data[0]?.token; 84 | if (!token) { 85 | return null; 86 | } 87 | 88 | return { params: { ending_before: token } }; 89 | } 90 | } 91 | 92 | export interface SinglePageResponse { 93 | data: Array; 94 | 95 | has_more: boolean; 96 | } 97 | 98 | export class SinglePage extends AbstractPage implements SinglePageResponse { 99 | data: Array; 100 | 101 | has_more: boolean; 102 | 103 | constructor( 104 | client: APIClient, 105 | response: Response, 106 | body: SinglePageResponse, 107 | options: FinalRequestOptions, 108 | ) { 109 | super(client, response, body, options); 110 | 111 | this.data = body.data || []; 112 | this.has_more = body.has_more; 113 | } 114 | 115 | getPaginatedItems(): Item[] { 116 | return this.data ?? []; 117 | } 118 | 119 | override hasNextPage(): boolean { 120 | return this.has_more && super.hasNextPage(); 121 | } 122 | 123 | // @deprecated Please use `nextPageInfo()` instead 124 | /** 125 | * This page represents a response that isn't actually paginated at the API level 126 | * so there will never be any next page params. 127 | */ 128 | nextPageParams(): null { 129 | return null; 130 | } 131 | 132 | nextPageInfo(): null { 133 | return null; 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /src/resource.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import type { Lithic } from './index'; 4 | 5 | export abstract class APIResource { 6 | protected _client: Lithic; 7 | 8 | constructor(client: Lithic) { 9 | this._client = client; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/resources.ts: -------------------------------------------------------------------------------- 1 | export * from './resources/index'; 2 | -------------------------------------------------------------------------------- /src/resources/aggregate-balances.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../resource'; 4 | import { isRequestOptions } from '../core'; 5 | import * as Core from '../core'; 6 | import { SinglePage } from '../pagination'; 7 | 8 | export class AggregateBalances extends APIResource { 9 | /** 10 | * Get the aggregated balance across all end-user accounts by financial account 11 | * type 12 | */ 13 | list( 14 | query?: AggregateBalanceListParams, 15 | options?: Core.RequestOptions, 16 | ): Core.PagePromise; 17 | list(options?: Core.RequestOptions): Core.PagePromise; 18 | list( 19 | query: AggregateBalanceListParams | Core.RequestOptions = {}, 20 | options?: Core.RequestOptions, 21 | ): Core.PagePromise { 22 | if (isRequestOptions(query)) { 23 | return this.list({}, query); 24 | } 25 | return this._client.getAPIList('/v1/aggregate_balances', AggregateBalancesSinglePage, { 26 | query, 27 | ...options, 28 | }); 29 | } 30 | } 31 | 32 | export class AggregateBalancesSinglePage extends SinglePage {} 33 | 34 | /** 35 | * Aggregate Balance across all end-user accounts 36 | */ 37 | export interface AggregateBalance { 38 | /** 39 | * Funds available for spend in the currency's smallest unit (e.g., cents for USD) 40 | */ 41 | available_amount: number; 42 | 43 | /** 44 | * Date and time for when the balance was first created. 45 | */ 46 | created: string; 47 | 48 | /** 49 | * 3-character alphabetic ISO 4217 code for the local currency of the balance. 50 | */ 51 | currency: string; 52 | 53 | /** 54 | * Type of financial account 55 | */ 56 | financial_account_type: 'ISSUING' | 'OPERATING' | 'RESERVE'; 57 | 58 | /** 59 | * Globally unique identifier for the financial account that had its balance 60 | * updated most recently 61 | */ 62 | last_financial_account_token: string; 63 | 64 | /** 65 | * Globally unique identifier for the last transaction event that impacted this 66 | * balance 67 | */ 68 | last_transaction_event_token: string; 69 | 70 | /** 71 | * Globally unique identifier for the last transaction that impacted this balance 72 | */ 73 | last_transaction_token: string; 74 | 75 | /** 76 | * Funds not available for spend due to card authorizations or pending ACH release. 77 | * Shown in the currency's smallest unit (e.g., cents for USD) 78 | */ 79 | pending_amount: number; 80 | 81 | /** 82 | * The sum of available and pending balance in the currency's smallest unit (e.g., 83 | * cents for USD) 84 | */ 85 | total_amount: number; 86 | 87 | /** 88 | * Date and time for when the balance was last updated. 89 | */ 90 | updated: string; 91 | } 92 | 93 | export interface AggregateBalanceListParams { 94 | /** 95 | * Get the aggregate balance for a given Financial Account type. 96 | */ 97 | financial_account_type?: 'ISSUING' | 'OPERATING' | 'RESERVE'; 98 | } 99 | 100 | AggregateBalances.AggregateBalancesSinglePage = AggregateBalancesSinglePage; 101 | 102 | export declare namespace AggregateBalances { 103 | export { 104 | type AggregateBalance as AggregateBalance, 105 | AggregateBalancesSinglePage as AggregateBalancesSinglePage, 106 | type AggregateBalanceListParams as AggregateBalanceListParams, 107 | }; 108 | } 109 | -------------------------------------------------------------------------------- /src/resources/auth-rules.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './auth-rules/index'; 4 | -------------------------------------------------------------------------------- /src/resources/auth-rules/auth-rules.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as V2API from './v2/v2'; 5 | import { 6 | AuthRule, 7 | AuthRuleCondition, 8 | Conditional3DSActionParameters, 9 | ConditionalAttribute, 10 | ConditionalBlockParameters, 11 | MerchantLockParameters, 12 | RuleStats, 13 | V2, 14 | V2ApplyParams, 15 | V2ApplyResponse, 16 | V2CreateParams, 17 | V2CreateResponse, 18 | V2DraftParams, 19 | V2DraftResponse, 20 | V2ListParams, 21 | V2ListResponse, 22 | V2ListResponsesCursorPage, 23 | V2PromoteResponse, 24 | V2ReportResponse, 25 | V2RetrieveReportParams, 26 | V2RetrieveReportResponse, 27 | V2RetrieveResponse, 28 | V2UpdateParams, 29 | V2UpdateResponse, 30 | VelocityLimitParams, 31 | VelocityLimitParamsPeriodWindow, 32 | } from './v2/v2'; 33 | 34 | export class AuthRules extends APIResource { 35 | v2: V2API.V2 = new V2API.V2(this._client); 36 | } 37 | 38 | AuthRules.V2 = V2; 39 | AuthRules.V2ListResponsesCursorPage = V2ListResponsesCursorPage; 40 | 41 | export declare namespace AuthRules { 42 | export { 43 | V2 as V2, 44 | type AuthRule as AuthRule, 45 | type AuthRuleCondition as AuthRuleCondition, 46 | type Conditional3DSActionParameters as Conditional3DSActionParameters, 47 | type ConditionalAttribute as ConditionalAttribute, 48 | type ConditionalBlockParameters as ConditionalBlockParameters, 49 | type MerchantLockParameters as MerchantLockParameters, 50 | type RuleStats as RuleStats, 51 | type VelocityLimitParams as VelocityLimitParams, 52 | type VelocityLimitParamsPeriodWindow as VelocityLimitParamsPeriodWindow, 53 | type V2CreateResponse as V2CreateResponse, 54 | type V2RetrieveResponse as V2RetrieveResponse, 55 | type V2UpdateResponse as V2UpdateResponse, 56 | type V2ListResponse as V2ListResponse, 57 | type V2ApplyResponse as V2ApplyResponse, 58 | type V2DraftResponse as V2DraftResponse, 59 | type V2PromoteResponse as V2PromoteResponse, 60 | type V2ReportResponse as V2ReportResponse, 61 | type V2RetrieveReportResponse as V2RetrieveReportResponse, 62 | V2ListResponsesCursorPage as V2ListResponsesCursorPage, 63 | type V2CreateParams as V2CreateParams, 64 | type V2UpdateParams as V2UpdateParams, 65 | type V2ListParams as V2ListParams, 66 | type V2ApplyParams as V2ApplyParams, 67 | type V2DraftParams as V2DraftParams, 68 | type V2RetrieveReportParams as V2RetrieveReportParams, 69 | }; 70 | } 71 | -------------------------------------------------------------------------------- /src/resources/auth-rules/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { AuthRules } from './auth-rules'; 4 | export { 5 | V2ListResponsesCursorPage, 6 | V2, 7 | type AuthRule, 8 | type AuthRuleCondition, 9 | type Conditional3DSActionParameters, 10 | type ConditionalAttribute, 11 | type ConditionalBlockParameters, 12 | type MerchantLockParameters, 13 | type RuleStats, 14 | type VelocityLimitParams, 15 | type VelocityLimitParamsPeriodWindow, 16 | type V2CreateResponse, 17 | type V2RetrieveResponse, 18 | type V2UpdateResponse, 19 | type V2ListResponse, 20 | type V2ApplyResponse, 21 | type V2DraftResponse, 22 | type V2PromoteResponse, 23 | type V2ReportResponse, 24 | type V2RetrieveReportResponse, 25 | type V2CreateParams, 26 | type V2UpdateParams, 27 | type V2ListParams, 28 | type V2ApplyParams, 29 | type V2DraftParams, 30 | type V2RetrieveReportParams, 31 | } from './v2/index'; 32 | -------------------------------------------------------------------------------- /src/resources/auth-rules/v2.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './v2/index'; 4 | -------------------------------------------------------------------------------- /src/resources/auth-rules/v2/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | Backtests, 5 | type BacktestResults, 6 | type BacktestCreateResponse, 7 | type BacktestCreateParams, 8 | } from './backtests'; 9 | export { 10 | V2ListResponsesCursorPage, 11 | V2, 12 | type AuthRule, 13 | type AuthRuleCondition, 14 | type Conditional3DSActionParameters, 15 | type ConditionalAttribute, 16 | type ConditionalBlockParameters, 17 | type MerchantLockParameters, 18 | type RuleStats, 19 | type VelocityLimitParams, 20 | type VelocityLimitParamsPeriodWindow, 21 | type V2CreateResponse, 22 | type V2RetrieveResponse, 23 | type V2UpdateResponse, 24 | type V2ListResponse, 25 | type V2ApplyResponse, 26 | type V2DraftResponse, 27 | type V2PromoteResponse, 28 | type V2ReportResponse, 29 | type V2RetrieveReportResponse, 30 | type V2CreateParams, 31 | type V2UpdateParams, 32 | type V2ListParams, 33 | type V2ApplyParams, 34 | type V2DraftParams, 35 | type V2RetrieveReportParams, 36 | } from './v2'; 37 | -------------------------------------------------------------------------------- /src/resources/auth-stream-enrollment.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../resource'; 4 | import * as Core from '../core'; 5 | 6 | export class AuthStreamEnrollment extends APIResource { 7 | /** 8 | * Retrieve the ASA HMAC secret key. If one does not exist for your program yet, 9 | * calling this endpoint will create one for you. The headers (which you can use to 10 | * verify webhooks) will begin appearing shortly after calling this endpoint for 11 | * the first time. See 12 | * [this page](https://docs.lithic.com/docs/auth-stream-access-asa#asa-webhook-verification) 13 | * for more detail about verifying ASA webhooks. 14 | */ 15 | retrieveSecret(options?: Core.RequestOptions): Core.APIPromise { 16 | return this._client.get('/v1/auth_stream/secret', options); 17 | } 18 | 19 | /** 20 | * Generate a new ASA HMAC secret key. The old ASA HMAC secret key will be 21 | * deactivated 24 hours after a successful request to this endpoint. Make a 22 | * [`GET /auth_stream/secret`](https://docs.lithic.com/reference/getauthstreamsecret) 23 | * request to retrieve the new secret key. 24 | */ 25 | rotateSecret(options?: Core.RequestOptions): Core.APIPromise { 26 | return this._client.post('/v1/auth_stream/secret/rotate', options); 27 | } 28 | } 29 | 30 | export interface AuthStreamSecret { 31 | /** 32 | * The shared HMAC ASA secret 33 | */ 34 | secret?: string; 35 | } 36 | 37 | export declare namespace AuthStreamEnrollment { 38 | export { type AuthStreamSecret as AuthStreamSecret }; 39 | } 40 | -------------------------------------------------------------------------------- /src/resources/balances.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../resource'; 4 | import { isRequestOptions } from '../core'; 5 | import * as Core from '../core'; 6 | import { SinglePage } from '../pagination'; 7 | 8 | export class Balances extends APIResource { 9 | /** 10 | * Get the balances for a program, business, or a given end-user account 11 | */ 12 | list( 13 | query?: BalanceListParams, 14 | options?: Core.RequestOptions, 15 | ): Core.PagePromise; 16 | list(options?: Core.RequestOptions): Core.PagePromise; 17 | list( 18 | query: BalanceListParams | Core.RequestOptions = {}, 19 | options?: Core.RequestOptions, 20 | ): Core.PagePromise { 21 | if (isRequestOptions(query)) { 22 | return this.list({}, query); 23 | } 24 | return this._client.getAPIList('/v1/balances', BalancesSinglePage, { query, ...options }); 25 | } 26 | } 27 | 28 | export class BalancesSinglePage extends SinglePage {} 29 | 30 | /** 31 | * Balance 32 | */ 33 | export interface Balance { 34 | /** 35 | * Funds available for spend in the currency's smallest unit (e.g., cents for USD) 36 | */ 37 | available_amount: number; 38 | 39 | /** 40 | * Date and time for when the balance was first created. 41 | */ 42 | created: string; 43 | 44 | /** 45 | * 3-character alphabetic ISO 4217 code for the local currency of the balance. 46 | */ 47 | currency: string; 48 | 49 | /** 50 | * Globally unique identifier for the financial account that holds this balance. 51 | */ 52 | financial_account_token: string; 53 | 54 | /** 55 | * Type of financial account. 56 | */ 57 | financial_account_type: 'ISSUING' | 'OPERATING' | 'RESERVE'; 58 | 59 | /** 60 | * Globally unique identifier for the last financial transaction event that 61 | * impacted this balance. 62 | */ 63 | last_transaction_event_token: string; 64 | 65 | /** 66 | * Globally unique identifier for the last financial transaction that impacted this 67 | * balance. 68 | */ 69 | last_transaction_token: string; 70 | 71 | /** 72 | * Funds not available for spend due to card authorizations or pending ACH release. 73 | * Shown in the currency's smallest unit (e.g., cents for USD). 74 | */ 75 | pending_amount: number; 76 | 77 | /** 78 | * The sum of available and pending balance in the currency's smallest unit (e.g., 79 | * cents for USD). 80 | */ 81 | total_amount: number; 82 | 83 | /** 84 | * Date and time for when the balance was last updated. 85 | */ 86 | updated: string; 87 | } 88 | 89 | export interface BalanceListParams { 90 | /** 91 | * List balances for all financial accounts of a given account_token. 92 | */ 93 | account_token?: string; 94 | 95 | /** 96 | * UTC date and time of the balances to retrieve. Defaults to latest available 97 | * balances 98 | */ 99 | balance_date?: string; 100 | 101 | /** 102 | * List balances for all financial accounts of a given business_account_token. 103 | */ 104 | business_account_token?: string; 105 | 106 | /** 107 | * List balances for a given Financial Account type. 108 | */ 109 | financial_account_type?: 'ISSUING' | 'OPERATING' | 'RESERVE'; 110 | } 111 | 112 | Balances.BalancesSinglePage = BalancesSinglePage; 113 | 114 | export declare namespace Balances { 115 | export { 116 | type Balance as Balance, 117 | BalancesSinglePage as BalancesSinglePage, 118 | type BalanceListParams as BalanceListParams, 119 | }; 120 | } 121 | -------------------------------------------------------------------------------- /src/resources/card-programs.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../resource'; 4 | import { isRequestOptions } from '../core'; 5 | import * as Core from '../core'; 6 | import { CursorPage, type CursorPageParams } from '../pagination'; 7 | 8 | export class CardPrograms extends APIResource { 9 | /** 10 | * Get card program. 11 | * 12 | * @example 13 | * ```ts 14 | * const cardProgram = await client.cardPrograms.retrieve( 15 | * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 16 | * ); 17 | * ``` 18 | */ 19 | retrieve(cardProgramToken: string, options?: Core.RequestOptions): Core.APIPromise { 20 | return this._client.get(`/v1/card_programs/${cardProgramToken}`, options); 21 | } 22 | 23 | /** 24 | * List card programs. 25 | * 26 | * @example 27 | * ```ts 28 | * // Automatically fetches more pages as needed. 29 | * for await (const cardProgram of client.cardPrograms.list()) { 30 | * // ... 31 | * } 32 | * ``` 33 | */ 34 | list( 35 | query?: CardProgramListParams, 36 | options?: Core.RequestOptions, 37 | ): Core.PagePromise; 38 | list(options?: Core.RequestOptions): Core.PagePromise; 39 | list( 40 | query: CardProgramListParams | Core.RequestOptions = {}, 41 | options?: Core.RequestOptions, 42 | ): Core.PagePromise { 43 | if (isRequestOptions(query)) { 44 | return this.list({}, query); 45 | } 46 | return this._client.getAPIList('/v1/card_programs', CardProgramsCursorPage, { query, ...options }); 47 | } 48 | } 49 | 50 | export class CardProgramsCursorPage extends CursorPage {} 51 | 52 | export interface CardProgram { 53 | /** 54 | * Globally unique identifier. 55 | */ 56 | token: string; 57 | 58 | /** 59 | * Timestamp of when the card program was created. 60 | */ 61 | created: string; 62 | 63 | /** 64 | * The name of the card program. 65 | */ 66 | name: string; 67 | 68 | /** 69 | * The first digits of the card number that this card program ends with. 70 | */ 71 | pan_range_end: string; 72 | 73 | /** 74 | * The first digits of the card number that this card program starts with. 75 | */ 76 | pan_range_start: string; 77 | 78 | /** 79 | * 3-character alphabetic ISO 4217 code for the currency of the cardholder. 80 | */ 81 | cardholder_currency?: string; 82 | 83 | /** 84 | * List of 3-character alphabetic ISO 4217 codes for the currencies that the card 85 | * program supports for settlement. 86 | */ 87 | settlement_currencies?: Array; 88 | } 89 | 90 | export interface CardProgramListParams extends CursorPageParams {} 91 | 92 | CardPrograms.CardProgramsCursorPage = CardProgramsCursorPage; 93 | 94 | export declare namespace CardPrograms { 95 | export { 96 | type CardProgram as CardProgram, 97 | CardProgramsCursorPage as CardProgramsCursorPage, 98 | type CardProgramListParams as CardProgramListParams, 99 | }; 100 | } 101 | -------------------------------------------------------------------------------- /src/resources/cards.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './cards/index'; 4 | -------------------------------------------------------------------------------- /src/resources/cards/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | AggregateBalanceListResponsesSinglePage, 5 | AggregateBalances, 6 | type AggregateBalanceListResponse, 7 | type AggregateBalanceListParams, 8 | } from './aggregate-balances'; 9 | export { 10 | BalanceListResponsesSinglePage, 11 | Balances, 12 | type BalanceListResponse, 13 | type BalanceListParams, 14 | } from './balances'; 15 | export { FinancialTransactions, type FinancialTransactionListParams } from './financial-transactions'; 16 | export { 17 | NonPCICardsCursorPage, 18 | Cards, 19 | type Card, 20 | type CardSpendLimits, 21 | type NonPCICard, 22 | type SpendLimitDuration, 23 | type CardEmbedResponse, 24 | type CardProvisionResponse, 25 | type CardWebProvisionResponse, 26 | type CardCreateParams, 27 | type CardUpdateParams, 28 | type CardListParams, 29 | type CardConvertPhysicalParams, 30 | type CardEmbedParams, 31 | type CardGetEmbedHTMLParams, 32 | type CardGetEmbedURLParams, 33 | type CardProvisionParams, 34 | type CardReissueParams, 35 | type CardRenewParams, 36 | type CardSearchByPanParams, 37 | type CardWebProvisionParams, 38 | } from './cards'; 39 | -------------------------------------------------------------------------------- /src/resources/credit-products.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './credit-products/index'; 4 | -------------------------------------------------------------------------------- /src/resources/credit-products/credit-products.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as ExtendedCreditAPI from './extended-credit'; 5 | import { ExtendedCredit, ExtendedCreditResource } from './extended-credit'; 6 | import * as PrimeRatesAPI from './prime-rates'; 7 | import { 8 | PrimeRateCreateParams, 9 | PrimeRateRetrieveParams, 10 | PrimeRateRetrieveResponse, 11 | PrimeRates, 12 | } from './prime-rates'; 13 | 14 | export class CreditProducts extends APIResource { 15 | extendedCredit: ExtendedCreditAPI.ExtendedCreditResource = new ExtendedCreditAPI.ExtendedCreditResource( 16 | this._client, 17 | ); 18 | primeRates: PrimeRatesAPI.PrimeRates = new PrimeRatesAPI.PrimeRates(this._client); 19 | } 20 | 21 | CreditProducts.ExtendedCreditResource = ExtendedCreditResource; 22 | CreditProducts.PrimeRates = PrimeRates; 23 | 24 | export declare namespace CreditProducts { 25 | export { ExtendedCreditResource as ExtendedCreditResource, type ExtendedCredit as ExtendedCredit }; 26 | 27 | export { 28 | PrimeRates as PrimeRates, 29 | type PrimeRateRetrieveResponse as PrimeRateRetrieveResponse, 30 | type PrimeRateCreateParams as PrimeRateCreateParams, 31 | type PrimeRateRetrieveParams as PrimeRateRetrieveParams, 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /src/resources/credit-products/extended-credit.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | 6 | export class ExtendedCreditResource extends APIResource { 7 | /** 8 | * Get the extended credit for a given credit product under a program 9 | */ 10 | retrieve(creditProductToken: string, options?: Core.RequestOptions): Core.APIPromise { 11 | return this._client.get(`/v1/credit_products/${creditProductToken}/extended_credit`, options); 12 | } 13 | } 14 | 15 | export interface ExtendedCredit { 16 | credit_extended: number; 17 | } 18 | 19 | export declare namespace ExtendedCreditResource { 20 | export { type ExtendedCredit as ExtendedCredit }; 21 | } 22 | -------------------------------------------------------------------------------- /src/resources/credit-products/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { CreditProducts } from './credit-products'; 4 | export { ExtendedCreditResource, type ExtendedCredit } from './extended-credit'; 5 | export { 6 | PrimeRates, 7 | type PrimeRateRetrieveResponse, 8 | type PrimeRateCreateParams, 9 | type PrimeRateRetrieveParams, 10 | } from './prime-rates'; 11 | -------------------------------------------------------------------------------- /src/resources/credit-products/prime-rates.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import { isRequestOptions } from '../../core'; 5 | import * as Core from '../../core'; 6 | 7 | export class PrimeRates extends APIResource { 8 | /** 9 | * Post Credit Product Prime Rate 10 | */ 11 | create( 12 | creditProductToken: string, 13 | body: PrimeRateCreateParams, 14 | options?: Core.RequestOptions, 15 | ): Core.APIPromise { 16 | return this._client.post(`/v1/credit_products/${creditProductToken}/prime_rates`, { body, ...options }); 17 | } 18 | 19 | /** 20 | * Get Credit Product Prime Rates 21 | */ 22 | retrieve( 23 | creditProductToken: string, 24 | query?: PrimeRateRetrieveParams, 25 | options?: Core.RequestOptions, 26 | ): Core.APIPromise; 27 | retrieve( 28 | creditProductToken: string, 29 | options?: Core.RequestOptions, 30 | ): Core.APIPromise; 31 | retrieve( 32 | creditProductToken: string, 33 | query: PrimeRateRetrieveParams | Core.RequestOptions = {}, 34 | options?: Core.RequestOptions, 35 | ): Core.APIPromise { 36 | if (isRequestOptions(query)) { 37 | return this.retrieve(creditProductToken, {}, query); 38 | } 39 | return this._client.get(`/v1/credit_products/${creditProductToken}/prime_rates`, { query, ...options }); 40 | } 41 | } 42 | 43 | export interface PrimeRateRetrieveResponse { 44 | /** 45 | * List of prime rates 46 | */ 47 | data: Array; 48 | 49 | /** 50 | * Whether there are more prime rates 51 | */ 52 | has_more: boolean; 53 | } 54 | 55 | export namespace PrimeRateRetrieveResponse { 56 | export interface Data { 57 | /** 58 | * Date the rate goes into effect 59 | */ 60 | effective_date: string; 61 | 62 | /** 63 | * The rate in decimal format 64 | */ 65 | rate: string; 66 | } 67 | } 68 | 69 | export interface PrimeRateCreateParams { 70 | /** 71 | * Date the rate goes into effect 72 | */ 73 | effective_date: string; 74 | 75 | /** 76 | * The rate in decimal format 77 | */ 78 | rate: string; 79 | } 80 | 81 | export interface PrimeRateRetrieveParams { 82 | /** 83 | * The effective date that the prime rates ends before 84 | */ 85 | ending_before?: string; 86 | 87 | /** 88 | * The effective date that the prime rate starts after 89 | */ 90 | starting_after?: string; 91 | } 92 | 93 | export declare namespace PrimeRates { 94 | export { 95 | type PrimeRateRetrieveResponse as PrimeRateRetrieveResponse, 96 | type PrimeRateCreateParams as PrimeRateCreateParams, 97 | type PrimeRateRetrieveParams as PrimeRateRetrieveParams, 98 | }; 99 | } 100 | -------------------------------------------------------------------------------- /src/resources/digital-card-art.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../resource'; 4 | import { isRequestOptions } from '../core'; 5 | import * as Core from '../core'; 6 | import { CursorPage, type CursorPageParams } from '../pagination'; 7 | 8 | export class DigitalCardArtResource extends APIResource { 9 | /** 10 | * Get digital card art by token. 11 | */ 12 | retrieve(digitalCardArtToken: string, options?: Core.RequestOptions): Core.APIPromise { 13 | return this._client.get(`/v1/digital_card_art/${digitalCardArtToken}`, options); 14 | } 15 | 16 | /** 17 | * List digital card art. 18 | */ 19 | list( 20 | query?: DigitalCardArtListParams, 21 | options?: Core.RequestOptions, 22 | ): Core.PagePromise; 23 | list(options?: Core.RequestOptions): Core.PagePromise; 24 | list( 25 | query: DigitalCardArtListParams | Core.RequestOptions = {}, 26 | options?: Core.RequestOptions, 27 | ): Core.PagePromise { 28 | if (isRequestOptions(query)) { 29 | return this.list({}, query); 30 | } 31 | return this._client.getAPIList('/v1/digital_card_art', DigitalCardArtsCursorPage, { query, ...options }); 32 | } 33 | } 34 | 35 | export class DigitalCardArtsCursorPage extends CursorPage {} 36 | 37 | export interface DigitalCardArt { 38 | /** 39 | * Globally unique identifier for the card art. 40 | */ 41 | token: string; 42 | 43 | /** 44 | * Globally unique identifier for the card program. 45 | */ 46 | card_program_token: string; 47 | 48 | /** 49 | * Timestamp of when card art was created. 50 | */ 51 | created: string; 52 | 53 | /** 54 | * Description of the card art. 55 | */ 56 | description: string; 57 | 58 | /** 59 | * Whether the card art is enabled. 60 | */ 61 | is_enabled: boolean; 62 | 63 | /** 64 | * Card network. 65 | */ 66 | network: 'MASTERCARD' | 'VISA'; 67 | 68 | /** 69 | * Whether the card art is the default card art to be added upon tokenization. 70 | */ 71 | is_card_program_default?: boolean; 72 | } 73 | 74 | export interface DigitalCardArtListParams extends CursorPageParams {} 75 | 76 | DigitalCardArtResource.DigitalCardArtsCursorPage = DigitalCardArtsCursorPage; 77 | 78 | export declare namespace DigitalCardArtResource { 79 | export { 80 | type DigitalCardArt as DigitalCardArt, 81 | DigitalCardArtsCursorPage as DigitalCardArtsCursorPage, 82 | type DigitalCardArtListParams as DigitalCardArtListParams, 83 | }; 84 | } 85 | -------------------------------------------------------------------------------- /src/resources/events.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './events/index'; 4 | -------------------------------------------------------------------------------- /src/resources/events/event-subscriptions.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | 6 | export class EventSubscriptions extends APIResource { 7 | /** 8 | * Resend an event to an event subscription. 9 | */ 10 | resend( 11 | eventToken: string, 12 | eventSubscriptionToken: string, 13 | options?: Core.RequestOptions, 14 | ): Core.APIPromise { 15 | return this._client.post( 16 | `/v1/events/${eventToken}/event_subscriptions/${eventSubscriptionToken}/resend`, 17 | options, 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/resources/events/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { EventSubscriptions } from './event-subscriptions'; 4 | export { 5 | EventSubscriptionsCursorPage, 6 | MessageAttemptsCursorPage, 7 | EventsCursorPage, 8 | Events, 9 | type Event, 10 | type EventSubscription, 11 | type MessageAttempt, 12 | type EventListParams, 13 | type EventListAttemptsParams, 14 | } from './events'; 15 | export { 16 | Subscriptions, 17 | type SubscriptionRetrieveSecretResponse, 18 | type SubscriptionCreateParams, 19 | type SubscriptionUpdateParams, 20 | type SubscriptionListParams, 21 | type SubscriptionListAttemptsParams, 22 | type SubscriptionRecoverParams, 23 | type SubscriptionReplayMissingParams, 24 | type SubscriptionSendSimulatedExampleParams, 25 | } from './subscriptions'; 26 | -------------------------------------------------------------------------------- /src/resources/external-bank-accounts.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './external-bank-accounts/index'; 4 | -------------------------------------------------------------------------------- /src/resources/external-bank-accounts/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | ExternalBankAccountListResponsesCursorPage, 5 | ExternalBankAccounts, 6 | type ExternalBankAccountAddress, 7 | type OwnerType, 8 | type VerificationMethod, 9 | type ExternalBankAccountCreateResponse, 10 | type ExternalBankAccountRetrieveResponse, 11 | type ExternalBankAccountUpdateResponse, 12 | type ExternalBankAccountListResponse, 13 | type ExternalBankAccountRetryMicroDepositsResponse, 14 | type ExternalBankAccountRetryPrenoteResponse, 15 | type ExternalBankAccountCreateParams, 16 | type ExternalBankAccountUpdateParams, 17 | type ExternalBankAccountListParams, 18 | type ExternalBankAccountRetryMicroDepositsParams, 19 | type ExternalBankAccountRetryPrenoteParams, 20 | } from './external-bank-accounts'; 21 | export { 22 | MicroDeposits, 23 | type MicroDepositCreateResponse, 24 | type MicroDepositCreateParams, 25 | } from './micro-deposits'; 26 | -------------------------------------------------------------------------------- /src/resources/financial-accounts.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './financial-accounts/index'; 4 | -------------------------------------------------------------------------------- /src/resources/financial-accounts/credit-configuration.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import { isRequestOptions } from '../../core'; 5 | import * as Core from '../../core'; 6 | 7 | export class CreditConfiguration extends APIResource { 8 | /** 9 | * Get an Account's credit configuration 10 | * 11 | * @example 12 | * ```ts 13 | * const financialAccountCreditConfig = 14 | * await client.financialAccounts.creditConfiguration.retrieve( 15 | * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 16 | * ); 17 | * ``` 18 | */ 19 | retrieve( 20 | financialAccountToken: string, 21 | options?: Core.RequestOptions, 22 | ): Core.APIPromise { 23 | return this._client.get(`/v1/financial_accounts/${financialAccountToken}/credit_configuration`, options); 24 | } 25 | 26 | /** 27 | * Update an account's credit configuration 28 | * 29 | * @example 30 | * ```ts 31 | * const financialAccountCreditConfig = 32 | * await client.financialAccounts.creditConfiguration.update( 33 | * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 34 | * ); 35 | * ``` 36 | */ 37 | update( 38 | financialAccountToken: string, 39 | body?: CreditConfigurationUpdateParams, 40 | options?: Core.RequestOptions, 41 | ): Core.APIPromise; 42 | update( 43 | financialAccountToken: string, 44 | options?: Core.RequestOptions, 45 | ): Core.APIPromise; 46 | update( 47 | financialAccountToken: string, 48 | body: CreditConfigurationUpdateParams | Core.RequestOptions = {}, 49 | options?: Core.RequestOptions, 50 | ): Core.APIPromise { 51 | if (isRequestOptions(body)) { 52 | return this.update(financialAccountToken, {}, body); 53 | } 54 | return this._client.patch(`/v1/financial_accounts/${financialAccountToken}/credit_configuration`, { 55 | body, 56 | ...options, 57 | }); 58 | } 59 | } 60 | 61 | export interface FinancialAccountCreditConfig { 62 | /** 63 | * Globally unique identifier for the account 64 | */ 65 | account_token: string; 66 | 67 | /** 68 | * Reason for the financial account being marked as Charged Off 69 | */ 70 | charged_off_reason: 'DELINQUENT' | 'FRAUD' | null; 71 | 72 | credit_limit: number | null; 73 | 74 | /** 75 | * Globally unique identifier for the credit product 76 | */ 77 | credit_product_token: string | null; 78 | 79 | external_bank_account_token: string | null; 80 | 81 | /** 82 | * State of the financial account 83 | */ 84 | financial_account_state: 'PENDING' | 'CURRENT' | 'DELINQUENT' | 'CHARGED_OFF'; 85 | 86 | is_spend_blocked: boolean; 87 | 88 | /** 89 | * Tier assigned to the financial account 90 | */ 91 | tier: string | null; 92 | } 93 | 94 | export interface CreditConfigurationUpdateParams { 95 | credit_limit?: number; 96 | 97 | /** 98 | * Globally unique identifier for the credit product 99 | */ 100 | credit_product_token?: string; 101 | 102 | external_bank_account_token?: string; 103 | 104 | /** 105 | * Tier to assign to a financial account 106 | */ 107 | tier?: string; 108 | } 109 | 110 | export declare namespace CreditConfiguration { 111 | export { 112 | type FinancialAccountCreditConfig as FinancialAccountCreditConfig, 113 | type CreditConfigurationUpdateParams as CreditConfigurationUpdateParams, 114 | }; 115 | } 116 | -------------------------------------------------------------------------------- /src/resources/financial-accounts/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | BalanceListResponsesSinglePage, 5 | Balances, 6 | type BalanceListResponse, 7 | type BalanceListParams, 8 | } from './balances'; 9 | export { 10 | CreditConfiguration, 11 | type FinancialAccountCreditConfig, 12 | type CreditConfigurationUpdateParams, 13 | } from './credit-configuration'; 14 | export { FinancialTransactions, type FinancialTransactionListParams } from './financial-transactions'; 15 | export { 16 | FinancialTransactionsSinglePage, 17 | FinancialAccountsSinglePage, 18 | FinancialAccounts, 19 | type FinancialAccount, 20 | type FinancialTransaction, 21 | type FinancialAccountCreateParams, 22 | type FinancialAccountUpdateParams, 23 | type FinancialAccountListParams, 24 | type FinancialAccountRegisterAccountNumberParams, 25 | type FinancialAccountUpdateStatusParams, 26 | } from './financial-accounts'; 27 | export { LoanTapesCursorPage, LoanTapes, type LoanTape, type LoanTapeListParams } from './loan-tapes'; 28 | export { 29 | StatementsCursorPage, 30 | Statements, 31 | type Statement, 32 | type StatementListParams, 33 | } from './statements/index'; 34 | -------------------------------------------------------------------------------- /src/resources/financial-accounts/statements.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './statements/index'; 4 | -------------------------------------------------------------------------------- /src/resources/financial-accounts/statements/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | StatementLineItemsDataCursorPage, 5 | LineItemListResponsesCursorPage, 6 | LineItems, 7 | type StatementLineItems, 8 | type LineItemListResponse, 9 | type LineItemListParams, 10 | } from './line-items'; 11 | export { StatementsCursorPage, Statements, type Statement, type StatementListParams } from './statements'; 12 | -------------------------------------------------------------------------------- /src/resources/fraud.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './fraud/index'; 4 | -------------------------------------------------------------------------------- /src/resources/fraud/fraud.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as TransactionsAPI from './transactions'; 5 | import { 6 | TransactionReportParams, 7 | TransactionReportResponse, 8 | TransactionRetrieveResponse, 9 | Transactions, 10 | } from './transactions'; 11 | 12 | export class Fraud extends APIResource { 13 | transactions: TransactionsAPI.Transactions = new TransactionsAPI.Transactions(this._client); 14 | } 15 | 16 | Fraud.Transactions = Transactions; 17 | 18 | export declare namespace Fraud { 19 | export { 20 | Transactions as Transactions, 21 | type TransactionRetrieveResponse as TransactionRetrieveResponse, 22 | type TransactionReportResponse as TransactionReportResponse, 23 | type TransactionReportParams as TransactionReportParams, 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /src/resources/fraud/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Fraud } from './fraud'; 4 | export { 5 | Transactions, 6 | type TransactionRetrieveResponse, 7 | type TransactionReportResponse, 8 | type TransactionReportParams, 9 | } from './transactions'; 10 | -------------------------------------------------------------------------------- /src/resources/reports.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './reports/index'; 4 | -------------------------------------------------------------------------------- /src/resources/reports/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Settlement, type SettlementListDetailsParams } from './settlement/index'; 4 | export { 5 | SettlementDetailsCursorPage, 6 | Reports, 7 | type SettlementDetail, 8 | type SettlementReport, 9 | type SettlementSummaryDetails, 10 | } from './reports'; 11 | -------------------------------------------------------------------------------- /src/resources/reports/settlement.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './settlement/index'; 4 | -------------------------------------------------------------------------------- /src/resources/reports/settlement/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | NetworkTotalListResponsesCursorPage, 5 | NetworkTotals, 6 | type NetworkTotalRetrieveResponse, 7 | type NetworkTotalListResponse, 8 | type NetworkTotalListParams, 9 | } from './network-totals'; 10 | export { Settlement, type SettlementListDetailsParams } from './settlement'; 11 | -------------------------------------------------------------------------------- /src/resources/reports/settlement/settlement.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import { isRequestOptions } from '../../../core'; 5 | import * as Core from '../../../core'; 6 | import * as ReportsAPI from '../reports'; 7 | import { SettlementDetailsCursorPage } from '../reports'; 8 | import * as NetworkTotalsAPI from './network-totals'; 9 | import { 10 | NetworkTotalListParams, 11 | NetworkTotalListResponse, 12 | NetworkTotalListResponsesCursorPage, 13 | NetworkTotalRetrieveResponse, 14 | NetworkTotals, 15 | } from './network-totals'; 16 | import { type CursorPageParams } from '../../../pagination'; 17 | 18 | export class Settlement extends APIResource { 19 | networkTotals: NetworkTotalsAPI.NetworkTotals = new NetworkTotalsAPI.NetworkTotals(this._client); 20 | 21 | /** 22 | * List details. 23 | * 24 | * @example 25 | * ```ts 26 | * // Automatically fetches more pages as needed. 27 | * for await (const settlementDetail of client.reports.settlement.listDetails( 28 | * '2023-09-01', 29 | * )) { 30 | * // ... 31 | * } 32 | * ``` 33 | */ 34 | listDetails( 35 | reportDate: string, 36 | query?: SettlementListDetailsParams, 37 | options?: Core.RequestOptions, 38 | ): Core.PagePromise; 39 | listDetails( 40 | reportDate: string, 41 | options?: Core.RequestOptions, 42 | ): Core.PagePromise; 43 | listDetails( 44 | reportDate: string, 45 | query: SettlementListDetailsParams | Core.RequestOptions = {}, 46 | options?: Core.RequestOptions, 47 | ): Core.PagePromise { 48 | if (isRequestOptions(query)) { 49 | return this.listDetails(reportDate, {}, query); 50 | } 51 | return this._client.getAPIList( 52 | `/v1/reports/settlement/details/${reportDate}`, 53 | SettlementDetailsCursorPage, 54 | { query, ...options }, 55 | ); 56 | } 57 | 58 | /** 59 | * Get the settlement report for a specified report date. Not available in sandbox. 60 | * 61 | * @example 62 | * ```ts 63 | * const settlementReport = 64 | * await client.reports.settlement.summary('2023-09-01'); 65 | * ``` 66 | */ 67 | summary(reportDate: string, options?: Core.RequestOptions): Core.APIPromise { 68 | return this._client.get(`/v1/reports/settlement/summary/${reportDate}`, options); 69 | } 70 | } 71 | 72 | export interface SettlementListDetailsParams extends CursorPageParams {} 73 | 74 | Settlement.NetworkTotals = NetworkTotals; 75 | Settlement.NetworkTotalListResponsesCursorPage = NetworkTotalListResponsesCursorPage; 76 | 77 | export declare namespace Settlement { 78 | export { type SettlementListDetailsParams as SettlementListDetailsParams }; 79 | 80 | export { 81 | NetworkTotals as NetworkTotals, 82 | type NetworkTotalRetrieveResponse as NetworkTotalRetrieveResponse, 83 | type NetworkTotalListResponse as NetworkTotalListResponse, 84 | NetworkTotalListResponsesCursorPage as NetworkTotalListResponsesCursorPage, 85 | type NetworkTotalListParams as NetworkTotalListParams, 86 | }; 87 | } 88 | 89 | export { SettlementDetailsCursorPage }; 90 | -------------------------------------------------------------------------------- /src/resources/responder-endpoints.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../resource'; 4 | import * as Core from '../core'; 5 | 6 | export class ResponderEndpoints extends APIResource { 7 | /** 8 | * Enroll a responder endpoint 9 | */ 10 | create( 11 | body: ResponderEndpointCreateParams, 12 | options?: Core.RequestOptions, 13 | ): Core.APIPromise { 14 | return this._client.post('/v1/responder_endpoints', { body, ...options }); 15 | } 16 | 17 | /** 18 | * Disenroll a responder endpoint 19 | */ 20 | del(params: ResponderEndpointDeleteParams, options?: Core.RequestOptions): Core.APIPromise { 21 | const { type } = params; 22 | return this._client.delete('/v1/responder_endpoints', { query: { type }, ...options }); 23 | } 24 | 25 | /** 26 | * Check the status of a responder endpoint 27 | */ 28 | checkStatus( 29 | query: ResponderEndpointCheckStatusParams, 30 | options?: Core.RequestOptions, 31 | ): Core.APIPromise { 32 | return this._client.get('/v1/responder_endpoints', { query, ...options }); 33 | } 34 | } 35 | 36 | export interface ResponderEndpointStatus { 37 | /** 38 | * True if the instance has an endpoint enrolled. 39 | */ 40 | enrolled?: boolean; 41 | 42 | /** 43 | * The URL of the currently enrolled endpoint or null. 44 | */ 45 | url?: string | null; 46 | } 47 | 48 | export interface ResponderEndpointCreateResponse { 49 | /** 50 | * True if the endpoint was enrolled successfully. 51 | */ 52 | enrolled?: boolean; 53 | } 54 | 55 | export interface ResponderEndpointCreateParams { 56 | /** 57 | * The type of the endpoint. 58 | */ 59 | type?: 'AUTH_STREAM_ACCESS' | 'THREE_DS_DECISIONING' | 'TOKENIZATION_DECISIONING'; 60 | 61 | /** 62 | * The URL for the responder endpoint (must be http(s)). 63 | */ 64 | url?: string; 65 | } 66 | 67 | export interface ResponderEndpointDeleteParams { 68 | /** 69 | * The type of the endpoint. 70 | */ 71 | type: 'AUTH_STREAM_ACCESS' | 'THREE_DS_DECISIONING' | 'TOKENIZATION_DECISIONING'; 72 | } 73 | 74 | export interface ResponderEndpointCheckStatusParams { 75 | /** 76 | * The type of the endpoint. 77 | */ 78 | type: 'AUTH_STREAM_ACCESS' | 'THREE_DS_DECISIONING' | 'TOKENIZATION_DECISIONING'; 79 | } 80 | 81 | export declare namespace ResponderEndpoints { 82 | export { 83 | type ResponderEndpointStatus as ResponderEndpointStatus, 84 | type ResponderEndpointCreateResponse as ResponderEndpointCreateResponse, 85 | type ResponderEndpointCreateParams as ResponderEndpointCreateParams, 86 | type ResponderEndpointDeleteParams as ResponderEndpointDeleteParams, 87 | type ResponderEndpointCheckStatusParams as ResponderEndpointCheckStatusParams, 88 | }; 89 | } 90 | -------------------------------------------------------------------------------- /src/resources/three-ds.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './three-ds/index'; 4 | -------------------------------------------------------------------------------- /src/resources/three-ds/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | Authentication, 5 | type AuthenticationRetrieveResponse, 6 | type AuthenticationSimulateResponse, 7 | type AuthenticationSimulateParams, 8 | type AuthenticationSimulateOtpEntryParams, 9 | } from './authentication'; 10 | export { 11 | Decisioning, 12 | type ChallengeResponse, 13 | type ChallengeResult, 14 | type DecisioningRetrieveSecretResponse, 15 | type DecisioningChallengeResponseParams, 16 | } from './decisioning'; 17 | export { ThreeDS } from './three-ds'; 18 | -------------------------------------------------------------------------------- /src/resources/three-ds/three-ds.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as AuthenticationAPI from './authentication'; 5 | import { 6 | Authentication, 7 | AuthenticationRetrieveResponse, 8 | AuthenticationSimulateOtpEntryParams, 9 | AuthenticationSimulateParams, 10 | AuthenticationSimulateResponse, 11 | } from './authentication'; 12 | import * as DecisioningAPI from './decisioning'; 13 | import { 14 | ChallengeResponse, 15 | ChallengeResult, 16 | Decisioning, 17 | DecisioningChallengeResponseParams, 18 | DecisioningRetrieveSecretResponse, 19 | } from './decisioning'; 20 | 21 | export class ThreeDS extends APIResource { 22 | authentication: AuthenticationAPI.Authentication = new AuthenticationAPI.Authentication(this._client); 23 | decisioning: DecisioningAPI.Decisioning = new DecisioningAPI.Decisioning(this._client); 24 | } 25 | 26 | ThreeDS.Authentication = Authentication; 27 | ThreeDS.Decisioning = Decisioning; 28 | 29 | export declare namespace ThreeDS { 30 | export { 31 | Authentication as Authentication, 32 | type AuthenticationRetrieveResponse as AuthenticationRetrieveResponse, 33 | type AuthenticationSimulateResponse as AuthenticationSimulateResponse, 34 | type AuthenticationSimulateParams as AuthenticationSimulateParams, 35 | type AuthenticationSimulateOtpEntryParams as AuthenticationSimulateOtpEntryParams, 36 | }; 37 | 38 | export { 39 | Decisioning as Decisioning, 40 | type ChallengeResponse as ChallengeResponse, 41 | type ChallengeResult as ChallengeResult, 42 | type DecisioningRetrieveSecretResponse as DecisioningRetrieveSecretResponse, 43 | type DecisioningChallengeResponseParams as DecisioningChallengeResponseParams, 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /src/resources/tokenization-decisioning.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../resource'; 4 | import * as Core from '../core'; 5 | 6 | export class TokenizationDecisioning extends APIResource { 7 | /** 8 | * Retrieve the Tokenization Decisioning secret key. If one does not exist your 9 | * program yet, calling this endpoint will create one for you. The headers of the 10 | * Tokenization Decisioning request will contain a hmac signature which you can use 11 | * to verify requests originate from Lithic. See 12 | * [this page](https://docs.lithic.com/docs/events-api#verifying-webhooks) for more 13 | * detail about verifying Tokenization Decisioning requests. 14 | */ 15 | retrieveSecret(options?: Core.RequestOptions): Core.APIPromise { 16 | return this._client.get('/v1/tokenization_decisioning/secret', options); 17 | } 18 | 19 | /** 20 | * Generate a new Tokenization Decisioning secret key. The old Tokenization 21 | * Decisioning secret key will be deactivated 24 hours after a successful request 22 | * to this endpoint. 23 | */ 24 | rotateSecret(options?: Core.RequestOptions): Core.APIPromise { 25 | return this._client.post('/v1/tokenization_decisioning/secret/rotate', options); 26 | } 27 | } 28 | 29 | export interface TokenizationSecret { 30 | /** 31 | * The Tokenization Decisioning HMAC secret 32 | */ 33 | secret?: string; 34 | } 35 | 36 | export interface TokenizationDecisioningRotateSecretResponse { 37 | /** 38 | * The new Tokenization Decisioning HMAC secret 39 | */ 40 | secret?: string; 41 | } 42 | 43 | export declare namespace TokenizationDecisioning { 44 | export { 45 | type TokenizationSecret as TokenizationSecret, 46 | type TokenizationDecisioningRotateSecretResponse as TokenizationDecisioningRotateSecretResponse, 47 | }; 48 | } 49 | -------------------------------------------------------------------------------- /src/resources/top-level.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export interface APIStatus { 4 | message?: string; 5 | } 6 | 7 | export declare namespace TopLevel { 8 | export { type APIStatus as APIStatus }; 9 | } 10 | -------------------------------------------------------------------------------- /src/resources/transactions.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './transactions/index'; 4 | -------------------------------------------------------------------------------- /src/resources/transactions/enhanced-commercial-data.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | import * as EventsEnhancedCommercialDataAPI from './events/enhanced-commercial-data'; 6 | 7 | export class EnhancedCommercialData extends APIResource { 8 | /** 9 | * Get all L2/L3 enhanced commercial data associated with a transaction. Not 10 | * available in sandbox. 11 | * 12 | * @example 13 | * ```ts 14 | * const enhancedCommercialData = 15 | * await client.transactions.enhancedCommercialData.retrieve( 16 | * '00000000-0000-0000-0000-000000000000', 17 | * ); 18 | * ``` 19 | */ 20 | retrieve( 21 | transactionToken: string, 22 | options?: Core.RequestOptions, 23 | ): Core.APIPromise { 24 | return this._client.get(`/v1/transactions/${transactionToken}/enhanced_commercial_data`, options); 25 | } 26 | } 27 | 28 | export interface EnhancedCommercialDataRetrieveResponse { 29 | data: Array; 30 | } 31 | 32 | export declare namespace EnhancedCommercialData { 33 | export { type EnhancedCommercialDataRetrieveResponse as EnhancedCommercialDataRetrieveResponse }; 34 | } 35 | -------------------------------------------------------------------------------- /src/resources/transactions/events.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export * from './events/index'; 4 | -------------------------------------------------------------------------------- /src/resources/transactions/events/events.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as EnhancedCommercialDataAPI from './enhanced-commercial-data'; 5 | import { EnhancedCommercialData, EnhancedData } from './enhanced-commercial-data'; 6 | 7 | export class Events extends APIResource { 8 | enhancedCommercialData: EnhancedCommercialDataAPI.EnhancedCommercialData = 9 | new EnhancedCommercialDataAPI.EnhancedCommercialData(this._client); 10 | } 11 | 12 | Events.EnhancedCommercialData = EnhancedCommercialData; 13 | 14 | export declare namespace Events { 15 | export { EnhancedCommercialData as EnhancedCommercialData, type EnhancedData as EnhancedData }; 16 | } 17 | -------------------------------------------------------------------------------- /src/resources/transactions/events/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { EnhancedCommercialData, type EnhancedData } from './enhanced-commercial-data'; 4 | export { Events } from './events'; 5 | -------------------------------------------------------------------------------- /src/resources/transactions/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | EnhancedCommercialData, 5 | type EnhancedCommercialDataRetrieveResponse, 6 | } from './enhanced-commercial-data'; 7 | export { Events } from './events/index'; 8 | export { 9 | TransactionsCursorPage, 10 | Transactions, 11 | type Transaction, 12 | type TransactionSimulateAuthorizationResponse, 13 | type TransactionSimulateAuthorizationAdviceResponse, 14 | type TransactionSimulateClearingResponse, 15 | type TransactionSimulateCreditAuthorizationResponse, 16 | type TransactionSimulateReturnResponse, 17 | type TransactionSimulateReturnReversalResponse, 18 | type TransactionSimulateVoidResponse, 19 | type TransactionListParams, 20 | type TransactionSimulateAuthorizationParams, 21 | type TransactionSimulateAuthorizationAdviceParams, 22 | type TransactionSimulateClearingParams, 23 | type TransactionSimulateCreditAuthorizationParams, 24 | type TransactionSimulateReturnParams, 25 | type TransactionSimulateReturnReversalParams, 26 | type TransactionSimulateVoidParams, 27 | } from './transactions'; 28 | -------------------------------------------------------------------------------- /src/shims/node.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import * as types from '../_shims/node-types'; 3 | import { setShims } from '../_shims/registry'; 4 | import { getRuntime } from '../_shims/node-runtime'; 5 | setShims(getRuntime()); 6 | 7 | declare module '../_shims/manual-types' { 8 | export namespace manual { 9 | // @ts-ignore 10 | export type Agent = types.Agent; 11 | // @ts-ignore 12 | export import fetch = types.fetch; 13 | // @ts-ignore 14 | export type Request = types.Request; 15 | // @ts-ignore 16 | export type RequestInfo = types.RequestInfo; 17 | // @ts-ignore 18 | export type RequestInit = types.RequestInit; 19 | // @ts-ignore 20 | export type Response = types.Response; 21 | // @ts-ignore 22 | export type ResponseInit = types.ResponseInit; 23 | // @ts-ignore 24 | export type ResponseType = types.ResponseType; 25 | // @ts-ignore 26 | export type BodyInit = types.BodyInit; 27 | // @ts-ignore 28 | export type Headers = types.Headers; 29 | // @ts-ignore 30 | export type HeadersInit = types.HeadersInit; 31 | // @ts-ignore 32 | export type BlobPropertyBag = types.BlobPropertyBag; 33 | // @ts-ignore 34 | export type FilePropertyBag = types.FilePropertyBag; 35 | // @ts-ignore 36 | export type FileFromPathOptions = types.FileFromPathOptions; 37 | // @ts-ignore 38 | export import FormData = types.FormData; 39 | // @ts-ignore 40 | export import File = types.File; 41 | // @ts-ignore 42 | export import Blob = types.Blob; 43 | // @ts-ignore 44 | export type Readable = types.Readable; 45 | // @ts-ignore 46 | export type FsReadStream = types.FsReadStream; 47 | // @ts-ignore 48 | export import ReadableStream = types.ReadableStream; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/shims/web.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import * as types from '../_shims/web-types'; 3 | import { setShims } from '../_shims/registry'; 4 | import { getRuntime } from '../_shims/web-runtime'; 5 | setShims(getRuntime({ manuallyImported: true })); 6 | 7 | declare module '../_shims/manual-types' { 8 | export namespace manual { 9 | // @ts-ignore 10 | export type Agent = types.Agent; 11 | // @ts-ignore 12 | export import fetch = types.fetch; 13 | // @ts-ignore 14 | export type Request = types.Request; 15 | // @ts-ignore 16 | export type RequestInfo = types.RequestInfo; 17 | // @ts-ignore 18 | export type RequestInit = types.RequestInit; 19 | // @ts-ignore 20 | export type Response = types.Response; 21 | // @ts-ignore 22 | export type ResponseInit = types.ResponseInit; 23 | // @ts-ignore 24 | export type ResponseType = types.ResponseType; 25 | // @ts-ignore 26 | export type BodyInit = types.BodyInit; 27 | // @ts-ignore 28 | export type Headers = types.Headers; 29 | // @ts-ignore 30 | export type HeadersInit = types.HeadersInit; 31 | // @ts-ignore 32 | export type BlobPropertyBag = types.BlobPropertyBag; 33 | // @ts-ignore 34 | export type FilePropertyBag = types.FilePropertyBag; 35 | // @ts-ignore 36 | export type FileFromPathOptions = types.FileFromPathOptions; 37 | // @ts-ignore 38 | export import FormData = types.FormData; 39 | // @ts-ignore 40 | export import File = types.File; 41 | // @ts-ignore 42 | export import Blob = types.Blob; 43 | // @ts-ignore 44 | export type Readable = types.Readable; 45 | // @ts-ignore 46 | export type FsReadStream = types.FsReadStream; 47 | // @ts-ignore 48 | export import ReadableStream = types.ReadableStream; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/version.ts: -------------------------------------------------------------------------------- 1 | export const VERSION = '0.109.0'; // x-release-please-version 2 | -------------------------------------------------------------------------------- /tests/api-resources/aggregate-balances.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource aggregateBalances', () => { 12 | test('list', async () => { 13 | const responsePromise = client.aggregateBalances.list(); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('list: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect(client.aggregateBalances.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 26 | Lithic.NotFoundError, 27 | ); 28 | }); 29 | 30 | test('list: request options and params are passed correctly', async () => { 31 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 32 | await expect( 33 | client.aggregateBalances.list( 34 | { financial_account_type: 'ISSUING' }, 35 | { path: '/_stainless_unknown_path' }, 36 | ), 37 | ).rejects.toThrow(Lithic.NotFoundError); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /tests/api-resources/auth-rules/v2/backtests.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource backtests', () => { 12 | test('create', async () => { 13 | const responsePromise = client.authRules.v2.backtests.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {}); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('retrieve', async () => { 24 | const responsePromise = client.authRules.v2.backtests.retrieve( 25 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 26 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 27 | ); 28 | const rawResponse = await responsePromise.asResponse(); 29 | expect(rawResponse).toBeInstanceOf(Response); 30 | const response = await responsePromise; 31 | expect(response).not.toBeInstanceOf(Response); 32 | const dataAndResponse = await responsePromise.withResponse(); 33 | expect(dataAndResponse.data).toBe(response); 34 | expect(dataAndResponse.response).toBe(rawResponse); 35 | }); 36 | 37 | test('retrieve: request options instead of params are passed correctly', async () => { 38 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 39 | await expect( 40 | client.authRules.v2.backtests.retrieve( 41 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 42 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 43 | { path: '/_stainless_unknown_path' }, 44 | ), 45 | ).rejects.toThrow(Lithic.NotFoundError); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /tests/api-resources/auth-stream-enrollment.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource authStreamEnrollment', () => { 12 | test('retrieveSecret', async () => { 13 | const responsePromise = client.authStreamEnrollment.retrieveSecret(); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('retrieveSecret: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.authStreamEnrollment.retrieveSecret({ path: '/_stainless_unknown_path' }), 27 | ).rejects.toThrow(Lithic.NotFoundError); 28 | }); 29 | 30 | test('rotateSecret', async () => { 31 | const responsePromise = client.authStreamEnrollment.rotateSecret(); 32 | const rawResponse = await responsePromise.asResponse(); 33 | expect(rawResponse).toBeInstanceOf(Response); 34 | const response = await responsePromise; 35 | expect(response).not.toBeInstanceOf(Response); 36 | const dataAndResponse = await responsePromise.withResponse(); 37 | expect(dataAndResponse.data).toBe(response); 38 | expect(dataAndResponse.response).toBe(rawResponse); 39 | }); 40 | 41 | test('rotateSecret: request options instead of params are passed correctly', async () => { 42 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 43 | await expect( 44 | client.authStreamEnrollment.rotateSecret({ path: '/_stainless_unknown_path' }), 45 | ).rejects.toThrow(Lithic.NotFoundError); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /tests/api-resources/balances.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource balances', () => { 12 | test('list', async () => { 13 | const responsePromise = client.balances.list(); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('list: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect(client.balances.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 26 | Lithic.NotFoundError, 27 | ); 28 | }); 29 | 30 | test('list: request options and params are passed correctly', async () => { 31 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 32 | await expect( 33 | client.balances.list( 34 | { 35 | account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 36 | balance_date: '2019-12-27T18:11:19.117Z', 37 | business_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 38 | financial_account_type: 'ISSUING', 39 | }, 40 | { path: '/_stainless_unknown_path' }, 41 | ), 42 | ).rejects.toThrow(Lithic.NotFoundError); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /tests/api-resources/card-programs.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource cardPrograms', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.cardPrograms.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('retrieve: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.cardPrograms.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 27 | path: '/_stainless_unknown_path', 28 | }), 29 | ).rejects.toThrow(Lithic.NotFoundError); 30 | }); 31 | 32 | test('list', async () => { 33 | const responsePromise = client.cardPrograms.list(); 34 | const rawResponse = await responsePromise.asResponse(); 35 | expect(rawResponse).toBeInstanceOf(Response); 36 | const response = await responsePromise; 37 | expect(response).not.toBeInstanceOf(Response); 38 | const dataAndResponse = await responsePromise.withResponse(); 39 | expect(dataAndResponse.data).toBe(response); 40 | expect(dataAndResponse.response).toBe(rawResponse); 41 | }); 42 | 43 | test('list: request options instead of params are passed correctly', async () => { 44 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 45 | await expect(client.cardPrograms.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 46 | Lithic.NotFoundError, 47 | ); 48 | }); 49 | 50 | test('list: request options and params are passed correctly', async () => { 51 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 52 | await expect( 53 | client.cardPrograms.list( 54 | { ending_before: 'ending_before', page_size: 1, starting_after: 'starting_after' }, 55 | { path: '/_stainless_unknown_path' }, 56 | ), 57 | ).rejects.toThrow(Lithic.NotFoundError); 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /tests/api-resources/cards/aggregate-balances.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource aggregateBalances', () => { 12 | test('list', async () => { 13 | const responsePromise = client.cards.aggregateBalances.list(); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('list: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect(client.cards.aggregateBalances.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 26 | Lithic.NotFoundError, 27 | ); 28 | }); 29 | 30 | test('list: request options and params are passed correctly', async () => { 31 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 32 | await expect( 33 | client.cards.aggregateBalances.list( 34 | { account_token: 'account_token', business_account_token: 'business_account_token' }, 35 | { path: '/_stainless_unknown_path' }, 36 | ), 37 | ).rejects.toThrow(Lithic.NotFoundError); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /tests/api-resources/cards/balances.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource balances', () => { 12 | test('list', async () => { 13 | const responsePromise = client.cards.balances.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('list: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.cards.balances.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 27 | path: '/_stainless_unknown_path', 28 | }), 29 | ).rejects.toThrow(Lithic.NotFoundError); 30 | }); 31 | 32 | test('list: request options and params are passed correctly', async () => { 33 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 34 | await expect( 35 | client.cards.balances.list( 36 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 37 | { 38 | balance_date: '2019-12-27T18:11:19.117Z', 39 | last_transaction_event_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 40 | }, 41 | { path: '/_stainless_unknown_path' }, 42 | ), 43 | ).rejects.toThrow(Lithic.NotFoundError); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /tests/api-resources/cards/financial-transactions.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource financialTransactions', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.cards.financialTransactions.retrieve( 14 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 15 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 16 | ); 17 | const rawResponse = await responsePromise.asResponse(); 18 | expect(rawResponse).toBeInstanceOf(Response); 19 | const response = await responsePromise; 20 | expect(response).not.toBeInstanceOf(Response); 21 | const dataAndResponse = await responsePromise.withResponse(); 22 | expect(dataAndResponse.data).toBe(response); 23 | expect(dataAndResponse.response).toBe(rawResponse); 24 | }); 25 | 26 | test('retrieve: request options instead of params are passed correctly', async () => { 27 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 28 | await expect( 29 | client.cards.financialTransactions.retrieve( 30 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 31 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 32 | { path: '/_stainless_unknown_path' }, 33 | ), 34 | ).rejects.toThrow(Lithic.NotFoundError); 35 | }); 36 | 37 | test('list', async () => { 38 | const responsePromise = client.cards.financialTransactions.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); 39 | const rawResponse = await responsePromise.asResponse(); 40 | expect(rawResponse).toBeInstanceOf(Response); 41 | const response = await responsePromise; 42 | expect(response).not.toBeInstanceOf(Response); 43 | const dataAndResponse = await responsePromise.withResponse(); 44 | expect(dataAndResponse.data).toBe(response); 45 | expect(dataAndResponse.response).toBe(rawResponse); 46 | }); 47 | 48 | test('list: request options instead of params are passed correctly', async () => { 49 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 50 | await expect( 51 | client.cards.financialTransactions.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 52 | path: '/_stainless_unknown_path', 53 | }), 54 | ).rejects.toThrow(Lithic.NotFoundError); 55 | }); 56 | 57 | test('list: request options and params are passed correctly', async () => { 58 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 59 | await expect( 60 | client.cards.financialTransactions.list( 61 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 62 | { 63 | begin: '2019-12-27T18:11:19.117Z', 64 | category: 'CARD', 65 | end: '2019-12-27T18:11:19.117Z', 66 | ending_before: 'ending_before', 67 | result: 'APPROVED', 68 | starting_after: 'starting_after', 69 | status: 'DECLINED', 70 | }, 71 | { path: '/_stainless_unknown_path' }, 72 | ), 73 | ).rejects.toThrow(Lithic.NotFoundError); 74 | }); 75 | }); 76 | -------------------------------------------------------------------------------- /tests/api-resources/credit-products/extended-credit.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource extendedCredit', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.creditProducts.extendedCredit.retrieve('credit_product_token'); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('retrieve: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.creditProducts.extendedCredit.retrieve('credit_product_token', { 27 | path: '/_stainless_unknown_path', 28 | }), 29 | ).rejects.toThrow(Lithic.NotFoundError); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /tests/api-resources/credit-products/prime-rates.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource primeRates', () => { 12 | test('create: only required params', async () => { 13 | const responsePromise = client.creditProducts.primeRates.create('credit_product_token', { 14 | effective_date: '2019-12-27', 15 | rate: 'rate', 16 | }); 17 | const rawResponse = await responsePromise.asResponse(); 18 | expect(rawResponse).toBeInstanceOf(Response); 19 | const response = await responsePromise; 20 | expect(response).not.toBeInstanceOf(Response); 21 | const dataAndResponse = await responsePromise.withResponse(); 22 | expect(dataAndResponse.data).toBe(response); 23 | expect(dataAndResponse.response).toBe(rawResponse); 24 | }); 25 | 26 | test('create: required and optional params', async () => { 27 | const response = await client.creditProducts.primeRates.create('credit_product_token', { 28 | effective_date: '2019-12-27', 29 | rate: 'rate', 30 | }); 31 | }); 32 | 33 | test('retrieve', async () => { 34 | const responsePromise = client.creditProducts.primeRates.retrieve('credit_product_token'); 35 | const rawResponse = await responsePromise.asResponse(); 36 | expect(rawResponse).toBeInstanceOf(Response); 37 | const response = await responsePromise; 38 | expect(response).not.toBeInstanceOf(Response); 39 | const dataAndResponse = await responsePromise.withResponse(); 40 | expect(dataAndResponse.data).toBe(response); 41 | expect(dataAndResponse.response).toBe(rawResponse); 42 | }); 43 | 44 | test('retrieve: request options instead of params are passed correctly', async () => { 45 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 46 | await expect( 47 | client.creditProducts.primeRates.retrieve('credit_product_token', { path: '/_stainless_unknown_path' }), 48 | ).rejects.toThrow(Lithic.NotFoundError); 49 | }); 50 | 51 | test('retrieve: request options and params are passed correctly', async () => { 52 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 53 | await expect( 54 | client.creditProducts.primeRates.retrieve( 55 | 'credit_product_token', 56 | { ending_before: '2019-12-27', starting_after: '2019-12-27' }, 57 | { path: '/_stainless_unknown_path' }, 58 | ), 59 | ).rejects.toThrow(Lithic.NotFoundError); 60 | }); 61 | }); 62 | -------------------------------------------------------------------------------- /tests/api-resources/digital-card-art.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource digitalCardArt', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.digitalCardArt.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('retrieve: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.digitalCardArt.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 27 | path: '/_stainless_unknown_path', 28 | }), 29 | ).rejects.toThrow(Lithic.NotFoundError); 30 | }); 31 | 32 | test('list', async () => { 33 | const responsePromise = client.digitalCardArt.list(); 34 | const rawResponse = await responsePromise.asResponse(); 35 | expect(rawResponse).toBeInstanceOf(Response); 36 | const response = await responsePromise; 37 | expect(response).not.toBeInstanceOf(Response); 38 | const dataAndResponse = await responsePromise.withResponse(); 39 | expect(dataAndResponse.data).toBe(response); 40 | expect(dataAndResponse.response).toBe(rawResponse); 41 | }); 42 | 43 | test('list: request options instead of params are passed correctly', async () => { 44 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 45 | await expect(client.digitalCardArt.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 46 | Lithic.NotFoundError, 47 | ); 48 | }); 49 | 50 | test('list: request options and params are passed correctly', async () => { 51 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 52 | await expect( 53 | client.digitalCardArt.list( 54 | { ending_before: 'ending_before', page_size: 1, starting_after: 'starting_after' }, 55 | { path: '/_stainless_unknown_path' }, 56 | ), 57 | ).rejects.toThrow(Lithic.NotFoundError); 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /tests/api-resources/events/event-subscriptions.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource eventSubscriptions', () => { 12 | test('resend', async () => { 13 | const responsePromise = client.events.eventSubscriptions.resend( 14 | 'event_token', 15 | 'event_subscription_token', 16 | ); 17 | const rawResponse = await responsePromise.asResponse(); 18 | expect(rawResponse).toBeInstanceOf(Response); 19 | const response = await responsePromise; 20 | expect(response).not.toBeInstanceOf(Response); 21 | const dataAndResponse = await responsePromise.withResponse(); 22 | expect(dataAndResponse.data).toBe(response); 23 | expect(dataAndResponse.response).toBe(rawResponse); 24 | }); 25 | 26 | test('resend: request options instead of params are passed correctly', async () => { 27 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 28 | await expect( 29 | client.events.eventSubscriptions.resend('event_token', 'event_subscription_token', { 30 | path: '/_stainless_unknown_path', 31 | }), 32 | ).rejects.toThrow(Lithic.NotFoundError); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /tests/api-resources/external-bank-accounts/micro-deposits.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource microDeposits', () => { 12 | test('create: only required params', async () => { 13 | const responsePromise = client.externalBankAccounts.microDeposits.create( 14 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 15 | { micro_deposits: [0, 0] }, 16 | ); 17 | const rawResponse = await responsePromise.asResponse(); 18 | expect(rawResponse).toBeInstanceOf(Response); 19 | const response = await responsePromise; 20 | expect(response).not.toBeInstanceOf(Response); 21 | const dataAndResponse = await responsePromise.withResponse(); 22 | expect(dataAndResponse.data).toBe(response); 23 | expect(dataAndResponse.response).toBe(rawResponse); 24 | }); 25 | 26 | test('create: required and optional params', async () => { 27 | const response = await client.externalBankAccounts.microDeposits.create( 28 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 29 | { micro_deposits: [0, 0] }, 30 | ); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /tests/api-resources/financial-accounts/balances.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource balances', () => { 12 | test('list', async () => { 13 | const responsePromise = client.financialAccounts.balances.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('list: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.financialAccounts.balances.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 27 | path: '/_stainless_unknown_path', 28 | }), 29 | ).rejects.toThrow(Lithic.NotFoundError); 30 | }); 31 | 32 | test('list: request options and params are passed correctly', async () => { 33 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 34 | await expect( 35 | client.financialAccounts.balances.list( 36 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 37 | { 38 | balance_date: '2019-12-27T18:11:19.117Z', 39 | last_transaction_event_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 40 | }, 41 | { path: '/_stainless_unknown_path' }, 42 | ), 43 | ).rejects.toThrow(Lithic.NotFoundError); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /tests/api-resources/financial-accounts/credit-configuration.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource creditConfiguration', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.financialAccounts.creditConfiguration.retrieve( 14 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 15 | ); 16 | const rawResponse = await responsePromise.asResponse(); 17 | expect(rawResponse).toBeInstanceOf(Response); 18 | const response = await responsePromise; 19 | expect(response).not.toBeInstanceOf(Response); 20 | const dataAndResponse = await responsePromise.withResponse(); 21 | expect(dataAndResponse.data).toBe(response); 22 | expect(dataAndResponse.response).toBe(rawResponse); 23 | }); 24 | 25 | test('retrieve: request options instead of params are passed correctly', async () => { 26 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 27 | await expect( 28 | client.financialAccounts.creditConfiguration.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 29 | path: '/_stainless_unknown_path', 30 | }), 31 | ).rejects.toThrow(Lithic.NotFoundError); 32 | }); 33 | 34 | test('update', async () => { 35 | const responsePromise = client.financialAccounts.creditConfiguration.update( 36 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 37 | ); 38 | const rawResponse = await responsePromise.asResponse(); 39 | expect(rawResponse).toBeInstanceOf(Response); 40 | const response = await responsePromise; 41 | expect(response).not.toBeInstanceOf(Response); 42 | const dataAndResponse = await responsePromise.withResponse(); 43 | expect(dataAndResponse.data).toBe(response); 44 | expect(dataAndResponse.response).toBe(rawResponse); 45 | }); 46 | 47 | test('update: request options instead of params are passed correctly', async () => { 48 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 49 | await expect( 50 | client.financialAccounts.creditConfiguration.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 51 | path: '/_stainless_unknown_path', 52 | }), 53 | ).rejects.toThrow(Lithic.NotFoundError); 54 | }); 55 | 56 | test('update: request options and params are passed correctly', async () => { 57 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 58 | await expect( 59 | client.financialAccounts.creditConfiguration.update( 60 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 61 | { 62 | credit_limit: 0, 63 | credit_product_token: 'credit_product_token', 64 | external_bank_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 65 | tier: 'x', 66 | }, 67 | { path: '/_stainless_unknown_path' }, 68 | ), 69 | ).rejects.toThrow(Lithic.NotFoundError); 70 | }); 71 | }); 72 | -------------------------------------------------------------------------------- /tests/api-resources/financial-accounts/financial-transactions.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource financialTransactions', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.financialAccounts.financialTransactions.retrieve( 14 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 15 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 16 | ); 17 | const rawResponse = await responsePromise.asResponse(); 18 | expect(rawResponse).toBeInstanceOf(Response); 19 | const response = await responsePromise; 20 | expect(response).not.toBeInstanceOf(Response); 21 | const dataAndResponse = await responsePromise.withResponse(); 22 | expect(dataAndResponse.data).toBe(response); 23 | expect(dataAndResponse.response).toBe(rawResponse); 24 | }); 25 | 26 | test('retrieve: request options instead of params are passed correctly', async () => { 27 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 28 | await expect( 29 | client.financialAccounts.financialTransactions.retrieve( 30 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 31 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 32 | { path: '/_stainless_unknown_path' }, 33 | ), 34 | ).rejects.toThrow(Lithic.NotFoundError); 35 | }); 36 | 37 | test('list', async () => { 38 | const responsePromise = client.financialAccounts.financialTransactions.list( 39 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 40 | ); 41 | const rawResponse = await responsePromise.asResponse(); 42 | expect(rawResponse).toBeInstanceOf(Response); 43 | const response = await responsePromise; 44 | expect(response).not.toBeInstanceOf(Response); 45 | const dataAndResponse = await responsePromise.withResponse(); 46 | expect(dataAndResponse.data).toBe(response); 47 | expect(dataAndResponse.response).toBe(rawResponse); 48 | }); 49 | 50 | test('list: request options instead of params are passed correctly', async () => { 51 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 52 | await expect( 53 | client.financialAccounts.financialTransactions.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 54 | path: '/_stainless_unknown_path', 55 | }), 56 | ).rejects.toThrow(Lithic.NotFoundError); 57 | }); 58 | 59 | test('list: request options and params are passed correctly', async () => { 60 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 61 | await expect( 62 | client.financialAccounts.financialTransactions.list( 63 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 64 | { 65 | begin: '2019-12-27T18:11:19.117Z', 66 | category: 'ACH', 67 | end: '2019-12-27T18:11:19.117Z', 68 | ending_before: 'ending_before', 69 | result: 'APPROVED', 70 | starting_after: 'starting_after', 71 | status: 'DECLINED', 72 | }, 73 | { path: '/_stainless_unknown_path' }, 74 | ), 75 | ).rejects.toThrow(Lithic.NotFoundError); 76 | }); 77 | }); 78 | -------------------------------------------------------------------------------- /tests/api-resources/financial-accounts/loan-tapes.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource loanTapes', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.financialAccounts.loanTapes.retrieve( 14 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 15 | 'loan_tape_token', 16 | ); 17 | const rawResponse = await responsePromise.asResponse(); 18 | expect(rawResponse).toBeInstanceOf(Response); 19 | const response = await responsePromise; 20 | expect(response).not.toBeInstanceOf(Response); 21 | const dataAndResponse = await responsePromise.withResponse(); 22 | expect(dataAndResponse.data).toBe(response); 23 | expect(dataAndResponse.response).toBe(rawResponse); 24 | }); 25 | 26 | test('retrieve: request options instead of params are passed correctly', async () => { 27 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 28 | await expect( 29 | client.financialAccounts.loanTapes.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'loan_tape_token', { 30 | path: '/_stainless_unknown_path', 31 | }), 32 | ).rejects.toThrow(Lithic.NotFoundError); 33 | }); 34 | 35 | test('list', async () => { 36 | const responsePromise = client.financialAccounts.loanTapes.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); 37 | const rawResponse = await responsePromise.asResponse(); 38 | expect(rawResponse).toBeInstanceOf(Response); 39 | const response = await responsePromise; 40 | expect(response).not.toBeInstanceOf(Response); 41 | const dataAndResponse = await responsePromise.withResponse(); 42 | expect(dataAndResponse.data).toBe(response); 43 | expect(dataAndResponse.response).toBe(rawResponse); 44 | }); 45 | 46 | test('list: request options instead of params are passed correctly', async () => { 47 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 48 | await expect( 49 | client.financialAccounts.loanTapes.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 50 | path: '/_stainless_unknown_path', 51 | }), 52 | ).rejects.toThrow(Lithic.NotFoundError); 53 | }); 54 | 55 | test('list: request options and params are passed correctly', async () => { 56 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 57 | await expect( 58 | client.financialAccounts.loanTapes.list( 59 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 60 | { 61 | begin: '2019-12-27', 62 | end: '2019-12-27', 63 | ending_before: 'ending_before', 64 | page_size: 1, 65 | starting_after: 'starting_after', 66 | }, 67 | { path: '/_stainless_unknown_path' }, 68 | ), 69 | ).rejects.toThrow(Lithic.NotFoundError); 70 | }); 71 | }); 72 | -------------------------------------------------------------------------------- /tests/api-resources/financial-accounts/statements/line-items.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource lineItems', () => { 12 | test('list', async () => { 13 | const responsePromise = client.financialAccounts.statements.lineItems.list( 14 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 15 | 'statement_token', 16 | ); 17 | const rawResponse = await responsePromise.asResponse(); 18 | expect(rawResponse).toBeInstanceOf(Response); 19 | const response = await responsePromise; 20 | expect(response).not.toBeInstanceOf(Response); 21 | const dataAndResponse = await responsePromise.withResponse(); 22 | expect(dataAndResponse.data).toBe(response); 23 | expect(dataAndResponse.response).toBe(rawResponse); 24 | }); 25 | 26 | test('list: request options instead of params are passed correctly', async () => { 27 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 28 | await expect( 29 | client.financialAccounts.statements.lineItems.list( 30 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 31 | 'statement_token', 32 | { path: '/_stainless_unknown_path' }, 33 | ), 34 | ).rejects.toThrow(Lithic.NotFoundError); 35 | }); 36 | 37 | test('list: request options and params are passed correctly', async () => { 38 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 39 | await expect( 40 | client.financialAccounts.statements.lineItems.list( 41 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 42 | 'statement_token', 43 | { ending_before: 'ending_before', page_size: 1, starting_after: 'starting_after' }, 44 | { path: '/_stainless_unknown_path' }, 45 | ), 46 | ).rejects.toThrow(Lithic.NotFoundError); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /tests/api-resources/financial-accounts/statements/statements.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource statements', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.financialAccounts.statements.retrieve( 14 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 15 | 'statement_token', 16 | ); 17 | const rawResponse = await responsePromise.asResponse(); 18 | expect(rawResponse).toBeInstanceOf(Response); 19 | const response = await responsePromise; 20 | expect(response).not.toBeInstanceOf(Response); 21 | const dataAndResponse = await responsePromise.withResponse(); 22 | expect(dataAndResponse.data).toBe(response); 23 | expect(dataAndResponse.response).toBe(rawResponse); 24 | }); 25 | 26 | test('retrieve: request options instead of params are passed correctly', async () => { 27 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 28 | await expect( 29 | client.financialAccounts.statements.retrieve( 30 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 31 | 'statement_token', 32 | { path: '/_stainless_unknown_path' }, 33 | ), 34 | ).rejects.toThrow(Lithic.NotFoundError); 35 | }); 36 | 37 | test('list', async () => { 38 | const responsePromise = client.financialAccounts.statements.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); 39 | const rawResponse = await responsePromise.asResponse(); 40 | expect(rawResponse).toBeInstanceOf(Response); 41 | const response = await responsePromise; 42 | expect(response).not.toBeInstanceOf(Response); 43 | const dataAndResponse = await responsePromise.withResponse(); 44 | expect(dataAndResponse.data).toBe(response); 45 | expect(dataAndResponse.response).toBe(rawResponse); 46 | }); 47 | 48 | test('list: request options instead of params are passed correctly', async () => { 49 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 50 | await expect( 51 | client.financialAccounts.statements.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 52 | path: '/_stainless_unknown_path', 53 | }), 54 | ).rejects.toThrow(Lithic.NotFoundError); 55 | }); 56 | 57 | test('list: request options and params are passed correctly', async () => { 58 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 59 | await expect( 60 | client.financialAccounts.statements.list( 61 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 62 | { 63 | begin: '2019-12-27', 64 | end: '2019-12-27', 65 | ending_before: 'ending_before', 66 | include_initial_statements: true, 67 | page_size: 1, 68 | starting_after: 'starting_after', 69 | }, 70 | { path: '/_stainless_unknown_path' }, 71 | ), 72 | ).rejects.toThrow(Lithic.NotFoundError); 73 | }); 74 | }); 75 | -------------------------------------------------------------------------------- /tests/api-resources/fraud/transactions.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource transactions', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.fraud.transactions.retrieve('00000000-0000-0000-0000-000000000000'); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('retrieve: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.fraud.transactions.retrieve('00000000-0000-0000-0000-000000000000', { 27 | path: '/_stainless_unknown_path', 28 | }), 29 | ).rejects.toThrow(Lithic.NotFoundError); 30 | }); 31 | 32 | test('report: only required params', async () => { 33 | const responsePromise = client.fraud.transactions.report('00000000-0000-0000-0000-000000000000', { 34 | fraud_status: 'SUSPECTED_FRAUD', 35 | }); 36 | const rawResponse = await responsePromise.asResponse(); 37 | expect(rawResponse).toBeInstanceOf(Response); 38 | const response = await responsePromise; 39 | expect(response).not.toBeInstanceOf(Response); 40 | const dataAndResponse = await responsePromise.withResponse(); 41 | expect(dataAndResponse.data).toBe(response); 42 | expect(dataAndResponse.response).toBe(rawResponse); 43 | }); 44 | 45 | test('report: required and optional params', async () => { 46 | const response = await client.fraud.transactions.report('00000000-0000-0000-0000-000000000000', { 47 | fraud_status: 'SUSPECTED_FRAUD', 48 | comment: 'comment', 49 | fraud_type: 'FIRST_PARTY_FRAUD', 50 | }); 51 | }); 52 | }); 53 | -------------------------------------------------------------------------------- /tests/api-resources/funding-events.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource fundingEvents', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.fundingEvents.retrieve('funding_event_token'); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('retrieve: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.fundingEvents.retrieve('funding_event_token', { path: '/_stainless_unknown_path' }), 27 | ).rejects.toThrow(Lithic.NotFoundError); 28 | }); 29 | 30 | test('list', async () => { 31 | const responsePromise = client.fundingEvents.list(); 32 | const rawResponse = await responsePromise.asResponse(); 33 | expect(rawResponse).toBeInstanceOf(Response); 34 | const response = await responsePromise; 35 | expect(response).not.toBeInstanceOf(Response); 36 | const dataAndResponse = await responsePromise.withResponse(); 37 | expect(dataAndResponse.data).toBe(response); 38 | expect(dataAndResponse.response).toBe(rawResponse); 39 | }); 40 | 41 | test('list: request options instead of params are passed correctly', async () => { 42 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 43 | await expect(client.fundingEvents.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 44 | Lithic.NotFoundError, 45 | ); 46 | }); 47 | 48 | test('list: request options and params are passed correctly', async () => { 49 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 50 | await expect( 51 | client.fundingEvents.list( 52 | { 53 | ending_before: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 54 | page_size: 1, 55 | starting_after: 'starting_after', 56 | }, 57 | { path: '/_stainless_unknown_path' }, 58 | ), 59 | ).rejects.toThrow(Lithic.NotFoundError); 60 | }); 61 | 62 | test('retrieveDetails', async () => { 63 | const responsePromise = client.fundingEvents.retrieveDetails('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); 64 | const rawResponse = await responsePromise.asResponse(); 65 | expect(rawResponse).toBeInstanceOf(Response); 66 | const response = await responsePromise; 67 | expect(response).not.toBeInstanceOf(Response); 68 | const dataAndResponse = await responsePromise.withResponse(); 69 | expect(dataAndResponse.data).toBe(response); 70 | expect(dataAndResponse.response).toBe(rawResponse); 71 | }); 72 | 73 | test('retrieveDetails: request options instead of params are passed correctly', async () => { 74 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 75 | await expect( 76 | client.fundingEvents.retrieveDetails('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 77 | path: '/_stainless_unknown_path', 78 | }), 79 | ).rejects.toThrow(Lithic.NotFoundError); 80 | }); 81 | }); 82 | -------------------------------------------------------------------------------- /tests/api-resources/reports/settlement/network-totals.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource networkTotals', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.reports.settlement.networkTotals.retrieve( 14 | '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 15 | ); 16 | const rawResponse = await responsePromise.asResponse(); 17 | expect(rawResponse).toBeInstanceOf(Response); 18 | const response = await responsePromise; 19 | expect(response).not.toBeInstanceOf(Response); 20 | const dataAndResponse = await responsePromise.withResponse(); 21 | expect(dataAndResponse.data).toBe(response); 22 | expect(dataAndResponse.response).toBe(rawResponse); 23 | }); 24 | 25 | test('retrieve: request options instead of params are passed correctly', async () => { 26 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 27 | await expect( 28 | client.reports.settlement.networkTotals.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 29 | path: '/_stainless_unknown_path', 30 | }), 31 | ).rejects.toThrow(Lithic.NotFoundError); 32 | }); 33 | 34 | test('list', async () => { 35 | const responsePromise = client.reports.settlement.networkTotals.list(); 36 | const rawResponse = await responsePromise.asResponse(); 37 | expect(rawResponse).toBeInstanceOf(Response); 38 | const response = await responsePromise; 39 | expect(response).not.toBeInstanceOf(Response); 40 | const dataAndResponse = await responsePromise.withResponse(); 41 | expect(dataAndResponse.data).toBe(response); 42 | expect(dataAndResponse.response).toBe(rawResponse); 43 | }); 44 | 45 | test('list: request options instead of params are passed correctly', async () => { 46 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 47 | await expect( 48 | client.reports.settlement.networkTotals.list({ path: '/_stainless_unknown_path' }), 49 | ).rejects.toThrow(Lithic.NotFoundError); 50 | }); 51 | 52 | test('list: request options and params are passed correctly', async () => { 53 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 54 | await expect( 55 | client.reports.settlement.networkTotals.list( 56 | { 57 | begin: '2019-12-27T18:11:19.117Z', 58 | end: '2019-12-27T18:11:19.117Z', 59 | ending_before: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 60 | institution_id: 'institution_id', 61 | network: 'VISA', 62 | page_size: 1, 63 | report_date: '2019-12-27', 64 | report_date_begin: '2019-12-27', 65 | report_date_end: '2019-12-27', 66 | settlement_institution_id: 'settlement_institution_id', 67 | starting_after: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 68 | }, 69 | { path: '/_stainless_unknown_path' }, 70 | ), 71 | ).rejects.toThrow(Lithic.NotFoundError); 72 | }); 73 | }); 74 | -------------------------------------------------------------------------------- /tests/api-resources/reports/settlement/settlement.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource settlement', () => { 12 | test('listDetails', async () => { 13 | const responsePromise = client.reports.settlement.listDetails('2023-09-01'); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('listDetails: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.reports.settlement.listDetails('2023-09-01', { path: '/_stainless_unknown_path' }), 27 | ).rejects.toThrow(Lithic.NotFoundError); 28 | }); 29 | 30 | test('listDetails: request options and params are passed correctly', async () => { 31 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 32 | await expect( 33 | client.reports.settlement.listDetails( 34 | '2023-09-01', 35 | { ending_before: 'ending_before', page_size: 1, starting_after: 'starting_after' }, 36 | { path: '/_stainless_unknown_path' }, 37 | ), 38 | ).rejects.toThrow(Lithic.NotFoundError); 39 | }); 40 | 41 | test('summary', async () => { 42 | const responsePromise = client.reports.settlement.summary('2023-09-01'); 43 | const rawResponse = await responsePromise.asResponse(); 44 | expect(rawResponse).toBeInstanceOf(Response); 45 | const response = await responsePromise; 46 | expect(response).not.toBeInstanceOf(Response); 47 | const dataAndResponse = await responsePromise.withResponse(); 48 | expect(dataAndResponse.data).toBe(response); 49 | expect(dataAndResponse.response).toBe(rawResponse); 50 | }); 51 | 52 | test('summary: request options instead of params are passed correctly', async () => { 53 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 54 | await expect( 55 | client.reports.settlement.summary('2023-09-01', { path: '/_stainless_unknown_path' }), 56 | ).rejects.toThrow(Lithic.NotFoundError); 57 | }); 58 | }); 59 | -------------------------------------------------------------------------------- /tests/api-resources/responder-endpoints.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource responderEndpoints', () => { 12 | test('create', async () => { 13 | const responsePromise = client.responderEndpoints.create({}); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | // Prism errors when accept header set but no request body is defined 24 | test.skip('del: only required params', async () => { 25 | const responsePromise = client.responderEndpoints.del({ type: 'AUTH_STREAM_ACCESS' }); 26 | const rawResponse = await responsePromise.asResponse(); 27 | expect(rawResponse).toBeInstanceOf(Response); 28 | const response = await responsePromise; 29 | expect(response).not.toBeInstanceOf(Response); 30 | const dataAndResponse = await responsePromise.withResponse(); 31 | expect(dataAndResponse.data).toBe(response); 32 | expect(dataAndResponse.response).toBe(rawResponse); 33 | }); 34 | 35 | // Prism errors when accept header set but no request body is defined 36 | test.skip('del: required and optional params', async () => { 37 | const response = await client.responderEndpoints.del({ type: 'AUTH_STREAM_ACCESS' }); 38 | }); 39 | 40 | test('checkStatus: only required params', async () => { 41 | const responsePromise = client.responderEndpoints.checkStatus({ type: 'AUTH_STREAM_ACCESS' }); 42 | const rawResponse = await responsePromise.asResponse(); 43 | expect(rawResponse).toBeInstanceOf(Response); 44 | const response = await responsePromise; 45 | expect(response).not.toBeInstanceOf(Response); 46 | const dataAndResponse = await responsePromise.withResponse(); 47 | expect(dataAndResponse.data).toBe(response); 48 | expect(dataAndResponse.response).toBe(rawResponse); 49 | }); 50 | 51 | test('checkStatus: required and optional params', async () => { 52 | const response = await client.responderEndpoints.checkStatus({ type: 'AUTH_STREAM_ACCESS' }); 53 | }); 54 | }); 55 | -------------------------------------------------------------------------------- /tests/api-resources/three-ds/authentication.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource authentication', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.threeDS.authentication.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('retrieve: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.threeDS.authentication.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { 27 | path: '/_stainless_unknown_path', 28 | }), 29 | ).rejects.toThrow(Lithic.NotFoundError); 30 | }); 31 | 32 | test('simulate: only required params', async () => { 33 | const responsePromise = client.threeDS.authentication.simulate({ 34 | merchant: { id: 'OODKZAPJVN4YS7O', country: 'USA', mcc: '5812', name: 'COFFEE SHOP' }, 35 | pan: '4111111289144142', 36 | transaction: { amount: 0, currency: 'GBP' }, 37 | }); 38 | const rawResponse = await responsePromise.asResponse(); 39 | expect(rawResponse).toBeInstanceOf(Response); 40 | const response = await responsePromise; 41 | expect(response).not.toBeInstanceOf(Response); 42 | const dataAndResponse = await responsePromise.withResponse(); 43 | expect(dataAndResponse.data).toBe(response); 44 | expect(dataAndResponse.response).toBe(rawResponse); 45 | }); 46 | 47 | test('simulate: required and optional params', async () => { 48 | const response = await client.threeDS.authentication.simulate({ 49 | merchant: { id: 'OODKZAPJVN4YS7O', country: 'USA', mcc: '5812', name: 'COFFEE SHOP' }, 50 | pan: '4111111289144142', 51 | transaction: { amount: 0, currency: 'GBP' }, 52 | card_expiry_check: 'MATCH', 53 | }); 54 | }); 55 | 56 | test('simulateOtpEntry: only required params', async () => { 57 | const responsePromise = client.threeDS.authentication.simulateOtpEntry({ 58 | token: 'fabd829d-7f7b-4432-a8f2-07ea4889aaac', 59 | otp: '123456', 60 | }); 61 | const rawResponse = await responsePromise.asResponse(); 62 | expect(rawResponse).toBeInstanceOf(Response); 63 | const response = await responsePromise; 64 | expect(response).not.toBeInstanceOf(Response); 65 | const dataAndResponse = await responsePromise.withResponse(); 66 | expect(dataAndResponse.data).toBe(response); 67 | expect(dataAndResponse.response).toBe(rawResponse); 68 | }); 69 | 70 | test('simulateOtpEntry: required and optional params', async () => { 71 | const response = await client.threeDS.authentication.simulateOtpEntry({ 72 | token: 'fabd829d-7f7b-4432-a8f2-07ea4889aaac', 73 | otp: '123456', 74 | }); 75 | }); 76 | }); 77 | -------------------------------------------------------------------------------- /tests/api-resources/three-ds/decisioning.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource decisioning', () => { 12 | test('challengeResponse: only required params', async () => { 13 | const responsePromise = client.threeDS.decisioning.challengeResponse({ 14 | token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 15 | challenge_response: 'APPROVE', 16 | }); 17 | const rawResponse = await responsePromise.asResponse(); 18 | expect(rawResponse).toBeInstanceOf(Response); 19 | const response = await responsePromise; 20 | expect(response).not.toBeInstanceOf(Response); 21 | const dataAndResponse = await responsePromise.withResponse(); 22 | expect(dataAndResponse.data).toBe(response); 23 | expect(dataAndResponse.response).toBe(rawResponse); 24 | }); 25 | 26 | test('challengeResponse: required and optional params', async () => { 27 | const response = await client.threeDS.decisioning.challengeResponse({ 28 | token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 29 | challenge_response: 'APPROVE', 30 | }); 31 | }); 32 | 33 | test('retrieveSecret', async () => { 34 | const responsePromise = client.threeDS.decisioning.retrieveSecret(); 35 | const rawResponse = await responsePromise.asResponse(); 36 | expect(rawResponse).toBeInstanceOf(Response); 37 | const response = await responsePromise; 38 | expect(response).not.toBeInstanceOf(Response); 39 | const dataAndResponse = await responsePromise.withResponse(); 40 | expect(dataAndResponse.data).toBe(response); 41 | expect(dataAndResponse.response).toBe(rawResponse); 42 | }); 43 | 44 | test('retrieveSecret: request options instead of params are passed correctly', async () => { 45 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 46 | await expect( 47 | client.threeDS.decisioning.retrieveSecret({ path: '/_stainless_unknown_path' }), 48 | ).rejects.toThrow(Lithic.NotFoundError); 49 | }); 50 | 51 | test('rotateSecret', async () => { 52 | const responsePromise = client.threeDS.decisioning.rotateSecret(); 53 | const rawResponse = await responsePromise.asResponse(); 54 | expect(rawResponse).toBeInstanceOf(Response); 55 | const response = await responsePromise; 56 | expect(response).not.toBeInstanceOf(Response); 57 | const dataAndResponse = await responsePromise.withResponse(); 58 | expect(dataAndResponse.data).toBe(response); 59 | expect(dataAndResponse.response).toBe(rawResponse); 60 | }); 61 | 62 | test('rotateSecret: request options instead of params are passed correctly', async () => { 63 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 64 | await expect( 65 | client.threeDS.decisioning.rotateSecret({ path: '/_stainless_unknown_path' }), 66 | ).rejects.toThrow(Lithic.NotFoundError); 67 | }); 68 | }); 69 | -------------------------------------------------------------------------------- /tests/api-resources/tokenization-decisioning.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource tokenizationDecisioning', () => { 12 | test('retrieveSecret', async () => { 13 | const responsePromise = client.tokenizationDecisioning.retrieveSecret(); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('retrieveSecret: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.tokenizationDecisioning.retrieveSecret({ path: '/_stainless_unknown_path' }), 27 | ).rejects.toThrow(Lithic.NotFoundError); 28 | }); 29 | 30 | test('rotateSecret', async () => { 31 | const responsePromise = client.tokenizationDecisioning.rotateSecret(); 32 | const rawResponse = await responsePromise.asResponse(); 33 | expect(rawResponse).toBeInstanceOf(Response); 34 | const response = await responsePromise; 35 | expect(response).not.toBeInstanceOf(Response); 36 | const dataAndResponse = await responsePromise.withResponse(); 37 | expect(dataAndResponse.data).toBe(response); 38 | expect(dataAndResponse.response).toBe(rawResponse); 39 | }); 40 | 41 | test('rotateSecret: request options instead of params are passed correctly', async () => { 42 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 43 | await expect( 44 | client.tokenizationDecisioning.rotateSecret({ path: '/_stainless_unknown_path' }), 45 | ).rejects.toThrow(Lithic.NotFoundError); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /tests/api-resources/top-level.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('top level methods', () => { 12 | test('apiStatus', async () => { 13 | const responsePromise = client.apiStatus(); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('apiStatus: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect(client.apiStatus({ path: '/_stainless_unknown_path' })).rejects.toThrow( 26 | Lithic.NotFoundError, 27 | ); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /tests/api-resources/transactions/enhanced-commercial-data.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource enhancedCommercialData', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.transactions.enhancedCommercialData.retrieve( 14 | '00000000-0000-0000-0000-000000000000', 15 | ); 16 | const rawResponse = await responsePromise.asResponse(); 17 | expect(rawResponse).toBeInstanceOf(Response); 18 | const response = await responsePromise; 19 | expect(response).not.toBeInstanceOf(Response); 20 | const dataAndResponse = await responsePromise.withResponse(); 21 | expect(dataAndResponse.data).toBe(response); 22 | expect(dataAndResponse.response).toBe(rawResponse); 23 | }); 24 | 25 | test('retrieve: request options instead of params are passed correctly', async () => { 26 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 27 | await expect( 28 | client.transactions.enhancedCommercialData.retrieve('00000000-0000-0000-0000-000000000000', { 29 | path: '/_stainless_unknown_path', 30 | }), 31 | ).rejects.toThrow(Lithic.NotFoundError); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /tests/api-resources/transactions/events/enhanced-commercial-data.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource enhancedCommercialData', () => { 12 | test('retrieve', async () => { 13 | const responsePromise = client.transactions.events.enhancedCommercialData.retrieve( 14 | '00000000-0000-0000-0000-000000000000', 15 | ); 16 | const rawResponse = await responsePromise.asResponse(); 17 | expect(rawResponse).toBeInstanceOf(Response); 18 | const response = await responsePromise; 19 | expect(response).not.toBeInstanceOf(Response); 20 | const dataAndResponse = await responsePromise.withResponse(); 21 | expect(dataAndResponse.data).toBe(response); 22 | expect(dataAndResponse.response).toBe(rawResponse); 23 | }); 24 | 25 | test('retrieve: request options instead of params are passed correctly', async () => { 26 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 27 | await expect( 28 | client.transactions.events.enhancedCommercialData.retrieve('00000000-0000-0000-0000-000000000000', { 29 | path: '/_stainless_unknown_path', 30 | }), 31 | ).rejects.toThrow(Lithic.NotFoundError); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /tests/api-resources/transfers.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Lithic from 'lithic'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Lithic({ 7 | apiKey: 'My Lithic API Key', 8 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', 9 | }); 10 | 11 | describe('resource transfers', () => { 12 | test('create: only required params', async () => { 13 | const responsePromise = client.transfers.create({ 14 | amount: 0, 15 | from: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 16 | to: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 17 | }); 18 | const rawResponse = await responsePromise.asResponse(); 19 | expect(rawResponse).toBeInstanceOf(Response); 20 | const response = await responsePromise; 21 | expect(response).not.toBeInstanceOf(Response); 22 | const dataAndResponse = await responsePromise.withResponse(); 23 | expect(dataAndResponse.data).toBe(response); 24 | expect(dataAndResponse.response).toBe(rawResponse); 25 | }); 26 | 27 | test('create: required and optional params', async () => { 28 | const response = await client.transfers.create({ 29 | amount: 0, 30 | from: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 31 | to: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 32 | token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 33 | memo: 'memo', 34 | }); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /tests/form.test.ts: -------------------------------------------------------------------------------- 1 | import { multipartFormRequestOptions, createForm } from 'lithic/core'; 2 | import { Blob } from 'lithic/_shims/index'; 3 | import { toFile } from 'lithic'; 4 | 5 | describe('form data validation', () => { 6 | test('valid values do not error', async () => { 7 | await multipartFormRequestOptions({ 8 | body: { 9 | foo: 'foo', 10 | string: 1, 11 | bool: true, 12 | file: await toFile(Buffer.from('some-content')), 13 | blob: new Blob(['Some content'], { type: 'text/plain' }), 14 | }, 15 | }); 16 | }); 17 | 18 | test('null', async () => { 19 | await expect(() => 20 | multipartFormRequestOptions({ 21 | body: { 22 | null: null, 23 | }, 24 | }), 25 | ).rejects.toThrow(TypeError); 26 | }); 27 | 28 | test('undefined is stripped', async () => { 29 | const form = await createForm({ 30 | foo: undefined, 31 | bar: 'baz', 32 | }); 33 | expect(form.has('foo')).toBe(false); 34 | expect(form.get('bar')).toBe('baz'); 35 | }); 36 | 37 | test('nested undefined property is stripped', async () => { 38 | const form = await createForm({ 39 | bar: { 40 | baz: undefined, 41 | }, 42 | }); 43 | expect(Array.from(form.entries())).toEqual([]); 44 | 45 | const form2 = await createForm({ 46 | bar: { 47 | foo: 'string', 48 | baz: undefined, 49 | }, 50 | }); 51 | expect(Array.from(form2.entries())).toEqual([['bar[foo]', 'string']]); 52 | }); 53 | 54 | test('nested undefined array item is stripped', async () => { 55 | const form = await createForm({ 56 | bar: [undefined, undefined], 57 | }); 58 | expect(Array.from(form.entries())).toEqual([]); 59 | 60 | const form2 = await createForm({ 61 | bar: [undefined, 'foo'], 62 | }); 63 | expect(Array.from(form2.entries())).toEqual([['bar[]', 'foo']]); 64 | }); 65 | }); 66 | -------------------------------------------------------------------------------- /tests/responses.test.ts: -------------------------------------------------------------------------------- 1 | import { createResponseHeaders } from 'lithic/core'; 2 | import { Headers } from 'lithic/_shims/index'; 3 | 4 | describe('response parsing', () => { 5 | // TODO: test unicode characters 6 | test('headers are case agnostic', async () => { 7 | const headers = createResponseHeaders(new Headers({ 'Content-Type': 'foo', Accept: 'text/plain' })); 8 | expect(headers['content-type']).toEqual('foo'); 9 | expect(headers['Content-type']).toEqual('foo'); 10 | expect(headers['Content-Type']).toEqual('foo'); 11 | expect(headers['accept']).toEqual('text/plain'); 12 | expect(headers['Accept']).toEqual('text/plain'); 13 | expect(headers['Hello-World']).toBeUndefined(); 14 | }); 15 | 16 | test('duplicate headers are concatenated', () => { 17 | const headers = createResponseHeaders( 18 | new Headers([ 19 | ['Content-Type', 'text/xml'], 20 | ['Content-Type', 'application/json'], 21 | ]), 22 | ); 23 | expect(headers['content-type']).toBe('text/xml, application/json'); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /tests/stringifyQuery.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { Lithic } from 'lithic'; 4 | 5 | const { stringifyQuery } = Lithic.prototype as any; 6 | 7 | describe(stringifyQuery, () => { 8 | for (const [input, expected] of [ 9 | [{ a: '1', b: 2, c: true }, 'a=1&b=2&c=true'], 10 | [{ a: null, b: false, c: undefined }, 'a=&b=false'], 11 | [{ 'a/b': 1.28341 }, `${encodeURIComponent('a/b')}=1.28341`], 12 | [ 13 | { 'a/b': 'c/d', 'e=f': 'g&h' }, 14 | `${encodeURIComponent('a/b')}=${encodeURIComponent('c/d')}&${encodeURIComponent( 15 | 'e=f', 16 | )}=${encodeURIComponent('g&h')}`, 17 | ], 18 | ]) { 19 | it(`${JSON.stringify(input)} -> ${expected}`, () => { 20 | expect(stringifyQuery(input)).toEqual(expected); 21 | }); 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /tests/uploads.test.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import { toFile, type ResponseLike } from 'lithic/uploads'; 3 | import { File } from 'lithic/_shims/index'; 4 | 5 | class MyClass { 6 | name: string = 'foo'; 7 | } 8 | 9 | function mockResponse({ url, content }: { url: string; content?: Blob }): ResponseLike { 10 | return { 11 | url, 12 | blob: async () => content as any, 13 | }; 14 | } 15 | 16 | describe('toFile', () => { 17 | it('throws a helpful error for mismatched types', async () => { 18 | await expect( 19 | // @ts-expect-error intentionally mismatched type 20 | toFile({ foo: 'string' }), 21 | ).rejects.toThrowErrorMatchingInlineSnapshot( 22 | `"Unexpected data type: object; constructor: Object; props: ["foo"]"`, 23 | ); 24 | 25 | await expect( 26 | // @ts-expect-error intentionally mismatched type 27 | toFile(new MyClass()), 28 | ).rejects.toThrowErrorMatchingInlineSnapshot( 29 | `"Unexpected data type: object; constructor: MyClass; props: ["name"]"`, 30 | ); 31 | }); 32 | 33 | it('disallows string at the type-level', async () => { 34 | // @ts-expect-error we intentionally do not type support for `string` 35 | // to help people avoid passing a file path 36 | const file = await toFile('contents'); 37 | expect(file.text()).resolves.toEqual('contents'); 38 | }); 39 | 40 | it('extracts a file name from a Response', async () => { 41 | const response = mockResponse({ url: 'https://example.com/my/audio.mp3' }); 42 | const file = await toFile(response); 43 | expect(file.name).toEqual('audio.mp3'); 44 | }); 45 | 46 | it('extracts a file name from a File', async () => { 47 | const input = new File(['foo'], 'input.jsonl'); 48 | const file = await toFile(input); 49 | expect(file.name).toEqual('input.jsonl'); 50 | }); 51 | 52 | it('extracts a file name from a ReadStream', async () => { 53 | const input = fs.createReadStream('tests/uploads.test.ts'); 54 | const file = await toFile(input); 55 | expect(file.name).toEqual('uploads.test.ts'); 56 | }); 57 | 58 | it('does not copy File objects', async () => { 59 | const input = new File(['foo'], 'input.jsonl', { type: 'jsonl' }); 60 | const file = await toFile(input); 61 | expect(file).toBe(input); 62 | expect(file.name).toEqual('input.jsonl'); 63 | expect(file.type).toBe('jsonl'); 64 | }); 65 | }); 66 | -------------------------------------------------------------------------------- /tsc-multi.json: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | { "extname": ".js", "module": "commonjs" }, 4 | { "extname": ".mjs", "module": "esnext" } 5 | ], 6 | "projects": ["tsconfig.build.json"] 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["dist/src"], 4 | "exclude": ["dist/src/_shims/*-deno.ts"], 5 | "compilerOptions": { 6 | "rootDir": "./dist/src", 7 | "paths": { 8 | "lithic/*": ["dist/src/*"], 9 | "lithic": ["dist/src/index.ts"] 10 | }, 11 | "noEmit": false, 12 | "declaration": true, 13 | "declarationMap": true, 14 | "outDir": "dist", 15 | "pretty": true, 16 | "sourceMap": true 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tsconfig.deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["dist-deno"], 4 | "exclude": [], 5 | "compilerOptions": { 6 | "rootDir": "./dist-deno", 7 | "lib": ["es2020", "DOM"], 8 | "noEmit": true, 9 | "declaration": true, 10 | "declarationMap": true, 11 | "outDir": "dist-deno", 12 | "pretty": true, 13 | "sourceMap": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tsconfig.dist-src.json: -------------------------------------------------------------------------------- 1 | { 2 | // this config is included in the published src directory to prevent TS errors 3 | // from appearing when users go to source, and VSCode opens the source .ts file 4 | // via declaration maps 5 | "include": ["index.ts"], 6 | "compilerOptions": { 7 | "target": "es2015", 8 | "lib": ["DOM"], 9 | "moduleResolution": "node" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["src", "tests", "examples"], 3 | "exclude": ["src/_shims/**/*-deno.ts"], 4 | "compilerOptions": { 5 | "target": "es2020", 6 | "lib": ["es2020"], 7 | "module": "commonjs", 8 | "moduleResolution": "node", 9 | "esModuleInterop": true, 10 | "baseUrl": "./", 11 | "paths": { 12 | "lithic/_shims/auto/*": ["src/_shims/auto/*-node"], 13 | "lithic/*": ["src/*"], 14 | "lithic": ["src/index.ts"] 15 | }, 16 | "noEmit": true, 17 | 18 | "resolveJsonModule": true, 19 | 20 | "forceConsistentCasingInFileNames": true, 21 | 22 | "strict": true, 23 | "noImplicitAny": true, 24 | "strictNullChecks": true, 25 | "strictFunctionTypes": true, 26 | "strictBindCallApply": true, 27 | "strictPropertyInitialization": true, 28 | "noImplicitThis": true, 29 | "noImplicitReturns": true, 30 | "alwaysStrict": true, 31 | "exactOptionalPropertyTypes": true, 32 | "noUncheckedIndexedAccess": true, 33 | "noImplicitOverride": true, 34 | "noPropertyAccessFromIndexSignature": true, 35 | "isolatedModules": false, 36 | 37 | "skipLibCheck": true 38 | } 39 | } 40 | --------------------------------------------------------------------------------