diff --git a/LICENSE b/LICENSE index 6813247..1b68672 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2025 Zeroentropy + Copyright 2025 ZeroEntropy Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 8fd1b8d..538fb24 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Zeroentropy Node API Library +# ZeroEntropy Node API Library [![NPM version](https://img.shields.io/npm/v/zeroentropy.svg)](https://npmjs.org/package/zeroentropy) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/zeroentropy) -This library provides convenient access to the Zeroentropy REST API from server-side TypeScript or JavaScript. +This library provides convenient access to the ZeroEntropy REST API from server-side TypeScript or JavaScript. The REST API documentation can be found on [docs.zeroentropy.dev](https://docs.zeroentropy.dev/api-reference). The full API of this library can be found in [api.md](api.md). @@ -20,9 +20,9 @@ The full API of this library can be found in [api.md](api.md). ```js -import Zeroentropy from 'zeroentropy'; +import ZeroEntropy from 'zeroentropy'; -const client = new Zeroentropy({ +const client = new ZeroEntropy({ apiKey: process.env['ZEROENTROPY_API_KEY'], // This is the default and can be omitted }); @@ -45,14 +45,14 @@ This library includes TypeScript definitions for all request params and response ```ts -import Zeroentropy from 'zeroentropy'; +import ZeroEntropy from 'zeroentropy'; -const client = new Zeroentropy({ +const client = new ZeroEntropy({ apiKey: process.env['ZEROENTROPY_API_KEY'], // This is the default and can be omitted }); async function main() { - const response: Zeroentropy.StatusGetStatusResponse = await client.status.getStatus(); + const response: ZeroEntropy.StatusGetStatusResponse = await client.status.getStatus(); } main(); @@ -70,7 +70,7 @@ a subclass of `APIError` will be thrown: ```ts async function main() { const response = await client.status.getStatus().catch(async (err) => { - if (err instanceof Zeroentropy.APIError) { + if (err instanceof ZeroEntropy.APIError) { console.log(err.status); // 400 console.log(err.name); // BadRequestError console.log(err.headers); // {server: 'nginx', ...} @@ -107,7 +107,7 @@ You can use the `maxRetries` option to configure or disable this: ```js // Configure the default for all requests: -const client = new Zeroentropy({ +const client = new ZeroEntropy({ maxRetries: 0, // default is 2 }); @@ -124,7 +124,7 @@ Requests time out after 1 minute by default. You can configure this with a `time ```ts // Configure the default for all requests: -const client = new Zeroentropy({ +const client = new ZeroEntropy({ timeout: 20 * 1000, // 20 seconds (default is 1 minute) }); @@ -140,7 +140,7 @@ Note that requests which time out will be [retried twice by default](#retries). ## Auto-pagination -List methods in the Zeroentropy API are paginated. +List methods in the ZeroEntropy API are paginated. You can use the `for await … of` syntax to iterate through items across all pages: ```ts @@ -181,7 +181,7 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi ```ts -const client = new Zeroentropy(); +const client = new ZeroEntropy(); const response = await client.status.getStatus().asResponse(); console.log(response.headers.get('X-My-Header')); @@ -242,13 +242,13 @@ By default, this library uses `node-fetch` in Node, and expects a global `fetch` If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment, (for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`), -add the following import before your first import `from "Zeroentropy"`: +add the following import before your first import `from "ZeroEntropy"`: ```ts // Tell TypeScript and the package to use the global web fetch instead of node-fetch. // Note, despite the name, this does not add any polyfills, but expects them to be provided if needed. import 'zeroentropy/shims/web'; -import Zeroentropy from 'zeroentropy'; +import ZeroEntropy from 'zeroentropy'; ``` To do the inverse, add `import "zeroentropy/shims/node"` (which does import polyfills). @@ -261,9 +261,9 @@ which can be used to inspect or alter the `Request` or `Response` before/after e ```ts import { fetch } from 'undici'; // as one example -import Zeroentropy from 'zeroentropy'; +import ZeroEntropy from 'zeroentropy'; -const client = new Zeroentropy({ +const client = new ZeroEntropy({ fetch: async (url: RequestInfo, init?: RequestInit): Promise => { console.log('About to make a request', url, init); const response = await fetch(url, init); @@ -288,7 +288,7 @@ import http from 'http'; import { HttpsProxyAgent } from 'https-proxy-agent'; // Configure the default for all requests: -const client = new Zeroentropy({ +const client = new ZeroEntropy({ httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), }); diff --git a/SECURITY.md b/SECURITY.md index 38de181..73d8066 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -16,9 +16,9 @@ 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 Zeroentropy please follow the respective company's security reporting guidelines. +or products provided by ZeroEntropy please follow the respective company's security reporting guidelines. -### Zeroentropy Terms and Policies +### ZeroEntropy Terms and Policies Please contact founders@zeroentropy.dev for any questions or concerns regarding security of our services. diff --git a/package.json b/package.json index b336294..6bb467f 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "zeroentropy", "version": "0.1.0-alpha.1", - "description": "The official TypeScript library for the Zeroentropy API", - "author": "Zeroentropy ", + "description": "The official TypeScript library for the ZeroEntropy API", + "author": "ZeroEntropy ", "types": "dist/index.d.ts", "main": "dist/index.js", "type": "commonjs", diff --git a/scripts/build b/scripts/build index 16b6351..896100c 100755 --- a/scripts/build +++ b/scripts/build @@ -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 = Zeroentropy to index.js; +# we need to add exports = module.exports = ZeroEntropy 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 diff --git a/src/core.ts b/src/core.ts index 99db81a..37e4b6e 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1,6 +1,6 @@ import { VERSION } from './version'; import { - ZeroentropyError, + ZeroEntropyError, APIError, APIConnectionError, APIConnectionTimeoutError, @@ -504,7 +504,7 @@ export abstract class APIClient { if (value === null) { return `${encodeURIComponent(key)}=`; } - throw new ZeroentropyError( + throw new ZeroEntropyError( `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`, ); }) @@ -654,7 +654,7 @@ export abstract class AbstractPage implements AsyncIterable { async getNextPage(): Promise { const nextInfo = this.nextPageInfo(); if (!nextInfo) { - throw new ZeroentropyError( + throw new ZeroEntropyError( 'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.', ); } @@ -990,10 +990,10 @@ export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve const validatePositiveInteger = (name: string, n: unknown): number => { if (typeof n !== 'number' || !Number.isInteger(n)) { - throw new ZeroentropyError(`${name} must be an integer`); + throw new ZeroEntropyError(`${name} must be an integer`); } if (n < 0) { - throw new ZeroentropyError(`${name} must be a positive integer`); + throw new ZeroEntropyError(`${name} must be a positive integer`); } return n; }; @@ -1010,7 +1010,7 @@ export const castToError = (err: any): Error => { export const ensurePresent = (value: T | null | undefined): T => { if (value == null) - throw new ZeroentropyError(`Expected a value to be given but received ${value} instead.`); + throw new ZeroEntropyError(`Expected a value to be given but received ${value} instead.`); return value; }; @@ -1035,14 +1035,14 @@ export const coerceInteger = (value: unknown): number => { if (typeof value === 'number') return Math.round(value); if (typeof value === 'string') return parseInt(value, 10); - throw new ZeroentropyError(`Could not coerce ${value} (type: ${typeof value}) into a number`); + throw new ZeroEntropyError(`Could not coerce ${value} (type: ${typeof value}) into a number`); }; export const coerceFloat = (value: unknown): number => { if (typeof value === 'number') return value; if (typeof value === 'string') return parseFloat(value); - throw new ZeroentropyError(`Could not coerce ${value} (type: ${typeof value}) into a number`); + throw new ZeroEntropyError(`Could not coerce ${value} (type: ${typeof value}) into a number`); }; export const coerceBoolean = (value: unknown): boolean => { @@ -1108,7 +1108,7 @@ function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void { export function debug(action: string, ...args: any[]) { if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') { - console.log(`Zeroentropy:DEBUG:${action}`, ...args); + console.log(`ZeroEntropy:DEBUG:${action}`, ...args); } } @@ -1193,7 +1193,7 @@ export const toBase64 = (str: string | null | undefined): string => { return btoa(str); } - throw new ZeroentropyError('Cannot generate b64 string; Expected `Buffer` or `btoa` to be defined'); + throw new ZeroEntropyError('Cannot generate b64 string; Expected `Buffer` or `btoa` to be defined'); }; export function isObj(obj: unknown): obj is Record { diff --git a/src/error.ts b/src/error.ts index ea17b6c..0126420 100644 --- a/src/error.ts +++ b/src/error.ts @@ -2,13 +2,13 @@ import { castToError, Headers } from './core'; -export class ZeroentropyError extends Error {} +export class ZeroEntropyError extends Error {} export class APIError< TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined, -> extends ZeroentropyError { +> extends ZeroEntropyError { /** HTTP status for the response that caused the error */ readonly status: TStatus; /** HTTP headers for the response that caused the error */ diff --git a/src/index.ts b/src/index.ts index bce7ff9..62e3e54 100644 --- a/src/index.ts +++ b/src/index.ts @@ -106,15 +106,15 @@ export interface ClientOptions { } /** - * API Client for interfacing with the Zeroentropy API. + * API Client for interfacing with the ZeroEntropy API. */ -export class Zeroentropy extends Core.APIClient { +export class ZeroEntropy extends Core.APIClient { apiKey: string; private _options: ClientOptions; /** - * API Client for interfacing with the Zeroentropy API. + * API Client for interfacing with the ZeroEntropy API. * * @param {string | undefined} [opts.apiKey=process.env['ZEROENTROPY_API_KEY'] ?? undefined] * @param {string} [opts.baseURL=process.env['ZEROENTROPY_BASE_URL'] ?? https://api.zeroentropy.dev/v1] - Override the default base URL for the API. @@ -131,8 +131,8 @@ export class Zeroentropy extends Core.APIClient { ...opts }: ClientOptions = {}) { if (apiKey === undefined) { - throw new Errors.ZeroentropyError( - "The ZEROENTROPY_API_KEY environment variable is missing or empty; either provide it, or instantiate the Zeroentropy client with an apiKey option, like new Zeroentropy({ apiKey: 'My API Key' }).", + throw new Errors.ZeroEntropyError( + "The ZEROENTROPY_API_KEY environment variable is missing or empty; either provide it, or instantiate the ZeroEntropy client with an apiKey option, like new ZeroEntropy({ apiKey: 'My API Key' }).", ); } @@ -176,10 +176,10 @@ export class Zeroentropy extends Core.APIClient { return { Authorization: `Bearer ${this.apiKey}` }; } - static Zeroentropy = this; + static ZeroEntropy = this; static DEFAULT_TIMEOUT = 60000; // 1 minute - static ZeroentropyError = Errors.ZeroentropyError; + static ZeroEntropyError = Errors.ZeroEntropyError; static APIError = Errors.APIError; static APIConnectionError = Errors.APIConnectionError; static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError; @@ -197,14 +197,14 @@ export class Zeroentropy extends Core.APIClient { static fileFromPath = Uploads.fileFromPath; } -Zeroentropy.Status = Status; -Zeroentropy.Collections = Collections; -Zeroentropy.Documents = Documents; -Zeroentropy.DocumentGetInfoListResponsesGetDocumentInfoListCursor = +ZeroEntropy.Status = Status; +ZeroEntropy.Collections = Collections; +ZeroEntropy.Documents = Documents; +ZeroEntropy.DocumentGetInfoListResponsesGetDocumentInfoListCursor = DocumentGetInfoListResponsesGetDocumentInfoListCursor; -Zeroentropy.Queries = Queries; -Zeroentropy.Parsers = Parsers; -export declare namespace Zeroentropy { +ZeroEntropy.Queries = Queries; +ZeroEntropy.Parsers = Parsers; +export declare namespace ZeroEntropy { export type RequestOptions = Core.RequestOptions; export import GetDocumentInfoListCursor = Pagination.GetDocumentInfoListCursor; @@ -263,7 +263,7 @@ export declare namespace Zeroentropy { export { toFile, fileFromPath } from './uploads'; export { - ZeroentropyError, + ZeroEntropyError, APIError, APIConnectionError, APIConnectionTimeoutError, @@ -278,4 +278,4 @@ export { UnprocessableEntityError, } from './error'; -export default Zeroentropy; +export default ZeroEntropy; diff --git a/src/resource.ts b/src/resource.ts index 5b67dc2..193a3fc 100644 --- a/src/resource.ts +++ b/src/resource.ts @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import type { Zeroentropy } from './index'; +import type { ZeroEntropy } from './index'; export class APIResource { - protected _client: Zeroentropy; + protected _client: ZeroEntropy; - constructor(client: Zeroentropy) { + constructor(client: ZeroEntropy) { this._client = client; } } diff --git a/tests/api-resources/collections.test.ts b/tests/api-resources/collections.test.ts index 453bfe1..8fabab5 100644 --- a/tests/api-resources/collections.test.ts +++ b/tests/api-resources/collections.test.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Zeroentropy from 'zeroentropy'; +import ZeroEntropy from 'zeroentropy'; import { Response } from 'node-fetch'; -const client = new Zeroentropy({ +const client = new ZeroEntropy({ apiKey: 'My API Key', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); @@ -53,7 +53,7 @@ describe('resource collections', () => { test('getList: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect(client.collections.getList({}, { path: '/_stainless_unknown_path' })).rejects.toThrow( - Zeroentropy.NotFoundError, + ZeroEntropy.NotFoundError, ); }); }); diff --git a/tests/api-resources/documents.test.ts b/tests/api-resources/documents.test.ts index 8c8f0e8..56e9852 100644 --- a/tests/api-resources/documents.test.ts +++ b/tests/api-resources/documents.test.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Zeroentropy from 'zeroentropy'; +import ZeroEntropy from 'zeroentropy'; import { Response } from 'node-fetch'; -const client = new Zeroentropy({ +const client = new ZeroEntropy({ apiKey: 'My API Key', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/parsers.test.ts b/tests/api-resources/parsers.test.ts index 3dbcb11..1a87120 100644 --- a/tests/api-resources/parsers.test.ts +++ b/tests/api-resources/parsers.test.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Zeroentropy from 'zeroentropy'; +import ZeroEntropy from 'zeroentropy'; import { Response } from 'node-fetch'; -const client = new Zeroentropy({ +const client = new ZeroEntropy({ apiKey: 'My API Key', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/queries.test.ts b/tests/api-resources/queries.test.ts index b1191ab..60465af 100644 --- a/tests/api-resources/queries.test.ts +++ b/tests/api-resources/queries.test.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Zeroentropy from 'zeroentropy'; +import ZeroEntropy from 'zeroentropy'; import { Response } from 'node-fetch'; -const client = new Zeroentropy({ +const client = new ZeroEntropy({ apiKey: 'My API Key', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/status.test.ts b/tests/api-resources/status.test.ts index 22358e7..94472a4 100644 --- a/tests/api-resources/status.test.ts +++ b/tests/api-resources/status.test.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Zeroentropy from 'zeroentropy'; +import ZeroEntropy from 'zeroentropy'; import { Response } from 'node-fetch'; -const client = new Zeroentropy({ +const client = new ZeroEntropy({ apiKey: 'My API Key', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); @@ -23,7 +23,7 @@ describe('resource status', () => { test('getStatus: request options instead of params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect(client.status.getStatus({ path: '/_stainless_unknown_path' })).rejects.toThrow( - Zeroentropy.NotFoundError, + ZeroEntropy.NotFoundError, ); }); @@ -31,6 +31,6 @@ describe('resource status', () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( client.status.getStatus({ collection_name: 'collection_name' }, { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Zeroentropy.NotFoundError); + ).rejects.toThrow(ZeroEntropy.NotFoundError); }); }); diff --git a/tests/index.test.ts b/tests/index.test.ts index b8ee5c2..5d83fd1 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Zeroentropy from 'zeroentropy'; +import ZeroEntropy from 'zeroentropy'; import { APIUserAbortError } from 'zeroentropy'; import { Headers } from 'zeroentropy/core'; import defaultFetch, { Response, type RequestInit, type RequestInfo } from 'node-fetch'; @@ -20,7 +20,7 @@ describe('instantiate client', () => { }); describe('defaultHeaders', () => { - const client = new Zeroentropy({ + const client = new ZeroEntropy({ baseURL: 'http://localhost:5000/', defaultHeaders: { 'X-My-Default-Header': '2' }, apiKey: 'My API Key', @@ -52,7 +52,7 @@ describe('instantiate client', () => { describe('defaultQuery', () => { test('with null query params given', () => { - const client = new Zeroentropy({ + const client = new ZeroEntropy({ baseURL: 'http://localhost:5000/', defaultQuery: { apiVersion: 'foo' }, apiKey: 'My API Key', @@ -61,7 +61,7 @@ describe('instantiate client', () => { }); test('multiple default query params', () => { - const client = new Zeroentropy({ + const client = new ZeroEntropy({ baseURL: 'http://localhost:5000/', defaultQuery: { apiVersion: 'foo', hello: 'world' }, apiKey: 'My API Key', @@ -70,7 +70,7 @@ describe('instantiate client', () => { }); test('overriding with `undefined`', () => { - const client = new Zeroentropy({ + const client = new ZeroEntropy({ baseURL: 'http://localhost:5000/', defaultQuery: { hello: 'world' }, apiKey: 'My API Key', @@ -80,7 +80,7 @@ describe('instantiate client', () => { }); test('custom fetch', async () => { - const client = new Zeroentropy({ + const client = new ZeroEntropy({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: (url) => { @@ -97,7 +97,7 @@ describe('instantiate client', () => { }); test('custom signal', async () => { - const client = new Zeroentropy({ + const client = new ZeroEntropy({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', apiKey: 'My API Key', fetch: (...args) => { @@ -129,7 +129,7 @@ describe('instantiate client', () => { return new Response(JSON.stringify({}), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new Zeroentropy({ + const client = new ZeroEntropy({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: testFetch, @@ -141,12 +141,12 @@ describe('instantiate client', () => { describe('baseUrl', () => { test('trailing slash', () => { - const client = new Zeroentropy({ baseURL: 'http://localhost:5000/custom/path/', apiKey: 'My API Key' }); + const client = new ZeroEntropy({ baseURL: 'http://localhost:5000/custom/path/', apiKey: 'My API Key' }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/custom/path/foo'); }); test('no trailing slash', () => { - const client = new Zeroentropy({ baseURL: 'http://localhost:5000/custom/path', apiKey: 'My API Key' }); + const client = new ZeroEntropy({ baseURL: 'http://localhost:5000/custom/path', apiKey: 'My API Key' }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/custom/path/foo'); }); @@ -155,55 +155,55 @@ describe('instantiate client', () => { }); test('explicit option', () => { - const client = new Zeroentropy({ baseURL: 'https://example.com', apiKey: 'My API Key' }); + const client = new ZeroEntropy({ baseURL: 'https://example.com', apiKey: 'My API Key' }); expect(client.baseURL).toEqual('https://example.com'); }); test('env variable', () => { process.env['ZEROENTROPY_BASE_URL'] = 'https://example.com/from_env'; - const client = new Zeroentropy({ apiKey: 'My API Key' }); + const client = new ZeroEntropy({ apiKey: 'My API Key' }); expect(client.baseURL).toEqual('https://example.com/from_env'); }); test('empty env variable', () => { process.env['ZEROENTROPY_BASE_URL'] = ''; // empty - const client = new Zeroentropy({ apiKey: 'My API Key' }); + const client = new ZeroEntropy({ apiKey: 'My API Key' }); expect(client.baseURL).toEqual('https://api.zeroentropy.dev/v1'); }); test('blank env variable', () => { process.env['ZEROENTROPY_BASE_URL'] = ' '; // blank - const client = new Zeroentropy({ apiKey: 'My API Key' }); + const client = new ZeroEntropy({ apiKey: 'My API Key' }); expect(client.baseURL).toEqual('https://api.zeroentropy.dev/v1'); }); }); test('maxRetries option is correctly set', () => { - const client = new Zeroentropy({ maxRetries: 4, apiKey: 'My API Key' }); + const client = new ZeroEntropy({ maxRetries: 4, apiKey: 'My API Key' }); expect(client.maxRetries).toEqual(4); // default - const client2 = new Zeroentropy({ apiKey: 'My API Key' }); + const client2 = new ZeroEntropy({ apiKey: 'My API Key' }); expect(client2.maxRetries).toEqual(2); }); test('with environment variable arguments', () => { // set options via env var process.env['ZEROENTROPY_API_KEY'] = 'My API Key'; - const client = new Zeroentropy(); + const client = new ZeroEntropy(); expect(client.apiKey).toBe('My API Key'); }); test('with overridden environment variable arguments', () => { // set options via env var process.env['ZEROENTROPY_API_KEY'] = 'another My API Key'; - const client = new Zeroentropy({ apiKey: 'My API Key' }); + const client = new ZeroEntropy({ apiKey: 'My API Key' }); expect(client.apiKey).toBe('My API Key'); }); }); describe('request building', () => { - const client = new Zeroentropy({ apiKey: 'My API Key' }); + const client = new ZeroEntropy({ apiKey: 'My API Key' }); describe('Content-Length', () => { test('handles multi-byte characters', () => { @@ -245,7 +245,7 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new Zeroentropy({ apiKey: 'My API Key', timeout: 10, fetch: testFetch }); + const client = new ZeroEntropy({ apiKey: 'My API Key', timeout: 10, fetch: testFetch }); expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); expect(count).toEqual(2); @@ -275,7 +275,7 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new Zeroentropy({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 }); + const client = new ZeroEntropy({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 }); expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); @@ -299,7 +299,7 @@ describe('retries', () => { capturedRequest = init; return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new Zeroentropy({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 }); + const client = new ZeroEntropy({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 }); expect( await client.request({ @@ -328,7 +328,7 @@ describe('retries', () => { capturedRequest = init; return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new Zeroentropy({ + const client = new ZeroEntropy({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4, @@ -361,7 +361,7 @@ describe('retries', () => { capturedRequest = init; return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new Zeroentropy({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 }); + const client = new ZeroEntropy({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 }); expect( await client.request({ @@ -388,7 +388,7 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new Zeroentropy({ apiKey: 'My API Key', fetch: testFetch }); + const client = new ZeroEntropy({ apiKey: 'My API Key', fetch: testFetch }); expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); expect(count).toEqual(2); @@ -415,7 +415,7 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new Zeroentropy({ apiKey: 'My API Key', fetch: testFetch }); + const client = new ZeroEntropy({ apiKey: 'My API Key', fetch: testFetch }); expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); expect(count).toEqual(2); diff --git a/tests/stringifyQuery.test.ts b/tests/stringifyQuery.test.ts index 30e00d3..141d953 100644 --- a/tests/stringifyQuery.test.ts +++ b/tests/stringifyQuery.test.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { Zeroentropy } from 'zeroentropy'; +import { ZeroEntropy } from 'zeroentropy'; -const { stringifyQuery } = Zeroentropy.prototype as any; +const { stringifyQuery } = ZeroEntropy.prototype as any; describe(stringifyQuery, () => { for (const [input, expected] of [