From e1a66880ec8843f5b9e62526ed31fbe34345a293 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 19:10:40 +0000 Subject: [PATCH] chore(api): Internal SDK changes --- .devcontainer/Dockerfile | 4 + .github/workflows/ci.yml | 18 +++ .github/workflows/publish-npm.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- .gitignore | 2 + .prettierignore | 2 +- .stats.yml | 1 + Brewfile | 1 + CONTRIBUTING.md | 2 +- README.md | 68 +++++++-- SECURITY.md | 27 ++++ bin/check-test-server | 50 ------- jest.config.ts | 4 + package.json | 13 +- scripts/bootstrap | 18 +++ build => scripts/build | 15 +- scripts/lint | 7 + scripts/mock | 41 ++++++ scripts/test | 57 +++++++ .../{ => utils}/check-is-in-git-install.sh | 0 scripts/{ => utils}/check-version.cjs | 4 +- scripts/{ => utils}/fix-index-exports.cjs | 2 +- .../{ => utils}/make-dist-package-json.cjs | 2 +- scripts/{ => utils}/postprocess-files.cjs | 6 +- src/core.ts | 21 +-- src/error.ts | 2 +- src/index.ts | 22 +-- src/lib/chat_completions_ext.ts | 2 +- src/resource.ts | 2 +- src/resources/audio/audio.ts | 2 +- src/resources/audio/index.ts | 2 +- src/resources/audio/transcriptions.ts | 2 +- src/resources/audio/translations.ts | 2 +- src/resources/chat/chat.ts | 2 +- src/resources/chat/completions.ts | 39 +---- src/resources/chat/index.ts | 2 +- src/resources/index.ts | 2 +- src/resources/models.ts | 2 +- src/uploads.ts | 5 +- .../audio/transcriptions.test.ts | 2 +- .../api-resources/audio/translations.test.ts | 2 +- tests/api-resources/chat/completions.test.ts | 2 +- tests/api-resources/models.test.ts | 2 +- tests/index.test.ts | 2 +- tsconfig.build.json | 1 - tsconfig.deno.json | 1 - tsconfig.json | 1 - typings/digest-fetch/index.d.ts | 33 ----- yarn.lock | 139 +++++++++++++----- 49 files changed, 398 insertions(+), 244 deletions(-) create mode 100644 Brewfile create mode 100644 SECURITY.md delete mode 100755 bin/check-test-server create mode 100755 scripts/bootstrap rename build => scripts/build (84%) create mode 100755 scripts/lint create mode 100755 scripts/mock create mode 100755 scripts/test rename scripts/{ => utils}/check-is-in-git-install.sh (100%) rename scripts/{ => utils}/check-version.cjs (82%) rename scripts/{ => utils}/fix-index-exports.cjs (86%) rename scripts/{ => utils}/make-dist-package-json.cjs (87%) rename scripts/{ => utils}/postprocess-files.cjs (97%) delete mode 100644 typings/digest-fetch/index.d.ts diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d03365a..8ea34be 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -7,6 +7,10 @@ RUN apt-get update && apt-get install -y \ yarnpkg \ && apt-get clean autoclean +# Ensure UTF-8 encoding +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 + # Yarn RUN ln -sf /usr/bin/yarnpkg /usr/bin/yarn diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e6d1af..f6b6073 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,3 +28,21 @@ jobs: - name: Check types run: | yarn build + test: + name: test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Bootstrap + run: ./scripts/bootstrap + + - name: Run tests + run: ./scripts/test + diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 2d48613..79d80ad 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Node uses: actions/setup-node@v3 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 17df6a6..2cf9324 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -10,7 +10,7 @@ jobs: if: github.repository == 'groq/groq-typescript' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check release environment run: | diff --git a/.gitignore b/.gitignore index 58b3944..9a5858a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ node_modules yarn-error.log codegen.log +Brewfile.lock.json dist /deno /*.tgz .idea/ + diff --git a/.prettierignore b/.prettierignore index fc6160f..3548c5a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,5 @@ CHANGELOG.md -/ecosystem-tests +/ecosystem-tests/*/** /node_modules /deno diff --git a/.stats.yml b/.stats.yml index 2b7dbf3..8c47545 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1,2 @@ configured_endpoints: 6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-0a3089666368ff1ff668f2a73ea3b40d8b20420d8403a18579a1168dd67f2220.yml diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..e4feee6 --- /dev/null +++ b/Brewfile @@ -0,0 +1 @@ +brew "node" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4ed35f6..046acde 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,7 +68,7 @@ pnpm link -—global groq-sdk Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. ```bash -npx prism path/to/your/openapi.yml +npx prism mock path/to/your/openapi.yml ``` ```bash diff --git a/README.md b/README.md index 9669449..ed3e5b8 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ This library provides convenient access to the Groq REST API from server-side Ty The REST API documentation can be found [on console.groq.com](https://console.groq.com/docs). The full API of this library can be found in [api.md](api.md). +It is generated with [Stainless](https://www.stainlessapi.com/). + ## Installation ```sh @@ -47,7 +49,7 @@ const groq = new Groq(); async function main() { const params: Groq.Chat.CompletionCreateParams = { messages: [ - { role: 'system', content: 'You are a helpful assisstant.' }, + { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'Explain the importance of low latency LLMs' }, ], model: 'mixtral-8x7b-32768', @@ -72,7 +74,7 @@ async function main() { const chatCompletion = await groq.chat.completions .create({ messages: [ - { role: 'system', content: 'You are a helpful assisstant.' }, + { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'Explain the importance of low latency LLMs' }, ], model: 'mixtral-8x7b-32768', @@ -120,7 +122,7 @@ const groq = new Groq({ }); // Or, configure per-request: -await groq.chat.completions.create({ messages: [{ role: 'system', content: 'You are a helpful assisstant.' }, { role: 'user', content: 'Explain the importance of low latency LLMs' }], model: 'mixtral-8x7b-32768' }, { +await groq.chat.completions.create({ messages: [{ role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'Explain the importance of low latency LLMs' }], model: 'mixtral-8x7b-32768' }, { maxRetries: 5, }); ``` @@ -137,7 +139,7 @@ const groq = new Groq({ }); // Override per-request: -await groq.chat.completions.create({ messages: [{ role: 'system', content: 'You are a helpful assisstant.' }, { role: 'user', content: 'Explain the importance of low latency LLMs' }], model: 'mixtral-8x7b-32768' }, { +await groq.chat.completions.create({ messages: [{ role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'Explain the importance of low latency LLMs' }], model: 'mixtral-8x7b-32768' }, { timeout: 5 * 1000, }); ``` @@ -161,7 +163,7 @@ const groq = new Groq(); const response = await groq.chat.completions .create({ messages: [ - { role: 'system', content: 'You are a helpful assisstant.' }, + { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'Explain the importance of low latency LLMs' }, ], model: 'mixtral-8x7b-32768', @@ -173,7 +175,7 @@ console.log(response.statusText); // access the underlying Response object const { data: chatCompletion, response: raw } = await groq.chat.completions .create({ messages: [ - { role: 'system', content: 'You are a helpful assisstant.' }, + { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'Explain the importance of low latency LLMs' }, ], model: 'mixtral-8x7b-32768', @@ -183,7 +185,51 @@ console.log(raw.headers.get('X-My-Header')); console.log(chatCompletion.id); ``` -## Customizing the fetch client +### Making custom/undocumented requests + +This library is typed for convenient access to the documented API. If you need to access undocumented +endpoints, params, or response properties, the library can still be used. + +#### Undocumented endpoints + +To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs. +Options on the client, such as retries, will be respected when making these requests. + +```ts +await client.post('/some/path', { + body: { some_prop: 'foo' }, + query: { some_query_arg: 'bar' }, +}); +``` + +#### Undocumented request params + +To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented +parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you +send will be sent as-is. + +```ts +client.foo.create({ + foo: 'my_param', + bar: 12, + // @ts-expect-error baz is not yet public + baz: 'undocumented option', +}); +``` + +For requests with the `GET` verb, any extra params will be in the query, all other requests will send the +extra param in the body. + +If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request +options. + +#### Undocumented response properties + +To access undocumented response properties, you may access the response object with `// @ts-expect-error` on +the response object, or cast the response object to the requisite type. Like the request params, we do not +validate or strip extra properties from the response from the API. + +### Customizing the fetch client By default, this library uses `node-fetch` in Node, and expects a global `fetch` function in other environments. @@ -201,6 +247,8 @@ import Groq from 'groq-sdk'; To do the inverse, add `import "groq-sdk/shims/node"` (which does import polyfills). This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/groq/groq-typescript/tree/main/src/_shims#readme)). +### Logging and middleware + You may also provide a custom `fetch` function when instantiating the client, which can be used to inspect or alter the `Request` or `Response` before/after each request: @@ -221,7 +269,7 @@ const client = new Groq({ Note that if given a `DEBUG=true` environment variable, this library will log all requests and responses automatically. This is intended for debugging purposes only and may change in the future without notice. -## Configuring an HTTP(S) Agent (e.g., for proxies) +### Configuring an HTTP(S) Agent (e.g., for proxies) By default, this library uses a stable agent for all http/https requests to reuse TCP connections, eliminating many TCP & TLS handshakes and shaving around 100ms off most requests. @@ -241,7 +289,7 @@ const groq = new Groq({ await groq.chat.completions.create( { messages: [ - { role: 'system', content: 'You are a helpful assisstant.' }, + { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'Explain the importance of low latency LLMs' }, ], model: 'mixtral-8x7b-32768', @@ -252,7 +300,7 @@ await groq.chat.completions.create( ); ``` -## Semantic Versioning +## Semantic versioning This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..9550f35 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +# Security Policy + +## Reporting Security Issues + +This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. + +To report a security issue, please contact the Stainless team at security@stainlessapi.com. + +## Responsible Disclosure + +We appreciate the efforts of security researchers and individuals who help us maintain the security of +SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible +disclosure practices by allowing us a reasonable amount of time to investigate and address the issue +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 Groq please follow the respective company's security reporting guidelines. + +### Groq Terms and Policies + +Please contact support@groq.com for any questions or concerns regarding security of our services. + +--- + +Thank you for helping us keep the SDKs and systems they interact with secure. diff --git a/bin/check-test-server b/bin/check-test-server deleted file mode 100755 index a6fa349..0000000 --- a/bin/check-test-server +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash - -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color - -function prism_is_running() { - curl --silent "http://localhost:4010" >/dev/null 2>&1 -} - -function is_overriding_api_base_url() { - [ -n "$TEST_API_BASE_URL" ] -} - -if is_overriding_api_base_url ; then - # If someone is running the tests against the live API, we can trust they know - # what they're doing and exit early. - echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" - - exit 0 -elif prism_is_running ; then - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" - echo - - exit 0 -else - echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" - echo -e "running against your OpenAPI spec." - echo - echo -e "${YELLOW}To fix:${NC}" - echo - echo -e "1. Install Prism (requires Node 16+):" - echo - echo -e " With npm:" - echo -e " \$ ${YELLOW}npm install -g @stoplight/prism-cli${NC}" - echo - echo -e " With yarn:" - echo -e " \$ ${YELLOW}yarn global add @stoplight/prism-cli${NC}" - echo - echo -e "2. Run the mock server" - echo - echo -e " To run the server, pass in the path of your OpenAPI" - echo -e " spec to the prism command:" - echo - echo -e " \$ ${YELLOW}prism mock path/to/your.openapi.yml${NC}" - echo - - exit 1 -fi diff --git a/jest.config.ts b/jest.config.ts index 273b7a8..79f4ae5 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -3,6 +3,9 @@ import type { JestConfigWithTsJest } from 'ts-jest'; const config: JestConfigWithTsJest = { preset: 'ts-jest/presets/default-esm', testEnvironment: 'node', + transform: { + '^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }], + }, moduleNameMapper: { '^groq-sdk$': '/src/index.ts', '^groq-sdk/_shims/auto/(.*)$': '/src/_shims/auto/$1-node', @@ -14,6 +17,7 @@ const config: JestConfigWithTsJest = { '/deno/', '/deno_tests/', ], + testPathIgnorePatterns: ['scripts'], }; export default config; diff --git a/package.json b/package.json index 0726388..ab4a2a8 100644 --- a/package.json +++ b/package.json @@ -8,20 +8,20 @@ "type": "commonjs", "repository": "github:groq/groq-typescript", "license": "Apache-2.0", - "packageManager": "yarn@1.22.21", + "packageManager": "yarn@1.22.22", "files": [ "*" ], "private": false, "scripts": { - "test": "bin/check-test-server && yarn jest", - "build": "bash ./build", + "test": "./scripts/test", + "build": "./scripts/build", "prepack": "echo 'to pack, run yarn build && (cd dist; yarn pack)' && exit 1", "prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1", "format": "prettier --write --cache --cache-strategy metadata . !dist", - "prepare": "if ./scripts/check-is-in-git-install.sh; then npm run build; fi", + "prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi", "tsn": "ts-node -r tsconfig-paths/register", - "lint": "eslint --ext ts,js .", + "lint": "./scripts/lint", "fix": "eslint --fix --ext ts,js ." }, "dependencies": { @@ -29,13 +29,14 @@ "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", - "digest-fetch": "^1.3.0", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7", "web-streams-polyfill": "^3.2.1" }, "devDependencies": { + "@swc/core": "^1.3.102", + "@swc/jest": "^0.2.29", "@types/jest": "^29.4.0", "@typescript-eslint/eslint-plugin": "^6.7.0", "@typescript-eslint/parser": "^6.7.0", diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100755 index 0000000..05dd47a --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then + brew bundle check >/dev/null 2>&1 || { + echo "==> Installing Homebrew dependencies…" + brew bundle + } +fi + +echo "==> Installing Node dependencies…" + +PACKAGE_MANAGER=$(command -v yarn >/dev/null 2>&1 && echo "yarn" || echo "npm") + +$PACKAGE_MANAGER install diff --git a/build b/scripts/build similarity index 84% rename from build rename to scripts/build index 75f8cc4..31dfaf8 100755 --- a/build +++ b/scripts/build @@ -1,7 +1,10 @@ #!/usr/bin/env bash + set -exuo pipefail -node scripts/check-version.cjs +cd "$(dirname "$0")/.." + +node scripts/utils/check-version.cjs # Build into dist and will publish the package from there, # so that src/resources/foo.ts becomes /resources/foo.js @@ -22,7 +25,7 @@ if [ -e "bin/cli" ]; then fi # this converts the export map paths for the dist directory # and does a few other minor things -node scripts/make-dist-package-json.cjs > dist/package.json +node scripts/utils/make-dist-package-json.cjs > dist/package.json # build to .js/.mjs/.d.ts files npm exec tsc-multi @@ -32,7 +35,7 @@ cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto # we need to add exports = module.exports = Groq Node to index.js; # No way to get that from index.ts because it would cause compile errors # when building .mjs -node scripts/fix-index-exports.cjs +node scripts/utils/fix-index-exports.cjs # with "moduleResolution": "nodenext", if ESM resolves to index.d.ts, # it'll have TS errors on the default import. But if it resolves to # index.d.mts the default import will work (even though both files have @@ -40,14 +43,14 @@ node scripts/fix-index-exports.cjs cp dist/index.d.ts dist/index.d.mts cp tsconfig.dist-src.json dist/src/tsconfig.json -node scripts/postprocess-files.cjs +node scripts/utils/postprocess-files.cjs # make sure that nothing crashes when we require the output CJS or # import the output ESM (cd dist && node -e 'require("groq-sdk")') (cd dist && node -e 'import("groq-sdk")' --input-type=module) -if command -v deno &> /dev/null && [ -e ./build-deno ] +if command -v deno &> /dev/null && [ -e ./scripts/build-deno ] then - ./build-deno + ./scripts/build-deno fi diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 0000000..4f05d66 --- /dev/null +++ b/scripts/lint @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +./node_modules/.bin/eslint --ext ts,js . diff --git a/scripts/mock b/scripts/mock new file mode 100755 index 0000000..fe89a1d --- /dev/null +++ b/scripts/mock @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [[ -n "$1" && "$1" != '--'* ]]; then + URL="$1" + shift +else + URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" +fi + +# Check if the URL is empty +if [ -z "$URL" ]; then + echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" + exit 1 +fi + +echo "==> Starting mock server with URL ${URL}" + +# Run prism mock on the given spec +if [ "$1" == "--daemon" ]; then + npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log & + + # Wait for server to come online + echo -n "Waiting for server" + while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + echo -n "." + sleep 0.1 + done + + if grep -q "✖ fatal" ".prism.log"; then + cat .prism.log + exit 1 + fi + + echo +else + npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" +fi diff --git a/scripts/test b/scripts/test new file mode 100755 index 0000000..b62a7cc --- /dev/null +++ b/scripts/test @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +function prism_is_running() { + curl --silent "http://localhost:4010" >/dev/null 2>&1 +} + +kill_server_on_port() { + pids=$(lsof -t -i tcp:"$1" || echo "") + if [ "$pids" != "" ]; then + kill "$pids" + echo "Stopped $pids." + fi +} + +function is_overriding_api_base_url() { + [ -n "$TEST_API_BASE_URL" ] +} + +if ! is_overriding_api_base_url && ! prism_is_running ; then + # When we exit this script, make sure to kill the background mock server process + trap 'kill_server_on_port 4010' EXIT + + # Start the dev server + ./scripts/mock --daemon +fi + +if is_overriding_api_base_url ; then + echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" + echo +elif ! prism_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" + echo -e "running against your OpenAPI spec." + echo + echo -e "To run the server, pass in the path or url of your OpenAPI" + echo -e "spec to the prism command:" + echo + echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" + echo + + exit 1 +else + echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo +fi + +# Run tests +echo "==> Running tests" +./node_modules/.bin/jest "$@" diff --git a/scripts/check-is-in-git-install.sh b/scripts/utils/check-is-in-git-install.sh similarity index 100% rename from scripts/check-is-in-git-install.sh rename to scripts/utils/check-is-in-git-install.sh diff --git a/scripts/check-version.cjs b/scripts/utils/check-version.cjs similarity index 82% rename from scripts/check-version.cjs rename to scripts/utils/check-version.cjs index 50a8566..86c56df 100644 --- a/scripts/check-version.cjs +++ b/scripts/utils/check-version.cjs @@ -2,14 +2,14 @@ const fs = require('fs'); const path = require('path'); const main = () => { - const pkg = require('../package.json'); + const pkg = require('../../package.json'); const version = pkg['version']; if (!version) throw 'The version property is not set in the package.json file'; if (typeof version !== 'string') { throw `Unexpected type for the package.json version field; got ${typeof version}, expected string`; } - const versionFile = path.resolve(__dirname, '..', 'src', 'version.ts'); + const versionFile = path.resolve(__dirname, '..', '..', 'src', 'version.ts'); const contents = fs.readFileSync(versionFile, 'utf8'); const output = contents.replace(/(export const VERSION = ')(.*)(')/g, `$1${version}$3`); fs.writeFileSync(versionFile, output); diff --git a/scripts/fix-index-exports.cjs b/scripts/utils/fix-index-exports.cjs similarity index 86% rename from scripts/fix-index-exports.cjs rename to scripts/utils/fix-index-exports.cjs index b61b2ea..72b0b8f 100644 --- a/scripts/fix-index-exports.cjs +++ b/scripts/utils/fix-index-exports.cjs @@ -4,7 +4,7 @@ const path = require('path'); const indexJs = process.env['DIST_PATH'] ? path.resolve(process.env['DIST_PATH'], 'index.js') - : path.resolve(__dirname, '..', 'dist', 'index.js'); + : path.resolve(__dirname, '..', '..', 'dist', 'index.js'); let before = fs.readFileSync(indexJs, 'utf8'); let after = before.replace( diff --git a/scripts/make-dist-package-json.cjs b/scripts/utils/make-dist-package-json.cjs similarity index 87% rename from scripts/make-dist-package-json.cjs rename to scripts/utils/make-dist-package-json.cjs index d4a0a69..7c24f56 100644 --- a/scripts/make-dist-package-json.cjs +++ b/scripts/utils/make-dist-package-json.cjs @@ -1,4 +1,4 @@ -const pkgJson = require(process.env['PKG_JSON_PATH'] || '../package.json'); +const pkgJson = require(process.env['PKG_JSON_PATH'] || '../../package.json'); function processExportMap(m) { for (const key in m) { diff --git a/scripts/postprocess-files.cjs b/scripts/utils/postprocess-files.cjs similarity index 97% rename from scripts/postprocess-files.cjs rename to scripts/utils/postprocess-files.cjs index 8be79a2..ccda7a0 100644 --- a/scripts/postprocess-files.cjs +++ b/scripts/utils/postprocess-files.cjs @@ -2,12 +2,12 @@ const fs = require('fs'); const path = require('path'); const { parse } = require('@typescript-eslint/parser'); -const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? 'groq-sdk/' +const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? 'groq-sdk/'; const distDir = process.env['DIST_PATH'] ? path.resolve(process.env['DIST_PATH']) - : path.resolve(__dirname, '..', 'dist'); + : path.resolve(__dirname, '..', '..', 'dist'); const distSrcDir = path.join(distDir, 'src'); /** @@ -103,7 +103,7 @@ async function* walk(dir) { } async function postprocess() { - for await (const file of walk(path.resolve(__dirname, '..', 'dist'))) { + for await (const file of walk(path.resolve(__dirname, '..', '..', 'dist'))) { if (!/\.([cm]?js|(\.d)?[cm]?ts)$/.test(file)) continue; const code = await fs.promises.readFile(file, 'utf8'); diff --git a/src/core.ts b/src/core.ts index 4e476b7..592f014 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1,5 +1,4 @@ import { VERSION } from './version'; -import { Stream } from './lib/streaming'; import { GroqError, APIError, @@ -39,19 +38,6 @@ type APIResponseProps = { async function defaultParseResponse(props: APIResponseProps): Promise { const { response } = props; - if (props.options.stream) { - debug('response', response.status, response.url, response.headers, response.body); - - // Note: there is an invariant here that isn't represented in the type system - // that if you set `stream: true` the response type must also be `Stream` - - if (props.options.__streamClass) { - return props.options.__streamClass.fromSSEResponse(response, props.controller) as any; - } - - return Stream.fromSSEResponse(response, props.controller) as any; - } - // fetch refuses to read the body when the status code is 204. if (response.status === 204) { return null as T; @@ -750,7 +736,6 @@ export type RequestOptions | Readable> = idempotencyKey?: string; __binaryResponse?: boolean | undefined; - __streamClass?: typeof Stream; }; // This is required so that we can determine if a given object matches the RequestOptions @@ -771,7 +756,6 @@ const requestOptionsKeys: KeysEnum = { idempotencyKey: true, __binaryResponse: true, - __streamClass: true, }; export const isRequestOptions = (obj: unknown): obj is RequestOptions => { @@ -818,7 +802,8 @@ const getPlatformProperties = (): PlatformProperties => { 'X-Stainless-OS': normalizePlatform(Deno.build.os), 'X-Stainless-Arch': normalizeArch(Deno.build.arch), 'X-Stainless-Runtime': 'deno', - 'X-Stainless-Runtime-Version': Deno.version, + 'X-Stainless-Runtime-Version': + typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown', }; } if (typeof EdgeRuntime !== 'undefined') { @@ -1075,7 +1060,7 @@ function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void { } export function debug(action: string, ...args: any[]) { - if (typeof process !== 'undefined' && process.env['DEBUG'] === 'true') { + if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') { console.log(`Groq:DEBUG:${action}`, ...args); } } diff --git a/src/error.ts b/src/error.ts index 6194f36..0dc61a9 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { castToError, Headers } from './core'; diff --git a/src/index.ts b/src/index.ts index ec67f68..c4dd8b9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import * as Core from './core'; import * as Errors from './error'; @@ -67,12 +67,6 @@ export interface ClientOptions { * param to `undefined` in request options. */ defaultQuery?: Core.DefaultQuery; - - /** - * By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. - * Only set this option to `true` if you understand the risks and have appropriate mitigations in place. - */ - dangerouslyAllowBrowser?: boolean; } /** API Client for interfacing with the Groq API. */ @@ -92,7 +86,6 @@ export class Groq extends Core.APIClient { * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API. * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API. - * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. */ constructor({ baseURL = Core.readEnv('GROQ_BASE_URL'), @@ -111,12 +104,6 @@ export class Groq extends Core.APIClient { baseURL: baseURL || `https://api.groq.com`, }; - if (!options.dangerouslyAllowBrowser && Core.isRunningInBrowser()) { - throw new Errors.GroqError( - 'This is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew Groq({ dangerouslyAllowBrowser: true })', - ); - } - super({ baseURL: options.baseURL!, timeout: options.timeout ?? 60000 /* 1 minute */, @@ -163,6 +150,9 @@ export class Groq extends Core.APIClient { static InternalServerError = Errors.InternalServerError; static PermissionDeniedError = Errors.PermissionDeniedError; static UnprocessableEntityError = Errors.UnprocessableEntityError; + + static toFile = Uploads.toFile; + static fileFromPath = Uploads.fileFromPath; } export const { @@ -185,10 +175,6 @@ export import toFile = Uploads.toFile; export import fileFromPath = Uploads.fileFromPath; export namespace Groq { - // Helper functions - export import toFile = Uploads.toFile; - export import fileFromPath = Uploads.fileFromPath; - export import RequestOptions = Core.RequestOptions; export import Chat = API.Chat; diff --git a/src/lib/chat_completions_ext.ts b/src/lib/chat_completions_ext.ts index a5ff66e..01af661 100644 --- a/src/lib/chat_completions_ext.ts +++ b/src/lib/chat_completions_ext.ts @@ -1,5 +1,5 @@ // Manually curated models for streaming chat completions. -import { ChatCompletion } from 'groq-sdk/resources/chat/index' +import { ChatCompletion } from 'groq-sdk/resources/chat/index'; export interface ChatCompletionChunk { id: string; diff --git a/src/resource.ts b/src/resource.ts index efa8f82..59d6bf3 100644 --- a/src/resource.ts +++ b/src/resource.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import type { Groq } from './index'; diff --git a/src/resources/audio/audio.ts b/src/resources/audio/audio.ts index af709ae..c4e7ad9 100644 --- a/src/resources/audio/audio.ts +++ b/src/resources/audio/audio.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'groq-sdk/resource'; import * as AudioAPI from 'groq-sdk/resources/audio/audio'; diff --git a/src/resources/audio/index.ts b/src/resources/audio/index.ts index 50d80c3..b899a22 100644 --- a/src/resources/audio/index.ts +++ b/src/resources/audio/index.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Transcription, TranscriptionCreateParams, Transcriptions } from './transcriptions'; export { Translation, Audio } from './audio'; diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 4db1665..7078c67 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import * as Core from 'groq-sdk/core'; import { APIResource } from 'groq-sdk/resource'; diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index e8eb56e..f0de268 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import * as Core from 'groq-sdk/core'; import { APIResource } from 'groq-sdk/resource'; diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 00ff6f4..4a678e5 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'groq-sdk/resource'; import * as CompletionsAPI from 'groq-sdk/resources/chat/completions'; diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 7bf78a4..5d548b1 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -1,34 +1,15 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import * as Core from 'groq-sdk/core'; import { APIResource } from 'groq-sdk/resource'; import * as CompletionsAPI from 'groq-sdk/resources/chat/completions'; -import { Stream } from 'groq-sdk/lib/streaming'; -import { ChatCompletionChunk } from 'groq-sdk/lib/chat_completions_ext'; export class Completions extends APIResource { /** * Creates a completion for a chat prompt */ - create( - body: ChatCompletionCreateParamsNonStreaming, - options?: Core.RequestOptions, - ): Core.APIPromise; - create( - body: ChatCompletionCreateParamsStreaming, - options?: Core.RequestOptions, - ): Core.APIPromise>; - create( - body: ChatCompletionCreateParamsBase, - options?: Core.RequestOptions, - ): Core.APIPromise | ChatCompletion>; - create( - body: ChatCompletionCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise | Core.APIPromise> { - return this._client.post('/openai/v1/chat/completions', { body, ...options, stream: body.stream ?? false }) as - | Core.APIPromise - | Core.APIPromise>; + create(body: CompletionCreateParams, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post('/openai/v1/chat/completions', { body, ...options }); } } @@ -130,7 +111,7 @@ export namespace ChatCompletion { } } -export interface ChatCompletionCreateParamsBase { +export interface CompletionCreateParams { messages: Array; model: string; @@ -254,15 +235,3 @@ export namespace Completions { export import ChatCompletion = CompletionsAPI.ChatCompletion; export import CompletionCreateParams = CompletionsAPI.CompletionCreateParams; } - -export interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase { - stream?: false; -} - -export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase { - stream: true; -} - -export type ChatCompletionCreateParams = - | ChatCompletionCreateParamsNonStreaming - | ChatCompletionCreateParamsStreaming; diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index f26983e..eccaa36 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Chat } from './chat'; export { ChatCompletion, CompletionCreateParams, Completions } from './completions'; diff --git a/src/resources/index.ts b/src/resources/index.ts index 9a18e49..3d61ce9 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Chat } from './chat/chat'; export { Model, ModelList, Models } from './models'; diff --git a/src/resources/models.ts b/src/resources/models.ts index 9fb6591..bbaf4af 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import * as Core from 'groq-sdk/core'; import { APIResource } from 'groq-sdk/resource'; diff --git a/src/uploads.ts b/src/uploads.ts index 2398baf..081827c 100644 --- a/src/uploads.ts +++ b/src/uploads.ts @@ -102,11 +102,14 @@ export type ToFileInput = Uploadable | Exclude | AsyncIter export async function toFile( value: ToFileInput | PromiseLike, name?: string | null | undefined, - options: FilePropertyBag | undefined = {}, + options?: FilePropertyBag | undefined, ): Promise { // If it's a promise, resolve it. value = await value; + // Use the file's options if there isn't one provided + options ??= isFileLike(value) ? { lastModified: value.lastModified, type: value.type } : {}; + if (isResponseLike(value)) { const blob = await value.blob(); name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file'; diff --git a/tests/api-resources/audio/transcriptions.test.ts b/tests/api-resources/audio/transcriptions.test.ts index 03eb701..aa27c59 100644 --- a/tests/api-resources/audio/transcriptions.test.ts +++ b/tests/api-resources/audio/transcriptions.test.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import Groq, { toFile } from 'groq-sdk'; import { Response } from 'node-fetch'; diff --git a/tests/api-resources/audio/translations.test.ts b/tests/api-resources/audio/translations.test.ts index 0de357a..1ee59cc 100644 --- a/tests/api-resources/audio/translations.test.ts +++ b/tests/api-resources/audio/translations.test.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import Groq, { toFile } from 'groq-sdk'; import { Response } from 'node-fetch'; diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index 7d5dacf..af929d8 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import Groq from 'groq-sdk'; import { Response } from 'node-fetch'; diff --git a/tests/api-resources/models.test.ts b/tests/api-resources/models.test.ts index 867ffe2..fb2fb5e 100644 --- a/tests/api-resources/models.test.ts +++ b/tests/api-resources/models.test.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import Groq from 'groq-sdk'; import { Response } from 'node-fetch'; diff --git a/tests/index.test.ts b/tests/index.test.ts index b7b08a0..8af7495 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,4 +1,4 @@ -// File generated from our OpenAPI spec by Stainless. +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import Groq from 'groq-sdk'; import { APIUserAbortError } from 'groq-sdk'; diff --git a/tsconfig.build.json b/tsconfig.build.json index 4740de1..b943052 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -7,7 +7,6 @@ "paths": { "groq-sdk/*": ["dist/src/*"], "groq-sdk": ["dist/src/index.ts"], - "digest-fetch": ["./typings/digest-fetch"] }, "noEmit": false, "declaration": true, diff --git a/tsconfig.deno.json b/tsconfig.deno.json index c972bda..8b2c623 100644 --- a/tsconfig.deno.json +++ b/tsconfig.deno.json @@ -9,7 +9,6 @@ "groq-sdk/_shims/auto/*": ["deno/_shims/auto/*-deno"], "groq-sdk/*": ["deno/*"], "groq-sdk": ["deno/index.ts"], - "digest-fetch": ["./typings/digest-fetch"] }, "noEmit": true, "declaration": true, diff --git a/tsconfig.json b/tsconfig.json index 73e2290..b4429d6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,6 @@ "groq-sdk/_shims/auto/*": ["src/_shims/auto/*-node"], "groq-sdk/*": ["src/*"], "groq-sdk": ["src/index.ts"], - "digest-fetch": ["./typings/digest-fetch"] }, "noEmit": true, diff --git a/typings/digest-fetch/index.d.ts b/typings/digest-fetch/index.d.ts deleted file mode 100644 index f6bcbfd..0000000 --- a/typings/digest-fetch/index.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -declare module 'digest-fetch'; - -import type { RequestInfo, RequestInit, Response } from 'node-fetch'; - -type Algorithm = 'MD5' | 'MD5-sess'; - -type Options = { - algorithm?: Algorithm; - statusCode?: number; - cnonceSize?: number; - basic?: boolean; - precomputeHash?: boolean; - logger?: typeof console; -}; - -class DigestClient { - user: string; - password: string; - - private nonceRaw: string; - private logger?: typeof console; - private precomputedHash?: boolean; - private statusCode?: number; - private basic: boolean; - private cnonceSize: number; - private hasAuth: boolean; - private digest: { nc: number; algorithm: Algorithm; realm: string }; - - constructor(user: string, password: string, options: Options = {}); - async fetch(url: RequestInfo, options: RequestInit = {}): Promise; -} - -export default DigestClient; diff --git a/yarn.lock b/yarn.lock index a79485a..dda4d2e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -432,6 +432,13 @@ slash "^3.0.0" strip-ansi "^6.0.0" +"@jest/create-cache-key-function@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz#793be38148fab78e65f40ae30c36785f4ad859f0" + integrity sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA== + dependencies: + "@jest/types" "^29.6.3" + "@jest/environment@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" @@ -662,6 +669,96 @@ dependencies: "@sinonjs/commons" "^3.0.0" +"@swc/core-darwin-arm64@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.16.tgz#2cd45d709ce76d448d96bf8d0006849541436611" + integrity sha512-UOCcH1GvjRnnM/LWT6VCGpIk0OhHRq6v1U6QXuPt5wVsgXnXQwnf5k3sG5Cm56hQHDvhRPY6HCsHi/p0oek8oQ== + +"@swc/core-darwin-x64@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.4.16.tgz#a5bc7d8b1dd850adb0bb95c6b5c742b92201fd01" + integrity sha512-t3bgqFoYLWvyVtVL6KkFNCINEoOrIlyggT/kJRgi1y0aXSr0oVgcrQ4ezJpdeahZZ4N+Q6vT3ffM30yIunELNA== + +"@swc/core-linux-arm-gnueabihf@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.16.tgz#961744908ee5cbb79bc009dcf58cc8b831111f38" + integrity sha512-DvHuwvEF86YvSd0lwnzVcjOTZ0jcxewIbsN0vc/0fqm9qBdMMjr9ox6VCam1n3yYeRtj4VFgrjeNFksqbUejdQ== + +"@swc/core-linux-arm64-gnu@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.16.tgz#43713be3f26757d82d2745dc25f8b63400e0a3d0" + integrity sha512-9Uu5YlPbyCvbidjKtYEsPpyZlu16roOZ5c2tP1vHfnU9bgf5Tz5q5VovSduNxPHx+ed2iC1b1URODHvDzbbDuQ== + +"@swc/core-linux-arm64-musl@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.16.tgz#394a7d030f3a61902bd3947bb9d70d26d42f3c81" + integrity sha512-/YZq/qB1CHpeoL0eMzyqK5/tYZn/rzKoCYDviFU4uduSUIJsDJQuQA/skdqUzqbheOXKAd4mnJ1hT04RbJ8FPQ== + +"@swc/core-linux-x64-gnu@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.16.tgz#71eb108b784f9d551ee8a35ebcdaed972f567981" + integrity sha512-UUjaW5VTngZYDcA8yQlrFmqs1tLi1TxbKlnaJwoNhel9zRQ0yG1YEVGrzTvv4YApSuIiDK18t+Ip927bwucuVQ== + +"@swc/core-linux-x64-musl@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.16.tgz#10dbaedb4e3dfc7268e3a9a66ad3431471ef035b" + integrity sha512-aFhxPifevDTwEDKPi4eRYWzC0p/WYJeiFkkpNU5Uc7a7M5iMWPAbPFUbHesdlb9Jfqs5c07oyz86u+/HySBNPQ== + +"@swc/core-win32-arm64-msvc@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.16.tgz#80247adff6c245ff32b44d773c1a148858cd655f" + integrity sha512-bTD43MbhIHL2s5QgCwyleaGwl96Gk/scF2TaVKdUe4QlJCDV/YK9h5oIBAp63ckHtE8GHlH4c8dZNBiAXn4Org== + +"@swc/core-win32-ia32-msvc@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.16.tgz#e540afc3ccf3224267b4ddfb408f9d9737984686" + integrity sha512-/lmZeAN/qV5XbK2SEvi8e2RkIg8FQNYiSA8y2/Zb4gTUMKVO5JMLH0BSWMiIKMstKDPDSxMWgwJaQHF8UMyPmQ== + +"@swc/core-win32-x64-msvc@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.16.tgz#f880939fca32c181adfe7e3abd2b6b7857bd3489" + integrity sha512-BPAfFfODWXtUu6SwaTTftDHvcbDyWBSI/oanUeRbQR5vVWkXoQ3cxLTsDluc3H74IqXS5z1Uyoe0vNo2hB1opA== + +"@swc/core@^1.3.102": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.4.16.tgz#d175bae2acfecd53bcbd4293f1fba5ec316634a0" + integrity sha512-Xaf+UBvW6JNuV131uvSNyMXHn+bh6LyKN4tbv7tOUFQpXyz/t9YWRE04emtlUW9Y0qrm/GKFCbY8n3z6BpZbTA== + dependencies: + "@swc/counter" "^0.1.2" + "@swc/types" "^0.1.5" + optionalDependencies: + "@swc/core-darwin-arm64" "1.4.16" + "@swc/core-darwin-x64" "1.4.16" + "@swc/core-linux-arm-gnueabihf" "1.4.16" + "@swc/core-linux-arm64-gnu" "1.4.16" + "@swc/core-linux-arm64-musl" "1.4.16" + "@swc/core-linux-x64-gnu" "1.4.16" + "@swc/core-linux-x64-musl" "1.4.16" + "@swc/core-win32-arm64-msvc" "1.4.16" + "@swc/core-win32-ia32-msvc" "1.4.16" + "@swc/core-win32-x64-msvc" "1.4.16" + +"@swc/counter@^0.1.2", "@swc/counter@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9" + integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ== + +"@swc/jest@^0.2.29": + version "0.2.36" + resolved "https://registry.yarnpkg.com/@swc/jest/-/jest-0.2.36.tgz#2797450a30d28b471997a17e901ccad946fe693e" + integrity sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw== + dependencies: + "@jest/create-cache-key-function" "^29.7.0" + "@swc/counter" "^0.1.3" + jsonc-parser "^3.2.0" + +"@swc/types@^0.1.5": + version "0.1.6" + resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.6.tgz#2f13f748995b247d146de2784d3eb7195410faba" + integrity sha512-/JLo/l2JsT/LRd80C3HfbmVpxOAJ11FO2RCEslFrgzLltoP9j8XIbsyDcfCt2WWyX+CM96rBoNM+IToAkFOugg== + dependencies: + "@swc/counter" "^0.1.3" + "@ts-morph/common@~0.20.0": version "0.20.0" resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.20.0.tgz#3f161996b085ba4519731e4d24c35f6cba5b80af" @@ -1076,11 +1173,6 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -base-64@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb" - integrity sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA== - big-integer@^1.6.44: version "1.6.52" resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" @@ -1193,11 +1285,6 @@ char-regex@^1.0.2: resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== -charenc@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" - integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA== - ci-info@^3.2.0: version "3.9.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" @@ -1305,11 +1392,6 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -crypt@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" - integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow== - debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -1380,14 +1462,6 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== -digest-fetch@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/digest-fetch/-/digest-fetch-1.3.0.tgz#898e69264d00012a23cf26e8a3e40320143fc661" - integrity sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA== - dependencies: - base-64 "^0.1.0" - md5 "^2.3.0" - dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -1934,11 +2008,6 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== -is-buffer@~1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== - is-core-module@^2.13.0: version "2.13.1" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" @@ -2473,6 +2542,11 @@ json5@^2.2.2, json5@^2.2.3: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== +jsonc-parser@^3.2.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.1.tgz#031904571ccf929d7670ee8c547545081cb37f1a" + integrity sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA== + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -2553,15 +2627,6 @@ makeerror@1.0.12: dependencies: tmpl "1.0.5" -md5@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f" - integrity sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g== - dependencies: - charenc "0.0.2" - crypt "0.0.2" - is-buffer "~1.1.6" - merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"