diff --git a/.gitignore b/.gitignore index 3eed6dd..d98d51a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ yarn-error.log codegen.log Brewfile.lock.json dist -/deno +dist-deno /*.tgz .idea/ diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c3f1463..96f1cd9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.0" + ".": "1.3.0" } diff --git a/.stats.yml b/.stats.yml index be7556d..40f1ba4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 18 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-4206be8170d98e1f909e4c0e34167f63952645f292b0e4fa7459ca7fcfc1b48a.yml +configured_endpoints: 21 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-82683f2fd5f8778a27960ebabda40d6dc4640bdfb77ac4ec7f173b8bf8076d3c.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index b4917da..e3c0a42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## 1.3.0 (2024-11-12) + +Full Changelog: [v1.2.0...v1.3.0](https://github.com/writer/writer-node/compare/v1.2.0...v1.3.0) + +### Features + +* **api:** add new endpoints ([#94](https://github.com/writer/writer-node/issues/94)) ([b0dcac4](https://github.com/writer/writer-node/commit/b0dcac40bb742924828cc51fd2c8702ab509e9a1)) +* **api:** add streaming to kg question ([#101](https://github.com/writer/writer-node/issues/101)) ([0279ffc](https://github.com/writer/writer-node/commit/0279ffc13185a7cc4e34bcd5df0489b19bcd8b64)) +* **api:** api update ([#100](https://github.com/writer/writer-node/issues/100)) ([a7c6e10](https://github.com/writer/writer-node/commit/a7c6e10b93285a3c5a42ed468097bab2556d6be3)) +* **api:** api update ([#87](https://github.com/writer/writer-node/issues/87)) ([eabef89](https://github.com/writer/writer-node/commit/eabef89d3b32f0a46e546e004d16d91f3b91e63c)) +* **api:** manual updates ([#102](https://github.com/writer/writer-node/issues/102)) ([eea7dcc](https://github.com/writer/writer-node/commit/eea7dcc7d88ebe666cce615991b302dfec62d46b)) +* **api:** manual updates ([#105](https://github.com/writer/writer-node/issues/105)) ([9158a6d](https://github.com/writer/writer-node/commit/9158a6debe889e7cc7cf23df00d5f46671d352e7)) +* **api:** manual updates ([#95](https://github.com/writer/writer-node/issues/95)) ([26f13bd](https://github.com/writer/writer-node/commit/26f13bda1f456ff17cb8194cf5c2edeb6303652b)) +* **api:** rename kg question and add text-to-graph ([#103](https://github.com/writer/writer-node/issues/103)) ([5e651e2](https://github.com/writer/writer-node/commit/5e651e2383975474a8dea114527c4111e01f9b2d)) +* **api:** update tools api methods ([#99](https://github.com/writer/writer-node/issues/99)) ([991f955](https://github.com/writer/writer-node/commit/991f955a62816fbd25e92649f84383f264521755)) + + +### Bug Fixes + +* fix tool_choice schema ([d3ade29](https://github.com/writer/writer-node/commit/d3ade29281eaf5ffd94022e77313d8cfe96955e3)) + + +### Chores + +* rebuild project due to codegen change ([#104](https://github.com/writer/writer-node/issues/104)) ([e1c82c3](https://github.com/writer/writer-node/commit/e1c82c3fcaa679478ed321bf97cf8935ed98e7d6)) +* rebuild project due to codegen change ([#90](https://github.com/writer/writer-node/issues/90)) ([89fa5b3](https://github.com/writer/writer-node/commit/89fa5b3b669fc430ab3578a126cffd4b536bcbd2)) +* rebuild project due to codegen change ([#91](https://github.com/writer/writer-node/issues/91)) ([3657edb](https://github.com/writer/writer-node/commit/3657edb012dac0612aef8d09944a0283718988e2)) +* rebuild project due to codegen change ([#92](https://github.com/writer/writer-node/issues/92)) ([a60408e](https://github.com/writer/writer-node/commit/a60408e45c1eae74b653e3f4b7120e461f9e29a0)) +* rebuild project due to codegen change ([#93](https://github.com/writer/writer-node/issues/93)) ([0f9276c](https://github.com/writer/writer-node/commit/0f9276cfecc4d48ded3536dfb6075636f298fc4f)) +* rebuild project due to codegen change ([#96](https://github.com/writer/writer-node/issues/96)) ([25327f5](https://github.com/writer/writer-node/commit/25327f5a7c98774387f100155428a291acd82f46)) +* rebuild project due to codegen change ([#97](https://github.com/writer/writer-node/issues/97)) ([6df076b](https://github.com/writer/writer-node/commit/6df076b5af13422cb960d602b6aeb174e6bbdbc9)) +* rebuild project due to codegen change ([#98](https://github.com/writer/writer-node/issues/98)) ([890c742](https://github.com/writer/writer-node/commit/890c74292aadb14d39ccec510f115b5740badf31)) + ## 1.2.0 (2024-10-10) Full Changelog: [v1.1.0...v1.2.0](https://github.com/writer/writer-node/compare/v1.1.0...v1.2.0) diff --git a/README.md b/README.md index f8f2e3e..4af101e 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ Note that requests which time out will be [retried twice by default](#retries). ## Auto-pagination List methods in the Writer API are paginated. -You can use `for await … of` syntax to iterate through items across all pages: +You can use the `for await … of` syntax to iterate through items across all pages: ```ts async function fetchAllGraphs(params) { @@ -175,7 +175,7 @@ async function fetchAllGraphs(params) { } ``` -Alternatively, you can make request a single page at a time: +Alternatively, you can request a single page at a time: ```ts let page = await client.graphs.list(); diff --git a/api.md b/api.md index 71b4e51..65561ed 100644 --- a/api.md +++ b/api.md @@ -46,6 +46,7 @@ Types: - Graph - Question +- QuestionResponseChunk - GraphCreateResponse - GraphUpdateResponse - GraphDeleteResponse @@ -78,3 +79,25 @@ Methods: - client.files.download(fileId) -> Response - client.files.retry({ ...params }) -> FileRetryResponse - client.files.upload({ ...params }) -> File + +# Tools + +Types: + +- ToolContextAwareSplittingResponse +- ToolParsePdfResponse + +Methods: + +- client.tools.contextAwareSplitting({ ...params }) -> ToolContextAwareSplittingResponse +- client.tools.parsePdf(fileId, { ...params }) -> ToolParsePdfResponse + +## Comprehend + +Types: + +- ComprehendMedicalResponse + +Methods: + +- client.tools.comprehend.medical({ ...params }) -> ComprehendMedicalResponse diff --git a/package.json b/package.json index ee5ecce..5e57ec8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "writer-sdk", - "version": "1.2.0", + "version": "1.3.0", "description": "The official TypeScript library for the Writer API", "author": "Writer ", "types": "dist/index.d.ts", @@ -10,7 +10,7 @@ "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "files": [ - "*" + "**/*" ], "private": false, "scripts": { diff --git a/scripts/build b/scripts/build index 9853d08..4394044 100755 --- a/scripts/build +++ b/scripts/build @@ -50,7 +50,7 @@ node scripts/utils/postprocess-files.cjs (cd dist && node -e 'require("writer-sdk")') (cd dist && node -e 'import("writer-sdk")' --input-type=module) -if command -v deno &> /dev/null && [ -e ./scripts/build-deno ] +if [ -e ./scripts/build-deno ] then ./scripts/build-deno fi diff --git a/src/core.ts b/src/core.ts index 5f5fd16..f37ece1 100644 --- a/src/core.ts +++ b/src/core.ts @@ -365,9 +365,13 @@ export abstract class APIClient { delete reqHeaders['content-type']; } - // Don't set the retry count header if it was already set or removed by the caller. We check `headers`, - // which can contain nulls, instead of `reqHeaders` to account for the removal case. - if (getHeader(headers, 'x-stainless-retry-count') === undefined) { + // Don't set the retry count header if it was already set or removed through default headers or by the + // caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to + // account for the removal case. + if ( + getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined && + getHeader(headers, 'x-stainless-retry-count') === undefined + ) { reqHeaders['x-stainless-retry-count'] = String(retryCount); } @@ -406,7 +410,7 @@ export abstract class APIClient { error: Object | undefined, message: string | undefined, headers: Headers | undefined, - ) { + ): APIError { return APIError.generate(status, error, message, headers); } @@ -678,9 +682,9 @@ export abstract class AbstractPage implements AsyncIterable { return await this.#client.requestAPIList(this.constructor as any, nextOptions); } - async *iterPages() { + async *iterPages(): AsyncGenerator { // eslint-disable-next-line @typescript-eslint/no-this-alias - let page: AbstractPage = this; + let page: this = this; yield page; while (page.hasNextPage()) { page = await page.getNextPage(); @@ -688,7 +692,7 @@ export abstract class AbstractPage implements AsyncIterable { } } - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { for await (const page of this.iterPages()) { for (const item of page.getPaginatedItems()) { yield item; @@ -731,7 +735,7 @@ export class PagePromise< * console.log(item) * } */ - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { const page = await this; for await (const item of page) { yield item; diff --git a/src/error.ts b/src/error.ts index 57dd8ee..981ddeb 100644 --- a/src/error.ts +++ b/src/error.ts @@ -47,7 +47,7 @@ export class APIError extends WriterError { errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined, - ) { + ): APIError { if (!status) { return new APIConnectionError({ message, cause: castToError(errorResponse) }); } diff --git a/src/index.ts b/src/index.ts index 2c9d06b..b0b0cdf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,11 +1,69 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Errors from './error'; -import * as Uploads from './uploads'; import { type Agent } from './_shims/index'; import * as Core from './core'; +import * as Errors from './error'; import * as Pagination from './pagination'; +import { type CursorPageParams, CursorPageResponse } from './pagination'; +import * as Uploads from './uploads'; import * as API from './resources/index'; +import { + ApplicationGenerateContentParams, + ApplicationGenerateContentResponse, + Applications, +} from './resources/applications'; +import { + Chat, + ChatChatParams, + ChatChatParamsNonStreaming, + ChatChatParamsStreaming, + ChatCompletionChunk, + ChatResource, +} from './resources/chat'; +import { + Completion, + CompletionCreateParams, + CompletionCreateParamsNonStreaming, + CompletionCreateParamsStreaming, + Completions, + StreamingData, +} from './resources/completions'; +import { + File, + FileDeleteResponse, + FileListParams, + FileRetryParams, + FileRetryResponse, + FileUploadParams, + Files, + FilesCursorPage, +} from './resources/files'; +import { + Graph, + GraphAddFileToGraphParams, + GraphCreateParams, + GraphCreateResponse, + GraphDeleteResponse, + GraphListParams, + GraphQuestionParams, + GraphQuestionParamsNonStreaming, + GraphQuestionParamsStreaming, + GraphRemoveFileFromGraphResponse, + GraphUpdateParams, + GraphUpdateResponse, + Graphs, + GraphsCursorPage, + Question, + QuestionResponseChunk, +} from './resources/graphs'; +import { ModelListResponse, Models } from './resources/models'; +import { + ToolContextAwareSplittingParams, + ToolContextAwareSplittingResponse, + ToolParsePdfParams, + ToolParsePdfResponse, + Tools, +} from './resources/tools/tools'; export interface ClientOptions { /** @@ -126,6 +184,7 @@ export class Writer extends Core.APIClient { models: API.Models = new API.Models(this); graphs: API.Graphs = new API.Graphs(this); files: API.Files = new API.Files(this); + tools: API.Tools = new API.Tools(this); protected override defaultQuery(): Core.DefaultQuery | undefined { return this._options.defaultQuery; @@ -163,7 +222,88 @@ export class Writer extends Core.APIClient { static fileFromPath = Uploads.fileFromPath; } -export const { +Writer.Applications = Applications; +Writer.ChatResource = ChatResource; +Writer.Completions = Completions; +Writer.Models = Models; +Writer.Graphs = Graphs; +Writer.GraphsCursorPage = GraphsCursorPage; +Writer.Files = Files; +Writer.FilesCursorPage = FilesCursorPage; +Writer.Tools = Tools; +export declare namespace Writer { + export type RequestOptions = Core.RequestOptions; + + export import CursorPage = Pagination.CursorPage; + export { type CursorPageParams as CursorPageParams, type CursorPageResponse as CursorPageResponse }; + + export { + Applications as Applications, + type ApplicationGenerateContentResponse as ApplicationGenerateContentResponse, + type ApplicationGenerateContentParams as ApplicationGenerateContentParams, + }; + + export { + ChatResource as ChatResource, + type Chat as Chat, + type ChatCompletionChunk as ChatCompletionChunk, + type ChatChatParams as ChatChatParams, + type ChatChatParamsNonStreaming as ChatChatParamsNonStreaming, + type ChatChatParamsStreaming as ChatChatParamsStreaming, + }; + + export { + Completions as Completions, + type Completion as Completion, + type StreamingData as StreamingData, + type CompletionCreateParams as CompletionCreateParams, + type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, + type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, + }; + + export { Models as Models, type ModelListResponse as ModelListResponse }; + + export { + Graphs as Graphs, + type Graph as Graph, + type Question as Question, + type QuestionResponseChunk as QuestionResponseChunk, + type GraphCreateResponse as GraphCreateResponse, + type GraphUpdateResponse as GraphUpdateResponse, + type GraphDeleteResponse as GraphDeleteResponse, + type GraphRemoveFileFromGraphResponse as GraphRemoveFileFromGraphResponse, + GraphsCursorPage as GraphsCursorPage, + type GraphCreateParams as GraphCreateParams, + type GraphUpdateParams as GraphUpdateParams, + type GraphListParams as GraphListParams, + type GraphAddFileToGraphParams as GraphAddFileToGraphParams, + type GraphQuestionParams as GraphQuestionParams, + type GraphQuestionParamsNonStreaming as GraphQuestionParamsNonStreaming, + type GraphQuestionParamsStreaming as GraphQuestionParamsStreaming, + }; + + export { + Files as Files, + type File as File, + type FileDeleteResponse as FileDeleteResponse, + type FileRetryResponse as FileRetryResponse, + FilesCursorPage as FilesCursorPage, + type FileListParams as FileListParams, + type FileRetryParams as FileRetryParams, + type FileUploadParams as FileUploadParams, + }; + + export { + Tools as Tools, + type ToolContextAwareSplittingResponse as ToolContextAwareSplittingResponse, + type ToolParsePdfResponse as ToolParsePdfResponse, + type ToolContextAwareSplittingParams as ToolContextAwareSplittingParams, + type ToolParsePdfParams as ToolParsePdfParams, + }; +} + +export { toFile, fileFromPath } from 'writer-sdk/uploads'; +export { WriterError, APIError, APIConnectionError, @@ -177,61 +317,6 @@ export const { InternalServerError, PermissionDeniedError, UnprocessableEntityError, -} = Errors; - -export import toFile = Uploads.toFile; -export import fileFromPath = Uploads.fileFromPath; - -export namespace Writer { - export import RequestOptions = Core.RequestOptions; - - export import CursorPage = Pagination.CursorPage; - export import CursorPageParams = Pagination.CursorPageParams; - export import CursorPageResponse = Pagination.CursorPageResponse; - - export import Applications = API.Applications; - export import ApplicationGenerateContentResponse = API.ApplicationGenerateContentResponse; - export import ApplicationGenerateContentParams = API.ApplicationGenerateContentParams; - - export import ChatResource = API.ChatResource; - export import Chat = API.Chat; - export import ChatCompletionChunk = API.ChatCompletionChunk; - export import ChatChatParams = API.ChatChatParams; - export import ChatChatParamsNonStreaming = API.ChatChatParamsNonStreaming; - export import ChatChatParamsStreaming = API.ChatChatParamsStreaming; - - export import Completions = API.Completions; - export import Completion = API.Completion; - export import StreamingData = API.StreamingData; - export import CompletionCreateParams = API.CompletionCreateParams; - export import CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming; - export import CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming; - - export import Models = API.Models; - export import ModelListResponse = API.ModelListResponse; - - export import Graphs = API.Graphs; - export import Graph = API.Graph; - export import Question = API.Question; - export import GraphCreateResponse = API.GraphCreateResponse; - export import GraphUpdateResponse = API.GraphUpdateResponse; - export import GraphDeleteResponse = API.GraphDeleteResponse; - export import GraphRemoveFileFromGraphResponse = API.GraphRemoveFileFromGraphResponse; - export import GraphsCursorPage = API.GraphsCursorPage; - export import GraphCreateParams = API.GraphCreateParams; - export import GraphUpdateParams = API.GraphUpdateParams; - export import GraphListParams = API.GraphListParams; - export import GraphAddFileToGraphParams = API.GraphAddFileToGraphParams; - export import GraphQuestionParams = API.GraphQuestionParams; - - export import Files = API.Files; - export import File = API.File; - export import FileDeleteResponse = API.FileDeleteResponse; - export import FileRetryResponse = API.FileRetryResponse; - export import FilesCursorPage = API.FilesCursorPage; - export import FileListParams = API.FileListParams; - export import FileRetryParams = API.FileRetryParams; - export import FileUploadParams = API.FileUploadParams; -} +} from 'writer-sdk/error'; export default Writer; diff --git a/src/resources/applications.ts b/src/resources/applications.ts index 382acc0..94ca7d8 100644 --- a/src/resources/applications.ts +++ b/src/resources/applications.ts @@ -2,7 +2,6 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -import * as ApplicationsAPI from './applications'; export class Applications extends APIResource { /** @@ -52,7 +51,9 @@ export namespace ApplicationGenerateContentParams { } } -export namespace Applications { - export import ApplicationGenerateContentResponse = ApplicationsAPI.ApplicationGenerateContentResponse; - export import ApplicationGenerateContentParams = ApplicationsAPI.ApplicationGenerateContentParams; +export declare namespace Applications { + export { + type ApplicationGenerateContentResponse as ApplicationGenerateContentResponse, + type ApplicationGenerateContentParams as ApplicationGenerateContentParams, + }; } diff --git a/src/resources/chat.ts b/src/resources/chat.ts index 113a5f5..b1d65b1 100644 --- a/src/resources/chat.ts +++ b/src/resources/chat.ts @@ -58,7 +58,7 @@ export interface Chat { * The type of object returned, which is always `chat.completion` for chat * responses. */ - object: string; + object: 'chat.completion'; /** * The service tier used for processing the request. @@ -92,78 +92,19 @@ export namespace Chat { */ index: number; - /** - * Log probability information for the choice. - */ - logprobs: Choice.Logprobs; - /** * The chat completion message from the model. Note: this field is deprecated for * streaming. Use `delta` instead. */ message: Choice.Message; - } - export namespace Choice { /** * Log probability information for the choice. */ - export interface Logprobs { - content: Array | null; - - refusal: Array | null; - } - - export namespace Logprobs { - export interface Content { - token: string; - - logprob: number; - - top_logprobs: Array; - - bytes?: Array; - } - - export namespace Content { - /** - * An array of mappings for each token to its top log probabilities, showing - * detailed prediction probabilities. - */ - export interface TopLogprob { - token: string; - - logprob: number; - - bytes?: Array; - } - } - - export interface Refusal { - token: string; - - logprob: number; - - top_logprobs: Array; - - bytes?: Array; - } - - export namespace Refusal { - /** - * An array of mappings for each token to its top log probabilities, showing - * detailed prediction probabilities. - */ - export interface TopLogprob { - token: string; - - logprob: number; - - bytes?: Array; - } - } - } + logprobs?: Choice.Logprobs | null; + } + export namespace Choice { /** * The chat completion message from the model. Note: this field is deprecated for * streaming. Use `delta` instead. @@ -175,7 +116,7 @@ export namespace Chat { */ content: string; - refusal: string; + refusal: string | null; /** * Specifies the role associated with the content. @@ -256,6 +197,65 @@ export namespace Chat { } } } + + /** + * Log probability information for the choice. + */ + export interface Logprobs { + content: Array | null; + + refusal: Array | null; + } + + export namespace Logprobs { + export interface Content { + token: string; + + logprob: number; + + top_logprobs: Array; + + bytes?: Array; + } + + export namespace Content { + /** + * An array of mappings for each token to its top log probabilities, showing + * detailed prediction probabilities. + */ + export interface TopLogprob { + token: string; + + logprob: number; + + bytes?: Array; + } + } + + export interface Refusal { + token: string; + + logprob: number; + + top_logprobs: Array; + + bytes?: Array; + } + + export namespace Refusal { + /** + * An array of mappings for each token to its top log probabilities, showing + * detailed prediction probabilities. + */ + export interface TopLogprob { + token: string; + + logprob: number; + + bytes?: Array; + } + } + } } /** @@ -315,7 +315,7 @@ export interface ChatCompletionChunk { * The type of object returned, which is always `chat.completion.chunk` for * streaming chat responses. */ - object: string; + object: 'chat.completion.chunk'; service_tier?: string; @@ -341,7 +341,7 @@ export namespace ChatCompletionChunk { * a stop sequence), 'content_filter' (harmful content filtered out), or * 'tool_calls' (encountered tool calls). */ - finish_reason: 'stop' | 'length' | 'content_filter' | 'tool_calls'; + finish_reason: 'stop' | 'length' | 'content_filter' | 'tool_calls' | null; /** * The index of the choice in the list of completions generated by the model. @@ -351,7 +351,7 @@ export namespace ChatCompletionChunk { /** * Log probability information for the choice. */ - logprobs?: Choice.Logprobs; + logprobs?: Choice.Logprobs | null; /** * The chat completion message from the model. Note: this field is deprecated for @@ -373,7 +373,7 @@ export namespace ChatCompletionChunk { graph_data?: Delta.GraphData; - refusal?: string; + refusal?: string | null; /** * Specifies the role associated with the content, indicating whether the message @@ -525,7 +525,7 @@ export namespace ChatCompletionChunk { */ content: string; - refusal: string; + refusal: string | null; /** * Specifies the role associated with the content. @@ -698,15 +698,14 @@ export interface ChatChatParamsBase { /** * Configure how the model will call functions: `auto` will allow the model to * automatically choose the best tool, `none` disables tool calling. You can also - * pass a specific previously defined function as a string. + * pass a specific previously defined function. */ - tool_choice?: ChatChatParams.JsonObjectToolChoice | ChatChatParams.StringToolChoice; + tool_choice?: ChatChatParams.StringToolChoice | ChatChatParams.JsonObjectToolChoice; /** - * [Beta] An array of tools described to the model using JSON schema that the model - * can use to generate responses. Please note that tool calling is in beta and - * subject to change. Passing graph IDs will automatically use the Knowledge Graph - * tool. + * An array of tools described to the model using JSON schema that the model can + * use to generate responses. Passing graph IDs will automatically use the + * Knowledge Graph tool. */ tools?: Array; @@ -723,11 +722,87 @@ export namespace ChatChatParams { export interface Message { role: 'user' | 'assistant' | 'system' | 'tool'; - content?: string; + content?: string | null; + + graph_data?: Message.GraphData | null; + + name?: string | null; + + refusal?: string | null; + + tool_call_id?: string | null; + + tool_calls?: Array | null; + } + + export namespace Message { + export interface GraphData { + sources?: Array; + + status?: 'processing' | 'finished'; + + subqueries?: Array; + } + + export namespace GraphData { + export interface Source { + /** + * The unique identifier of the file. + */ + file_id: string; + + /** + * A snippet of text from the source file. + */ + snippet: string; + } + + export interface Subquery { + /** + * The answer to the subquery. + */ + answer: string; + + /** + * The subquery that was asked. + */ + query: string; + + sources: Array; + } + + export namespace Subquery { + export interface Source { + /** + * The unique identifier of the file. + */ + file_id: string; + + /** + * A snippet of text from the source file. + */ + snippet: string; + } + } + } + + export interface ToolCall { + id: string; + + function: ToolCall.Function; + + type: string; - name?: string; + index?: number; + } + + export namespace ToolCall { + export interface Function { + arguments: string; - tool_call_id?: string; + name: string; + } + } } /** @@ -740,30 +815,46 @@ export namespace ChatChatParams { include_usage: boolean; } - export interface JsonObjectToolChoice { - value: unknown; - } - export interface StringToolChoice { value: 'none' | 'auto' | 'required'; } + export interface JsonObjectToolChoice { + value: Record; + } + export interface FunctionTool { function: FunctionTool.Function; + + /** + * The type of tool. + */ + type: 'function'; } export namespace FunctionTool { export interface Function { + /** + * Name of the function + */ name: string; + /** + * Description of the function + */ description?: string; - parameters?: unknown; + parameters?: Record; } } export interface GraphTool { function: GraphTool.Function; + + /** + * The type of tool. + */ + type: 'graph'; } export namespace GraphTool { @@ -807,10 +898,12 @@ export interface ChatChatParamsStreaming extends ChatChatParamsBase { stream: true; } -export namespace ChatResource { - export import Chat = ChatAPI.Chat; - export import ChatCompletionChunk = ChatAPI.ChatCompletionChunk; - export import ChatChatParams = ChatAPI.ChatChatParams; - export import ChatChatParamsNonStreaming = ChatAPI.ChatChatParamsNonStreaming; - export import ChatChatParamsStreaming = ChatAPI.ChatChatParamsStreaming; +export declare namespace ChatResource { + export { + type Chat as Chat, + type ChatCompletionChunk as ChatCompletionChunk, + type ChatChatParams as ChatChatParams, + type ChatChatParamsNonStreaming as ChatChatParamsNonStreaming, + type ChatChatParamsStreaming as ChatChatParamsStreaming, + }; } diff --git a/src/resources/completions.ts b/src/resources/completions.ts index d65cf5e..3c41553 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -198,10 +198,12 @@ export interface CompletionCreateParamsStreaming extends CompletionCreateParamsB stream: true; } -export namespace Completions { - export import Completion = CompletionsAPI.Completion; - export import StreamingData = CompletionsAPI.StreamingData; - export import CompletionCreateParams = CompletionsAPI.CompletionCreateParams; - export import CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming; - export import CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming; +export declare namespace Completions { + export { + type Completion as Completion, + type StreamingData as StreamingData, + type CompletionCreateParams as CompletionCreateParams, + type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, + type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, + }; } diff --git a/src/resources/files.ts b/src/resources/files.ts index acd7adc..962767e 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -3,7 +3,6 @@ import { APIResource } from '../resource'; import { isRequestOptions } from '../core'; import * as Core from '../core'; -import * as FilesAPI from './files'; import { CursorPage, type CursorPageParams } from '../pagination'; import { type Response } from '../_shims/index'; @@ -168,12 +167,16 @@ export interface FileUploadParams { 'Content-Type': string; } -export namespace Files { - export import File = FilesAPI.File; - export import FileDeleteResponse = FilesAPI.FileDeleteResponse; - export import FileRetryResponse = FilesAPI.FileRetryResponse; - export import FilesCursorPage = FilesAPI.FilesCursorPage; - export import FileListParams = FilesAPI.FileListParams; - export import FileRetryParams = FilesAPI.FileRetryParams; - export import FileUploadParams = FilesAPI.FileUploadParams; +Files.FilesCursorPage = FilesCursorPage; + +export declare namespace Files { + export { + type File as File, + type FileDeleteResponse as FileDeleteResponse, + type FileRetryResponse as FileRetryResponse, + FilesCursorPage as FilesCursorPage, + type FileListParams as FileListParams, + type FileRetryParams as FileRetryParams, + type FileUploadParams as FileUploadParams, + }; } diff --git a/src/resources/graphs.ts b/src/resources/graphs.ts index 2a6c80d..b505e3a 100644 --- a/src/resources/graphs.ts +++ b/src/resources/graphs.ts @@ -2,10 +2,12 @@ import { APIResource } from '../resource'; import { isRequestOptions } from '../core'; +import { APIPromise } from '../core'; import * as Core from '../core'; import * as GraphsAPI from './graphs'; import * as FilesAPI from './files'; import { CursorPage, type CursorPageParams } from '../pagination'; +import { Stream } from '../streaming'; export class Graphs extends APIResource { /** @@ -86,8 +88,22 @@ export class Graphs extends APIResource { /** * Ask a question to specified Knowledge Graphs. */ - question(body: GraphQuestionParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/v1/graphs/question', { body, ...options }); + question(body: GraphQuestionParamsNonStreaming, options?: Core.RequestOptions): APIPromise; + question( + body: GraphQuestionParamsStreaming, + options?: Core.RequestOptions, + ): APIPromise>; + question( + body: GraphQuestionParamsBase, + options?: Core.RequestOptions, + ): APIPromise | Question>; + question( + body: GraphQuestionParams, + options?: Core.RequestOptions, + ): APIPromise | APIPromise> { + return this._client.post('/v1/graphs/question', { body, ...options, stream: body.stream ?? false }) as + | APIPromise + | APIPromise>; } /** @@ -210,6 +226,10 @@ export namespace Question { } } +export interface QuestionResponseChunk { + data: Question; +} + export interface GraphCreateResponse { /** * A unique identifier of the graph. @@ -323,7 +343,9 @@ export interface GraphAddFileToGraphParams { file_id: string; } -export interface GraphQuestionParams { +export type GraphQuestionParams = GraphQuestionParamsNonStreaming | GraphQuestionParamsStreaming; + +export interface GraphQuestionParamsBase { /** * The unique identifiers of the Knowledge Graphs to be queried. */ @@ -347,17 +369,47 @@ export interface GraphQuestionParams { subqueries: boolean; } -export namespace Graphs { - export import Graph = GraphsAPI.Graph; - export import Question = GraphsAPI.Question; - export import GraphCreateResponse = GraphsAPI.GraphCreateResponse; - export import GraphUpdateResponse = GraphsAPI.GraphUpdateResponse; - export import GraphDeleteResponse = GraphsAPI.GraphDeleteResponse; - export import GraphRemoveFileFromGraphResponse = GraphsAPI.GraphRemoveFileFromGraphResponse; - export import GraphsCursorPage = GraphsAPI.GraphsCursorPage; - export import GraphCreateParams = GraphsAPI.GraphCreateParams; - export import GraphUpdateParams = GraphsAPI.GraphUpdateParams; - export import GraphListParams = GraphsAPI.GraphListParams; - export import GraphAddFileToGraphParams = GraphsAPI.GraphAddFileToGraphParams; - export import GraphQuestionParams = GraphsAPI.GraphQuestionParams; +export namespace GraphQuestionParams { + export type GraphQuestionParamsNonStreaming = GraphsAPI.GraphQuestionParamsNonStreaming; + export type GraphQuestionParamsStreaming = GraphsAPI.GraphQuestionParamsStreaming; +} + +export interface GraphQuestionParamsNonStreaming extends GraphQuestionParamsBase { + /** + * Determines whether the model's output should be streamed. If true, the output is + * generated and sent incrementally, which can be useful for real-time + * applications. + */ + stream: false; +} + +export interface GraphQuestionParamsStreaming extends GraphQuestionParamsBase { + /** + * Determines whether the model's output should be streamed. If true, the output is + * generated and sent incrementally, which can be useful for real-time + * applications. + */ + stream: true; +} + +Graphs.GraphsCursorPage = GraphsCursorPage; + +export declare namespace Graphs { + export { + type Graph as Graph, + type Question as Question, + type QuestionResponseChunk as QuestionResponseChunk, + type GraphCreateResponse as GraphCreateResponse, + type GraphUpdateResponse as GraphUpdateResponse, + type GraphDeleteResponse as GraphDeleteResponse, + type GraphRemoveFileFromGraphResponse as GraphRemoveFileFromGraphResponse, + GraphsCursorPage as GraphsCursorPage, + type GraphCreateParams as GraphCreateParams, + type GraphUpdateParams as GraphUpdateParams, + type GraphListParams as GraphListParams, + type GraphAddFileToGraphParams as GraphAddFileToGraphParams, + type GraphQuestionParams as GraphQuestionParams, + type GraphQuestionParamsNonStreaming as GraphQuestionParamsNonStreaming, + type GraphQuestionParamsStreaming as GraphQuestionParamsStreaming, + }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index d6fdbef..4efc706 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -1,49 +1,59 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - ApplicationGenerateContentResponse, - ApplicationGenerateContentParams, Applications, + type ApplicationGenerateContentResponse, + type ApplicationGenerateContentParams, } from './applications'; export { - Chat, - ChatCompletionChunk, - ChatChatParams, - ChatChatParamsNonStreaming, - ChatChatParamsStreaming, ChatResource, + type Chat, + type ChatCompletionChunk, + type ChatChatParams, + type ChatChatParamsNonStreaming, + type ChatChatParamsStreaming, } from './chat'; export { - Completion, - StreamingData, - CompletionCreateParams, - CompletionCreateParamsNonStreaming, - CompletionCreateParamsStreaming, Completions, + type Completion, + type StreamingData, + type CompletionCreateParams, + type CompletionCreateParamsNonStreaming, + type CompletionCreateParamsStreaming, } from './completions'; export { - File, - FileDeleteResponse, - FileRetryResponse, - FileListParams, - FileRetryParams, - FileUploadParams, FilesCursorPage, Files, + type File, + type FileDeleteResponse, + type FileRetryResponse, + type FileListParams, + type FileRetryParams, + type FileUploadParams, } from './files'; export { - Graph, - Question, - GraphCreateResponse, - GraphUpdateResponse, - GraphDeleteResponse, - GraphRemoveFileFromGraphResponse, - GraphCreateParams, - GraphUpdateParams, - GraphListParams, - GraphAddFileToGraphParams, - GraphQuestionParams, GraphsCursorPage, Graphs, + type Graph, + type Question, + type QuestionResponseChunk, + type GraphCreateResponse, + type GraphUpdateResponse, + type GraphDeleteResponse, + type GraphRemoveFileFromGraphResponse, + type GraphCreateParams, + type GraphUpdateParams, + type GraphListParams, + type GraphAddFileToGraphParams, + type GraphQuestionParams, + type GraphQuestionParamsNonStreaming, + type GraphQuestionParamsStreaming, } from './graphs'; -export { ModelListResponse, Models } from './models'; +export { Models, type ModelListResponse } from './models'; +export { + Tools, + type ToolContextAwareSplittingResponse, + type ToolParsePdfResponse, + type ToolContextAwareSplittingParams, + type ToolParsePdfParams, +} from './tools/tools'; diff --git a/src/resources/models.ts b/src/resources/models.ts index 88e55f7..e2d4c5d 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -2,7 +2,6 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -import * as ModelsAPI from './models'; export class Models extends APIResource { /** @@ -34,6 +33,6 @@ export namespace ModelListResponse { } } -export namespace Models { - export import ModelListResponse = ModelsAPI.ModelListResponse; +export declare namespace Models { + export { type ModelListResponse as ModelListResponse }; } diff --git a/src/resources/tools/comprehend.ts b/src/resources/tools/comprehend.ts new file mode 100644 index 0000000..807959c --- /dev/null +++ b/src/resources/tools/comprehend.ts @@ -0,0 +1,121 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; + +export class Comprehend extends APIResource { + /** + * Analyze unstructured medical text to extract entities labeled with standardized + * medical codes and confidence scores. + */ + medical( + body: ComprehendMedicalParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v1/tools/comprehend/medical', { body, ...options }); + } +} + +export interface ComprehendMedicalResponse { + /** + * An array of medical entities extracted from the input text. + */ + entities: Array; +} + +export namespace ComprehendMedicalResponse { + export interface Entity { + attributes: Array; + + begin_offset: number; + + category: string; + + concepts: Array; + + end_offset: number; + + score: number; + + text: string; + + traits: Array; + + type: string; + } + + export namespace Entity { + export interface Attribute { + begin_offset: number; + + concepts: Array; + + end_offset: number; + + relationship_score: number; + + score: number; + + text: string; + + traits: Array; + + type: string; + + category?: string; + + relationship_type?: string; + } + + export namespace Attribute { + export interface Concept { + code: string; + + description: string; + + score: number; + } + + export interface Trait { + name: string; + + score: number; + } + } + + export interface Concept { + code: string; + + description: string; + + score: number; + } + + export interface Trait { + name: string; + + score: number; + } + } +} + +export interface ComprehendMedicalParams { + /** + * The text to be analyzed. + */ + content: string; + + /** + * The structure of the response to be returned. `Entities` returns medical + * entities, `RxNorm` returns medication information, `ICD-10-CM` returns diagnosis + * codes, and `SNOMED CT` returns medical concepts. + */ + response_type: 'Entities' | 'RxNorm' | 'ICD-10-CM' | 'SNOMED CT'; +} + +export declare namespace Comprehend { + export { + type ComprehendMedicalResponse as ComprehendMedicalResponse, + type ComprehendMedicalParams as ComprehendMedicalParams, + }; +} diff --git a/src/resources/tools/index.ts b/src/resources/tools/index.ts new file mode 100644 index 0000000..9138e6f --- /dev/null +++ b/src/resources/tools/index.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Comprehend, type ComprehendMedicalResponse, type ComprehendMedicalParams } from './comprehend'; +export { + Tools, + type ToolContextAwareSplittingResponse, + type ToolParsePdfResponse, + type ToolContextAwareSplittingParams, + type ToolParsePdfParams, +} from './tools'; diff --git a/src/resources/tools/tools.ts b/src/resources/tools/tools.ts new file mode 100644 index 0000000..bbd5bae --- /dev/null +++ b/src/resources/tools/tools.ts @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as ComprehendAPI from './comprehend'; +import { Comprehend, ComprehendMedicalParams, ComprehendMedicalResponse } from './comprehend'; + +export class Tools extends APIResource { + comprehend: ComprehendAPI.Comprehend = new ComprehendAPI.Comprehend(this._client); + + /** + * Splits a long block of text (maximum 4000 words) into smaller chunks while + * preserving the semantic meaning of the text and context between the chunks. + */ + contextAwareSplitting( + body: ToolContextAwareSplittingParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v1/tools/context-aware-splitting', { body, ...options }); + } + + /** + * Parse PDF to other formats. + */ + parsePdf( + fileId: string, + body: ToolParsePdfParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post(`/v1/tools/pdf-parser/${fileId}`, { body, ...options }); + } +} + +export interface ToolContextAwareSplittingResponse { + /** + * An array of text chunks generated by splitting the input text based on the + * specified strategy. + */ + chunks: Array; +} + +export interface ToolParsePdfResponse { + /** + * The extracted content from the PDF file, converted to the specified format. + */ + content: string; +} + +export interface ToolContextAwareSplittingParams { + /** + * The strategy to be used for splitting the text into chunks. `llm_split` uses the + * language model to split the text, `fast_split` uses a fast heuristic-based + * approach, and `hybrid_split` combines both strategies. + */ + strategy: 'llm_split' | 'fast_split' | 'hybrid_split'; + + /** + * The text to be split into chunks. + */ + text: string; +} + +export interface ToolParsePdfParams { + /** + * The format into which the PDF content should be converted. + */ + format: 'text' | 'markdown'; +} + +Tools.Comprehend = Comprehend; + +export declare namespace Tools { + export { + type ToolContextAwareSplittingResponse as ToolContextAwareSplittingResponse, + type ToolParsePdfResponse as ToolParsePdfResponse, + type ToolContextAwareSplittingParams as ToolContextAwareSplittingParams, + type ToolParsePdfParams as ToolParsePdfParams, + }; + + export { + Comprehend as Comprehend, + type ComprehendMedicalResponse as ComprehendMedicalResponse, + type ComprehendMedicalParams as ComprehendMedicalParams, + }; +} diff --git a/src/streaming.ts b/src/streaming.ts index 4642f84..8445032 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -2,8 +2,8 @@ import { ReadableStream, type Response } from './_shims/index'; import { WriterError } from './error'; import { LineDecoder } from './internal/decoders/line'; -import { createResponseHeaders } from 'writer-sdk/core'; -import { APIError } from 'writer-sdk/error'; +import { createResponseHeaders } from './core'; +import { APIError } from './error'; type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined; @@ -23,7 +23,7 @@ export class Stream implements AsyncIterable { this.controller = controller; } - static fromSSEResponse(response: Response, controller: AbortController) { + static fromSSEResponse(response: Response, controller: AbortController): Stream { let consumed = false; async function* iterator(): AsyncIterator { @@ -71,7 +71,7 @@ export class Stream implements AsyncIterable { * Generates a Stream from a newline-separated ReadableStream * where each item is a JSON value. */ - static fromReadableStream(readableStream: ReadableStream, controller: AbortController) { + static fromReadableStream(readableStream: ReadableStream, controller: AbortController): Stream { let consumed = false; async function* iterLines(): AsyncGenerator { diff --git a/src/version.ts b/src/version.ts index 54c8a47..39fa5bc 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '1.2.0'; // x-release-please-version +export const VERSION = '1.3.0'; // x-release-please-version diff --git a/tests/api-resources/chat.test.ts b/tests/api-resources/chat.test.ts index 661fa36..8ac3a9e 100644 --- a/tests/api-resources/chat.test.ts +++ b/tests/api-resources/chat.test.ts @@ -26,8 +26,49 @@ describe('resource chat', () => { { role: 'user', content: 'Write a memo summarizing this earnings report.', + graph_data: { + sources: [ + { file_id: 'file_id', snippet: 'snippet' }, + { file_id: 'file_id', snippet: 'snippet' }, + { file_id: 'file_id', snippet: 'snippet' }, + ], + status: 'processing', + subqueries: [ + { + answer: 'answer', + query: 'query', + sources: [ + { file_id: 'file_id', snippet: 'snippet' }, + { file_id: 'file_id', snippet: 'snippet' }, + { file_id: 'file_id', snippet: 'snippet' }, + ], + }, + { + answer: 'answer', + query: 'query', + sources: [ + { file_id: 'file_id', snippet: 'snippet' }, + { file_id: 'file_id', snippet: 'snippet' }, + { file_id: 'file_id', snippet: 'snippet' }, + ], + }, + { + answer: 'answer', + query: 'query', + sources: [ + { file_id: 'file_id', snippet: 'snippet' }, + { file_id: 'file_id', snippet: 'snippet' }, + { file_id: 'file_id', snippet: 'snippet' }, + ], + }, + ], + }, name: 'name', + refusal: 'refusal', tool_call_id: 'tool_call_id', + tool_calls: [ + { id: 'id', function: { arguments: 'arguments', name: 'name' }, type: 'type', index: 0 }, + ], }, ], model: 'palmyra-x-004', @@ -38,11 +79,20 @@ describe('resource chat', () => { stream: false, stream_options: { include_usage: true }, temperature: 0, - tool_choice: { value: {} }, + tool_choice: { value: 'none' }, tools: [ - { function: { name: 'name', description: 'description', parameters: {} } }, - { function: { name: 'name', description: 'description', parameters: {} } }, - { function: { name: 'name', description: 'description', parameters: {} } }, + { + function: { name: 'name', description: 'description', parameters: { foo: 'bar' } }, + type: 'function', + }, + { + function: { name: 'name', description: 'description', parameters: { foo: 'bar' } }, + type: 'function', + }, + { + function: { name: 'name', description: 'description', parameters: { foo: 'bar' } }, + type: 'function', + }, ], top_p: 0, }); diff --git a/tests/api-resources/graphs.test.ts b/tests/api-resources/graphs.test.ts index cbd4523..04e7c8b 100644 --- a/tests/api-resources/graphs.test.ts +++ b/tests/api-resources/graphs.test.ts @@ -134,7 +134,7 @@ describe('resource graphs', () => { const responsePromise = client.graphs.question({ graph_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], question: 'question', - stream: true, + stream: false, subqueries: true, }); const rawResponse = await responsePromise.asResponse(); @@ -150,7 +150,7 @@ describe('resource graphs', () => { const response = await client.graphs.question({ graph_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], question: 'question', - stream: true, + stream: false, subqueries: true, }); }); diff --git a/tests/api-resources/tools/comprehend.test.ts b/tests/api-resources/tools/comprehend.test.ts new file mode 100644 index 0000000..9a82a57 --- /dev/null +++ b/tests/api-resources/tools/comprehend.test.ts @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Writer from 'writer-sdk'; +import { Response } from 'node-fetch'; + +const client = new Writer({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource comprehend', () => { + test('medical: only required params', async () => { + const responsePromise = client.tools.comprehend.medical({ + content: 'content', + response_type: 'Entities', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('medical: required and optional params', async () => { + const response = await client.tools.comprehend.medical({ content: 'content', response_type: 'Entities' }); + }); +}); diff --git a/tests/api-resources/tools/tools.test.ts b/tests/api-resources/tools/tools.test.ts new file mode 100644 index 0000000..38a1517 --- /dev/null +++ b/tests/api-resources/tools/tools.test.ts @@ -0,0 +1,41 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Writer from 'writer-sdk'; +import { Response } from 'node-fetch'; + +const client = new Writer({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource tools', () => { + test('contextAwareSplitting: only required params', async () => { + const responsePromise = client.tools.contextAwareSplitting({ strategy: 'llm_split', text: 'text' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('contextAwareSplitting: required and optional params', async () => { + const response = await client.tools.contextAwareSplitting({ strategy: 'llm_split', text: 'text' }); + }); + + test('parsePdf: only required params', async () => { + const responsePromise = client.tools.parsePdf('file_id', { format: 'text' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('parsePdf: required and optional params', async () => { + const response = await client.tools.parsePdf('file_id', { format: 'text' }); + }); +}); diff --git a/tests/index.test.ts b/tests/index.test.ts index 052d58c..7a96b73 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -295,6 +295,39 @@ describe('retries', () => { expect(capturedRequest!.headers as Headers).not.toHaveProperty('x-stainless-retry-count'); }); + test('omit retry count header by default', async () => { + let count = 0; + let capturedRequest: RequestInit | undefined; + const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => { + count++; + if (count <= 2) { + return new Response(undefined, { + status: 429, + headers: { + 'Retry-After': '0.1', + }, + }); + } + capturedRequest = init; + return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); + }; + const client = new Writer({ + apiKey: 'My API Key', + fetch: testFetch, + maxRetries: 4, + defaultHeaders: { 'X-Stainless-Retry-Count': null }, + }); + + expect( + await client.request({ + path: '/foo', + method: 'get', + }), + ).toEqual({ a: 1 }); + + expect(capturedRequest!.headers as Headers).not.toHaveProperty('x-stainless-retry-count'); + }); + test('overwrite retry count header', async () => { let count = 0; let capturedRequest: RequestInit | undefined; diff --git a/tsconfig.deno.json b/tsconfig.deno.json index 95adb8c..849e070 100644 --- a/tsconfig.deno.json +++ b/tsconfig.deno.json @@ -1,19 +1,14 @@ { "extends": "./tsconfig.json", - "include": ["deno"], + "include": ["dist-deno"], "exclude": [], "compilerOptions": { - "rootDir": "./deno", + "rootDir": "./dist-deno", "lib": ["es2020", "DOM"], - "paths": { - "writer-sdk/_shims/auto/*": ["deno/_shims/auto/*-deno"], - "writer-sdk/*": ["deno/*"], - "writer-sdk": ["deno/index.ts"], - }, "noEmit": true, "declaration": true, "declarationMap": true, - "outDir": "deno", + "outDir": "dist-deno", "pretty": true, "sourceMap": true } diff --git a/tsconfig.json b/tsconfig.json index 8380215..dd7a520 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "paths": { "writer-sdk/_shims/auto/*": ["src/_shims/auto/*-node"], "writer-sdk/*": ["src/*"], - "writer-sdk": ["src/index.ts"], + "writer-sdk": ["src/index.ts"] }, "noEmit": true, @@ -32,6 +32,7 @@ "noUncheckedIndexedAccess": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, + "isolatedModules": false, "skipLibCheck": true } diff --git a/yarn.lock b/yarn.lock index 10ebd6d..14e8a75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -322,9 +322,9 @@ eslint-visitor-keys "^3.3.0" "@eslint-community/regexpp@^4.5.1": - version "4.9.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.9.0.tgz#7ccb5f58703fa61ffdcbf39e2c604a109e781162" - integrity sha512-zJmuCWj2VLBt4c25CfBIbMZLGLyhkvs7LznyVX5HfpzeocThgIj5XQK4L+g3U36mMcx8bPMhGyPpwCATamC4jQ== + version "4.11.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.1.tgz#a547badfc719eb3e5f4b556325e542fbe9d7a18f" + integrity sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q== "@eslint-community/regexpp@^4.6.1": version "4.6.2" @@ -857,9 +857,9 @@ pretty-format "^29.0.0" "@types/json-schema@^7.0.12": - version "7.0.13" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.13.tgz#02c24f4363176d2d18fc8b70b9f3c54aba178a85" - integrity sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ== + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== "@types/node-fetch@^2.6.4": version "2.6.4" @@ -882,9 +882,9 @@ integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== "@types/semver@^7.5.0": - version "7.5.3" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.3.tgz#9a726e116beb26c24f1ccd6850201e1246122e04" - integrity sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw== + version "7.5.8" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" + integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== "@types/stack-utils@^2.0.0": version "2.0.3" @@ -904,15 +904,15 @@ "@types/yargs-parser" "*" "@typescript-eslint/eslint-plugin@^6.7.0": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.3.tgz#d98046e9f7102d49a93d944d413c6055c47fafd7" - integrity sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA== + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz#30830c1ca81fd5f3c2714e524c4303e0194f9cd3" + integrity sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA== dependencies: "@eslint-community/regexpp" "^4.5.1" - "@typescript-eslint/scope-manager" "6.7.3" - "@typescript-eslint/type-utils" "6.7.3" - "@typescript-eslint/utils" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/type-utils" "6.21.0" + "@typescript-eslint/utils" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" graphemer "^1.4.0" ignore "^5.2.4" @@ -921,71 +921,72 @@ ts-api-utils "^1.0.1" "@typescript-eslint/parser@^6.7.0": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.7.3.tgz#aaf40092a32877439e5957e18f2d6a91c82cc2fd" - integrity sha512-TlutE+iep2o7R8Lf+yoer3zU6/0EAUc8QIBB3GYBc1KGz4c4TRm83xwXUZVPlZ6YCLss4r77jbu6j3sendJoiQ== - dependencies: - "@typescript-eslint/scope-manager" "6.7.3" - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/typescript-estree" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b" + integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ== + dependencies: + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/typescript-estree" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz#07e5709c9bdae3eaf216947433ef97b3b8b7d755" - integrity sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ== +"@typescript-eslint/scope-manager@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1" + integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg== dependencies: - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" -"@typescript-eslint/type-utils@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz#c2c165c135dda68a5e70074ade183f5ad68f3400" - integrity sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw== +"@typescript-eslint/type-utils@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz#6473281cfed4dacabe8004e8521cee0bd9d4c01e" + integrity sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag== dependencies: - "@typescript-eslint/typescript-estree" "6.7.3" - "@typescript-eslint/utils" "6.7.3" + "@typescript-eslint/typescript-estree" "6.21.0" + "@typescript-eslint/utils" "6.21.0" debug "^4.3.4" ts-api-utils "^1.0.1" -"@typescript-eslint/types@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.7.3.tgz#0402b5628a63f24f2dc9d4a678e9a92cc50ea3e9" - integrity sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw== +"@typescript-eslint/types@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" + integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg== -"@typescript-eslint/typescript-estree@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz#ec5bb7ab4d3566818abaf0e4a8fa1958561b7279" - integrity sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g== +"@typescript-eslint/typescript-estree@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" + integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ== dependencies: - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" + minimatch "9.0.3" semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/utils@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.7.3.tgz#96c655816c373135b07282d67407cb577f62e143" - integrity sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg== +"@typescript-eslint/utils@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134" + integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ== dependencies: "@eslint-community/eslint-utils" "^4.4.0" "@types/json-schema" "^7.0.12" "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "6.7.3" - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/typescript-estree" "6.7.3" + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/typescript-estree" "6.21.0" semver "^7.5.4" -"@typescript-eslint/visitor-keys@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz#83809631ca12909bd2083558d2f93f5747deebb2" - integrity sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg== +"@typescript-eslint/visitor-keys@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47" + integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A== dependencies: - "@typescript-eslint/types" "6.7.3" + "@typescript-eslint/types" "6.21.0" eslint-visitor-keys "^3.4.1" abort-controller@^3.0.0: @@ -1392,13 +1393,20 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: +debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" +debug@^4.3.4: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + dedent@^1.0.0: version "1.5.1" resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.1.tgz#4f3fc94c8b711e9bb2800d185cd6ad20f2a90aff" @@ -1546,12 +1554,7 @@ eslint-scope@^7.2.2: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: - version "3.4.2" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz#8c2095440eca8c933bedcadf16fefa44dbe9ba5f" - integrity sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw== - -eslint-visitor-keys@^3.4.3: +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: version "3.4.3" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== @@ -1709,18 +1712,7 @@ fast-glob@^3.2.12: merge2 "^1.3.0" micromatch "^4.0.4" -fast-glob@^3.2.9: - version "3.3.1" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4" - integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fast-glob@^3.3.0: +fast-glob@^3.2.9, fast-glob@^3.3.0: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -1742,9 +1734,9 @@ fast-levenshtein@^2.0.6: integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fastq@^1.6.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" - integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + version "1.17.1" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" + integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== dependencies: reusify "^1.0.4" @@ -1967,9 +1959,9 @@ iconv-lite@^0.6.3: safer-buffer ">= 2.1.2 < 3.0.0" ignore@^5.2.0, ignore@^5.2.4: - version "5.2.4" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" - integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== + version "5.3.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" + integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== import-fresh@^3.2.1: version "3.3.0" @@ -2674,6 +2666,13 @@ mimic-fn@^4.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== +minimatch@9.0.3: + version "9.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -2703,7 +2702,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.0.0: +ms@^2.0.0, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -3058,13 +3057,18 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.5.3, semver@^7.5.4: +semver@^7.5.3: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0" +semver@^7.5.4: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -3261,9 +3265,9 @@ tr46@~0.0.3: integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= ts-api-utils@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331" - integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg== + version "1.3.0" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" + integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== ts-jest@^29.1.0: version "29.1.1"