Skip to content

release: 3.0.0-alpha.19 #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.0.0-alpha.18"
".": "3.0.0-alpha.19"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-c56ce3c876eec0737db8394bd6235bff8dc42314b6460f3365c06945749d8714.yml
openapi_spec_hash: 9e633a8fe5c71fa8bd5cbc34073b7c52
config_hash: 9126c561d449a28cea7267ac5773a0ed
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-4c45e387cbdc7c80d75cdb8eb924cf92a3a48a0c10060fda917b83a7e454aef5.yml
openapi_spec_hash: c859ac2e3429ad3663337b99c722f317
config_hash: 3b2810c1e7a7de95e23e3d2121374740
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Changelog

## 3.0.0-alpha.19 (2025-06-24)

Full Changelog: [v3.0.0-alpha.18...v3.0.0-alpha.19](https://github.com/supermemoryai/sdk-ts/compare/v3.0.0-alpha.18...v3.0.0-alpha.19)

### Features

* **api:** api update ([7f31200](https://github.com/supermemoryai/sdk-ts/commit/7f312003f01cc5e7820d9d7169822b655366ebda))
* **api:** api update ([fd23b75](https://github.com/supermemoryai/sdk-ts/commit/fd23b7509fc43f59b55ca98401b8293b940f748a))
* **api:** api update ([ca755ef](https://github.com/supermemoryai/sdk-ts/commit/ca755efd0450f19b6780b11c5461bba7bac8b72f))
* **client:** add support for endpoint-specific base URLs ([950b6e6](https://github.com/supermemoryai/sdk-ts/commit/950b6e66eb30a3908621bb64250d495b8187eab0))


### Bug Fixes

* **client:** explicitly copy fetch in withOptions ([ea7d42b](https://github.com/supermemoryai/sdk-ts/commit/ea7d42bf3e1cda451d587285a668b163674a34ef))


### Chores

* **ci:** enable for pull requests ([b9d3281](https://github.com/supermemoryai/sdk-ts/commit/b9d32816e77fe57348a5c07fd1b93ab387717753))
* **client:** refactor imports ([ae245a4](https://github.com/supermemoryai/sdk-ts/commit/ae245a4cc035602bc89c5d8d0c1a94827d93ad72))
* **readme:** update badges ([74cd982](https://github.com/supermemoryai/sdk-ts/commit/74cd982784564d11817fb8aaff756128a64e964c))
* **readme:** use better example snippet for undocumented params ([76142a1](https://github.com/supermemoryai/sdk-ts/commit/76142a1abf13c4460d8716060200dc53d5c1b9be))


### Refactors

* **types:** replace Record with mapped types ([687fd59](https://github.com/supermemoryai/sdk-ts/commit/687fd59d82a8ab6b0b287e5c86fb69518008e96a))

## 3.0.0-alpha.18 (2025-06-14)

Full Changelog: [v3.0.0-alpha.17...v3.0.0-alpha.18](https://github.com/supermemoryai/sdk-ts/compare/v3.0.0-alpha.17...v3.0.0-alpha.18)
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Supermemory TypeScript API Library

[![NPM version](https://img.shields.io/npm/v/supermemory.svg)](https://npmjs.org/package/supermemory) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/supermemory)
[![NPM version](<https://img.shields.io/npm/v/supermemory.svg?label=npm%20(stable)>)](https://npmjs.org/package/supermemory) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/supermemory)

This library provides convenient access to the Supermemory REST API from server-side TypeScript or JavaScript.

Expand Down Expand Up @@ -231,9 +231,8 @@ parameter. This library doesn't validate at runtime that the request matches the
send will be sent as-is.

```ts
client.foo.create({
foo: 'my_param',
bar: 12,
client.search.execute({
// ...
// @ts-expect-error baz is not yet public
baz: 'undocumented option',
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supermemory",
"version": "3.0.0-alpha.18",
"version": "3.0.0-alpha.19",
"description": "The official TypeScript library for the Supermemory API",
"author": "Supermemory <[email protected]>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -42,7 +42,7 @@
"publint": "^0.2.12",
"ts-jest": "^29.1.0",
"ts-node": "^10.5.0",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz",
"tsconfig-paths": "^4.0.0",
"typescript": "5.8.3"
},
Expand Down
36 changes: 27 additions & 9 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { HTTPMethod, PromiseOrValue, MergedRequestInit, FinalizedRequestIni
import { uuid4 } from './internal/utils/uuid';
import { validatePositiveInteger, isAbsoluteURL, safeJSON } from './internal/utils/values';
import { sleep } from './internal/utils/sleep';
import { type Logger, type LogLevel, parseLogLevel } from './internal/utils/log';
export type { Logger, LogLevel } from './internal/utils/log';
import { castToError, isAbortError } from './internal/errors';
import type { APIResponseProps } from './internal/parse';
Expand All @@ -17,9 +16,6 @@ import * as Errors from './core/error';
import * as Uploads from './core/uploads';
import * as API from './resources/index';
import { APIPromise } from './core/api-promise';
import { type Fetch } from './internal/builtin-types';
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
import {
ConnectionCreateParams,
ConnectionCreateResponse,
Expand Down Expand Up @@ -52,8 +48,17 @@ import {
SettingUpdateResponse,
Settings,
} from './resources/settings';
import { type Fetch } from './internal/builtin-types';
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
import { readEnv } from './internal/utils/env';
import { formatRequestDetails, loggerFor } from './internal/utils/log';
import {
type LogLevel,
type Logger,
formatRequestDetails,
loggerFor,
parseLogLevel,
} from './internal/utils/log';
import { isEmptyObj } from './internal/utils/values';

export interface ClientOptions {
Expand Down Expand Up @@ -207,12 +212,20 @@ export class Supermemory {
timeout: this.timeout,
logger: this.logger,
logLevel: this.logLevel,
fetch: this.fetch,
fetchOptions: this.fetchOptions,
apiKey: this.apiKey,
...options,
});
}

/**
* Check whether the base URL is set to its default.
*/
#baseURLOverridden(): boolean {
return this.baseURL !== 'https://api.supermemory.ai';
}

protected defaultQuery(): Record<string, string | undefined> | undefined {
return this._options.defaultQuery;
}
Expand Down Expand Up @@ -262,11 +275,16 @@ export class Supermemory {
return Errors.APIError.generate(status, error, message, headers);
}

buildURL(path: string, query: Record<string, unknown> | null | undefined): string {
buildURL(
path: string,
query: Record<string, unknown> | null | undefined,
defaultBaseURL?: string | undefined,
): string {
const baseURL = (!this.#baseURLOverridden() && defaultBaseURL) || this.baseURL;
const url =
isAbsoluteURL(path) ?
new URL(path)
: new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));

const defaultQuery = this.defaultQuery();
if (!isEmptyObj(defaultQuery)) {
Expand Down Expand Up @@ -607,9 +625,9 @@ export class Supermemory {
{ retryCount = 0 }: { retryCount?: number } = {},
): { req: FinalizedRequestInit; url: string; timeout: number } {
const options = { ...inputOptions };
const { method, path, query } = options;
const { method, path, query, defaultBaseURL } = options;

const url = this.buildURL(path!, query as Record<string, unknown>);
const url = this.buildURL(path!, query as Record<string, unknown>, defaultBaseURL);
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
options.timeout = options.timeout ?? this.timeout;
const { bodyHeaders, body } = this.buildBody({ options });
Expand Down
1 change: 1 addition & 0 deletions src/internal/request-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type RequestOptions = {
fetchOptions?: MergedRequestInit;
signal?: AbortSignal | undefined | null;
idempotencyKey?: string;
defaultBaseURL?: string | undefined;

__binaryResponse?: boolean | undefined;
};
Expand Down
27 changes: 9 additions & 18 deletions src/resources/connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ export class Connections extends APIResource {
* ```ts
* const response = await client.connections.deleteByProvider(
* 'notion',
* { containerTags: ['user_123', 'project_123'] },
* );
* ```
*/
deleteByProvider(
provider: 'notion' | 'google-drive' | 'onedrive',
body: ConnectionDeleteByProviderParams | null | undefined = {},
body: ConnectionDeleteByProviderParams,
options?: RequestOptions,
): APIPromise<ConnectionDeleteByProviderResponse> {
return this._client.delete(path`/v3/connections/${provider}`, { body, ...options });
Expand Down Expand Up @@ -156,24 +157,14 @@ export namespace ConnectionListResponse {

expiresAt?: number;

metadata?: Record<string, unknown>;
metadata?: { [key: string]: unknown };
}
}

export interface ConnectionDeleteByProviderResponse {
deletedConnections: Array<ConnectionDeleteByProviderResponse.DeletedConnection>;

deletedCount: number;

success: boolean;
}

export namespace ConnectionDeleteByProviderResponse {
export interface DeletedConnection {
id: string;
id: string;

provider: string;
}
provider: string;
}

export interface ConnectionGetByIDResponse {
Expand All @@ -189,7 +180,7 @@ export interface ConnectionGetByIDResponse {

expiresAt?: number;

metadata?: Record<string, unknown>;
metadata?: { [key: string]: unknown };
}

export interface ConnectionGetByTagsResponse {
Expand All @@ -205,7 +196,7 @@ export interface ConnectionGetByTagsResponse {

expiresAt?: number;

metadata?: Record<string, unknown>;
metadata?: { [key: string]: unknown };
}

export type ConnectionListDocumentsResponse =
Expand Down Expand Up @@ -234,7 +225,7 @@ export interface ConnectionCreateParams {

documentLimit?: number;

metadata?: Record<string, string | number | boolean> | null;
metadata?: { [key: string]: string | number | boolean } | null;

redirectUrl?: string;
}
Expand All @@ -250,7 +241,7 @@ export interface ConnectionDeleteByProviderParams {
/**
* Optional comma-separated list of container tags to filter connections by
*/
containerTags?: Array<string>;
containerTags: Array<string>;
}

export interface ConnectionGetByTagsParams {
Expand Down
14 changes: 8 additions & 6 deletions src/resources/memories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export namespace MemoryListResponse {
* case sensitive. Values can be strings, numbers, or booleans. You cannot nest
* objects.
*/
metadata: string | number | boolean | Record<string, unknown> | Array<unknown> | null;
metadata: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;

/**
* Status of the memory
Expand Down Expand Up @@ -162,7 +162,8 @@ export namespace MemoryListResponse {
| 'image'
| 'video'
| 'notion_doc'
| 'webpage';
| 'webpage'
| 'onedrive';

/**
* Last update timestamp
Expand Down Expand Up @@ -241,7 +242,7 @@ export interface MemoryGetResponse {
* case sensitive. Values can be strings, numbers, or booleans. You cannot nest
* objects.
*/
metadata: string | number | boolean | Record<string, unknown> | Array<unknown> | null;
metadata: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;

ogImage: string | null;

Expand Down Expand Up @@ -278,7 +279,8 @@ export interface MemoryGetResponse {
| 'image'
| 'video'
| 'notion_doc'
| 'webpage';
| 'webpage'
| 'onedrive';

/**
* Last update timestamp
Expand Down Expand Up @@ -334,7 +336,7 @@ export interface MemoryUpdateParams {
* case sensitive. Values can be strings, numbers, or booleans. You cannot nest
* objects.
*/
metadata?: Record<string, string | number | boolean>;
metadata?: { [key: string]: string | number | boolean };
}

export interface MemoryListParams {
Expand Down Expand Up @@ -402,7 +404,7 @@ export interface MemoryAddParams {
* case sensitive. Values can be strings, numbers, or booleans. You cannot nest
* objects.
*/
metadata?: Record<string, string | number | boolean>;
metadata?: { [key: string]: string | number | boolean };
}

export declare namespace Memories {
Expand Down
4 changes: 2 additions & 2 deletions src/resources/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export namespace SearchExecuteResponse {
/**
* Document metadata
*/
metadata: Record<string, unknown> | null;
metadata: { [key: string]: unknown } | null;

/**
* Relevance score of the match
Expand Down Expand Up @@ -134,7 +134,7 @@ export interface SearchExecuteParams {
/**
* Optional filters to apply to the search
*/
filters?: SearchExecuteParams.UnionMember0 | Record<string, unknown>;
filters?: SearchExecuteParams.UnionMember0 | { [key: string]: unknown };

/**
* If true, include full document in the response. This is helpful if you want a
Expand Down
Loading