Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'

- name: Bootstrap
run: ./scripts/bootstrap

- name: Build
run: ./scripts/build

- name: Run tests
run: ./scripts/test
11 changes: 10 additions & 1 deletion .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
name: Publish NPM
on:
workflow_dispatch:
inputs:
path:
description: The path to run the release in, e.g. '.' or 'packages/mcp-server'
required: true

release:
types: [published]
Expand All @@ -27,6 +31,11 @@ jobs:

- name: Publish to NPM
run: |
bash ./bin/publish-npm
if [ -n "${{ github.event.inputs.path }}" ]; then
PATHS_RELEASED='[\"${{ github.event.inputs.path }}\"]'
else
PATHS_RELEASED='[\".\", \"packages/mcp-server\"]'
fi
yarn tsn scripts/publish-packages.ts "{ \"paths_released\": \"$PATHS_RELEASED\" }"
env:
NPM_TOKEN: ${{ secrets.CAS_PARSER_NPM_TOKEN || secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ CHANGELOG.md
/deno

# don't format tsc output, will break source maps
/dist
dist
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.0.0"
".": "1.1.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 5
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-33841d833a48438cd79a13b2e70eeb61551b67e954ed788209ece1b0f5886e15.yml
openapi_spec_hash: 6a784691ea7c8cf7c2987c93f6a2ab25
config_hash: c35d87a285c3e03721211e5585e57e54
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-b7fdba3d3f97c7debc22c7ca30b828bce81bcd64648df8c94029b27a3321ebb9.yml
openapi_spec_hash: 03f1315f1d32ada42445ca920f047dff
config_hash: 1de8a243a3962065e289ca915dfc6127
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 1.1.0 (2025-08-18)

Full Changelog: [v1.0.0...v1.1.0](https://github.com/CASParser/cas-parser-node/compare/v1.0.0...v1.1.0)

### Features

* **api:** api update ([6108aea](https://github.com/CASParser/cas-parser-node/commit/6108aea7cb4622bb475866a49784a9f519bb487e))


### Chores

* configure new SDK language ([8c5268d](https://github.com/CASParser/cas-parser-node/commit/8c5268d5a259411365d9f567f0c14e31e3b3c100))
* update SDK settings ([e57c92b](https://github.com/CASParser/cas-parser-node/commit/e57c92bdc3a0be8def3e0110adf637141d861fe8))

## 1.0.0 (2025-08-18)

Full Changelog: [v0.0.1-alpha.0...v1.0.0](https://github.com/CASParser/cas-parser-node/compare/v0.0.1-alpha.0...v1.0.0)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ $ cd cas-parser-node
# With yarn
$ yarn link
$ cd ../my-package
$ yarn link cas-parser
$ yarn link cas-parser-node

# With pnpm
$ pnpm link --global
$ cd ../my-package
$ pnpm link -—global cas-parser
$ pnpm link -—global cas-parser-node
```

## Running tests
Expand Down
51 changes: 11 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cas Parser TypeScript API Library

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

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

Expand All @@ -11,7 +11,7 @@ It is generated with [Stainless](https://www.stainless.com/).
## Installation

```sh
npm install cas-parser
npm install cas-parser-node
```

## Usage
Expand All @@ -20,7 +20,7 @@ The full API of this library can be found in [api.md](api.md).

<!-- prettier-ignore -->
```js
import CasParser from 'cas-parser';
import CasParser from 'cas-parser-node';

const client = new CasParser({
apiKey: process.env['CAS_PARSER_API_KEY'], // This is the default and can be omitted
Expand All @@ -38,7 +38,7 @@ This library includes TypeScript definitions for all request params and response

<!-- prettier-ignore -->
```ts
import CasParser from 'cas-parser';
import CasParser from 'cas-parser-node';

const client = new CasParser({
apiKey: process.env['CAS_PARSER_API_KEY'], // This is the default and can be omitted
Expand All @@ -50,35 +50,6 @@ const unifiedResponse: CasParser.UnifiedResponse = await client.casParser.camsKf

Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.

## File uploads

Request parameters that correspond to file uploads can be passed in many different forms:

- `File` (or an object with the same structure)
- a `fetch` `Response` (or an object with the same structure)
- an `fs.ReadStream`
- the return value of our `toFile` helper

```ts
import fs from 'fs';
import CasParser, { toFile } from 'cas-parser';

const client = new CasParser();

// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
await client.casParser.camsKfintech({ pdf_file: fs.createReadStream('/path/to/file') });

// Or if you have the web `File` API you can pass a `File` instance:
await client.casParser.camsKfintech({ pdf_file: new File(['my bytes'], 'file') });

// You can also pass a `fetch` `Response`:
await client.casParser.camsKfintech({ pdf_file: await fetch('https://somesite/file') });

// Finally, if none of the above are convenient, you can use our `toFile` helper:
await client.casParser.camsKfintech({ pdf_file: await toFile(Buffer.from('my bytes'), 'file') });
await client.casParser.camsKfintech({ pdf_file: await toFile(new Uint8Array([0, 1, 2]), 'file') });
```

## Handling errors

When the library is unable to connect to the API,
Expand Down Expand Up @@ -190,7 +161,7 @@ The log level can be configured in two ways:
2. Using the `logLevel` client option (overrides the environment variable if set)

```ts
import CasParser from 'cas-parser';
import CasParser from 'cas-parser-node';

const client = new CasParser({
logLevel: 'debug', // Show all log messages
Expand Down Expand Up @@ -218,7 +189,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
below the configured level will not be sent to your logger.

```ts
import CasParser from 'cas-parser';
import CasParser from 'cas-parser-node';
import pino from 'pino';

const logger = pino();
Expand Down Expand Up @@ -287,7 +258,7 @@ globalThis.fetch = fetch;
Or pass it to the client:

```ts
import CasParser from 'cas-parser';
import CasParser from 'cas-parser-node';
import fetch from 'my-fetch';

const client = new CasParser({ fetch });
Expand All @@ -298,7 +269,7 @@ const client = new CasParser({ fetch });
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)

```ts
import CasParser from 'cas-parser';
import CasParser from 'cas-parser-node';

const client = new CasParser({
fetchOptions: {
Expand All @@ -315,7 +286,7 @@ options to requests:
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>

```ts
import CasParser from 'cas-parser';
import CasParser from 'cas-parser-node';
import * as undici from 'undici';

const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
Expand All @@ -329,7 +300,7 @@ const client = new CasParser({
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>

```ts
import CasParser from 'cas-parser';
import CasParser from 'cas-parser-node';

const client = new CasParser({
fetchOptions: {
Expand All @@ -341,7 +312,7 @@ const client = new CasParser({
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>

```ts
import CasParser from 'npm:cas-parser';
import CasParser from 'npm:cas-parser-node';

const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
const client = new CasParser({
Expand Down
4 changes: 2 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default tseslint.config(
{
patterns: [
{
regex: '^cas-parser(/.*)?',
regex: '^cas-parser-node(/.*)?',
message: 'Use a relative import, not a package import.',
},
],
Expand All @@ -34,7 +34,7 @@ export default tseslint.config(
},
},
{
files: ['tests/**', 'examples/**'],
files: ['tests/**', 'examples/**', 'packages/**'],
rules: {
'no-restricted-imports': 'off',
},
Expand Down
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const config: JestConfigWithTsJest = {
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
},
moduleNameMapper: {
'^cas-parser$': '<rootDir>/src/index.ts',
'^cas-parser/(.*)$': '<rootDir>/src/$1',
'^cas-parser-node$': '<rootDir>/src/index.ts',
'^cas-parser-node/(.*)$': '<rootDir>/src/$1',
},
modulePathIgnorePatterns: [
'<rootDir>/ecosystem-tests/',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cas-parser",
"version": "1.0.0",
"name": "cas-parser-node",
"version": "1.1.0",
"description": "The official TypeScript library for the Cas Parser API",
"author": "Cas Parser <sameer@casparser.in>",
"types": "dist/index.d.ts",
Expand Down
Loading