diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..8ea34be --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,23 @@ +# syntax=docker/dockerfile:1 +FROM debian:bookworm-slim AS stainless + +RUN apt-get update && apt-get install -y \ + nodejs \ + npm \ + 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 + +WORKDIR /workspace + +COPY package.json yarn.lock /workspace/ + +RUN yarn install + +COPY . /workspace diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..60f0e7a --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,10 @@ +module.exports = { + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint', 'unused-imports', 'prettier'], + rules: { + 'no-unused-vars': 'off', + 'prettier/prettier': 'error', + 'unused-imports/no-unused-imports': 'error', + }, + root: true, +}; diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7b51ca0..5e39b94 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.17.0" + ".": "0.18.0" } diff --git a/.stats.yml b/.stats.yml index 718bfb9..fbf52db 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 5 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai%2Fperplexity-a251035716e17e7699e06dc69d4d7ab44ff3a8bde20bf3d35ecb03f6536b0f19.yml -openapi_spec_hash: 60fd7b4e1f54d41e944a5f2ec6744ef8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai%2Fperplexity-625f4b8c8e0776ba42d4848352701e8a482c732f47b4570bcc6bd55d0fa40d4f.yml +openapi_spec_hash: 81b4e099cc6c902cacac6cfae611157f config_hash: 5b10428c82f4119aa4837f03046d0e5c diff --git a/CHANGELOG.md b/CHANGELOG.md index 279760a..9132374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 0.18.0 (2025-12-05) + +Full Changelog: [v0.17.0...v0.18.0](https://github.com/perplexityai/perplexity-node/compare/v0.17.0...v0.18.0) + +### Features + +* **api:** manual updates ([fc07d79](https://github.com/perplexityai/perplexity-node/commit/fc07d79363e3bbe103595139270ddfa9cdc9af4d)) + + +### Bug Fixes + +* **mcp:** correct code tool API endpoint ([d7be1ad](https://github.com/perplexityai/perplexity-node/commit/d7be1ad64f691f68b9fd626ff657ff58056bb0a1)) +* **mcp:** return correct lines on typescript errors ([2719b53](https://github.com/perplexityai/perplexity-node/commit/2719b530e2560713cdba9a407ad74a5bf8cd0f32)) + + +### Chores + +* **internal:** codegen related update ([6ac26a8](https://github.com/perplexityai/perplexity-node/commit/6ac26a8aeebf04d7d1f2f0e4e9241d2327a3eb70)) + ## 0.17.0 (2025-12-02) Full Changelog: [v0.16.0...v0.17.0](https://github.com/perplexityai/perplexity-node/compare/v0.16.0...v0.17.0) diff --git a/jest.setup.ts b/jest.setup.ts new file mode 100644 index 0000000..e69de29 diff --git a/package.json b/package.json index bdbbd19..313059b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@perplexity-ai/perplexity_ai", - "version": "0.17.0", + "version": "0.18.0", "description": "The official TypeScript library for the Perplexity API", "author": "Perplexity ", "types": "dist/index.d.ts", diff --git a/src/internal/polyfill/file.node.d.ts b/src/internal/polyfill/file.node.d.ts new file mode 100644 index 0000000..c95276d --- /dev/null +++ b/src/internal/polyfill/file.node.d.ts @@ -0,0 +1,14 @@ +/** + * This file polyfills the global `File` object for you if it's not already defined + * when running on Node.js + * + * This is only needed on Node.js v18 & v19. Newer versions already define `File` + * as a global. + */ + +// @ts-ignore +type nodeBuffer = typeof import('node:buffer'); +declare const File: typeof globalThis extends { File: unknown } ? (typeof globalThis)['File'] +: nodeBuffer extends { File: unknown } ? nodeBuffer['File'] +: any; +export {}; diff --git a/src/internal/polyfill/file.node.mjs b/src/internal/polyfill/file.node.mjs new file mode 100644 index 0000000..520dcb8 --- /dev/null +++ b/src/internal/polyfill/file.node.mjs @@ -0,0 +1,9 @@ +/** + * This file polyfills the global `File` object for you if it's not already defined + * when running on Node.js + * + * This is only needed on Node.js v18 & v19. Newer versions already define `File` + * as a global. + */ + +import './file.node.js'; diff --git a/src/resources/search.ts b/src/resources/search.ts index 201fed5..3465db6 100644 --- a/src/resources/search.ts +++ b/src/resources/search.ts @@ -42,6 +42,10 @@ export interface SearchCreateParams { display_server_time?: boolean; + last_updated_after_filter?: string | null; + + last_updated_before_filter?: string | null; + max_results?: number; max_tokens?: number; diff --git a/src/version.ts b/src/version.ts index 0251da7..74131f9 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.17.0'; // x-release-please-version +export const VERSION = '0.18.0'; // x-release-please-version diff --git a/tests/api-resources/search.test.ts b/tests/api-resources/search.test.ts index c2e0be9..ca58717 100644 --- a/tests/api-resources/search.test.ts +++ b/tests/api-resources/search.test.ts @@ -26,6 +26,8 @@ describe('resource search', () => { query: 'string', country: 'country', display_server_time: true, + last_updated_after_filter: 'last_updated_after_filter', + last_updated_before_filter: 'last_updated_before_filter', max_results: 0, max_tokens: 0, max_tokens_per_page: 0, diff --git a/tests/responses.test.ts b/tests/responses.test.ts new file mode 100644 index 0000000..ee1cd34 --- /dev/null +++ b/tests/responses.test.ts @@ -0,0 +1,24 @@ +import { createResponseHeaders } from '@perplexity-ai/perplexity_ai/internal/headers'; + +describe('response parsing', () => { + // TODO: test unicode characters + test('headers are case agnostic', async () => { + const headers = createResponseHeaders(new Headers({ 'Content-Type': 'foo', Accept: 'text/plain' })); + expect(headers['content-type']).toEqual('foo'); + expect(headers['Content-type']).toEqual('foo'); + expect(headers['Content-Type']).toEqual('foo'); + expect(headers['accept']).toEqual('text/plain'); + expect(headers['Accept']).toEqual('text/plain'); + expect(headers['Hello-World']).toBeUndefined(); + }); + + test('duplicate headers are concatenated', () => { + const headers = createResponseHeaders( + new Headers([ + ['Content-Type', 'text/xml'], + ['Content-Type', 'application/json'], + ]), + ); + expect(headers['content-type']).toBe('text/xml, application/json'); + }); +});