Skip to content
Open
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
23 changes: 0 additions & 23 deletions .devcontainer/Dockerfile

This file was deleted.

27 changes: 12 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Debian",
"build": {
"dockerfile": "Dockerfile"
"name": "Development",
"image": "mcr.microsoft.com/devcontainers/typescript-node:latest",
"features": {
"ghcr.io/devcontainers/features/node:1": {}
},
"postCreateCommand": "yarn install",
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode"
]
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ yarn-error.log
codegen.log
Brewfile.lock.json
dist
/deno
dist-deno
/*.tgz
.idea/

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.1"
".": "0.1.0-alpha.2"
}
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.1.0-alpha.2 (2025-03-13)

Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/CZL-AI/czlai-node/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

### Chores

* configure new SDK language ([#12](https://github.com/CZL-AI/czlai-node/issues/12)) ([826f10c](https://github.com/CZL-AI/czlai-node/commit/826f10c159662a05f71015b0e94af6e09eeb24c9))
* rebuild project due to codegen change ([#4](https://github.com/CZL-AI/czlai-node/issues/4)) ([f9a13c2](https://github.com/CZL-AI/czlai-node/commit/f9a13c201d51250409c76b24cc36ba2100854183))
* rebuild project due to codegen change ([#6](https://github.com/CZL-AI/czlai-node/issues/6)) ([1b43d9d](https://github.com/CZL-AI/czlai-node/commit/1b43d9dfc40e723ac2cc06e88b79518a50a507a1))
* rebuild project due to codegen change ([#7](https://github.com/CZL-AI/czlai-node/issues/7)) ([39968be](https://github.com/CZL-AI/czlai-node/commit/39968bee190b2bec95c7d0281e5c590b2e65c308))
* rebuild project due to codegen change ([#8](https://github.com/CZL-AI/czlai-node/issues/8)) ([a6664e6](https://github.com/CZL-AI/czlai-node/commit/a6664e6693bfb8688384f2c439026417848e38c2))
* rebuild project due to codegen change ([#9](https://github.com/CZL-AI/czlai-node/issues/9)) ([3dd7d29](https://github.com/CZL-AI/czlai-node/commit/3dd7d2978b318b2d307fe0f64893bee2e4478430))
* remove redundant word in comment ([#11](https://github.com/CZL-AI/czlai-node/issues/11)) ([3db43ff](https://github.com/CZL-AI/czlai-node/commit/3db43ff71ced53c446bb32c245941794713ba67e))


### Documentation

* remove suggestion to use `npm` call out ([#10](https://github.com/CZL-AI/czlai-node/issues/10)) ([5901fb3](https://github.com/CZL-AI/czlai-node/commit/5901fb3545eb9d6d0692e2f8270aa0a156b1b678))

## 0.1.0-alpha.1 (2024-10-29)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/CZL-AI/czlai-node/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Setting up the environment

This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable).
This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install).
Other package managers may work but are not officially supported for development.

To set up the repository, run:
Expand Down Expand Up @@ -29,10 +29,10 @@ All files in the `examples/` directory are not modified by the generator and can
```

```
chmod +x examples/<your-example>.ts
```sh
$ chmod +x examples/<your-example>.ts
# run the example against your api
yarn tsn -T examples/<your-example>.ts
$ yarn tsn -T examples/<your-example>.ts
```

## Using the repository from source
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Czlai
Copyright 2025 Czlai

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This library provides convenient access to the Czlai REST API from server-side T

The REST API documentation can be found on [docs.czlai.com](https://docs.czlai.com). The full API of this library can be found in [api.md](api.md).

It is generated with [Stainless](https://www.stainlessapi.com/).
It is generated with [Stainless](https://www.stainless.com/).

## Installation

Expand Down Expand Up @@ -52,6 +52,36 @@ main();

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 fetch from 'node-fetch';
import Czlai, { toFile } from 'czlai';

const client = new Czlai();

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

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

// You can also pass a `fetch` `Response`:
await client.upload.create({ image: await fetch('https://somesite/file') });

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

## Handling errors

When the library is unable to connect to the API,
Expand Down Expand Up @@ -262,7 +292,7 @@ await client.aiCheckup.sessionStart({
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

1. Changes that only affect static types, without breaking runtime behavior.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
3. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
Expand All @@ -275,6 +305,15 @@ TypeScript >= 4.5 is supported.

The following runtimes are supported:

- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Deno v1.28.0 or higher.
- Bun 1.0 or later.
- Cloudflare Workers.
- Vercel Edge Runtime.
- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
- Nitro v2.6 or greater.

Note that React Native is not supported at this time.

If you are interested in other runtime environments, please open or upvote an issue on GitHub.
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Reporting Security Issues

This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
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.

To report a security issue, please contact the Stainless team at security@stainlessapi.com.
To report a security issue, please contact the Stainless team at security@stainless.com.

## Responsible Disclosure

Expand Down
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "czlai",
"version": "0.1.0-alpha.1",
"version": "0.1.0-alpha.2",
"description": "The official TypeScript library for the Czlai API",
"author": "Czlai <dev-feedback@czlai.com>",
"types": "dist/index.d.ts",
Expand All @@ -18,7 +18,7 @@
"build": "./scripts/build",
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi",
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "./scripts/lint",
"fix": "./scripts/format"
Expand All @@ -45,7 +45,6 @@
"jest": "^29.4.0",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
"ts-morph": "^19.0.0",
"ts-node": "^10.5.0",
"tsc-multi": "^1.1.0",
"tsconfig-paths": "^4.0.0",
Expand Down Expand Up @@ -108,17 +107,17 @@
"default": "./dist/index.mjs"
},
"./*.mjs": {
"types": "./dist/*.d.ts",
"default": "./dist/*.mjs"
"types": ["./dist/*.d.ts", "./dist/*/index.d.ts"],
"default": ["./dist/*.mjs", "./dist/*/index.mjs"]
},
"./*.js": {
"types": "./dist/*.d.ts",
"default": "./dist/*.js"
"types": ["./dist/*.d.ts", "./dist/*/index.d.ts"],
"default": ["./dist/*.js", "./dist/*/index.js"]
},
"./*": {
"types": "./dist/*.d.ts",
"require": "./dist/*.js",
"default": "./dist/*.mjs"
"types": ["./dist/*.d.ts", "./dist/*/index.d.ts"],
"require": ["./dist/*.js", "./dist/*/index.js"],
"default": ["./dist/*.mjs", "./dist/*/index.mjs"]
}
}
}
2 changes: 1 addition & 1 deletion scripts/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

cd "$(dirname "$0")/.."

if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
Expand Down
4 changes: 2 additions & 2 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ npm exec tsc-multi
# copy over handwritten .js/.mjs/.d.ts files
cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims
cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto
# we need to add exports = module.exports = Czlai Node to index.js;
# we need to add exports = module.exports = Czlai to index.js;
# No way to get that from index.ts because it would cause compile errors
# when building .mjs
node scripts/utils/fix-index-exports.cjs
Expand All @@ -50,7 +50,7 @@ node scripts/utils/postprocess-files.cjs
(cd dist && node -e 'require("czlai")')
(cd dist && node -e 'import("czlai")' --input-type=module)

if command -v deno &> /dev/null && [ -e ./scripts/build-deno ]
if [ -e ./scripts/build-deno ]
then
./scripts/build-deno
fi
2 changes: 1 addition & 1 deletion scripts/utils/check-is-in-git-install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Check if you happen to call prepare for a repository that's already in node_modules.
[ "$(basename "$(dirname "$PWD")")" = 'node_modules' ] ||
# The name of the containing directory that 'npm` uses, which looks like
Expand Down
13 changes: 13 additions & 0 deletions scripts/utils/git-swap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -exuo pipefail
# the package is published to NPM from ./dist
# we want the final file structure for git installs to match the npm installs, so we

# delete everything except ./dist and ./node_modules
find . -maxdepth 1 -mindepth 1 ! -name 'dist' ! -name 'node_modules' -exec rm -rf '{}' +

# move everything from ./dist to .
mv dist/* .

# delete the now-empty ./dist
rmdir dist
Loading
Loading