diff --git a/src/index.ts b/src/index.ts index 051deadd..c72d44cc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,25 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Errors from './error'; -import * as Uploads from './uploads'; import { type Agent } from './_shims/index'; import * as Core from './core'; +import * as Errors from './error'; +import * as Uploads from './uploads'; import * as API from './resources/index'; +import { Commits } from './resources/commits/commits'; +import { + InferencePipelineRetrieveResponse, + InferencePipelineUpdateParams, + InferencePipelineUpdateResponse, + InferencePipelines, +} from './resources/inference-pipelines/inference-pipelines'; +import { + ProjectCreateParams, + ProjectCreateResponse, + ProjectListParams, + ProjectListResponse, + Projects, +} from './resources/projects/projects'; +import { Storage } from './resources/storage/storage'; export interface ClientOptions { /** @@ -170,42 +185,49 @@ export class Openlayer extends Core.APIClient { static fileFromPath = Uploads.fileFromPath; } -export const { - OpenlayerError, - APIError, - APIConnectionError, - APIConnectionTimeoutError, - APIUserAbortError, - NotFoundError, - ConflictError, - RateLimitError, - BadRequestError, - AuthenticationError, - InternalServerError, - PermissionDeniedError, - UnprocessableEntityError, -} = Errors; +export const OpenlayerError = Errors.OpenlayerError; +export const APIError = Errors.APIError; +export const APIConnectionError = Errors.APIConnectionError; +export const APIConnectionTimeoutError = Errors.APIConnectionTimeoutError; +export const APIUserAbortError = Errors.APIUserAbortError; +export const NotFoundError = Errors.NotFoundError; +export const ConflictError = Errors.ConflictError; +export const RateLimitError = Errors.RateLimitError; +export const BadRequestError = Errors.BadRequestError; +export const AuthenticationError = Errors.AuthenticationError; +export const InternalServerError = Errors.InternalServerError; +export const PermissionDeniedError = Errors.PermissionDeniedError; +export const UnprocessableEntityError = Errors.UnprocessableEntityError; export import toFile = Uploads.toFile; export import fileFromPath = Uploads.fileFromPath; -export namespace Openlayer { - export import RequestOptions = Core.RequestOptions; +Openlayer.Projects = Projects; +Openlayer.Commits = Commits; +Openlayer.InferencePipelines = InferencePipelines; +Openlayer.Storage = Storage; + +export declare namespace Openlayer { + export type RequestOptions = Core.RequestOptions; - export import Projects = API.Projects; - export import ProjectCreateResponse = API.ProjectCreateResponse; - export import ProjectListResponse = API.ProjectListResponse; - export import ProjectCreateParams = API.ProjectCreateParams; - export import ProjectListParams = API.ProjectListParams; + export { + Projects as Projects, + type ProjectCreateResponse as ProjectCreateResponse, + type ProjectListResponse as ProjectListResponse, + type ProjectCreateParams as ProjectCreateParams, + type ProjectListParams as ProjectListParams, + }; - export import Commits = API.Commits; + export { Commits as Commits }; - export import InferencePipelines = API.InferencePipelines; - export import InferencePipelineRetrieveResponse = API.InferencePipelineRetrieveResponse; - export import InferencePipelineUpdateResponse = API.InferencePipelineUpdateResponse; - export import InferencePipelineUpdateParams = API.InferencePipelineUpdateParams; + export { + InferencePipelines as InferencePipelines, + type InferencePipelineRetrieveResponse as InferencePipelineRetrieveResponse, + type InferencePipelineUpdateResponse as InferencePipelineUpdateResponse, + type InferencePipelineUpdateParams as InferencePipelineUpdateParams, + }; - export import Storage = API.Storage; + export { Storage as Storage }; } export default Openlayer; diff --git a/src/resources/commits/commits.ts b/src/resources/commits/commits.ts index bc3cc40d..a4f808b6 100644 --- a/src/resources/commits/commits.ts +++ b/src/resources/commits/commits.ts @@ -2,13 +2,18 @@ import { APIResource } from '../../resource'; import * as TestResultsAPI from './test-results'; +import { TestResultListParams, TestResultListResponse, TestResults } from './test-results'; export class Commits extends APIResource { testResults: TestResultsAPI.TestResults = new TestResultsAPI.TestResults(this._client); } -export namespace Commits { - export import TestResults = TestResultsAPI.TestResults; - export import TestResultListResponse = TestResultsAPI.TestResultListResponse; - export import TestResultListParams = TestResultsAPI.TestResultListParams; +Commits.TestResults = TestResults; + +export declare namespace Commits { + export { + TestResults as TestResults, + type TestResultListResponse as TestResultListResponse, + type TestResultListParams as TestResultListParams, + }; } diff --git a/src/resources/commits/index.ts b/src/resources/commits/index.ts index 9f35f3f4..935b4403 100644 --- a/src/resources/commits/index.ts +++ b/src/resources/commits/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Commits } from './commits'; -export { TestResultListResponse, TestResultListParams, TestResults } from './test-results'; +export { TestResults, type TestResultListResponse, type TestResultListParams } from './test-results'; diff --git a/src/resources/commits/test-results.ts b/src/resources/commits/test-results.ts index c033f089..ab1b9771 100644 --- a/src/resources/commits/test-results.ts +++ b/src/resources/commits/test-results.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as TestResultsAPI from './test-results'; export class TestResults extends APIResource { /** @@ -254,7 +253,9 @@ export interface TestResultListParams { type?: 'integrity' | 'consistency' | 'performance' | 'fairness' | 'robustness'; } -export namespace TestResults { - export import TestResultListResponse = TestResultsAPI.TestResultListResponse; - export import TestResultListParams = TestResultsAPI.TestResultListParams; +export declare namespace TestResults { + export { + type TestResultListResponse as TestResultListResponse, + type TestResultListParams as TestResultListParams, + }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 8ab3b09b..aca525c1 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -2,16 +2,16 @@ export { Commits } from './commits/commits'; export { - InferencePipelineRetrieveResponse, - InferencePipelineUpdateResponse, - InferencePipelineUpdateParams, InferencePipelines, + type InferencePipelineRetrieveResponse, + type InferencePipelineUpdateResponse, + type InferencePipelineUpdateParams, } from './inference-pipelines/inference-pipelines'; export { - ProjectCreateResponse, - ProjectListResponse, - ProjectCreateParams, - ProjectListParams, Projects, + type ProjectCreateResponse, + type ProjectListResponse, + type ProjectCreateParams, + type ProjectListParams, } from './projects/projects'; export { Storage } from './storage/storage'; diff --git a/src/resources/inference-pipelines/data.ts b/src/resources/inference-pipelines/data.ts index 4e329488..d2009c3d 100644 --- a/src/resources/inference-pipelines/data.ts +++ b/src/resources/inference-pipelines/data.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as DataAPI from './data'; export class Data extends APIResource { /** @@ -279,7 +278,6 @@ export namespace DataStreamParams { } } -export namespace Data { - export import DataStreamResponse = DataAPI.DataStreamResponse; - export import DataStreamParams = DataAPI.DataStreamParams; +export declare namespace Data { + export { type DataStreamResponse as DataStreamResponse, type DataStreamParams as DataStreamParams }; } diff --git a/src/resources/inference-pipelines/index.ts b/src/resources/inference-pipelines/index.ts index 854757b3..3cc039f4 100644 --- a/src/resources/inference-pipelines/index.ts +++ b/src/resources/inference-pipelines/index.ts @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { DataStreamResponse, DataStreamParams, Data } from './data'; +export { Data, type DataStreamResponse, type DataStreamParams } from './data'; export { - InferencePipelineRetrieveResponse, - InferencePipelineUpdateResponse, - InferencePipelineUpdateParams, InferencePipelines, + type InferencePipelineRetrieveResponse, + type InferencePipelineUpdateResponse, + type InferencePipelineUpdateParams, } from './inference-pipelines'; -export { RowUpdateResponse, RowUpdateParams, Rows } from './rows'; -export { TestResultListResponse, TestResultListParams, TestResults } from './test-results'; +export { Rows, type RowUpdateResponse, type RowUpdateParams } from './rows'; +export { TestResults, type TestResultListResponse, type TestResultListParams } from './test-results'; diff --git a/src/resources/inference-pipelines/inference-pipelines.ts b/src/resources/inference-pipelines/inference-pipelines.ts index 3244939a..8e4b7804 100644 --- a/src/resources/inference-pipelines/inference-pipelines.ts +++ b/src/resources/inference-pipelines/inference-pipelines.ts @@ -3,10 +3,12 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as InferencePipelinesAPI from './inference-pipelines'; import * as DataAPI from './data'; +import { Data, DataStreamParams, DataStreamResponse } from './data'; import * as RowsAPI from './rows'; +import { RowUpdateParams, RowUpdateResponse, Rows } from './rows'; import * as TestResultsAPI from './test-results'; +import { TestResultListParams, TestResultListResponse, TestResults } from './test-results'; export class InferencePipelines extends APIResource { data: DataAPI.Data = new DataAPI.Data(this._client); @@ -235,17 +237,32 @@ export interface InferencePipelineUpdateParams { referenceDatasetUri?: string | null; } -export namespace InferencePipelines { - export import InferencePipelineRetrieveResponse = InferencePipelinesAPI.InferencePipelineRetrieveResponse; - export import InferencePipelineUpdateResponse = InferencePipelinesAPI.InferencePipelineUpdateResponse; - export import InferencePipelineUpdateParams = InferencePipelinesAPI.InferencePipelineUpdateParams; - export import Data = DataAPI.Data; - export import DataStreamResponse = DataAPI.DataStreamResponse; - export import DataStreamParams = DataAPI.DataStreamParams; - export import Rows = RowsAPI.Rows; - export import RowUpdateResponse = RowsAPI.RowUpdateResponse; - export import RowUpdateParams = RowsAPI.RowUpdateParams; - export import TestResults = TestResultsAPI.TestResults; - export import TestResultListResponse = TestResultsAPI.TestResultListResponse; - export import TestResultListParams = TestResultsAPI.TestResultListParams; +InferencePipelines.Data = Data; +InferencePipelines.Rows = Rows; +InferencePipelines.TestResults = TestResults; + +export declare namespace InferencePipelines { + export { + type InferencePipelineRetrieveResponse as InferencePipelineRetrieveResponse, + type InferencePipelineUpdateResponse as InferencePipelineUpdateResponse, + type InferencePipelineUpdateParams as InferencePipelineUpdateParams, + }; + + export { + Data as Data, + type DataStreamResponse as DataStreamResponse, + type DataStreamParams as DataStreamParams, + }; + + export { + Rows as Rows, + type RowUpdateResponse as RowUpdateResponse, + type RowUpdateParams as RowUpdateParams, + }; + + export { + TestResults as TestResults, + type TestResultListResponse as TestResultListResponse, + type TestResultListParams as TestResultListParams, + }; } diff --git a/src/resources/inference-pipelines/rows.ts b/src/resources/inference-pipelines/rows.ts index f8f40854..b959d413 100644 --- a/src/resources/inference-pipelines/rows.ts +++ b/src/resources/inference-pipelines/rows.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as RowsAPI from './rows'; export class Rows extends APIResource { /** @@ -75,7 +74,6 @@ export namespace RowUpdateParams { } } -export namespace Rows { - export import RowUpdateResponse = RowsAPI.RowUpdateResponse; - export import RowUpdateParams = RowsAPI.RowUpdateParams; +export declare namespace Rows { + export { type RowUpdateResponse as RowUpdateResponse, type RowUpdateParams as RowUpdateParams }; } diff --git a/src/resources/inference-pipelines/test-results.ts b/src/resources/inference-pipelines/test-results.ts index e51fea41..17a72f9e 100644 --- a/src/resources/inference-pipelines/test-results.ts +++ b/src/resources/inference-pipelines/test-results.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as TestResultsAPI from './test-results'; export class TestResults extends APIResource { /** @@ -249,7 +248,9 @@ export interface TestResultListParams { type?: 'integrity' | 'consistency' | 'performance' | 'fairness' | 'robustness'; } -export namespace TestResults { - export import TestResultListResponse = TestResultsAPI.TestResultListResponse; - export import TestResultListParams = TestResultsAPI.TestResultListParams; +export declare namespace TestResults { + export { + type TestResultListResponse as TestResultListResponse, + type TestResultListParams as TestResultListParams, + }; } diff --git a/src/resources/projects/commits.ts b/src/resources/projects/commits.ts index 4a39a5d9..87368525 100644 --- a/src/resources/projects/commits.ts +++ b/src/resources/projects/commits.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as CommitsAPI from './commits'; export class Commits extends APIResource { /** @@ -392,9 +391,11 @@ export interface CommitListParams { perPage?: number; } -export namespace Commits { - export import CommitCreateResponse = CommitsAPI.CommitCreateResponse; - export import CommitListResponse = CommitsAPI.CommitListResponse; - export import CommitCreateParams = CommitsAPI.CommitCreateParams; - export import CommitListParams = CommitsAPI.CommitListParams; +export declare namespace Commits { + export { + type CommitCreateResponse as CommitCreateResponse, + type CommitListResponse as CommitListResponse, + type CommitCreateParams as CommitCreateParams, + type CommitListParams as CommitListParams, + }; } diff --git a/src/resources/projects/index.ts b/src/resources/projects/index.ts index 6b87b6dc..de971905 100644 --- a/src/resources/projects/index.ts +++ b/src/resources/projects/index.ts @@ -1,23 +1,23 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - CommitCreateResponse, - CommitListResponse, - CommitCreateParams, - CommitListParams, Commits, + type CommitCreateResponse, + type CommitListResponse, + type CommitCreateParams, + type CommitListParams, } from './commits'; export { - InferencePipelineCreateResponse, - InferencePipelineListResponse, - InferencePipelineCreateParams, - InferencePipelineListParams, InferencePipelines, + type InferencePipelineCreateResponse, + type InferencePipelineListResponse, + type InferencePipelineCreateParams, + type InferencePipelineListParams, } from './inference-pipelines'; export { - ProjectCreateResponse, - ProjectListResponse, - ProjectCreateParams, - ProjectListParams, Projects, + type ProjectCreateResponse, + type ProjectListResponse, + type ProjectCreateParams, + type ProjectListParams, } from './projects'; diff --git a/src/resources/projects/inference-pipelines.ts b/src/resources/projects/inference-pipelines.ts index e65e5c47..37012f28 100644 --- a/src/resources/projects/inference-pipelines.ts +++ b/src/resources/projects/inference-pipelines.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as InferencePipelinesAPI from './inference-pipelines'; export class InferencePipelines extends APIResource { /** @@ -233,9 +232,11 @@ export interface InferencePipelineListParams { perPage?: number; } -export namespace InferencePipelines { - export import InferencePipelineCreateResponse = InferencePipelinesAPI.InferencePipelineCreateResponse; - export import InferencePipelineListResponse = InferencePipelinesAPI.InferencePipelineListResponse; - export import InferencePipelineCreateParams = InferencePipelinesAPI.InferencePipelineCreateParams; - export import InferencePipelineListParams = InferencePipelinesAPI.InferencePipelineListParams; +export declare namespace InferencePipelines { + export { + type InferencePipelineCreateResponse as InferencePipelineCreateResponse, + type InferencePipelineListResponse as InferencePipelineListResponse, + type InferencePipelineCreateParams as InferencePipelineCreateParams, + type InferencePipelineListParams as InferencePipelineListParams, + }; } diff --git a/src/resources/projects/projects.ts b/src/resources/projects/projects.ts index ff4d9a8c..dbf39e5f 100644 --- a/src/resources/projects/projects.ts +++ b/src/resources/projects/projects.ts @@ -3,9 +3,22 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as ProjectsAPI from './projects'; import * as CommitsAPI from './commits'; +import { + CommitCreateParams, + CommitCreateResponse, + CommitListParams, + CommitListResponse, + Commits, +} from './commits'; import * as InferencePipelinesAPI from './inference-pipelines'; +import { + InferencePipelineCreateParams, + InferencePipelineCreateResponse, + InferencePipelineListParams, + InferencePipelineListResponse, + InferencePipelines, +} from './inference-pipelines'; export class Projects extends APIResource { commits: CommitsAPI.Commits = new CommitsAPI.Commits(this._client); @@ -309,19 +322,30 @@ export interface ProjectListParams { taskType?: 'llm-base' | 'tabular-classification' | 'tabular-regression' | 'text-classification'; } -export namespace Projects { - export import ProjectCreateResponse = ProjectsAPI.ProjectCreateResponse; - export import ProjectListResponse = ProjectsAPI.ProjectListResponse; - export import ProjectCreateParams = ProjectsAPI.ProjectCreateParams; - export import ProjectListParams = ProjectsAPI.ProjectListParams; - export import Commits = CommitsAPI.Commits; - export import CommitCreateResponse = CommitsAPI.CommitCreateResponse; - export import CommitListResponse = CommitsAPI.CommitListResponse; - export import CommitCreateParams = CommitsAPI.CommitCreateParams; - export import CommitListParams = CommitsAPI.CommitListParams; - export import InferencePipelines = InferencePipelinesAPI.InferencePipelines; - export import InferencePipelineCreateResponse = InferencePipelinesAPI.InferencePipelineCreateResponse; - export import InferencePipelineListResponse = InferencePipelinesAPI.InferencePipelineListResponse; - export import InferencePipelineCreateParams = InferencePipelinesAPI.InferencePipelineCreateParams; - export import InferencePipelineListParams = InferencePipelinesAPI.InferencePipelineListParams; +Projects.Commits = Commits; +Projects.InferencePipelines = InferencePipelines; + +export declare namespace Projects { + export { + type ProjectCreateResponse as ProjectCreateResponse, + type ProjectListResponse as ProjectListResponse, + type ProjectCreateParams as ProjectCreateParams, + type ProjectListParams as ProjectListParams, + }; + + export { + Commits as Commits, + type CommitCreateResponse as CommitCreateResponse, + type CommitListResponse as CommitListResponse, + type CommitCreateParams as CommitCreateParams, + type CommitListParams as CommitListParams, + }; + + export { + InferencePipelines as InferencePipelines, + type InferencePipelineCreateResponse as InferencePipelineCreateResponse, + type InferencePipelineListResponse as InferencePipelineListResponse, + type InferencePipelineCreateParams as InferencePipelineCreateParams, + type InferencePipelineListParams as InferencePipelineListParams, + }; } diff --git a/src/resources/storage/index.ts b/src/resources/storage/index.ts index 97760a20..9cbd2500 100644 --- a/src/resources/storage/index.ts +++ b/src/resources/storage/index.ts @@ -1,4 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { PresignedURLCreateResponse, PresignedURLCreateParams, PresignedURL } from './presigned-url'; +export { + PresignedURL, + type PresignedURLCreateResponse, + type PresignedURLCreateParams, +} from './presigned-url'; export { Storage } from './storage'; diff --git a/src/resources/storage/presigned-url.ts b/src/resources/storage/presigned-url.ts index 138dd355..3a1f1bb8 100644 --- a/src/resources/storage/presigned-url.ts +++ b/src/resources/storage/presigned-url.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PresignedURLAPI from './presigned-url'; export class PresignedURL extends APIResource { /** @@ -41,7 +40,9 @@ export interface PresignedURLCreateParams { objectName: string; } -export namespace PresignedURL { - export import PresignedURLCreateResponse = PresignedURLAPI.PresignedURLCreateResponse; - export import PresignedURLCreateParams = PresignedURLAPI.PresignedURLCreateParams; +export declare namespace PresignedURL { + export { + type PresignedURLCreateResponse as PresignedURLCreateResponse, + type PresignedURLCreateParams as PresignedURLCreateParams, + }; } diff --git a/src/resources/storage/storage.ts b/src/resources/storage/storage.ts index 85b28887..87b1af94 100644 --- a/src/resources/storage/storage.ts +++ b/src/resources/storage/storage.ts @@ -2,13 +2,18 @@ import { APIResource } from '../../resource'; import * as PresignedURLAPI from './presigned-url'; +import { PresignedURL, PresignedURLCreateParams, PresignedURLCreateResponse } from './presigned-url'; export class Storage extends APIResource { presignedURL: PresignedURLAPI.PresignedURL = new PresignedURLAPI.PresignedURL(this._client); } -export namespace Storage { - export import PresignedURL = PresignedURLAPI.PresignedURL; - export import PresignedURLCreateResponse = PresignedURLAPI.PresignedURLCreateResponse; - export import PresignedURLCreateParams = PresignedURLAPI.PresignedURLCreateParams; +Storage.PresignedURL = PresignedURL; + +export declare namespace Storage { + export { + PresignedURL as PresignedURL, + type PresignedURLCreateResponse as PresignedURLCreateResponse, + type PresignedURLCreateParams as PresignedURLCreateParams, + }; } diff --git a/tests/api-resources/commits/commits.test.ts b/tests/api-resources/commits/commits.test.ts deleted file mode 100644 index 6b7f5bc2..00000000 --- a/tests/api-resources/commits/commits.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Openlayer from 'openlayer'; -import { Response } from 'node-fetch'; - -const client = new Openlayer({ - apiKey: 'My API Key', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource commits', () => { - test('create: only required params', async () => { - const responsePromise = client.commits.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { - commit: { message: 'Updated the prompt.' }, - storageUri: 's3://...', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('create: required and optional params', async () => { - const response = await client.commits.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { - commit: { message: 'Updated the prompt.' }, - storageUri: 's3://...', - archived: false, - deploymentStatus: 'Deployed', - }); - }); -}); diff --git a/tsconfig.json b/tsconfig.json index d23b136c..2ba0896c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "paths": { "openlayer/_shims/auto/*": ["src/_shims/auto/*-node"], "openlayer/*": ["src/*"], - "openlayer": ["src/index.ts"], + "openlayer": ["src/index.ts"] }, "noEmit": true,