Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d04e245
feat(api): update via SDK Studio
stainless-app[bot] May 21, 2025
5c5a063
feat(api): update via SDK Studio
stainless-app[bot] May 21, 2025
93f8200
chore(docs): grammar improvements
stainless-app[bot] May 22, 2025
4bedf3d
feat(api): update via SDK Studio
stainless-app[bot] May 22, 2025
a43a003
feat(api): update via SDK Studio
stainless-app[bot] May 22, 2025
f65a114
chore(internal): codegen related update
stainless-app[bot] May 23, 2025
112fb67
fix(mcp): fix cursor schema transformation issue with recursive refer…
stainless-app[bot] May 24, 2025
588cd03
fix(mcp): include description in dynamic tool search
stainless-app[bot] May 28, 2025
2053613
chore: improve publish-npm script --latest tag logic
stainless-app[bot] May 28, 2025
3d8e524
feat(mcp): include http information in tools
stainless-app[bot] May 29, 2025
df3e9b5
chore(mcp): remove duplicate assignment
stainless-app[bot] May 29, 2025
96df746
fix: compat with more runtimes
stainless-app[bot] May 30, 2025
d4ded48
chore(deps): bump eslint-plugin-prettier
stainless-app[bot] May 31, 2025
2d34bb5
chore(internal): update jest config
stainless-app[bot] May 31, 2025
a3eeed2
chore: adjust eslint.config.mjs ignore pattern
stainless-app[bot] Jun 3, 2025
d9519ed
chore(docs): use top-level-await in example snippets
stainless-app[bot] Jun 4, 2025
79d997e
chore(internal): fix readablestream types in node 20
stainless-app[bot] Jun 4, 2025
a89234f
feat(mcp): implement support for binary responses
stainless-app[bot] Jun 6, 2025
13a317a
chore: avoid type error in certain environments
stainless-app[bot] Jun 7, 2025
67ae503
chore(mcp): provides high-level initMcpServer function and exports kn…
stainless-app[bot] Jun 11, 2025
fc5ea58
fix: publish script — handle NPM errors correctly
stainless-app[bot] Jun 14, 2025
9ce83f6
chore(internal): add pure annotations, make base APIResource abstract
stainless-app[bot] Jun 14, 2025
6d04f3b
feat(mcp): set X-Stainless-MCP header
stainless-app[bot] Jun 14, 2025
ebb2afd
chore(client): refactor imports
stainless-app[bot] Jun 17, 2025
d154b67
feat(client): add support for endpoint-specific base URLs
stainless-app[bot] Jun 17, 2025
23ffa3c
chore(ci): enable for pull requests
stainless-app[bot] Jun 17, 2025
96e2b2e
chore(readme): update badges
stainless-app[bot] Jun 18, 2025
4f15e11
chore(readme): use better example snippet for undocumented params
stainless-app[bot] Jun 19, 2025
0c5fe5a
fix(client): explicitly copy fetch in withOptions
stainless-app[bot] Jun 21, 2025
1b2ab0b
refactor(types): replace Record with mapped types
stainless-app[bot] Jun 24, 2025
70168fa
feat(api): update via SDK Studio
stainless-app[bot] Jun 24, 2025
2e4bdfd
release: 0.1.0-alpha.5
stainless-app[bot] Jun 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.4"
".": "0.1.0-alpha.5"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 17
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/scan-documents%2Fscan-documents-41af66c2f2ba90b745f6c36d89d31281f16d916521b98a8f510ec3a8f90a1efb.yml
openapi_spec_hash: 0c629cd46c640a055b0cfa5d88aad337
config_hash: ee078a284af580362c78b746a0c811c2
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/scan-documents%2Fscan-documents-42f9aa9c3b2769584f60fa3742f3a004bdf2e3b5ba30a44535b0191654b1a51e.yml
openapi_spec_hash: a0bab3e1411b24d8a662df98d227049a
config_hash: 4f1180f734cbc7323ff2ed85a9cd510d
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
# Changelog

## 0.1.0-alpha.5 (2025-06-24)

Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/Scan-Documents/node-sdk/compare/v0.1.0-alpha.4...v0.1.0-alpha.5)

### Features

* **api:** update via SDK Studio ([70168fa](https://github.com/Scan-Documents/node-sdk/commit/70168fa2bf97cb14beb6e050d90871240168e44c))
* **api:** update via SDK Studio ([a43a003](https://github.com/Scan-Documents/node-sdk/commit/a43a00355e7fc01e579754abb248329b4917d778))
* **api:** update via SDK Studio ([4bedf3d](https://github.com/Scan-Documents/node-sdk/commit/4bedf3df8238c97071510a3683a742add5939d5d))
* **api:** update via SDK Studio ([5c5a063](https://github.com/Scan-Documents/node-sdk/commit/5c5a063a2f53dec45c0a193adb446250efc430a8))
* **api:** update via SDK Studio ([d04e245](https://github.com/Scan-Documents/node-sdk/commit/d04e2459e3af994e8124b85240423f171dfd6f75))
* **client:** add support for endpoint-specific base URLs ([d154b67](https://github.com/Scan-Documents/node-sdk/commit/d154b6772a1a12c052eb1f97a4ae45f685100fc8))
* **mcp:** implement support for binary responses ([a89234f](https://github.com/Scan-Documents/node-sdk/commit/a89234fd6eb4de419eb80f4c9d5a324e3da34183))
* **mcp:** include http information in tools ([3d8e524](https://github.com/Scan-Documents/node-sdk/commit/3d8e52400096f3f9868ab83586976a3a92a2d467))
* **mcp:** set X-Stainless-MCP header ([6d04f3b](https://github.com/Scan-Documents/node-sdk/commit/6d04f3b56632c8b8f4fbb47862b3b5c0d5371f0e))


### Bug Fixes

* **client:** explicitly copy fetch in withOptions ([0c5fe5a](https://github.com/Scan-Documents/node-sdk/commit/0c5fe5acff20bd4ca263d05f08d8d890257b72a8))
* compat with more runtimes ([96df746](https://github.com/Scan-Documents/node-sdk/commit/96df7469f152a286f008ef22757d79512bd28cef))
* **mcp:** fix cursor schema transformation issue with recursive references ([112fb67](https://github.com/Scan-Documents/node-sdk/commit/112fb67a3f37d876d0b00d801c4092c508ec33da))
* **mcp:** include description in dynamic tool search ([588cd03](https://github.com/Scan-Documents/node-sdk/commit/588cd035d9908c073e26021046cbace0f809a5c0))
* publish script — handle NPM errors correctly ([fc5ea58](https://github.com/Scan-Documents/node-sdk/commit/fc5ea5897660f918c600d9b6f90c405d52b609b5))


### Chores

* adjust eslint.config.mjs ignore pattern ([a3eeed2](https://github.com/Scan-Documents/node-sdk/commit/a3eeed23683fea726fca2a9755320caec5f5b08a))
* avoid type error in certain environments ([13a317a](https://github.com/Scan-Documents/node-sdk/commit/13a317a3d40e8e53686c06860e9a8eb13ae3d6a5))
* **ci:** enable for pull requests ([23ffa3c](https://github.com/Scan-Documents/node-sdk/commit/23ffa3cafec1e413ad5468f804e1ccf8d26872b7))
* **client:** refactor imports ([ebb2afd](https://github.com/Scan-Documents/node-sdk/commit/ebb2afd0c55b2c02f374c761b4e668cfdc9cd0a0))
* **deps:** bump eslint-plugin-prettier ([d4ded48](https://github.com/Scan-Documents/node-sdk/commit/d4ded48bc45b220e74f4130d3ba95f2203318933))
* **docs:** grammar improvements ([93f8200](https://github.com/Scan-Documents/node-sdk/commit/93f8200ffd314b4ec9e36dd3ea972ab2a9781ef7))
* **docs:** use top-level-await in example snippets ([d9519ed](https://github.com/Scan-Documents/node-sdk/commit/d9519eda1ac2b8e10ae306c0690815a915709fe0))
* improve publish-npm script --latest tag logic ([2053613](https://github.com/Scan-Documents/node-sdk/commit/20536130588f3ea098459c542c680a1f0b8c7537))
* **internal:** add pure annotations, make base APIResource abstract ([9ce83f6](https://github.com/Scan-Documents/node-sdk/commit/9ce83f6d0994b3e9712dc25bd64c51762d18cb95))
* **internal:** codegen related update ([f65a114](https://github.com/Scan-Documents/node-sdk/commit/f65a114a884f9595b263d7216ff48fa05d194430))
* **internal:** fix readablestream types in node 20 ([79d997e](https://github.com/Scan-Documents/node-sdk/commit/79d997eaa3df27558d7664c02381ac989b141848))
* **internal:** update jest config ([2d34bb5](https://github.com/Scan-Documents/node-sdk/commit/2d34bb54aa3f193ca3bbb64d5bfc8c058b6c9b50))
* **mcp:** provides high-level initMcpServer function and exports known clients ([67ae503](https://github.com/Scan-Documents/node-sdk/commit/67ae503e605c16a97f3286017348bc7e8fa366c8))
* **mcp:** remove duplicate assignment ([df3e9b5](https://github.com/Scan-Documents/node-sdk/commit/df3e9b575185818ec86317331deaaa339795914a))
* **readme:** update badges ([96e2b2e](https://github.com/Scan-Documents/node-sdk/commit/96e2b2e4bcdc2aac0ae54a166da1bb74d9b0a4ed))
* **readme:** use better example snippet for undocumented params ([4f15e11](https://github.com/Scan-Documents/node-sdk/commit/4f15e1146712fe17de280aafcf7e0db38a3978e9))


### Refactors

* **types:** replace Record with mapped types ([1b2ab0b](https://github.com/Scan-Documents/node-sdk/commit/1b2ab0b6728a66f72c8726c814c1480af27ac799))

## 0.1.0-alpha.4 (2025-05-21)

Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/Scan-Documents/node-sdk/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
Expand Down
53 changes: 20 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Scan Documents TypeScript API Library

[![NPM version](https://img.shields.io/npm/v/scan-documents.svg)](https://npmjs.org/package/scan-documents) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/scan-documents)
[![NPM version](<https://img.shields.io/npm/v/scan-documents.svg?label=npm%20(stable)>)](https://npmjs.org/package/scan-documents) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/scan-documents)

This library provides convenient access to the Scan Documents REST API from server-side TypeScript or JavaScript.

Expand All @@ -26,11 +26,7 @@ const client = new ScanDocuments({
apiKey: process.env['SCAN_DOCUMENTS_API_KEY'], // This is the default and can be omitted
});

async function main() {
const file = await client.files.upload({ file: fs.createReadStream('path/to/file'), name: 'REPLACE_ME' });
}

main();
const file = await client.files.upload({ file: fs.createReadStream('path/to/file'), name: 'REPLACE_ME' });
```

### Request & Response types
Expand All @@ -45,15 +41,11 @@ const client = new ScanDocuments({
apiKey: process.env['SCAN_DOCUMENTS_API_KEY'], // This is the default and can be omitted
});

async function main() {
const params: ScanDocuments.FileUploadParams = {
file: fs.createReadStream('path/to/file'),
name: 'REPLACE_ME',
};
const file: ScanDocuments.File = await client.files.upload(params);
}

main();
const params: ScanDocuments.FileUploadParams = {
file: fs.createReadStream('path/to/file'),
name: 'REPLACE_ME',
};
const file: ScanDocuments.File = await client.files.upload(params);
```

Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
Expand Down Expand Up @@ -115,21 +107,17 @@ a subclass of `APIError` will be thrown:

<!-- prettier-ignore -->
```ts
async function main() {
const file = await client.files
.upload({ file: fs.createReadStream('path/to/file'), name: 'REPLACE_ME' })
.catch(async (err) => {
if (err instanceof ScanDocuments.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
}

main();
const file = await client.files
.upload({ file: fs.createReadStream('path/to/file'), name: 'REPLACE_ME' })
.catch(async (err) => {
if (err instanceof ScanDocuments.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
```

Error codes are as follows:
Expand Down Expand Up @@ -291,9 +279,8 @@ parameter. This library doesn't validate at runtime that the request matches the
send will be sent as-is.

```ts
client.foo.create({
foo: 'my_param',
bar: 12,
client.files.upload({
// ...
// @ts-expect-error baz is not yet public
baz: 'undocumented option',
});
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ before making any information public.
## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Scan Documents please follow the respective company's security reporting guidelines.
or products provided by Scan Documents, please follow the respective company's security reporting guidelines.

### Scan Documents Terms and Policies

Please contact support@scan-documents.com for any questions or concerns regarding security of our services.
Please contact support@scan-documents.com for any questions or concerns regarding the security of our services.

---

Expand Down
7 changes: 6 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Shared

Types:

- <code><a href="./src/resources/shared.ts">JsonSchemaSpec</a></code>

# Files

Types:
Expand Down Expand Up @@ -48,7 +54,6 @@ Types:
- <code><a href="./src/resources/image-operations.ts">ExtractTextRequest</a></code>
- <code><a href="./src/resources/image-operations.ts">ExtractTextResponse</a></code>
- <code><a href="./src/resources/image-operations.ts">ImageFromTaskResponse</a></code>
- <code><a href="./src/resources/image-operations.ts">JsonSchemaSpec</a></code>
- <code><a href="./src/resources/image-operations.ts">WarpRequest</a></code>
- <code><a href="./src/resources/image-operations.ts">WarpResponse</a></code>

Expand Down
52 changes: 44 additions & 8 deletions bin/publish-npm
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,55 @@ set -eux

npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"

# Build the project
yarn build

# Navigate to the dist directory
cd dist

# Get the version from package.json
VERSION="$(node -p "require('./package.json').version")"
# Get package name and version from package.json
PACKAGE_NAME="$(jq -r -e '.name' ./package.json)"
VERSION="$(jq -r -e '.version' ./package.json)"

# Get latest version from npm
#
# If the package doesn't exist, npm will return:
# {
# "error": {
# "code": "E404",
# "summary": "Unpublished on 2025-06-05T09:54:53.528Z",
# "detail": "'the_package' is not in this registry..."
# }
# }
NPM_INFO="$(npm view "$PACKAGE_NAME" version --json 2>/dev/null || true)"

# Check if we got an E404 error
if echo "$NPM_INFO" | jq -e '.error.code == "E404"' > /dev/null 2>&1; then
# Package doesn't exist yet, no last version
LAST_VERSION=""
elif echo "$NPM_INFO" | jq -e '.error' > /dev/null 2>&1; then
# Report other errors
echo "ERROR: npm returned unexpected data:"
echo "$NPM_INFO"
exit 1
else
# Success - get the version
LAST_VERSION=$(echo "$NPM_INFO" | jq -r '.') # strip quotes
fi

# Extract the pre-release tag if it exists
# Check if current version is pre-release (e.g. alpha / beta / rc)
CURRENT_IS_PRERELEASE=false
if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then
# Extract the part before any dot in the pre-release identifier
TAG="${BASH_REMATCH[1]}"
CURRENT_IS_PRERELEASE=true
CURRENT_TAG="${BASH_REMATCH[1]}"
fi

# Check if last version is a stable release
LAST_IS_STABLE_RELEASE=true
if [[ -z "$LAST_VERSION" || "$LAST_VERSION" =~ -([a-zA-Z]+) ]]; then
LAST_IS_STABLE_RELEASE=false
fi

# Use a corresponding alpha/beta tag if there already is a stable release and we're publishing a prerelease.
if $CURRENT_IS_PRERELEASE && $LAST_IS_STABLE_RELEASE; then
TAG="$CURRENT_TAG"
else
TAG="latest"
fi
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default tseslint.config(
parserOptions: { sourceType: 'module' },
},
files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.js', '**/*.mjs', '**/*.cjs'],
ignores: ['dist/**'],
ignores: ['dist/'],
plugins: {
'@typescript-eslint': tseslint.plugin,
'unused-imports': unusedImports,
Expand Down
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const config: JestConfigWithTsJest = {
'<rootDir>/dist/',
'<rootDir>/deno/',
'<rootDir>/deno_tests/',
'<rootDir>/packages/',
],
testPathIgnorePatterns: ['scripts'],
};
Expand Down
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scan-documents",
"version": "0.1.0-alpha.4",
"version": "0.1.0-alpha.5",
"description": "The official TypeScript library for the Scan Documents API",
"author": "Scan Documents <support@scan-documents.com>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -34,21 +34,18 @@
"@typescript-eslint/eslint-plugin": "8.31.1",
"@typescript-eslint/parser": "8.31.1",
"eslint": "^9.20.1",
"eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-prettier": "^5.4.1",
"eslint-plugin-unused-imports": "^4.1.4",
"iconv-lite": "^0.6.3",
"jest": "^29.4.0",
"prettier": "^3.0.0",
"publint": "^0.2.12",
"ts-jest": "^29.1.0",
"ts-node": "^10.5.0",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz",
"tsconfig-paths": "^4.0.0",
"typescript": "5.8.3"
},
"resolutions": {
"synckit": "0.8.8"
},
"imports": {
"scan-documents": ".",
"scan-documents/*": "./src/*"
Expand Down
6 changes: 1 addition & 5 deletions packages/mcp-server/build
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ PKG_JSON_PATH=../../packages/mcp-server/package.json node ../../scripts/utils/ma
node scripts/postprocess-dist-package-json.cjs

# build to .js/.mjs/.d.ts files
npm exec tsc-multi
./node_modules/.bin/tsc-multi

cp tsconfig.dist-src.json dist/src/tsconfig.json

# Add proper Node.js shebang to the top of the file
sed -i.bak '1s;^;#!/usr/bin/env node\n;' dist/index.js
rm dist/index.js.bak

chmod +x dist/index.js

DIST_PATH=./dist PKG_IMPORT_PATH=scan-documents-mcp/ node ../../scripts/utils/postprocess-files.cjs
8 changes: 4 additions & 4 deletions packages/mcp-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scan-documents-mcp",
"version": "0.1.0-alpha.4",
"version": "0.1.0-alpha.5",
"description": "The official MCP Server for the Scan Documents API",
"author": "Scan Documents <support@scan-documents.com>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -28,10 +28,10 @@
},
"dependencies": {
"scan-documents": "file:../../dist/",
"@modelcontextprotocol/sdk": "^1.6.1",
"@modelcontextprotocol/sdk": "^1.11.5",
"yargs": "^17.7.2",
"@cloudflare/cabidela": "^0.2.4",
"zod": "^3.24.4",
"zod": "^3.25.20",
"zod-to-json-schema": "^3.24.5"
},
"bin": {
Expand All @@ -49,7 +49,7 @@
"ts-jest": "^29.1.0",
"ts-morph": "^19.0.0",
"ts-node": "^10.5.0",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz",
"tsconfig-paths": "^4.0.0",
"typescript": "5.8.3"
},
Expand Down
Loading