From 4a2c34a97b3e2131ac1c0f6f392d54962bc50f62 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 4 Feb 2025 06:43:15 +0000
Subject: [PATCH 01/25] feat(api): update via SDK Studio (#20)
---
api.md | 1 +
src/index.ts | 2 +
src/resources/documents.ts | 78 +++++++++++---------------------------
src/resources/index.ts | 1 +
4 files changed, 26 insertions(+), 56 deletions(-)
diff --git a/api.md b/api.md
index 8fb61c26..0f6cb222 100644
--- a/api.md
+++ b/api.md
@@ -4,6 +4,7 @@ Types:
- Document
- DocumentStatus
+- Scores
- DocumentListResponse
Methods:
diff --git a/src/index.ts b/src/index.ts
index 195475e6..65d13647 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -26,6 +26,7 @@ import {
DocumentStatus,
DocumentUploadParams,
Documents,
+ Scores,
} from './resources/documents';
import { Query, QuerySearchParams, QuerySearchResponse } from './resources/query';
@@ -209,6 +210,7 @@ export declare namespace Hyperspell {
Documents as Documents,
type Document as Document,
type DocumentStatus as DocumentStatus,
+ type Scores as Scores,
type DocumentListResponse as DocumentListResponse,
DocumentListResponsesCursorPage as DocumentListResponsesCursorPage,
type DocumentListParams as DocumentListParams,
diff --git a/src/resources/documents.ts b/src/resources/documents.ts
index df7f83d7..6d660622 100644
--- a/src/resources/documents.ts
+++ b/src/resources/documents.ts
@@ -2,6 +2,7 @@
import { APIResource } from '../resource';
import * as Core from '../core';
+import * as DocumentsAPI from './documents';
import { CursorPage, type CursorPageParams } from '../pagination';
export class Documents extends APIResource {
@@ -98,36 +99,17 @@ export namespace Document {
export interface SectionResult {
id?: number | null;
- scores?: SectionResult.Scores;
+ scores?: DocumentsAPI.Scores;
text?: string;
}
- export namespace SectionResult {
- export interface Scores {
- /**
- * How relevant the section is based on full text search
- */
- full_text_search?: number | null;
-
- /**
- * How relevant the section is based on vector search
- */
- semantic_search?: number | null;
-
- /**
- * The final weighted score of the section
- */
- weighted?: number | null;
- }
- }
-
export interface SectionResultWithElements {
id?: number | null;
elements?: Array;
- scores?: SectionResultWithElements.Scores;
+ scores?: DocumentsAPI.Scores;
text?: string;
}
@@ -166,23 +148,6 @@ export namespace Document {
title_level?: number | null;
}
}
-
- export interface Scores {
- /**
- * How relevant the section is based on full text search
- */
- full_text_search?: number | null;
-
- /**
- * How relevant the section is based on vector search
- */
- semantic_search?: number | null;
-
- /**
- * The final weighted score of the section
- */
- weighted?: number | null;
- }
}
}
@@ -194,6 +159,23 @@ export interface DocumentStatus {
status: 'pending' | 'processing' | 'completed' | 'failed';
}
+export interface Scores {
+ /**
+ * How relevant the section is based on full text search
+ */
+ full_text_search?: number | null;
+
+ /**
+ * How relevant the section is based on vector search
+ */
+ semantic_search?: number | null;
+
+ /**
+ * The final weighted score of the section
+ */
+ weighted?: number | null;
+}
+
export interface DocumentListResponse {
id?: number | null;
@@ -250,7 +232,7 @@ export namespace DocumentListResponse {
metadata?: Record;
- scores?: Section.Scores;
+ scores?: DocumentsAPI.Scores;
text?: string;
}
@@ -289,23 +271,6 @@ export namespace DocumentListResponse {
title_level?: number | null;
}
}
-
- export interface Scores {
- /**
- * How relevant the section is based on full text search
- */
- full_text_search?: number | null;
-
- /**
- * How relevant the section is based on vector search
- */
- semantic_search?: number | null;
-
- /**
- * The final weighted score of the section
- */
- weighted?: number | null;
- }
}
}
@@ -386,6 +351,7 @@ export declare namespace Documents {
export {
type Document as Document,
type DocumentStatus as DocumentStatus,
+ type Scores as Scores,
type DocumentListResponse as DocumentListResponse,
DocumentListResponsesCursorPage as DocumentListResponsesCursorPage,
type DocumentListParams as DocumentListParams,
diff --git a/src/resources/index.ts b/src/resources/index.ts
index bf196d87..d6b05f12 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -14,6 +14,7 @@ export {
Documents,
type Document,
type DocumentStatus,
+ type Scores,
type DocumentListResponse,
type DocumentListParams,
type DocumentAddParams,
From 4ad814769ef6503eb9b5a51c14d1ea3f74c736c5 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 5 Feb 2025 03:29:22 +0000
Subject: [PATCH 02/25] feat(client): send `X-Stainless-Timeout` header (#22)
---
src/core.ts | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/core.ts b/src/core.ts
index 62af19dc..f745bdea 100644
--- a/src/core.ts
+++ b/src/core.ts
@@ -280,6 +280,7 @@ export abstract class APIClient {
options: FinalRequestOptions,
{ retryCount = 0 }: { retryCount?: number } = {},
): { req: RequestInit; url: string; timeout: number } {
+ options = { ...options };
const { method, path, query, headers: headers = {} } = options;
const body =
@@ -292,9 +293,9 @@ export abstract class APIClient {
const url = this.buildURL(path!, query);
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
- const timeout = options.timeout ?? this.timeout;
+ options.timeout = options.timeout ?? this.timeout;
const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
- const minAgentTimeout = timeout + 1000;
+ const minAgentTimeout = options.timeout + 1000;
if (
typeof (httpAgent as any)?.options?.timeout === 'number' &&
minAgentTimeout > ((httpAgent as any).options.timeout ?? 0)
@@ -323,7 +324,7 @@ export abstract class APIClient {
signal: options.signal ?? null,
};
- return { req, url, timeout };
+ return { req, url, timeout: options.timeout };
}
private buildHeaders({
@@ -351,15 +352,22 @@ export abstract class APIClient {
delete reqHeaders['content-type'];
}
- // 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.
+ // Don't set theses headers if they were 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);
}
+ if (
+ getHeader(defaultHeaders, 'x-stainless-timeout') === undefined &&
+ getHeader(headers, 'x-stainless-timeout') === undefined &&
+ options.timeout
+ ) {
+ reqHeaders['x-stainless-timeout'] = String(options.timeout);
+ }
this.validateHeaders(reqHeaders, headers);
From c9aaf54d0505676b9cc6a75af87a9994cca2f5b3 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 5 Feb 2025 20:05:35 +0000
Subject: [PATCH 03/25] feat(api): api update (#23)
---
.stats.yml | 2 +-
src/resources/documents.ts | 5 ++---
tests/api-resources/documents.test.ts | 2 +-
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 59ca7083..56c998df 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 10
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-7632a025f14cf4ef9630966e00cb47fd93e8b43f1e9111f3917eb5adf145f0dd.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-ba6c4db7ea12bd505fe5cfe650ef7372c17dbe083875afea40d5de959dbba9e1.yml
diff --git a/src/resources/documents.ts b/src/resources/documents.ts
index 6d660622..3b901a7a 100644
--- a/src/resources/documents.ts
+++ b/src/resources/documents.ts
@@ -333,10 +333,9 @@ export interface DocumentAddURLParams {
collection: string;
/**
- * Source URL of the document. If text is not provided and URL is publicly
- * accessible, Hyperspell will retrieve the document from this URL.
+ * Source URL of the document.
*/
- url?: string | null;
+ url: string;
}
export interface DocumentUploadParams {
diff --git a/tests/api-resources/documents.test.ts b/tests/api-resources/documents.test.ts
index 7bba8f9f..1a456d94 100644
--- a/tests/api-resources/documents.test.ts
+++ b/tests/api-resources/documents.test.ts
@@ -46,7 +46,7 @@ describe('resource documents', () => {
});
test('addURL: only required params', async () => {
- const responsePromise = client.documents.addURL({ collection: 'collection' });
+ const responsePromise = client.documents.addURL({ collection: 'collection', url: 'url' });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
From 53266933ad271b9f2f00b7c7e3607eb91f65b7f4 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 5 Feb 2025 21:27:45 +0000
Subject: [PATCH 04/25] feat(api): api update (#24)
---
.stats.yml | 2 +-
src/resources/query.ts | 8 ++++----
tests/api-resources/query.test.ts | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 56c998df..baec5548 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 10
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-ba6c4db7ea12bd505fe5cfe650ef7372c17dbe083875afea40d5de959dbba9e1.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-e2730102bf18b9b31baab9d5f3a0545acdcaec16f74b2b64831c5a99230ab847.yml
diff --git a/src/resources/query.ts b/src/resources/query.ts
index 9397ed5f..0e1502f3 100644
--- a/src/resources/query.ts
+++ b/src/resources/query.ts
@@ -21,14 +21,14 @@ export interface QuerySearchResponse {
export interface QuerySearchParams {
/**
- * Query to run.
+ * Only query documents in these collections.
*/
- query: string;
+ collections: string | Array;
/**
- * Only query documents in these collections.
+ * Query to run.
*/
- collections?: Array;
+ query: string;
/**
* Filter the query results.
diff --git a/tests/api-resources/query.test.ts b/tests/api-resources/query.test.ts
index cad0704a..ec97cca8 100644
--- a/tests/api-resources/query.test.ts
+++ b/tests/api-resources/query.test.ts
@@ -10,7 +10,7 @@ const client = new Hyperspell({
describe('resource query', () => {
test('search: only required params', async () => {
- const responsePromise = client.query.search({ query: 'query' });
+ const responsePromise = client.query.search({ collections: 'string', query: 'query' });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -22,8 +22,8 @@ describe('resource query', () => {
test('search: required and optional params', async () => {
const response = await client.query.search({
+ collections: 'string',
query: 'query',
- collections: ['string'],
filter: {
end_date: '2019-12-27T18:11:19.117Z',
source: ['generic'],
From fdc83d13e6e6d4de12378b219a3ed6b790c66466 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 10 Feb 2025 21:27:31 +0000
Subject: [PATCH 05/25] feat(api): api update (#25)
---
.stats.yml | 2 +-
src/resources/documents.ts | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index baec5548..1d9cbdf6 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 10
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-e2730102bf18b9b31baab9d5f3a0545acdcaec16f74b2b64831c5a99230ab847.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-13d2b5d2fd8520c18100c06bf65b8a716deb0860cf06aa35101b64c628cca348.yml
diff --git a/src/resources/documents.ts b/src/resources/documents.ts
index 3b901a7a..eff57659 100644
--- a/src/resources/documents.ts
+++ b/src/resources/documents.ts
@@ -62,6 +62,8 @@ export interface Document {
created_at?: string | null;
+ events?: Array;
+
ingested_at?: string | null;
metadata?: Record;
@@ -96,6 +98,14 @@ export interface Document {
}
export namespace Document {
+ export interface Event {
+ message: string;
+
+ type: 'error' | 'warning' | 'info';
+
+ time?: string;
+ }
+
export interface SectionResult {
id?: number | null;
@@ -183,6 +193,8 @@ export interface DocumentListResponse {
created_at?: string | null;
+ events?: Array;
+
ingested_at?: string | null;
metadata?: Record;
@@ -219,6 +231,14 @@ export interface DocumentListResponse {
}
export namespace DocumentListResponse {
+ export interface Event {
+ message: string;
+
+ type: 'error' | 'warning' | 'info';
+
+ time?: string;
+ }
+
export interface Section {
document_id: number;
From eef40b4f33a39ad5a7887669414a4efdd3303f80 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 11 Feb 2025 23:27:33 +0000
Subject: [PATCH 06/25] feat(api): api update (#26)
---
.stats.yml | 2 +-
src/resources/documents.ts | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 1d9cbdf6..bf5212a6 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 10
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-13d2b5d2fd8520c18100c06bf65b8a716deb0860cf06aa35101b64c628cca348.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-036faa49b258b84e5e0b005039461bfc4942c718fb105444d863b9d7af2922f2.yml
diff --git a/src/resources/documents.ts b/src/resources/documents.ts
index eff57659..e252e286 100644
--- a/src/resources/documents.ts
+++ b/src/resources/documents.ts
@@ -359,8 +359,14 @@ export interface DocumentAddURLParams {
}
export interface DocumentUploadParams {
+ /**
+ * The collection to add the document to.
+ */
collection: string;
+ /**
+ * The file to ingest.
+ */
file: Core.Uploadable;
}
From 5543d8ea3804070de726997e8474deb01318eb68 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 14 Feb 2025 05:39:00 +0000
Subject: [PATCH 07/25] fix(client): fix export map for index exports (#27)
---
package.json | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/package.json b/package.json
index d8b338a9..64d85961 100644
--- a/package.json
+++ b/package.json
@@ -107,17 +107,17 @@
"default": "./dist/index.mjs"
},
"./*.mjs": {
- "types": "./dist/*.d.ts",
- "default": "./dist/*.mjs"
+ "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"],
+ "default": ["./dist/*.mjs", "./dist/*/index.mjs"]
},
"./*.js": {
- "types": "./dist/*.d.ts",
- "default": "./dist/*.js"
+ "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"],
+ "default": ["./dist/*.js", "./dist/*/index.js"]
},
"./*": {
- "types": "./dist/*.d.ts",
- "require": "./dist/*.js",
- "default": "./dist/*.mjs"
+ "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"],
+ "require": ["./dist/*.js", "./dist/*/index.js"],
+ "default": ["./dist/*.mjs", "./dist/*/index.mjs"]
}
}
}
From 44c69e887a6e32339a487e28e14e444e68ac32c5 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 19 Feb 2025 05:33:12 +0000
Subject: [PATCH 08/25] chore(internal): codegen related update (#28)
---
README.md | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/README.md b/README.md
index 7e6295f8..c361685c 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,42 @@ main();
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
+## File uploads
+
+Request parameters that correspond to file uploads can be passed in many different forms:
+
+- `File` (or an object with the same structure)
+- a `fetch` `Response` (or an object with the same structure)
+- an `fs.ReadStream`
+- the return value of our `toFile` helper
+
+```ts
+import fs from 'fs';
+import fetch from 'node-fetch';
+import Hyperspell, { toFile } from 'hyperspell';
+
+const client = new Hyperspell();
+
+// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
+await client.documents.upload({ collection: 'collection', file: fs.createReadStream('/path/to/file') });
+
+// Or if you have the web `File` API you can pass a `File` instance:
+await client.documents.upload({ collection: 'collection', file: new File(['my bytes'], 'file') });
+
+// You can also pass a `fetch` `Response`:
+await client.documents.upload({ collection: 'collection', file: await fetch('https://somesite/file') });
+
+// Finally, if none of the above are convenient, you can use our `toFile` helper:
+await client.documents.upload({
+ collection: 'collection',
+ file: await toFile(Buffer.from('my bytes'), 'file'),
+});
+await client.documents.upload({
+ collection: 'collection',
+ file: await toFile(new Uint8Array([0, 1, 2]), 'file'),
+});
+```
+
## Handling errors
When the library is unable to connect to the API,
From 26194ce3891b4f5e6bc89d13a7e8c85137dfe731 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 22 Feb 2025 06:03:18 +0000
Subject: [PATCH 09/25] chore(internal): fix devcontainers setup (#29)
---
.devcontainer/Dockerfile | 23 -----------------------
.devcontainer/devcontainer.json | 27 ++++++++++++---------------
2 files changed, 12 insertions(+), 38 deletions(-)
delete mode 100644 .devcontainer/Dockerfile
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
deleted file mode 100644
index 8ea34be9..00000000
--- a/.devcontainer/Dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index d55fc4d6..763462fa 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,20 +1,17 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
- "name": "Debian",
- "build": {
- "dockerfile": "Dockerfile"
+ "name": "Development",
+ "image": "mcr.microsoft.com/devcontainers/typescript-node:latest",
+ "features": {
+ "ghcr.io/devcontainers/features/node:1": {}
+ },
+ "postCreateCommand": "yarn install",
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "esbenp.prettier-vscode"
+ ]
+ }
}
-
- // Features to add to the dev container. More info: https://containers.dev/features.
- // "features": {},
-
- // Use 'forwardPorts' to make a list of ports inside the container available locally.
- // "forwardPorts": [],
-
- // Configure tool-specific properties.
- // "customizations": {},
-
- // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
- // "remoteUser": "root"
}
From f9c04926d82f1f863e6e111feb3b6e4ab33ff0bf Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 28 Feb 2025 03:25:41 +0000
Subject: [PATCH 10/25] docs: update URLs from stainlessapi.com to
stainless.com (#30)
More details at https://www.stainless.com/changelog/stainless-com
---
README.md | 2 +-
SECURITY.md | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index c361685c..8583449a 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ This library provides convenient access to the Hyperspell REST API from server-s
The REST API documentation can be found on [docs.hyperspell.com](https://docs.hyperspell.com/). The full API of this library can be found in [api.md](api.md).
-It is generated with [Stainless](https://www.stainlessapi.com/).
+It is generated with [Stainless](https://www.stainless.com/).
## Installation
diff --git a/SECURITY.md b/SECURITY.md
index 19b33727..4b274355 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -2,9 +2,9 @@
## 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.
+This SDK is generated by [Stainless Software Inc](http://stainless.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.
+To report a security issue, please contact the Stainless team at security@stainless.com.
## Responsible Disclosure
From 2b286c14f6545cfaf65259fabc051c40dbe336e7 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 8 Mar 2025 05:35:10 +0000
Subject: [PATCH 11/25] chore(internal): codegen related update (#31)
---
src/pagination.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pagination.ts b/src/pagination.ts
index 09e20afb..1bf82aba 100644
--- a/src/pagination.ts
+++ b/src/pagination.ts
@@ -53,7 +53,7 @@ export class CursorPage- extends AbstractPage
- implements CursorPageRe
return {
params: {
- cursor: cursor,
+ cursor,
},
};
}
From ecdef891f2210522efe31e5120d26ad572432f3b Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 11 Mar 2025 09:23:12 +0000
Subject: [PATCH 12/25] feat: add SKIP_BREW env var to ./scripts/bootstrap
(#32)
---
scripts/bootstrap | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/bootstrap b/scripts/bootstrap
index 05dd47a6..0af58e25 100755
--- a/scripts/bootstrap
+++ b/scripts/bootstrap
@@ -4,7 +4,7 @@ set -e
cd "$(dirname "$0")/.."
-if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
+if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
From ca38adc6b3125f68d682462e42f7c79ac0d65da1 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 11 Mar 2025 09:38:47 +0000
Subject: [PATCH 13/25] feat(client): accept RFC6838 JSON content types (#33)
---
src/core.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core.ts b/src/core.ts
index f745bdea..4413a5de 100644
--- a/src/core.ts
+++ b/src/core.ts
@@ -48,8 +48,8 @@ async function defaultParseResponse(props: APIResponseProps): Promise {
}
const contentType = response.headers.get('content-type');
- const isJSON =
- contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
+ const mediaType = contentType?.split(';')[0]?.trim();
+ const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
if (isJSON) {
const json = await response.json();
From 3677c0c5673c2f49e7f37072be45aad49f1ee5d6 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 14 Mar 2025 07:02:01 +0000
Subject: [PATCH 14/25] chore(internal): remove extra empty newlines (#34)
---
.github/workflows/ci.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e3530dcb..0312165a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -63,4 +63,3 @@ jobs:
- name: Run tests
run: ./scripts/test
-
From 641f5b3a2311b4db0c16d4555e6073a502c94226 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 20 Mar 2025 06:54:35 +0000
Subject: [PATCH 15/25] chore(exports): cleaner resource index imports (#35)
---
src/resources.ts | 1 +
1 file changed, 1 insertion(+)
create mode 100644 src/resources.ts
diff --git a/src/resources.ts b/src/resources.ts
new file mode 100644
index 00000000..b283d578
--- /dev/null
+++ b/src/resources.ts
@@ -0,0 +1 @@
+export * from './resources/index';
From 801d961baa29194a1ecc3656305297e893fb2bb0 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 20 Mar 2025 06:55:32 +0000
Subject: [PATCH 16/25] chore(exports): stop using path fallbacks (#36)
---
package.json | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/package.json b/package.json
index 64d85961..d8b338a9 100644
--- a/package.json
+++ b/package.json
@@ -107,17 +107,17 @@
"default": "./dist/index.mjs"
},
"./*.mjs": {
- "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"],
- "default": ["./dist/*.mjs", "./dist/*/index.mjs"]
+ "types": "./dist/*.d.ts",
+ "default": "./dist/*.mjs"
},
"./*.js": {
- "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"],
- "default": ["./dist/*.js", "./dist/*/index.js"]
+ "types": "./dist/*.d.ts",
+ "default": "./dist/*.js"
},
"./*": {
- "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"],
- "require": ["./dist/*.js", "./dist/*/index.js"],
- "default": ["./dist/*.mjs", "./dist/*/index.mjs"]
+ "types": "./dist/*.d.ts",
+ "require": "./dist/*.js",
+ "default": "./dist/*.mjs"
}
}
}
From 42542b91e05ae3543112c21eae0c110158b753e5 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 22 Mar 2025 06:07:08 +0000
Subject: [PATCH 17/25] fix: avoid type error in certain environments (#37)
---
src/core.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core.ts b/src/core.ts
index 4413a5de..5a2112d7 100644
--- a/src/core.ts
+++ b/src/core.ts
@@ -395,7 +395,7 @@ export abstract class APIClient {
!headers ? {}
: Symbol.iterator in headers ?
Object.fromEntries(Array.from(headers as Iterable).map((header) => [...header]))
- : { ...headers }
+ : { ...(headers as any as Record) }
);
}
From a9f47673364b5e8f8b2fcfee54b2c7a22eca9d2b Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 25 Mar 2025 21:04:28 +0000
Subject: [PATCH 18/25] feat(api): api update
---
.github/workflows/create-releases.yml | 41 +++++
.github/workflows/publish-npm.yml | 8 +-
.github/workflows/release-doctor.yml | 1 +
.stats.yml | 2 +-
README.md | 36 ++--
bin/check-release-environment | 4 +
src/resources/documents.ts | 245 ++++++++++----------------
src/resources/query.ts | 43 +++--
tests/api-resources/documents.test.ts | 29 ++-
tests/api-resources/query.test.ts | 5 +-
10 files changed, 208 insertions(+), 206 deletions(-)
create mode 100644 .github/workflows/create-releases.yml
diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml
new file mode 100644
index 00000000..79f62b85
--- /dev/null
+++ b/.github/workflows/create-releases.yml
@@ -0,0 +1,41 @@
+name: Create releases
+on:
+ schedule:
+ - cron: '0 5 * * *' # every day at 5am UTC
+ push:
+ branches:
+ - main
+
+jobs:
+ release:
+ name: release
+ if: github.ref == 'refs/heads/main' && github.repository == 'hyperspell/node-sdk'
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: stainless-api/trigger-release-please@v1
+ id: release
+ with:
+ repo: ${{ github.event.repository.full_name }}
+ stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
+
+ - name: Set up Node
+ if: ${{ steps.release.outputs.releases_created }}
+ uses: actions/setup-node@v3
+ with:
+ node-version: '18'
+
+ - name: Install dependencies
+ if: ${{ steps.release.outputs.releases_created }}
+ run: |
+ yarn install
+
+ - name: Publish to NPM
+ if: ${{ steps.release.outputs.releases_created }}
+ run: |
+ bash ./bin/publish-npm
+ env:
+ NPM_TOKEN: ${{ secrets.HYPERSPELL_NPM_TOKEN || secrets.NPM_TOKEN }}
+
diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml
index 00dc207b..f7cfc1b6 100644
--- a/.github/workflows/publish-npm.yml
+++ b/.github/workflows/publish-npm.yml
@@ -1,13 +1,9 @@
-# This workflow is triggered when a GitHub release is created.
-# It can also be run manually to re-publish to NPM in case it failed for some reason.
-# You can run this workflow by navigating to https://www.github.com/hyperspell/node-sdk/actions/workflows/publish-npm.yml
+# workflow for re-running publishing to NPM in case it fails for some reason
+# you can run this workflow by navigating to https://www.github.com/hyperspell/node-sdk/actions/workflows/publish-npm.yml
name: Publish NPM
on:
workflow_dispatch:
- release:
- types: [published]
-
jobs:
publish:
name: publish
diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
index 293a7b16..01aed405 100644
--- a/.github/workflows/release-doctor.yml
+++ b/.github/workflows/release-doctor.yml
@@ -18,5 +18,6 @@ jobs:
run: |
bash ./bin/check-release-environment
env:
+ STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
NPM_TOKEN: ${{ secrets.HYPERSPELL_NPM_TOKEN || secrets.NPM_TOKEN }}
diff --git a/.stats.yml b/.stats.yml
index bf5212a6..50cbe57c 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 10
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-036faa49b258b84e5e0b005039461bfc4942c718fb105444d863b9d7af2922f2.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-4e177b58fa8cf23ba450d5247fcad65a6bbe1921ae3d5d42180e496e40a9864f.yml
diff --git a/README.md b/README.md
index 8583449a..cebc744b 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ const client = new Hyperspell({
});
async function main() {
- const documentStatus = await client.documents.add({ collection: 'collection', text: 'text' });
+ const documentStatus = await client.documents.add({ text: 'text' });
console.log(documentStatus.id);
}
@@ -48,7 +48,7 @@ const client = new Hyperspell({
});
async function main() {
- const params: Hyperspell.DocumentAddParams = { collection: 'collection', text: 'text' };
+ const params: Hyperspell.DocumentAddParams = { text: 'text' };
const documentStatus: Hyperspell.DocumentStatus = await client.documents.add(params);
}
@@ -102,17 +102,15 @@ a subclass of `APIError` will be thrown:
```ts
async function main() {
- const documentStatus = await client.documents
- .add({ collection: 'collection', text: 'text' })
- .catch(async (err) => {
- if (err instanceof Hyperspell.APIError) {
- console.log(err.status); // 400
- console.log(err.name); // BadRequestError
- console.log(err.headers); // {server: 'nginx', ...}
- } else {
- throw err;
- }
- });
+ const documentStatus = await client.documents.add({ text: 'text' }).catch(async (err) => {
+ if (err instanceof Hyperspell.APIError) {
+ console.log(err.status); // 400
+ console.log(err.name); // BadRequestError
+ console.log(err.headers); // {server: 'nginx', ...}
+ } else {
+ throw err;
+ }
+ });
}
main();
@@ -147,7 +145,7 @@ const client = new Hyperspell({
});
// Or, configure per-request:
-await client.documents.add({ collection: 'collection', text: 'text' }, {
+await client.documents.add({ text: 'text' }, {
maxRetries: 5,
});
```
@@ -164,7 +162,7 @@ const client = new Hyperspell({
});
// Override per-request:
-await client.documents.add({ collection: 'collection', text: 'text' }, {
+await client.documents.add({ text: 'text' }, {
timeout: 5 * 1000,
});
```
@@ -216,13 +214,11 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
```ts
const client = new Hyperspell();
-const response = await client.documents.add({ collection: 'collection', text: 'text' }).asResponse();
+const response = await client.documents.add({ text: 'text' }).asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object
-const { data: documentStatus, response: raw } = await client.documents
- .add({ collection: 'collection', text: 'text' })
- .withResponse();
+const { data: documentStatus, response: raw } = await client.documents.add({ text: 'text' }).withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(documentStatus.id);
```
@@ -329,7 +325,7 @@ const client = new Hyperspell({
// Override per-request:
await client.documents.add(
- { collection: 'collection', text: 'text' },
+ { text: 'text' },
{
httpAgent: new http.Agent({ keepAlive: false }),
},
diff --git a/bin/check-release-environment b/bin/check-release-environment
index 9ee7bb7d..28c07aa0 100644
--- a/bin/check-release-environment
+++ b/bin/check-release-environment
@@ -2,6 +2,10 @@
errors=()
+if [ -z "${STAINLESS_API_KEY}" ]; then
+ errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.")
+fi
+
if [ -z "${NPM_TOKEN}" ]; then
errors+=("The HYPERSPELL_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
diff --git a/src/resources/documents.ts b/src/resources/documents.ts
index e252e286..c8470507 100644
--- a/src/resources/documents.ts
+++ b/src/resources/documents.ts
@@ -1,6 +1,7 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
+import { isRequestOptions } from '../core';
import * as Core from '../core';
import * as DocumentsAPI from './documents';
import { CursorPage, type CursorPageParams } from '../pagination';
@@ -11,9 +12,19 @@ export class Documents extends APIResource {
* filter the documents by title, date, metadata, etc.
*/
list(
- query: DocumentListParams,
+ query?: DocumentListParams,
+ options?: Core.RequestOptions,
+ ): Core.PagePromise;
+ list(
+ options?: Core.RequestOptions,
+ ): Core.PagePromise;
+ list(
+ query: DocumentListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.PagePromise {
+ if (isRequestOptions(query)) {
+ return this.list({}, query);
+ }
return this._client.getAPIList('/documents/list', DocumentListResponsesCursorPage, { query, ...options });
}
@@ -58,12 +69,20 @@ export class DocumentListResponsesCursorPage extends CursorPage;
+
+ /**
+ * Summary of the document
+ */
+ summary: string;
+
id?: number | null;
created_at?: string | null;
- events?: Array;
-
ingested_at?: string | null;
metadata?: Record;
@@ -73,9 +92,13 @@ export interface Document {
*/
resource_id?: string;
- sections?: Array;
+ source?: 'generic' | 'slack' | 's3' | 'gmail' | 'notion' | 'google_docs' | 'hubspot';
- source?:
+ status?: 'pending' | 'processing' | 'completed' | 'failed';
+
+ title?: string | null;
+
+ type?:
| 'generic'
| 'markdown'
| 'chat'
@@ -86,79 +109,18 @@ export interface Document {
| 'image'
| 'pdf'
| 'audio'
- | 'slack'
- | 's3'
- | 'gmail'
- | 'notion'
- | 'google_docs';
-
- status?: 'pending' | 'processing' | 'completed' | 'failed';
-
- title?: string | null;
-}
-
-export namespace Document {
- export interface Event {
- message: string;
-
- type: 'error' | 'warning' | 'info';
-
- time?: string;
- }
-
- export interface SectionResult {
- id?: number | null;
-
- scores?: DocumentsAPI.Scores;
-
- text?: string;
- }
-
- export interface SectionResultWithElements {
- id?: number | null;
-
- elements?: Array;
-
- scores?: DocumentsAPI.Scores;
-
- text?: string;
- }
-
- export namespace SectionResultWithElements {
- export interface Element {
- text: string;
-
- type: 'text' | 'markdown' | 'image' | 'table' | 'title' | 'query';
-
- id?: string;
-
- metadata?: Element.Metadata;
-
- summary?: string | null;
- }
-
- export namespace Element {
- export interface Metadata {
- author?: string | null;
-
- /**
- * The id of the element that this element is continued from if it had to be split
- * during chunking
- */
- continued_from?: string | null;
-
- filename?: string | null;
-
- languages?: Array;
-
- links?: Array;
-
- page_number?: number | null;
-
- title_level?: number | null;
- }
- }
- }
+ | 'spreadsheet'
+ | 'archive'
+ | 'book'
+ | 'video'
+ | 'code'
+ | 'calendar'
+ | 'json'
+ | 'presentation'
+ | 'unsupported'
+ | 'person'
+ | 'company'
+ | 'crm_contact';
}
export interface DocumentStatus {
@@ -187,6 +149,16 @@ export interface Scores {
}
export interface DocumentListResponse {
+ /**
+ * Structured representation of the document
+ */
+ data: unknown | Array;
+
+ /**
+ * Summary of the document
+ */
+ summary: string;
+
id?: number | null;
collection?: string;
@@ -208,7 +180,13 @@ export interface DocumentListResponse {
sections_count?: number | null;
- source?:
+ source?: 'generic' | 'slack' | 's3' | 'gmail' | 'notion' | 'google_docs' | 'hubspot';
+
+ status?: 'pending' | 'processing' | 'completed' | 'failed';
+
+ title?: string | null;
+
+ type?:
| 'generic'
| 'markdown'
| 'chat'
@@ -219,15 +197,18 @@ export interface DocumentListResponse {
| 'image'
| 'pdf'
| 'audio'
- | 'slack'
- | 's3'
- | 'gmail'
- | 'notion'
- | 'google_docs';
-
- status?: 'pending' | 'processing' | 'completed' | 'failed';
-
- title?: string | null;
+ | 'spreadsheet'
+ | 'archive'
+ | 'book'
+ | 'video'
+ | 'code'
+ | 'calendar'
+ | 'json'
+ | 'presentation'
+ | 'unsupported'
+ | 'person'
+ | 'company'
+ | 'crm_contact';
}
export namespace DocumentListResponse {
@@ -242,9 +223,16 @@ export namespace DocumentListResponse {
export interface Section {
document_id: number;
+ /**
+ * Summary of the section
+ */
+ text: string;
+
id?: number | null;
- elements?: Array;
+ content?: string | null;
+
+ elements?: Array;
embedding_e5_large?: Array | null;
@@ -253,62 +241,25 @@ export namespace DocumentListResponse {
metadata?: Record;
scores?: DocumentsAPI.Scores;
-
- text?: string;
- }
-
- export namespace Section {
- export interface Element {
- text: string;
-
- type: 'text' | 'markdown' | 'image' | 'table' | 'title' | 'query';
-
- id?: string;
-
- metadata?: Element.Metadata;
-
- summary?: string | null;
- }
-
- export namespace Element {
- export interface Metadata {
- author?: string | null;
-
- /**
- * The id of the element that this element is continued from if it had to be split
- * during chunking
- */
- continued_from?: string | null;
-
- filename?: string | null;
-
- languages?: Array;
-
- links?: Array;
-
- page_number?: number | null;
-
- title_level?: number | null;
- }
- }
}
}
export interface DocumentListParams extends CursorPageParams {
- collection: string;
+ collection?: string | null;
}
export interface DocumentAddParams {
/**
- * Name of the collection to add the document to. If the collection does not exist,
- * it will be created.
+ * Full text of the document.
*/
- collection: string;
+ text: string;
/**
- * Full text of the document.
+ * Name of the collection to add the document to. If the collection does not exist,
+ * it will be created. If not given, the document will be added to the user's
+ * default collection.
*/
- text: string;
+ collection?: string | null;
/**
* Date of the document. Depending on the document, this could be the creation date
@@ -322,22 +273,7 @@ export interface DocumentAddParams {
* Source of the document. This helps in parsing the document. Note that some
* sources require the document to be in a specific format.
*/
- source?:
- | 'generic'
- | 'markdown'
- | 'chat'
- | 'email'
- | 'transcript'
- | 'legal'
- | 'website'
- | 'image'
- | 'pdf'
- | 'audio'
- | 'slack'
- | 's3'
- | 'gmail'
- | 'notion'
- | 'google_docs';
+ source?: 'generic' | 'slack' | 's3' | 'gmail' | 'notion' | 'google_docs' | 'hubspot';
/**
* Title of the document.
@@ -347,15 +283,16 @@ export interface DocumentAddParams {
export interface DocumentAddURLParams {
/**
- * Name of the collection to add the document to. If the collection does not exist,
- * it will be created.
+ * Source URL of the document.
*/
- collection: string;
+ url: string;
/**
- * Source URL of the document.
+ * Name of the collection to add the document to. If the collection does not exist,
+ * it will be created. If not given, the document will be added to the user's
+ * default collection.
*/
- url: string;
+ collection?: string | null;
}
export interface DocumentUploadParams {
diff --git a/src/resources/query.ts b/src/resources/query.ts
index 0e1502f3..93b49c32 100644
--- a/src/resources/query.ts
+++ b/src/resources/query.ts
@@ -21,14 +21,15 @@ export interface QuerySearchResponse {
export interface QuerySearchParams {
/**
- * Only query documents in these collections.
+ * Query to run.
*/
- collections: string | Array;
+ query: string;
/**
- * Query to run.
+ * Only query documents in these collections. If not given, will query the user's
+ * default collection
*/
- query: string;
+ collections?: string | Array | null;
/**
* Filter the query results.
@@ -61,10 +62,20 @@ export namespace QuerySearchParams {
*/
end_date?: string | null;
+ /**
+ * Only query documents from these sources.
+ */
+ source?: Array<'generic' | 'slack' | 's3' | 'gmail' | 'notion' | 'google_docs' | 'hubspot'>;
+
+ /**
+ * Only query documents on or after this date.
+ */
+ start_date?: string | null;
+
/**
* Only query documents of these types.
*/
- source?: Array<
+ types?: Array<
| 'generic'
| 'markdown'
| 'chat'
@@ -75,17 +86,19 @@ export namespace QuerySearchParams {
| 'image'
| 'pdf'
| 'audio'
- | 'slack'
- | 's3'
- | 'gmail'
- | 'notion'
- | 'google_docs'
+ | 'spreadsheet'
+ | 'archive'
+ | 'book'
+ | 'video'
+ | 'code'
+ | 'calendar'
+ | 'json'
+ | 'presentation'
+ | 'unsupported'
+ | 'person'
+ | 'company'
+ | 'crm_contact'
>;
-
- /**
- * Only query documents on or after this date.
- */
- start_date?: string | null;
}
}
diff --git a/tests/api-resources/documents.test.ts b/tests/api-resources/documents.test.ts
index 1a456d94..851cdebf 100644
--- a/tests/api-resources/documents.test.ts
+++ b/tests/api-resources/documents.test.ts
@@ -9,8 +9,8 @@ const client = new Hyperspell({
});
describe('resource documents', () => {
- test('list: only required params', async () => {
- const responsePromise = client.documents.list({ collection: 'collection' });
+ test('list', async () => {
+ const responsePromise = client.documents.list();
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -20,12 +20,25 @@ describe('resource documents', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- test('list: required and optional params', async () => {
- const response = await client.documents.list({ collection: 'collection', cursor: 'cursor', size: 0 });
+ test('list: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(client.documents.list({ path: '/_stainless_unknown_path' })).rejects.toThrow(
+ Hyperspell.NotFoundError,
+ );
+ });
+
+ test('list: request options and params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ client.documents.list(
+ { collection: 'collection', cursor: 'cursor', size: 0 },
+ { path: '/_stainless_unknown_path' },
+ ),
+ ).rejects.toThrow(Hyperspell.NotFoundError);
});
test('add: only required params', async () => {
- const responsePromise = client.documents.add({ collection: 'collection', text: 'text' });
+ const responsePromise = client.documents.add({ text: 'text' });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -37,8 +50,8 @@ describe('resource documents', () => {
test('add: required and optional params', async () => {
const response = await client.documents.add({
- collection: 'collection',
text: 'text',
+ collection: 'collection',
date: '2019-12-27T18:11:19.117Z',
source: 'generic',
title: 'title',
@@ -46,7 +59,7 @@ describe('resource documents', () => {
});
test('addURL: only required params', async () => {
- const responsePromise = client.documents.addURL({ collection: 'collection', url: 'url' });
+ const responsePromise = client.documents.addURL({ url: 'url' });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -57,7 +70,7 @@ describe('resource documents', () => {
});
test('addURL: required and optional params', async () => {
- const response = await client.documents.addURL({ collection: 'collection', url: 'url' });
+ const response = await client.documents.addURL({ url: 'url', collection: 'collection' });
});
test('get', async () => {
diff --git a/tests/api-resources/query.test.ts b/tests/api-resources/query.test.ts
index ec97cca8..886dd8a3 100644
--- a/tests/api-resources/query.test.ts
+++ b/tests/api-resources/query.test.ts
@@ -10,7 +10,7 @@ const client = new Hyperspell({
describe('resource query', () => {
test('search: only required params', async () => {
- const responsePromise = client.query.search({ collections: 'string', query: 'query' });
+ const responsePromise = client.query.search({ query: 'query' });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -22,12 +22,13 @@ describe('resource query', () => {
test('search: required and optional params', async () => {
const response = await client.query.search({
- collections: 'string',
query: 'query',
+ collections: 'string',
filter: {
end_date: '2019-12-27T18:11:19.117Z',
source: ['generic'],
start_date: '2019-12-27T18:11:19.117Z',
+ types: ['generic'],
},
include_elements: true,
max_results: 0,
From 61373c843629c169d69c4dd133d5b3a9899a230f Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 25 Mar 2025 21:23:18 +0000
Subject: [PATCH 19/25] feat(api): update via SDK Studio (#38)
---
.github/workflows/create-releases.yml | 41 ------
.github/workflows/publish-npm.yml | 8 +-
.github/workflows/release-doctor.yml | 1 -
api.md | 8 ++
bin/check-release-environment | 4 -
src/index.ts | 5 +-
src/resources/index.ts | 1 +
src/resources/shared.ts | 177 ++++++++++++++++++++++++++
8 files changed, 196 insertions(+), 49 deletions(-)
delete mode 100644 .github/workflows/create-releases.yml
create mode 100644 src/resources/shared.ts
diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml
deleted file mode 100644
index 79f62b85..00000000
--- a/.github/workflows/create-releases.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-name: Create releases
-on:
- schedule:
- - cron: '0 5 * * *' # every day at 5am UTC
- push:
- branches:
- - main
-
-jobs:
- release:
- name: release
- if: github.ref == 'refs/heads/main' && github.repository == 'hyperspell/node-sdk'
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v4
-
- - uses: stainless-api/trigger-release-please@v1
- id: release
- with:
- repo: ${{ github.event.repository.full_name }}
- stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
-
- - name: Set up Node
- if: ${{ steps.release.outputs.releases_created }}
- uses: actions/setup-node@v3
- with:
- node-version: '18'
-
- - name: Install dependencies
- if: ${{ steps.release.outputs.releases_created }}
- run: |
- yarn install
-
- - name: Publish to NPM
- if: ${{ steps.release.outputs.releases_created }}
- run: |
- bash ./bin/publish-npm
- env:
- NPM_TOKEN: ${{ secrets.HYPERSPELL_NPM_TOKEN || secrets.NPM_TOKEN }}
-
diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml
index f7cfc1b6..00dc207b 100644
--- a/.github/workflows/publish-npm.yml
+++ b/.github/workflows/publish-npm.yml
@@ -1,9 +1,13 @@
-# workflow for re-running publishing to NPM in case it fails for some reason
-# you can run this workflow by navigating to https://www.github.com/hyperspell/node-sdk/actions/workflows/publish-npm.yml
+# This workflow is triggered when a GitHub release is created.
+# It can also be run manually to re-publish to NPM in case it failed for some reason.
+# You can run this workflow by navigating to https://www.github.com/hyperspell/node-sdk/actions/workflows/publish-npm.yml
name: Publish NPM
on:
workflow_dispatch:
+ release:
+ types: [published]
+
jobs:
publish:
name: publish
diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
index 01aed405..293a7b16 100644
--- a/.github/workflows/release-doctor.yml
+++ b/.github/workflows/release-doctor.yml
@@ -18,6 +18,5 @@ jobs:
run: |
bash ./bin/check-release-environment
env:
- STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
NPM_TOKEN: ${{ secrets.HYPERSPELL_NPM_TOKEN || secrets.NPM_TOKEN }}
diff --git a/api.md b/api.md
index 0f6cb222..e1bfb809 100644
--- a/api.md
+++ b/api.md
@@ -1,3 +1,11 @@
+# Shared
+
+Types:
+
+-
Apikey
+- App
+- Collection
+
# Documents
Types:
diff --git a/bin/check-release-environment b/bin/check-release-environment
index 28c07aa0..9ee7bb7d 100644
--- a/bin/check-release-environment
+++ b/bin/check-release-environment
@@ -2,10 +2,6 @@
errors=()
-if [ -z "${STAINLESS_API_KEY}" ]; then
- errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.")
-fi
-
if [ -z "${NPM_TOKEN}" ]; then
errors+=("The HYPERSPELL_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
diff --git a/src/index.ts b/src/index.ts
index 65d13647..eac9925b 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -9,7 +9,6 @@ import * as Uploads from './uploads';
import * as API from './resources/index';
import { Auth, AuthUserTokenParams, Token } from './resources/auth';
import {
- Collection,
CollectionCreateParams,
CollectionListParams,
CollectionListResponse,
@@ -235,6 +234,10 @@ export declare namespace Hyperspell {
};
export { Auth as Auth, type Token as Token, type AuthUserTokenParams as AuthUserTokenParams };
+
+ export type Apikey = API.Apikey;
+ export type App = API.App;
+ export type Collection = API.Collection;
}
export { toFile, fileFromPath } from './uploads';
diff --git a/src/resources/index.ts b/src/resources/index.ts
index d6b05f12..b3e58dd1 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -1,5 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+export * from './shared';
export { Auth, type Token, type AuthUserTokenParams } from './auth';
export {
CollectionListResponsesCursorPage,
diff --git a/src/resources/shared.ts b/src/resources/shared.ts
new file mode 100644
index 00000000..aa6598df
--- /dev/null
+++ b/src/resources/shared.ts
@@ -0,0 +1,177 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import * as DocumentsAPI from './documents';
+
+/**
+ * ApiKeys Base Schema.
+ */
+export interface Apikey {
+ app_id: number;
+
+ scopes: Array<'all' | 'ingest' | 'query'>;
+
+ secret: string;
+
+ id?: number | null;
+
+ /**
+ * Apps Base Schema.
+ */
+ app?: App | null;
+
+ created_at?: string;
+
+ label?: string | null;
+
+ revoked_at?: string | null;
+}
+
+/**
+ * Apps Base Schema.
+ */
+export interface App {
+ name: string;
+
+ slug: string;
+
+ user_id: string;
+
+ id?: number | null;
+
+ api_keys?: Array | null;
+
+ collections?: Array | null;
+
+ created_at?: string;
+
+ integrations?: Array;
+
+ jwt_secret?: string;
+
+ optional_integrations?: Array | null;
+
+ public_key?: string;
+
+ settings?: unknown;
+}
+
+export interface Collection {
+ app_id: number;
+
+ name: string;
+
+ id?: number | null;
+
+ /**
+ * Apps Base Schema.
+ */
+ app?: App | null;
+
+ created_at?: string;
+
+ documents?: Array | null;
+
+ documents_count?: number | null;
+
+ owner?: string | null;
+}
+
+export namespace Collection {
+ export interface Document {
+ collection_id: number;
+
+ /**
+ * Structured representation of the document
+ */
+ data: unknown | Array;
+
+ /**
+ * Summary of the document
+ */
+ summary: string;
+
+ id?: number | null;
+
+ collection?: string;
+
+ created_at?: string | null;
+
+ events?: Array;
+
+ ingested_at?: string | null;
+
+ metadata?: Record;
+
+ /**
+ * Along with service, uniquely identifies the source document
+ */
+ resource_id?: string;
+
+ sections?: Array;
+
+ sections_count?: number | null;
+
+ source?: 'generic' | 'slack' | 's3' | 'gmail' | 'notion' | 'google_docs' | 'hubspot';
+
+ status?: 'pending' | 'processing' | 'completed' | 'failed';
+
+ title?: string | null;
+
+ type?:
+ | 'generic'
+ | 'markdown'
+ | 'chat'
+ | 'email'
+ | 'transcript'
+ | 'legal'
+ | 'website'
+ | 'image'
+ | 'pdf'
+ | 'audio'
+ | 'spreadsheet'
+ | 'archive'
+ | 'book'
+ | 'video'
+ | 'code'
+ | 'calendar'
+ | 'json'
+ | 'presentation'
+ | 'unsupported'
+ | 'person'
+ | 'company'
+ | 'crm_contact';
+ }
+
+ export namespace Document {
+ export interface Event {
+ message: string;
+
+ type: 'error' | 'warning' | 'info';
+
+ time?: string;
+ }
+
+ export interface Section {
+ document_id: number;
+
+ /**
+ * Summary of the section
+ */
+ text: string;
+
+ id?: number | null;
+
+ content?: string | null;
+
+ elements?: Array;
+
+ embedding_e5_large?: Array | null;
+
+ embedding_ts?: string | null;
+
+ metadata?: Record;
+
+ scores?: DocumentsAPI.Scores;
+ }
+ }
+}
From a0ce99aae41fa41ad8bde420f00870ce647ff5d1 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 25 Mar 2025 21:24:56 +0000
Subject: [PATCH 20/25] feat(api): update via SDK Studio (#39)
---
api.md | 8 ++++----
src/index.ts | 5 +++--
src/resources/collections.ts | 8 ++++----
src/resources/index.ts | 2 +-
src/resources/shared.ts | 4 ++--
5 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/api.md b/api.md
index e1bfb809..750e26c0 100644
--- a/api.md
+++ b/api.md
@@ -2,7 +2,7 @@
Types:
-- Apikey
+- APIKkey
- App
- Collection
@@ -27,14 +27,14 @@ Methods:
Types:
-- Collection
+- CollectionResponse
- CollectionListResponse
Methods:
-- client.collections.create({ ...params }) -> Collection
+- client.collections.create({ ...params }) -> CollectionResponse
- client.collections.list({ ...params }) -> CollectionListResponsesCursorPage
-- client.collections.get(name) -> Collection
+- client.collections.get(name) -> CollectionResponse
# Query
diff --git a/src/index.ts b/src/index.ts
index eac9925b..6d7238a8 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -13,6 +13,7 @@ import {
CollectionListParams,
CollectionListResponse,
CollectionListResponsesCursorPage,
+ CollectionResponse,
Collections,
} from './resources/collections';
import {
@@ -220,7 +221,7 @@ export declare namespace Hyperspell {
export {
Collections as Collections,
- type Collection as Collection,
+ type CollectionResponse as CollectionResponse,
type CollectionListResponse as CollectionListResponse,
CollectionListResponsesCursorPage as CollectionListResponsesCursorPage,
type CollectionCreateParams as CollectionCreateParams,
@@ -235,7 +236,7 @@ export declare namespace Hyperspell {
export { Auth as Auth, type Token as Token, type AuthUserTokenParams as AuthUserTokenParams };
- export type Apikey = API.Apikey;
+ export type APIKkey = API.APIKkey;
export type App = API.App;
export type Collection = API.Collection;
}
diff --git a/src/resources/collections.ts b/src/resources/collections.ts
index 10c517ac..769fadf8 100644
--- a/src/resources/collections.ts
+++ b/src/resources/collections.ts
@@ -10,7 +10,7 @@ export class Collections extends APIResource {
* This endpoint allows you to paginate through all documents in the index. You can
* filter the documents by title, date, metadata, etc.
*/
- create(body: CollectionCreateParams, options?: Core.RequestOptions): Core.APIPromise {
+ create(body: CollectionCreateParams, options?: Core.RequestOptions): Core.APIPromise {
return this._client.post('/collections/add', { body, ...options });
}
@@ -40,14 +40,14 @@ export class Collections extends APIResource {
/**
* Retrieves a collection by name.
*/
- get(name: string, options?: Core.RequestOptions): Core.APIPromise {
+ get(name: string, options?: Core.RequestOptions): Core.APIPromise {
return this._client.get(`/collections/get/${name}`, options);
}
}
export class CollectionListResponsesCursorPage extends CursorPage {}
-export interface Collection {
+export interface CollectionResponse {
created_at: string;
name: string;
@@ -86,7 +86,7 @@ Collections.CollectionListResponsesCursorPage = CollectionListResponsesCursorPag
export declare namespace Collections {
export {
- type Collection as Collection,
+ type CollectionResponse as CollectionResponse,
type CollectionListResponse as CollectionListResponse,
CollectionListResponsesCursorPage as CollectionListResponsesCursorPage,
type CollectionCreateParams as CollectionCreateParams,
diff --git a/src/resources/index.ts b/src/resources/index.ts
index b3e58dd1..405ca170 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -5,7 +5,7 @@ export { Auth, type Token, type AuthUserTokenParams } from './auth';
export {
CollectionListResponsesCursorPage,
Collections,
- type Collection,
+ type CollectionResponse,
type CollectionListResponse,
type CollectionCreateParams,
type CollectionListParams,
diff --git a/src/resources/shared.ts b/src/resources/shared.ts
index aa6598df..5017a93a 100644
--- a/src/resources/shared.ts
+++ b/src/resources/shared.ts
@@ -5,7 +5,7 @@ import * as DocumentsAPI from './documents';
/**
* ApiKeys Base Schema.
*/
-export interface Apikey {
+export interface APIKkey {
app_id: number;
scopes: Array<'all' | 'ingest' | 'query'>;
@@ -38,7 +38,7 @@ export interface App {
id?: number | null;
- api_keys?: Array | null;
+ api_keys?: Array | null;
collections?: Array | null;
From 5614b84d9d2f34d59ba1b61dc43dd7ce4a143d3a Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 25 Mar 2025 21:27:42 +0000
Subject: [PATCH 21/25] feat(api): update via SDK Studio (#40)
---
api.md | 7 +-
src/index.ts | 5 +-
src/resources/collections.ts | 8 +--
src/resources/index.ts | 2 +-
src/resources/shared.ts | 125 +----------------------------------
5 files changed, 11 insertions(+), 136 deletions(-)
diff --git a/api.md b/api.md
index 750e26c0..46d10df9 100644
--- a/api.md
+++ b/api.md
@@ -4,7 +4,6 @@ Types:
- APIKkey
- App
-- Collection
# Documents
@@ -27,14 +26,14 @@ Methods:
Types:
-- CollectionResponse
+- Collection
- CollectionListResponse
Methods:
-- client.collections.create({ ...params }) -> CollectionResponse
+- client.collections.create({ ...params }) -> Collection
- client.collections.list({ ...params }) -> CollectionListResponsesCursorPage
-- client.collections.get(name) -> CollectionResponse
+- client.collections.get(name) -> Collection
# Query
diff --git a/src/index.ts b/src/index.ts
index 6d7238a8..3f5c6626 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -9,11 +9,11 @@ import * as Uploads from './uploads';
import * as API from './resources/index';
import { Auth, AuthUserTokenParams, Token } from './resources/auth';
import {
+ Collection,
CollectionCreateParams,
CollectionListParams,
CollectionListResponse,
CollectionListResponsesCursorPage,
- CollectionResponse,
Collections,
} from './resources/collections';
import {
@@ -221,7 +221,7 @@ export declare namespace Hyperspell {
export {
Collections as Collections,
- type CollectionResponse as CollectionResponse,
+ type Collection as Collection,
type CollectionListResponse as CollectionListResponse,
CollectionListResponsesCursorPage as CollectionListResponsesCursorPage,
type CollectionCreateParams as CollectionCreateParams,
@@ -238,7 +238,6 @@ export declare namespace Hyperspell {
export type APIKkey = API.APIKkey;
export type App = API.App;
- export type Collection = API.Collection;
}
export { toFile, fileFromPath } from './uploads';
diff --git a/src/resources/collections.ts b/src/resources/collections.ts
index 769fadf8..10c517ac 100644
--- a/src/resources/collections.ts
+++ b/src/resources/collections.ts
@@ -10,7 +10,7 @@ export class Collections extends APIResource {
* This endpoint allows you to paginate through all documents in the index. You can
* filter the documents by title, date, metadata, etc.
*/
- create(body: CollectionCreateParams, options?: Core.RequestOptions): Core.APIPromise {
+ create(body: CollectionCreateParams, options?: Core.RequestOptions): Core.APIPromise {
return this._client.post('/collections/add', { body, ...options });
}
@@ -40,14 +40,14 @@ export class Collections extends APIResource {
/**
* Retrieves a collection by name.
*/
- get(name: string, options?: Core.RequestOptions): Core.APIPromise {
+ get(name: string, options?: Core.RequestOptions): Core.APIPromise {
return this._client.get(`/collections/get/${name}`, options);
}
}
export class CollectionListResponsesCursorPage extends CursorPage {}
-export interface CollectionResponse {
+export interface Collection {
created_at: string;
name: string;
@@ -86,7 +86,7 @@ Collections.CollectionListResponsesCursorPage = CollectionListResponsesCursorPag
export declare namespace Collections {
export {
- type CollectionResponse as CollectionResponse,
+ type Collection as Collection,
type CollectionListResponse as CollectionListResponse,
CollectionListResponsesCursorPage as CollectionListResponsesCursorPage,
type CollectionCreateParams as CollectionCreateParams,
diff --git a/src/resources/index.ts b/src/resources/index.ts
index 405ca170..b3e58dd1 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -5,7 +5,7 @@ export { Auth, type Token, type AuthUserTokenParams } from './auth';
export {
CollectionListResponsesCursorPage,
Collections,
- type CollectionResponse,
+ type Collection,
type CollectionListResponse,
type CollectionCreateParams,
type CollectionListParams,
diff --git a/src/resources/shared.ts b/src/resources/shared.ts
index 5017a93a..9d1da8b6 100644
--- a/src/resources/shared.ts
+++ b/src/resources/shared.ts
@@ -1,7 +1,5 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import * as DocumentsAPI from './documents';
-
/**
* ApiKeys Base Schema.
*/
@@ -40,7 +38,7 @@ export interface App {
api_keys?: Array | null;
- collections?: Array | null;
+ collections?: Array | null;
created_at?: string;
@@ -54,124 +52,3 @@ export interface App {
settings?: unknown;
}
-
-export interface Collection {
- app_id: number;
-
- name: string;
-
- id?: number | null;
-
- /**
- * Apps Base Schema.
- */
- app?: App | null;
-
- created_at?: string;
-
- documents?: Array | null;
-
- documents_count?: number | null;
-
- owner?: string | null;
-}
-
-export namespace Collection {
- export interface Document {
- collection_id: number;
-
- /**
- * Structured representation of the document
- */
- data: unknown | Array;
-
- /**
- * Summary of the document
- */
- summary: string;
-
- id?: number | null;
-
- collection?: string;
-
- created_at?: string | null;
-
- events?: Array;
-
- ingested_at?: string | null;
-
- metadata?: Record;
-
- /**
- * Along with service, uniquely identifies the source document
- */
- resource_id?: string;
-
- sections?: Array;
-
- sections_count?: number | null;
-
- source?: 'generic' | 'slack' | 's3' | 'gmail' | 'notion' | 'google_docs' | 'hubspot';
-
- status?: 'pending' | 'processing' | 'completed' | 'failed';
-
- title?: string | null;
-
- type?:
- | 'generic'
- | 'markdown'
- | 'chat'
- | 'email'
- | 'transcript'
- | 'legal'
- | 'website'
- | 'image'
- | 'pdf'
- | 'audio'
- | 'spreadsheet'
- | 'archive'
- | 'book'
- | 'video'
- | 'code'
- | 'calendar'
- | 'json'
- | 'presentation'
- | 'unsupported'
- | 'person'
- | 'company'
- | 'crm_contact';
- }
-
- export namespace Document {
- export interface Event {
- message: string;
-
- type: 'error' | 'warning' | 'info';
-
- time?: string;
- }
-
- export interface Section {
- document_id: number;
-
- /**
- * Summary of the section
- */
- text: string;
-
- id?: number | null;
-
- content?: string | null;
-
- elements?: Array;
-
- embedding_e5_large?: Array | null;
-
- embedding_ts?: string | null;
-
- metadata?: Record;
-
- scores?: DocumentsAPI.Scores;
- }
- }
-}
From 6f9da54a9104bbaab340cfb230f4217fdc8ec4ed Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 25 Mar 2025 21:28:11 +0000
Subject: [PATCH 22/25] feat(api): update via SDK Studio (#41)
---
api.md | 2 +-
src/index.ts | 2 +-
src/resources/shared.ts | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/api.md b/api.md
index 46d10df9..72635b39 100644
--- a/api.md
+++ b/api.md
@@ -2,7 +2,7 @@
Types:
-- APIKkey
+- APIKey
- App
# Documents
diff --git a/src/index.ts b/src/index.ts
index 3f5c6626..f186dc37 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -236,7 +236,7 @@ export declare namespace Hyperspell {
export { Auth as Auth, type Token as Token, type AuthUserTokenParams as AuthUserTokenParams };
- export type APIKkey = API.APIKkey;
+ export type APIKey = API.APIKey;
export type App = API.App;
}
diff --git a/src/resources/shared.ts b/src/resources/shared.ts
index 9d1da8b6..e286b47e 100644
--- a/src/resources/shared.ts
+++ b/src/resources/shared.ts
@@ -3,7 +3,7 @@
/**
* ApiKeys Base Schema.
*/
-export interface APIKkey {
+export interface APIKey {
app_id: number;
scopes: Array<'all' | 'ingest' | 'query'>;
@@ -36,7 +36,7 @@ export interface App {
id?: number | null;
- api_keys?: Array | null;
+ api_keys?: Array | null;
collections?: Array | null;
From 9e25c59176277df1cd2999ed875968d68137f93d Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 25 Mar 2025 21:49:56 +0000
Subject: [PATCH 23/25] feat(api): api update (#42)
---
.stats.yml | 2 +-
src/resources/shared.ts | 10 +---------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 50cbe57c..2f55224c 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 10
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-4e177b58fa8cf23ba450d5247fcad65a6bbe1921ae3d5d42180e496e40a9864f.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-c562e6864fc7607b8a6ff45ad2abaf22344660501695ee0270350b37bbbf3bdf.yml
diff --git a/src/resources/shared.ts b/src/resources/shared.ts
index e286b47e..2ca1f9fc 100644
--- a/src/resources/shared.ts
+++ b/src/resources/shared.ts
@@ -36,19 +36,11 @@ export interface App {
id?: number | null;
- api_keys?: Array | null;
-
- collections?: Array | null;
-
created_at?: string;
integrations?: Array;
- jwt_secret?: string;
-
optional_integrations?: Array | null;
- public_key?: string;
-
- settings?: unknown;
+ settings?: Record;
}
From 588ad3b6267ca1509e01babedaa2ff89c830bbc0 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 25 Mar 2025 21:50:32 +0000
Subject: [PATCH 24/25] feat(api): update via SDK Studio (#43)
---
api.md | 7 -------
src/index.ts | 3 ---
src/resources/index.ts | 1 -
src/resources/shared.ts | 46 -----------------------------------------
4 files changed, 57 deletions(-)
delete mode 100644 src/resources/shared.ts
diff --git a/api.md b/api.md
index 72635b39..0f6cb222 100644
--- a/api.md
+++ b/api.md
@@ -1,10 +1,3 @@
-# Shared
-
-Types:
-
-- APIKey
-- App
-
# Documents
Types:
diff --git a/src/index.ts b/src/index.ts
index f186dc37..65d13647 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -235,9 +235,6 @@ export declare namespace Hyperspell {
};
export { Auth as Auth, type Token as Token, type AuthUserTokenParams as AuthUserTokenParams };
-
- export type APIKey = API.APIKey;
- export type App = API.App;
}
export { toFile, fileFromPath } from './uploads';
diff --git a/src/resources/index.ts b/src/resources/index.ts
index b3e58dd1..d6b05f12 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -1,6 +1,5 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export * from './shared';
export { Auth, type Token, type AuthUserTokenParams } from './auth';
export {
CollectionListResponsesCursorPage,
diff --git a/src/resources/shared.ts b/src/resources/shared.ts
deleted file mode 100644
index 2ca1f9fc..00000000
--- a/src/resources/shared.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-/**
- * ApiKeys Base Schema.
- */
-export interface APIKey {
- app_id: number;
-
- scopes: Array<'all' | 'ingest' | 'query'>;
-
- secret: string;
-
- id?: number | null;
-
- /**
- * Apps Base Schema.
- */
- app?: App | null;
-
- created_at?: string;
-
- label?: string | null;
-
- revoked_at?: string | null;
-}
-
-/**
- * Apps Base Schema.
- */
-export interface App {
- name: string;
-
- slug: string;
-
- user_id: string;
-
- id?: number | null;
-
- created_at?: string;
-
- integrations?: Array;
-
- optional_integrations?: Array | null;
-
- settings?: Record;
-}
From 324c847fdcc2762b604c626c4fce07f3e7762c0c Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 26 Mar 2025 22:34:21 +0000
Subject: [PATCH 25/25] release: 0.8.2
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 43 +++++++++++++++++++++++++++++++++++
package.json | 2 +-
src/version.ts | 2 +-
4 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index d9d5699b..2e1c40ed 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.5.3"
+ ".": "0.8.2"
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7957907c..2b0e70e4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,48 @@
# Changelog
+## 0.8.2 (2025-03-26)
+
+Full Changelog: [v0.5.3...v0.8.2](https://github.com/hyperspell/node-sdk/compare/v0.5.3...v0.8.2)
+
+### Features
+
+* add SKIP_BREW env var to ./scripts/bootstrap ([#32](https://github.com/hyperspell/node-sdk/issues/32)) ([ecdef89](https://github.com/hyperspell/node-sdk/commit/ecdef891f2210522efe31e5120d26ad572432f3b))
+* **api:** api update ([a9f4767](https://github.com/hyperspell/node-sdk/commit/a9f47673364b5e8f8b2fcfee54b2c7a22eca9d2b))
+* **api:** api update ([#23](https://github.com/hyperspell/node-sdk/issues/23)) ([c9aaf54](https://github.com/hyperspell/node-sdk/commit/c9aaf54d0505676b9cc6a75af87a9994cca2f5b3))
+* **api:** api update ([#24](https://github.com/hyperspell/node-sdk/issues/24)) ([5326693](https://github.com/hyperspell/node-sdk/commit/53266933ad271b9f2f00b7c7e3607eb91f65b7f4))
+* **api:** api update ([#25](https://github.com/hyperspell/node-sdk/issues/25)) ([fdc83d1](https://github.com/hyperspell/node-sdk/commit/fdc83d13e6e6d4de12378b219a3ed6b790c66466))
+* **api:** api update ([#26](https://github.com/hyperspell/node-sdk/issues/26)) ([eef40b4](https://github.com/hyperspell/node-sdk/commit/eef40b4f33a39ad5a7887669414a4efdd3303f80))
+* **api:** api update ([#42](https://github.com/hyperspell/node-sdk/issues/42)) ([9e25c59](https://github.com/hyperspell/node-sdk/commit/9e25c59176277df1cd2999ed875968d68137f93d))
+* **api:** update via SDK Studio ([#20](https://github.com/hyperspell/node-sdk/issues/20)) ([4a2c34a](https://github.com/hyperspell/node-sdk/commit/4a2c34a97b3e2131ac1c0f6f392d54962bc50f62))
+* **api:** update via SDK Studio ([#38](https://github.com/hyperspell/node-sdk/issues/38)) ([61373c8](https://github.com/hyperspell/node-sdk/commit/61373c843629c169d69c4dd133d5b3a9899a230f))
+* **api:** update via SDK Studio ([#39](https://github.com/hyperspell/node-sdk/issues/39)) ([a0ce99a](https://github.com/hyperspell/node-sdk/commit/a0ce99aae41fa41ad8bde420f00870ce647ff5d1))
+* **api:** update via SDK Studio ([#40](https://github.com/hyperspell/node-sdk/issues/40)) ([5614b84](https://github.com/hyperspell/node-sdk/commit/5614b84d9d2f34d59ba1b61dc43dd7ce4a143d3a))
+* **api:** update via SDK Studio ([#41](https://github.com/hyperspell/node-sdk/issues/41)) ([6f9da54](https://github.com/hyperspell/node-sdk/commit/6f9da54a9104bbaab340cfb230f4217fdc8ec4ed))
+* **api:** update via SDK Studio ([#43](https://github.com/hyperspell/node-sdk/issues/43)) ([588ad3b](https://github.com/hyperspell/node-sdk/commit/588ad3b6267ca1509e01babedaa2ff89c830bbc0))
+* **client:** accept RFC6838 JSON content types ([#33](https://github.com/hyperspell/node-sdk/issues/33)) ([ca38adc](https://github.com/hyperspell/node-sdk/commit/ca38adc6b3125f68d682462e42f7c79ac0d65da1))
+* **client:** send `X-Stainless-Timeout` header ([#22](https://github.com/hyperspell/node-sdk/issues/22)) ([4ad8147](https://github.com/hyperspell/node-sdk/commit/4ad814769ef6503eb9b5a51c14d1ea3f74c736c5))
+
+
+### Bug Fixes
+
+* avoid type error in certain environments ([#37](https://github.com/hyperspell/node-sdk/issues/37)) ([42542b9](https://github.com/hyperspell/node-sdk/commit/42542b91e05ae3543112c21eae0c110158b753e5))
+* **client:** fix export map for index exports ([#27](https://github.com/hyperspell/node-sdk/issues/27)) ([5543d8e](https://github.com/hyperspell/node-sdk/commit/5543d8ea3804070de726997e8474deb01318eb68))
+
+
+### Chores
+
+* **exports:** cleaner resource index imports ([#35](https://github.com/hyperspell/node-sdk/issues/35)) ([641f5b3](https://github.com/hyperspell/node-sdk/commit/641f5b3a2311b4db0c16d4555e6073a502c94226))
+* **exports:** stop using path fallbacks ([#36](https://github.com/hyperspell/node-sdk/issues/36)) ([801d961](https://github.com/hyperspell/node-sdk/commit/801d961baa29194a1ecc3656305297e893fb2bb0))
+* **internal:** codegen related update ([#28](https://github.com/hyperspell/node-sdk/issues/28)) ([44c69e8](https://github.com/hyperspell/node-sdk/commit/44c69e887a6e32339a487e28e14e444e68ac32c5))
+* **internal:** codegen related update ([#31](https://github.com/hyperspell/node-sdk/issues/31)) ([2b286c1](https://github.com/hyperspell/node-sdk/commit/2b286c14f6545cfaf65259fabc051c40dbe336e7))
+* **internal:** fix devcontainers setup ([#29](https://github.com/hyperspell/node-sdk/issues/29)) ([26194ce](https://github.com/hyperspell/node-sdk/commit/26194ce3891b4f5e6bc89d13a7e8c85137dfe731))
+* **internal:** remove extra empty newlines ([#34](https://github.com/hyperspell/node-sdk/issues/34)) ([3677c0c](https://github.com/hyperspell/node-sdk/commit/3677c0c5673c2f49e7f37072be45aad49f1ee5d6))
+
+
+### Documentation
+
+* update URLs from stainlessapi.com to stainless.com ([#30](https://github.com/hyperspell/node-sdk/issues/30)) ([f9c0492](https://github.com/hyperspell/node-sdk/commit/f9c04926d82f1f863e6e111feb3b6e4ab33ff0bf))
+
## 0.5.3 (2025-02-04)
Full Changelog: [v0.1.0-alpha.2...v0.5.3](https://github.com/hyperspell/node-sdk/compare/v0.1.0-alpha.2...v0.5.3)
diff --git a/package.json b/package.json
index d8b338a9..22c4b6d8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hyperspell",
- "version": "0.5.3",
+ "version": "0.8.2",
"description": "The official TypeScript library for the Hyperspell API",
"author": "Hyperspell ",
"types": "dist/index.d.ts",
diff --git a/src/version.ts b/src/version.ts
index 80cb290b..72b24dd1 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.5.3'; // x-release-please-version
+export const VERSION = '0.8.2'; // x-release-please-version