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
23 changes: 18 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v4

Expand All @@ -31,8 +29,9 @@ jobs:
build:
name: build
runs-on: ubuntu-latest


permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4

Expand All @@ -46,10 +45,24 @@ jobs:

- name: Check build
run: ./scripts/build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/isaacus-typescript'
id: github-oidc
uses: actions/github-script@v6
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: github.repository == 'stainless-sdks/isaacus-typescript'
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
run: ./scripts/utils/upload-artifact.sh
test:
name: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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.5.0"
".": "0.5.1"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 2
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-861e8a85f0fb73cf4b7fc6c2b27722072ff33109459e90c17be24af15dfcbd0c.yml
openapi_spec_hash: 644a0383600633ee604bb1e5b9ca025d
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-d58ccd91625a3b12fd8d1ceece128b604010bd840096000287c927cb5dcf79eb.yml
openapi_spec_hash: 22c8c973d55f26649e9df96c89ea537f
config_hash: 1d603d50b7183a492ad6df5f728a1863
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 0.5.1 (2025-04-16)

Full Changelog: [v0.5.0...v0.5.1](https://github.com/isaacus-dev/isaacus-typescript/compare/v0.5.0...v0.5.1)

### Bug Fixes

* **client:** send all configured auth headers ([50c37d7](https://github.com/isaacus-dev/isaacus-typescript/commit/50c37d755bb3c3380556ace406b56eab876afeb8))
* **internal:** fix file uploads in node 18 jest ([c7b7e21](https://github.com/isaacus-dev/isaacus-typescript/commit/c7b7e216e58d1543021380438e1d30e15c396117))
* **mcp:** fix readEnv type error ([8b4b190](https://github.com/isaacus-dev/isaacus-typescript/commit/8b4b19063b1a17a8a6c421428c6a6a82a9bd519c))
* **mcp:** include all necessary env vars in client instantiation ([19a3c7b](https://github.com/isaacus-dev/isaacus-typescript/commit/19a3c7b4b100a1ca6613e1fb7013191b606a1902))


### Chores

* **client:** minor internal fixes ([1d498c9](https://github.com/isaacus-dev/isaacus-typescript/commit/1d498c94b272c1a7f7b18257a9c88f812d34b393))
* **internal:** codegen related update ([2e3d74a](https://github.com/isaacus-dev/isaacus-typescript/commit/2e3d74a28bc40cf99a1398b1a4060584e0766504))
* **internal:** improve node 18 shims ([fb9eac1](https://github.com/isaacus-dev/isaacus-typescript/commit/fb9eac171311ab834c0391fe9f516fc5c94d0128))
* **internal:** reduce CI branch coverage ([08a7c8d](https://github.com/isaacus-dev/isaacus-typescript/commit/08a7c8ddddce2bb2c06f2aea2ec5c9eff99609b9))
* **internal:** upload builds and expand CI branch coverage ([4f0428c](https://github.com/isaacus-dev/isaacus-typescript/commit/4f0428c3546e7520ff828319d49f7539907265f6))


### Documentation

* **api:** removed description of certain objects due to Mintlify bug ([17a6ea9](https://github.com/isaacus-dev/isaacus-typescript/commit/17a6ea975aeb53ffe496e7eea3ed7c1ac802a171))

## 0.5.0 (2025-04-05)

Full Changelog: [v0.4.0...v0.5.0](https://github.com/isaacus-dev/isaacus-typescript/compare/v0.4.0...v0.5.0)
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "isaacus",
"version": "0.5.0",
"version": "0.5.1",
"description": "The official TypeScript library for the Isaacus API",
"author": "Isaacus <support@isaacus.com>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -49,6 +49,10 @@
"resolutions": {
"synckit": "0.8.8"
},
"browser": {
"./internal/shims/getBuiltinModule.mjs": "./internal/shims/nullGetBuiltinModule.mjs",
"./internal/shims/getBuiltinModule.js": "./internal/shims/nullGetBuiltinModule.js"
},
"imports": {
"isaacus": ".",
"isaacus/*": "./src/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "isaacus-mcp",
"version": "0.5.0",
"version": "0.5.1",
"description": "The official MCP Server for the Isaacus API",
"author": "Isaacus <support@isaacus.com>",
"types": "dist/index.d.ts",
Expand Down
14 changes: 9 additions & 5 deletions packages/mcp-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export { endpoints } from './tools';
export const server = new McpServer(
{
name: 'isaacus_api',
version: '0.5.0',
version: '0.5.1',
},
{
capabilities: {
Expand Down Expand Up @@ -75,13 +75,17 @@ export async function executeHandler(
};
}

export const readEnv = (env: string): string => {
let envValue = undefined;
export const readEnv = (env: string): string | undefined => {
if (typeof (globalThis as any).process !== 'undefined') {
envValue = (globalThis as any).process.env?.[env]?.trim();
return (globalThis as any).process.env?.[env]?.trim();
} else if (typeof (globalThis as any).Deno !== 'undefined') {
envValue = (globalThis as any).Deno.env?.get?.(env)?.trim();
return (globalThis as any).Deno.env?.get?.(env)?.trim();
}
return;
};

export const readEnvOrError = (env: string): string => {
let envValue = readEnv(env);
if (envValue === undefined) {
throw new Error(`Environment variable ${env} is not set`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const tool: Tool = {
items: {
type: 'string',
title: 'Non-blank string',
description: 'A string with at least one non-whitespace character.',
},
},
chunking_options: {
Expand Down
2 changes: 0 additions & 2 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ node scripts/utils/fix-index-exports.cjs
cp tsconfig.dist-src.json dist/src/tsconfig.json
cp src/internal/shim-types.d.ts dist/internal/shim-types.d.ts
cp src/internal/shim-types.d.ts dist/internal/shim-types.d.mts
mkdir -p dist/internal/shims
cp src/internal/shims/*.{mjs,js,d.ts,d.mts} dist/internal/shims

node scripts/utils/postprocess-files.cjs

Expand Down
25 changes: 25 additions & 0 deletions scripts/utils/upload-artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -exuo pipefail

RESPONSE=$(curl -X POST "$URL" \
-H "Authorization: Bearer $AUTH" \
-H "Content-Type: application/json")

SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url')

if [[ "$SIGNED_URL" == "null" ]]; then
echo -e "\033[31mFailed to get signed URL.\033[0m"
exit 1
fi

UPLOAD_RESPONSE=$(tar -cz dist | curl -v -X PUT \
-H "Content-Type: application/gzip" \
--data-binary @- "$SIGNED_URL" 2>&1)

if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/isaacus-typescript/$SHA'\033[0m"
else
echo -e "\033[31mFailed to upload artifact.\033[0m"
exit 1
fi
10 changes: 5 additions & 5 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ export class Isaacus {
return;
}

protected authHeaders(opts: FinalRequestOptions): Headers | undefined {
return new Headers({ Authorization: `Bearer ${this.apiKey}` });
protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined {
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
}

/**
Expand Down Expand Up @@ -556,17 +556,17 @@ export class Isaacus {
}

buildRequest(
options: FinalRequestOptions,
inputOptions: FinalRequestOptions,
{ retryCount = 0 }: { retryCount?: number } = {},
): { req: FinalizedRequestInit; url: string; timeout: number } {
options = { ...options };
const options = { ...inputOptions };
const { method, path, query } = options;

const url = this.buildURL(path!, query as Record<string, unknown>);
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
options.timeout = options.timeout ?? this.timeout;
const { bodyHeaders, body } = this.buildBody({ options });
const reqHeaders = this.buildHeaders({ options, method, bodyHeaders, retryCount });
const reqHeaders = this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });

const req: FinalizedRequestInit = {
method,
Expand Down
1 change: 0 additions & 1 deletion src/internal/shims/crypto.node.d.mts

This file was deleted.

10 changes: 0 additions & 10 deletions src/internal/shims/crypto.node.d.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/internal/shims/crypto.node.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/internal/shims/crypto.node.mjs

This file was deleted.

18 changes: 18 additions & 0 deletions src/internal/shims/crypto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { getBuiltinModule } from './getBuiltinModule';

type Crypto = {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
getRandomValues<T extends ArrayBufferView | null>(array: T): T;
/**
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
*/
randomUUID?: () => string;
};
export let getCrypto: () => Crypto | undefined = function lazyGetCrypto() {
if (getCrypto !== lazyGetCrypto) return getCrypto();
const crypto: Crypto = (globalThis as any).crypto || (getBuiltinModule?.('node:crypto') as any)?.webcrypto;
getCrypto = () => crypto;
return crypto;
};
1 change: 0 additions & 1 deletion src/internal/shims/file.node.d.mts

This file was deleted.

20 changes: 0 additions & 20 deletions src/internal/shims/file.node.d.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/internal/shims/file.node.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/internal/shims/file.node.mjs

This file was deleted.

32 changes: 32 additions & 0 deletions src/internal/shims/file.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { getBuiltinModule } from './getBuiltinModule';

export let getFile = function lazyGetFile(): FileConstructor {
if (getFile !== lazyGetFile) return getFile();
// We can drop getBuiltinModule once we no longer support Node < 20.0.0
const File = (globalThis as any).File ?? (getBuiltinModule?.('node:buffer') as any)?.File;
if (!File) throw new Error('`File` is not defined as a global, which is required for file uploads.');
getFile = () => File;
return File;
};

type FileConstructor =
typeof globalThis extends { File: infer fileConstructor } ? fileConstructor : typeof FallbackFile;
export type File = InstanceType<FileConstructor>;

// The infer is to make TS show it as a nice union type,
// instead of literally `ConstructorParameters<typeof Blob>[0]`
type FallbackBlobSource = ConstructorParameters<typeof Blob>[0] extends infer T ? T : never;
/**
* A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
*/
declare class FallbackFile extends Blob {
constructor(sources: FallbackBlobSource, fileName: string, options?: any);
/**
* The name of the `File`.
*/
readonly name: string;
/**
* The last modified date of the `File`.
*/
readonly lastModified: number;
}
Loading