diff --git a/.gitignore b/.gitignore index 3eed6dd..d98d51a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ yarn-error.log codegen.log Brewfile.lock.json dist -/deno +dist-deno /*.tgz .idea/ diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a0ad416..cdc55cc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.12" + ".": "0.1.0-alpha.13" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fb385c..da5e034 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## 0.1.0-alpha.13 (2024-11-28) + +Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/clear-street/studio-sdk-node/compare/v0.1.0-alpha.12...v0.1.0-alpha.13) + +### Features + +* **internal:** make git install file structure match npm ([#65](https://github.com/clear-street/studio-sdk-node/issues/65)) ([0a97e8d](https://github.com/clear-street/studio-sdk-node/commit/0a97e8dac6a65c9354d80fd3da7d4ba0add30ad3)) + + +### Chores + +* **internal:** version bump ([#56](https://github.com/clear-street/studio-sdk-node/issues/56)) ([edbfb81](https://github.com/clear-street/studio-sdk-node/commit/edbfb81a999c641559f5509af03c904223d26340)) +* rebuild project due to codegen change ([#58](https://github.com/clear-street/studio-sdk-node/issues/58)) ([9de16eb](https://github.com/clear-street/studio-sdk-node/commit/9de16eb6782a634457f9d1c301764637f5296e52)) +* rebuild project due to codegen change ([#59](https://github.com/clear-street/studio-sdk-node/issues/59)) ([d4c4b6b](https://github.com/clear-street/studio-sdk-node/commit/d4c4b6bc92160bbe6d011723502688ccb4a93a76)) +* rebuild project due to codegen change ([#60](https://github.com/clear-street/studio-sdk-node/issues/60)) ([3e9fb2b](https://github.com/clear-street/studio-sdk-node/commit/3e9fb2bc4de1b0ca2506ce46b010fba1b70492ab)) +* rebuild project due to codegen change ([#61](https://github.com/clear-street/studio-sdk-node/issues/61)) ([677ee27](https://github.com/clear-street/studio-sdk-node/commit/677ee2768857d7f3e1a6312d4b6adaaccb84bb7b)) +* rebuild project due to codegen change ([#62](https://github.com/clear-street/studio-sdk-node/issues/62)) ([bfe87b7](https://github.com/clear-street/studio-sdk-node/commit/bfe87b739732e335dbb66c77d5a5ca17ded60d4a)) +* remove redundant word in comment ([#64](https://github.com/clear-street/studio-sdk-node/issues/64)) ([cc8bab8](https://github.com/clear-street/studio-sdk-node/commit/cc8bab80186d5f5a0c1ffcac082c62f18c5dc231)) + + +### Documentation + +* remove suggestion to use `npm` call out ([#63](https://github.com/clear-street/studio-sdk-node/issues/63)) ([face38a](https://github.com/clear-street/studio-sdk-node/commit/face38a396911e3f80722c99ceb49254e1a6149c)) + ## 0.1.0-alpha.12 (2024-11-01) Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.12](https://github.com/clear-street/studio-sdk-node/compare/v0.1.0-alpha.10...v0.1.0-alpha.12) diff --git a/README.md b/README.md index 14f916f..dda781f 100644 --- a/README.md +++ b/README.md @@ -281,6 +281,15 @@ TypeScript >= 4.5 is supported. The following runtimes are supported: +- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more) +- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions. +- Deno v1.28.0 or higher. +- Bun 1.0 or later. +- Cloudflare Workers. +- Vercel Edge Runtime. +- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time). +- Nitro v2.6 or greater. + Note that React Native is not supported at this time. If you are interested in other runtime environments, please open or upvote an issue on GitHub. diff --git a/package.json b/package.json index c1c4d3a..5741722 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@clear-street/studio-sdk", - "version": "0.1.0-alpha.12", + "version": "0.1.0-alpha.13", "description": "The official TypeScript library for the Studio SDK API", "author": "Studio SDK ", "types": "dist/index.d.ts", @@ -10,7 +10,7 @@ "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "files": [ - "*" + "**/*" ], "private": false, "scripts": { @@ -18,7 +18,7 @@ "build": "./scripts/build", "prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1", "format": "prettier --write --cache --cache-strategy metadata . !dist", - "prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi", + "prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi", "tsn": "ts-node -r tsconfig-paths/register", "lint": "./scripts/lint", "fix": "./scripts/format" @@ -45,7 +45,6 @@ "jest": "^29.4.0", "prettier": "^3.0.0", "ts-jest": "^29.1.0", - "ts-morph": "^19.0.0", "ts-node": "^10.5.0", "tsc-multi": "^1.1.0", "tsconfig-paths": "^4.0.0", diff --git a/scripts/build b/scripts/build index cb66590..0a56f5b 100755 --- a/scripts/build +++ b/scripts/build @@ -32,7 +32,7 @@ npm exec tsc-multi # copy over handwritten .js/.mjs/.d.ts files cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto -# we need to add exports = module.exports = Studio SDK Node to index.js; +# we need to add exports = module.exports = StudioSDK to index.js; # No way to get that from index.ts because it would cause compile errors # when building .mjs node scripts/utils/fix-index-exports.cjs @@ -50,7 +50,7 @@ node scripts/utils/postprocess-files.cjs (cd dist && node -e 'require("@clear-street/studio-sdk")') (cd dist && node -e 'import("@clear-street/studio-sdk")' --input-type=module) -if command -v deno &> /dev/null && [ -e ./scripts/build-deno ] +if [ -e ./scripts/build-deno ] then ./scripts/build-deno fi diff --git a/scripts/utils/check-is-in-git-install.sh b/scripts/utils/check-is-in-git-install.sh index 36bcedc..1354eb4 100755 --- a/scripts/utils/check-is-in-git-install.sh +++ b/scripts/utils/check-is-in-git-install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Check if you happen to call prepare for a repository that's already in node_modules. [ "$(basename "$(dirname "$PWD")")" = 'node_modules' ] || # The name of the containing directory that 'npm` uses, which looks like diff --git a/scripts/utils/git-swap.sh b/scripts/utils/git-swap.sh new file mode 100755 index 0000000..79d1888 --- /dev/null +++ b/scripts/utils/git-swap.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -exuo pipefail +# the package is published to NPM from ./dist +# we want the final file structure for git installs to match the npm installs, so we + +# delete everything except ./dist and ./node_modules +find . -maxdepth 1 -mindepth 1 ! -name 'dist' ! -name 'node_modules' -exec rm -rf '{}' + + +# move everything from ./dist to . +mv dist/* . + +# delete the now-empty ./dist +rmdir dist diff --git a/src/core.ts b/src/core.ts index a2beba0..d951d0c 100644 --- a/src/core.ts +++ b/src/core.ts @@ -396,7 +396,7 @@ export abstract class APIClient { error: Object | undefined, message: string | undefined, headers: Headers | undefined, - ) { + ): APIError { return APIError.generate(status, error, message, headers); } @@ -668,9 +668,9 @@ export abstract class AbstractPage implements AsyncIterable { return await this.#client.requestAPIList(this.constructor as any, nextOptions); } - async *iterPages() { + async *iterPages(): AsyncGenerator { // eslint-disable-next-line @typescript-eslint/no-this-alias - let page: AbstractPage = this; + let page: this = this; yield page; while (page.hasNextPage()) { page = await page.getNextPage(); @@ -678,7 +678,7 @@ export abstract class AbstractPage implements AsyncIterable { } } - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { for await (const page of this.iterPages()) { for (const item of page.getPaginatedItems()) { yield item; @@ -721,7 +721,7 @@ export class PagePromise< * console.log(item) * } */ - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { const page = await this; for await (const item of page) { yield item; diff --git a/src/error.ts b/src/error.ts index 9c4340c..33e5404 100644 --- a/src/error.ts +++ b/src/error.ts @@ -47,7 +47,7 @@ export class APIError extends StudioSDKError { errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined, - ) { + ): APIError { if (!status) { return new APIConnectionError({ message, cause: castToError(errorResponse) }); } diff --git a/src/index.ts b/src/index.ts index 9d4903b..9b25369 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,17 +1,26 @@ // 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 { Instrument, InstrumentRetrieveParams, Instruments } from './resources/instruments'; +import { Account, AccountListResponse, Accounts } from './resources/accounts/accounts'; +import { + Entities, + Entity, + EntityListResponse, + PnlSummary, + PortfolioMargin, + RegtMargin, +} from './resources/entities/entities'; const environments = { production: 'https://api.clearstreet.io/studio/v2', sandbox: 'https://sandbox-api.clearstreet.io/studio/v2', }; type Environment = keyof typeof environments; - export interface ClientOptions { /** * Defaults to process.env['STUDIO_SDK_BEARER_TOKEN']. @@ -182,7 +191,40 @@ export class StudioSDK extends Core.APIClient { static fileFromPath = Uploads.fileFromPath; } -export const { +StudioSDK.Entities = Entities; +StudioSDK.Accounts = Accounts; +StudioSDK.Instruments = Instruments; +export declare namespace StudioSDK { + export type RequestOptions = Core.RequestOptions; + + export { + Entities as Entities, + type Entity as Entity, + type PnlSummary as PnlSummary, + type PortfolioMargin as PortfolioMargin, + type RegtMargin as RegtMargin, + type EntityListResponse as EntityListResponse, + }; + + export { Accounts as Accounts, type Account as Account, type AccountListResponse as AccountListResponse }; + + export { + Instruments as Instruments, + type Instrument as Instrument, + type InstrumentRetrieveParams as InstrumentRetrieveParams, + }; + + export type BaseStrategy = API.BaseStrategy; + export type LocateOrder = API.LocateOrder; + export type Order = API.Order; + export type Position = API.Position; + export type RegtMarginSimulation = API.RegtMarginSimulation; + export type Strategy = API.Strategy; + export type Trade = API.Trade; +} + +export { toFile, fileFromPath } from './uploads'; +export { StudioSDKError, APIError, APIConnectionError, @@ -196,36 +238,6 @@ export const { InternalServerError, PermissionDeniedError, UnprocessableEntityError, -} = Errors; - -export import toFile = Uploads.toFile; -export import fileFromPath = Uploads.fileFromPath; - -export namespace StudioSDK { - export import RequestOptions = Core.RequestOptions; - - export import Entities = API.Entities; - export import Entity = API.Entity; - export import PnlSummary = API.PnlSummary; - export import PortfolioMargin = API.PortfolioMargin; - export import RegtMargin = API.RegtMargin; - export import EntityListResponse = API.EntityListResponse; - - export import Accounts = API.Accounts; - export import Account = API.Account; - export import AccountListResponse = API.AccountListResponse; - - export import Instruments = API.Instruments; - export import Instrument = API.Instrument; - export import InstrumentRetrieveParams = API.InstrumentRetrieveParams; - - export import BaseStrategy = API.BaseStrategy; - export import LocateOrder = API.LocateOrder; - export import Order = API.Order; - export import Position = API.Position; - export import RegtMarginSimulation = API.RegtMarginSimulation; - export import Strategy = API.Strategy; - export import Trade = API.Trade; -} +} from './error'; export default StudioSDK; diff --git a/src/resources/accounts/accounts.ts b/src/resources/accounts/accounts.ts index 9ca22dc..9acbade 100644 --- a/src/resources/accounts/accounts.ts +++ b/src/resources/accounts/accounts.ts @@ -2,18 +2,42 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as AccountsAPI from './accounts'; import * as BulkOrdersAPI from './bulk-orders'; +import { BulkOrderCreateParams, BulkOrderCreateResponse, BulkOrders } from './bulk-orders'; import * as EasyBorrowsAPI from './easy-borrows'; +import { EasyBorrowListResponse, EasyBorrows } from './easy-borrows'; import * as HoldingsAPI from './holdings'; +import { HoldingListParams, HoldingListResponse, Holdings } from './holdings'; import * as InventoriesAPI from './inventories'; +import { Inventories, InventoryRetrieveResponse } from './inventories'; import * as LocateOrdersAPI from './locate-orders'; +import { + LocateOrderCreateParams, + LocateOrderListResponse, + LocateOrderUpdateParams, + LocateOrders, +} from './locate-orders'; import * as OrdersAPI from './orders'; +import { + OrderCreateParams, + OrderCreateResponse, + OrderDeleteParams, + OrderDeleteResponse, + OrderListParams, + OrderListResponse, + OrderRetrieveResponse, + Orders, +} from './orders'; import * as PnlDetailsAPI from './pnl-details'; +import { PnlDetailListResponse, PnlDetails } from './pnl-details'; import * as PnlSummaryAPI from './pnl-summary'; +import { PnlSummary } from './pnl-summary'; import * as PnlSumsAPI from './pnl-sums'; +import { PnlSumListParams, PnlSumListResponse, PnlSums } from './pnl-sums'; import * as PositionsAPI from './positions'; +import { PositionListParams, PositionListResponse, Positions } from './positions'; import * as TradesAPI from './trades'; +import { TradeListParams, TradeListResponse, Trades } from './trades'; export class Accounts extends APIResource { bulkOrders: BulkOrdersAPI.BulkOrders = new BulkOrdersAPI.BulkOrders(this._client); @@ -61,41 +85,74 @@ export interface AccountListResponse { data?: Array; } -export namespace Accounts { - export import Account = AccountsAPI.Account; - export import AccountListResponse = AccountsAPI.AccountListResponse; - export import BulkOrders = BulkOrdersAPI.BulkOrders; - export import BulkOrderCreateResponse = BulkOrdersAPI.BulkOrderCreateResponse; - export import BulkOrderCreateParams = BulkOrdersAPI.BulkOrderCreateParams; - export import Orders = OrdersAPI.Orders; - export import OrderCreateResponse = OrdersAPI.OrderCreateResponse; - export import OrderRetrieveResponse = OrdersAPI.OrderRetrieveResponse; - export import OrderListResponse = OrdersAPI.OrderListResponse; - export import OrderDeleteResponse = OrdersAPI.OrderDeleteResponse; - export import OrderCreateParams = OrdersAPI.OrderCreateParams; - export import OrderListParams = OrdersAPI.OrderListParams; - export import OrderDeleteParams = OrdersAPI.OrderDeleteParams; - export import Trades = TradesAPI.Trades; - export import TradeListResponse = TradesAPI.TradeListResponse; - export import TradeListParams = TradesAPI.TradeListParams; - export import Positions = PositionsAPI.Positions; - export import PositionListResponse = PositionsAPI.PositionListResponse; - export import PositionListParams = PositionsAPI.PositionListParams; - export import LocateOrders = LocateOrdersAPI.LocateOrders; - export import LocateOrderListResponse = LocateOrdersAPI.LocateOrderListResponse; - export import LocateOrderCreateParams = LocateOrdersAPI.LocateOrderCreateParams; - export import LocateOrderUpdateParams = LocateOrdersAPI.LocateOrderUpdateParams; - export import EasyBorrows = EasyBorrowsAPI.EasyBorrows; - export import EasyBorrowListResponse = EasyBorrowsAPI.EasyBorrowListResponse; - export import PnlSummary = PnlSummaryAPI.PnlSummary; - export import PnlDetails = PnlDetailsAPI.PnlDetails; - export import PnlDetailListResponse = PnlDetailsAPI.PnlDetailListResponse; - export import PnlSums = PnlSumsAPI.PnlSums; - export import PnlSumListResponse = PnlSumsAPI.PnlSumListResponse; - export import PnlSumListParams = PnlSumsAPI.PnlSumListParams; - export import Holdings = HoldingsAPI.Holdings; - export import HoldingListResponse = HoldingsAPI.HoldingListResponse; - export import HoldingListParams = HoldingsAPI.HoldingListParams; - export import Inventories = InventoriesAPI.Inventories; - export import InventoryRetrieveResponse = InventoriesAPI.InventoryRetrieveResponse; +Accounts.BulkOrders = BulkOrders; +Accounts.Orders = Orders; +Accounts.Trades = Trades; +Accounts.Positions = Positions; +Accounts.LocateOrders = LocateOrders; +Accounts.EasyBorrows = EasyBorrows; +Accounts.PnlSummary = PnlSummary; +Accounts.PnlDetails = PnlDetails; +Accounts.PnlSums = PnlSums; +Accounts.Holdings = Holdings; +Accounts.Inventories = Inventories; + +export declare namespace Accounts { + export { type Account as Account, type AccountListResponse as AccountListResponse }; + + export { + BulkOrders as BulkOrders, + type BulkOrderCreateResponse as BulkOrderCreateResponse, + type BulkOrderCreateParams as BulkOrderCreateParams, + }; + + export { + Orders as Orders, + type OrderCreateResponse as OrderCreateResponse, + type OrderRetrieveResponse as OrderRetrieveResponse, + type OrderListResponse as OrderListResponse, + type OrderDeleteResponse as OrderDeleteResponse, + type OrderCreateParams as OrderCreateParams, + type OrderListParams as OrderListParams, + type OrderDeleteParams as OrderDeleteParams, + }; + + export { + Trades as Trades, + type TradeListResponse as TradeListResponse, + type TradeListParams as TradeListParams, + }; + + export { + Positions as Positions, + type PositionListResponse as PositionListResponse, + type PositionListParams as PositionListParams, + }; + + export { + LocateOrders as LocateOrders, + type LocateOrderListResponse as LocateOrderListResponse, + type LocateOrderCreateParams as LocateOrderCreateParams, + type LocateOrderUpdateParams as LocateOrderUpdateParams, + }; + + export { EasyBorrows as EasyBorrows, type EasyBorrowListResponse as EasyBorrowListResponse }; + + export { PnlSummary as PnlSummary }; + + export { PnlDetails as PnlDetails, type PnlDetailListResponse as PnlDetailListResponse }; + + export { + PnlSums as PnlSums, + type PnlSumListResponse as PnlSumListResponse, + type PnlSumListParams as PnlSumListParams, + }; + + export { + Holdings as Holdings, + type HoldingListResponse as HoldingListResponse, + type HoldingListParams as HoldingListParams, + }; + + export { Inventories as Inventories, type InventoryRetrieveResponse as InventoryRetrieveResponse }; } diff --git a/src/resources/accounts/bulk-orders.ts b/src/resources/accounts/bulk-orders.ts index 4379af9..44fc3b6 100644 --- a/src/resources/accounts/bulk-orders.ts +++ b/src/resources/accounts/bulk-orders.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as BulkOrdersAPI from './bulk-orders'; import * as Shared from '../shared'; export class BulkOrders extends APIResource { @@ -155,7 +154,9 @@ export namespace BulkOrderCreateParams { } } -export namespace BulkOrders { - export import BulkOrderCreateResponse = BulkOrdersAPI.BulkOrderCreateResponse; - export import BulkOrderCreateParams = BulkOrdersAPI.BulkOrderCreateParams; +export declare namespace BulkOrders { + export { + type BulkOrderCreateResponse as BulkOrderCreateResponse, + type BulkOrderCreateParams as BulkOrderCreateParams, + }; } diff --git a/src/resources/accounts/easy-borrows.ts b/src/resources/accounts/easy-borrows.ts index c06106e..ad0aec6 100644 --- a/src/resources/accounts/easy-borrows.ts +++ b/src/resources/accounts/easy-borrows.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as EasyBorrowsAPI from './easy-borrows'; export class EasyBorrows extends APIResource { /** @@ -18,6 +17,6 @@ export interface EasyBorrowListResponse { data: Array; } -export namespace EasyBorrows { - export import EasyBorrowListResponse = EasyBorrowsAPI.EasyBorrowListResponse; +export declare namespace EasyBorrows { + export { type EasyBorrowListResponse as EasyBorrowListResponse }; } diff --git a/src/resources/accounts/holdings.ts b/src/resources/accounts/holdings.ts index d5a819e..4bab3fd 100644 --- a/src/resources/accounts/holdings.ts +++ b/src/resources/accounts/holdings.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as HoldingsAPI from './holdings'; export class Holdings extends APIResource { /** @@ -97,7 +96,6 @@ export interface HoldingListParams { date?: number; } -export namespace Holdings { - export import HoldingListResponse = HoldingsAPI.HoldingListResponse; - export import HoldingListParams = HoldingsAPI.HoldingListParams; +export declare namespace Holdings { + export { type HoldingListResponse as HoldingListResponse, type HoldingListParams as HoldingListParams }; } diff --git a/src/resources/accounts/index.ts b/src/resources/accounts/index.ts index fca2933..9770bfe 100644 --- a/src/resources/accounts/index.ts +++ b/src/resources/accounts/index.ts @@ -1,28 +1,28 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Account, AccountListResponse, Accounts } from './accounts'; -export { BulkOrderCreateResponse, BulkOrderCreateParams, BulkOrders } from './bulk-orders'; -export { EasyBorrowListResponse, EasyBorrows } from './easy-borrows'; -export { HoldingListResponse, HoldingListParams, Holdings } from './holdings'; -export { InventoryRetrieveResponse, Inventories } from './inventories'; +export { Accounts, type Account, type AccountListResponse } from './accounts'; +export { BulkOrders, type BulkOrderCreateResponse, type BulkOrderCreateParams } from './bulk-orders'; +export { EasyBorrows, type EasyBorrowListResponse } from './easy-borrows'; +export { Holdings, type HoldingListResponse, type HoldingListParams } from './holdings'; +export { Inventories, type InventoryRetrieveResponse } from './inventories'; export { - LocateOrderListResponse, - LocateOrderCreateParams, - LocateOrderUpdateParams, LocateOrders, + type LocateOrderListResponse, + type LocateOrderCreateParams, + type LocateOrderUpdateParams, } from './locate-orders'; export { - OrderCreateResponse, - OrderRetrieveResponse, - OrderListResponse, - OrderDeleteResponse, - OrderCreateParams, - OrderListParams, - OrderDeleteParams, Orders, + type OrderCreateResponse, + type OrderRetrieveResponse, + type OrderListResponse, + type OrderDeleteResponse, + type OrderCreateParams, + type OrderListParams, + type OrderDeleteParams, } from './orders'; -export { PnlDetailListResponse, PnlDetails } from './pnl-details'; -export { PnlSumListResponse, PnlSumListParams, PnlSums } from './pnl-sums'; +export { PnlDetails, type PnlDetailListResponse } from './pnl-details'; export { PnlSummary } from './pnl-summary'; -export { PositionListResponse, PositionListParams, Positions } from './positions'; -export { TradeListResponse, TradeListParams, Trades } from './trades'; +export { PnlSums, type PnlSumListResponse, type PnlSumListParams } from './pnl-sums'; +export { Positions, type PositionListResponse, type PositionListParams } from './positions'; +export { Trades, type TradeListResponse, type TradeListParams } from './trades'; diff --git a/src/resources/accounts/inventories.ts b/src/resources/accounts/inventories.ts index e04a217..9978410 100644 --- a/src/resources/accounts/inventories.ts +++ b/src/resources/accounts/inventories.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as InventoriesAPI from './inventories'; export class Inventories extends APIResource { /** @@ -41,6 +40,6 @@ export interface InventoryRetrieveResponse { used?: string; } -export namespace Inventories { - export import InventoryRetrieveResponse = InventoriesAPI.InventoryRetrieveResponse; +export declare namespace Inventories { + export { type InventoryRetrieveResponse as InventoryRetrieveResponse }; } diff --git a/src/resources/accounts/locate-orders.ts b/src/resources/accounts/locate-orders.ts index 96ba397..4d2f93d 100644 --- a/src/resources/accounts/locate-orders.ts +++ b/src/resources/accounts/locate-orders.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as LocateOrdersAPI from './locate-orders'; import * as Shared from '../shared'; export class LocateOrders extends APIResource { @@ -87,8 +86,10 @@ export interface LocateOrderUpdateParams { accept: boolean; } -export namespace LocateOrders { - export import LocateOrderListResponse = LocateOrdersAPI.LocateOrderListResponse; - export import LocateOrderCreateParams = LocateOrdersAPI.LocateOrderCreateParams; - export import LocateOrderUpdateParams = LocateOrdersAPI.LocateOrderUpdateParams; +export declare namespace LocateOrders { + export { + type LocateOrderListResponse as LocateOrderListResponse, + type LocateOrderCreateParams as LocateOrderCreateParams, + type LocateOrderUpdateParams as LocateOrderUpdateParams, + }; } diff --git a/src/resources/accounts/orders.ts b/src/resources/accounts/orders.ts index 8828025..2f26617 100644 --- a/src/resources/accounts/orders.ts +++ b/src/resources/accounts/orders.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as OrdersAPI from './orders'; import * as Shared from '../shared'; export class Orders extends APIResource { @@ -232,12 +231,14 @@ export interface OrderDeleteParams { symbol_format?: 'cms' | 'osi'; } -export namespace Orders { - export import OrderCreateResponse = OrdersAPI.OrderCreateResponse; - export import OrderRetrieveResponse = OrdersAPI.OrderRetrieveResponse; - export import OrderListResponse = OrdersAPI.OrderListResponse; - export import OrderDeleteResponse = OrdersAPI.OrderDeleteResponse; - export import OrderCreateParams = OrdersAPI.OrderCreateParams; - export import OrderListParams = OrdersAPI.OrderListParams; - export import OrderDeleteParams = OrdersAPI.OrderDeleteParams; +export declare namespace Orders { + export { + type OrderCreateResponse as OrderCreateResponse, + type OrderRetrieveResponse as OrderRetrieveResponse, + type OrderListResponse as OrderListResponse, + type OrderDeleteResponse as OrderDeleteResponse, + type OrderCreateParams as OrderCreateParams, + type OrderListParams as OrderListParams, + type OrderDeleteParams as OrderDeleteParams, + }; } diff --git a/src/resources/accounts/pnl-details.ts b/src/resources/accounts/pnl-details.ts index a2a7526..cb3720e 100644 --- a/src/resources/accounts/pnl-details.ts +++ b/src/resources/accounts/pnl-details.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PnlDetailsAPI from './pnl-details'; export class PnlDetails extends APIResource { /** @@ -138,6 +137,6 @@ export namespace PnlDetailListResponse { } } -export namespace PnlDetails { - export import PnlDetailListResponse = PnlDetailsAPI.PnlDetailListResponse; +export declare namespace PnlDetails { + export { type PnlDetailListResponse as PnlDetailListResponse }; } diff --git a/src/resources/accounts/pnl-sums.ts b/src/resources/accounts/pnl-sums.ts index 43d4281..00507a3 100644 --- a/src/resources/accounts/pnl-sums.ts +++ b/src/resources/accounts/pnl-sums.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PnlSumsAPI from './pnl-sums'; export class PnlSums extends APIResource { /** @@ -170,7 +169,6 @@ export interface PnlSumListParams { underlying_symbol?: string; } -export namespace PnlSums { - export import PnlSumListResponse = PnlSumsAPI.PnlSumListResponse; - export import PnlSumListParams = PnlSumsAPI.PnlSumListParams; +export declare namespace PnlSums { + export { type PnlSumListResponse as PnlSumListResponse, type PnlSumListParams as PnlSumListParams }; } diff --git a/src/resources/accounts/positions.ts b/src/resources/accounts/positions.ts index 7b0697d..aded8f8 100644 --- a/src/resources/accounts/positions.ts +++ b/src/resources/accounts/positions.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as PositionsAPI from './positions'; import * as Shared from '../shared'; export class Positions extends APIResource { @@ -60,7 +59,6 @@ export interface PositionListParams { page_token?: string; } -export namespace Positions { - export import PositionListResponse = PositionsAPI.PositionListResponse; - export import PositionListParams = PositionsAPI.PositionListParams; +export declare namespace Positions { + export { type PositionListResponse as PositionListResponse, type PositionListParams as PositionListParams }; } diff --git a/src/resources/accounts/trades.ts b/src/resources/accounts/trades.ts index 3bac1a4..f97acfd 100644 --- a/src/resources/accounts/trades.ts +++ b/src/resources/accounts/trades.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as TradesAPI from './trades'; import * as Shared from '../shared'; export class Trades extends APIResource { @@ -56,7 +55,6 @@ export interface TradeListParams { page_token?: string; } -export namespace Trades { - export import TradeListResponse = TradesAPI.TradeListResponse; - export import TradeListParams = TradesAPI.TradeListParams; +export declare namespace Trades { + export { type TradeListResponse as TradeListResponse, type TradeListParams as TradeListParams }; } diff --git a/src/resources/entities/entities.ts b/src/resources/entities/entities.ts index fb39c15..31d9402 100644 --- a/src/resources/entities/entities.ts +++ b/src/resources/entities/entities.ts @@ -2,11 +2,19 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as EntitiesAPI from './entities'; import * as PnlSummariesAPI from './pnl-summaries'; +import { PnlSummaries } from './pnl-summaries'; import * as PortfolioMarginsAPI from './portfolio-margins'; +import { PortfolioMargins } from './portfolio-margins'; import * as RegtMarginSimulationsAPI from './regt-margin-simulations'; +import { + RegtMarginSimulationCreateParams, + RegtMarginSimulationCreateResponse, + RegtMarginSimulations, + SimulationID, +} from './regt-margin-simulations'; import * as RegtMarginsAPI from './regt-margins'; +import { RegtMargins } from './regt-margins'; export class Entities extends APIResource { pnlSummaries: PnlSummariesAPI.PnlSummaries = new PnlSummariesAPI.PnlSummaries(this._client); @@ -546,17 +554,30 @@ export interface EntityListResponse { data?: Array; } -export namespace Entities { - export import Entity = EntitiesAPI.Entity; - export import PnlSummary = EntitiesAPI.PnlSummary; - export import PortfolioMargin = EntitiesAPI.PortfolioMargin; - export import RegtMargin = EntitiesAPI.RegtMargin; - export import EntityListResponse = EntitiesAPI.EntityListResponse; - export import PnlSummaries = PnlSummariesAPI.PnlSummaries; - export import RegtMargins = RegtMarginsAPI.RegtMargins; - export import PortfolioMargins = PortfolioMarginsAPI.PortfolioMargins; - export import RegtMarginSimulations = RegtMarginSimulationsAPI.RegtMarginSimulations; - export import SimulationID = RegtMarginSimulationsAPI.SimulationID; - export import RegtMarginSimulationCreateResponse = RegtMarginSimulationsAPI.RegtMarginSimulationCreateResponse; - export import RegtMarginSimulationCreateParams = RegtMarginSimulationsAPI.RegtMarginSimulationCreateParams; +Entities.PnlSummaries = PnlSummaries; +Entities.RegtMargins = RegtMargins; +Entities.PortfolioMargins = PortfolioMargins; +Entities.RegtMarginSimulations = RegtMarginSimulations; + +export declare namespace Entities { + export { + type Entity as Entity, + type PnlSummary as PnlSummary, + type PortfolioMargin as PortfolioMargin, + type RegtMargin as RegtMargin, + type EntityListResponse as EntityListResponse, + }; + + export { PnlSummaries as PnlSummaries }; + + export { RegtMargins as RegtMargins }; + + export { PortfolioMargins as PortfolioMargins }; + + export { + RegtMarginSimulations as RegtMarginSimulations, + type SimulationID as SimulationID, + type RegtMarginSimulationCreateResponse as RegtMarginSimulationCreateResponse, + type RegtMarginSimulationCreateParams as RegtMarginSimulationCreateParams, + }; } diff --git a/src/resources/entities/index.ts b/src/resources/entities/index.ts index 2051976..bbf82d5 100644 --- a/src/resources/entities/index.ts +++ b/src/resources/entities/index.ts @@ -1,12 +1,19 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Entity, PnlSummary, PortfolioMargin, RegtMargin, EntityListResponse, Entities } from './entities'; +export { + Entities, + type Entity, + type PnlSummary, + type PortfolioMargin, + type RegtMargin, + type EntityListResponse, +} from './entities'; export { PnlSummaries } from './pnl-summaries'; export { PortfolioMargins } from './portfolio-margins'; -export { RegtMargins } from './regt-margins'; export { - SimulationID, - RegtMarginSimulationCreateResponse, - RegtMarginSimulationCreateParams, RegtMarginSimulations, + type SimulationID, + type RegtMarginSimulationCreateResponse, + type RegtMarginSimulationCreateParams, } from './regt-margin-simulations'; +export { RegtMargins } from './regt-margins'; diff --git a/src/resources/entities/regt-margin-simulations.ts b/src/resources/entities/regt-margin-simulations.ts index 1792726..3b457b7 100644 --- a/src/resources/entities/regt-margin-simulations.ts +++ b/src/resources/entities/regt-margin-simulations.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as RegtMarginSimulationsAPI from './regt-margin-simulations'; import * as Shared from '../shared'; export class RegtMarginSimulations extends APIResource { @@ -120,8 +119,10 @@ export namespace RegtMarginSimulationCreateParams { } } -export namespace RegtMarginSimulations { - export import SimulationID = RegtMarginSimulationsAPI.SimulationID; - export import RegtMarginSimulationCreateResponse = RegtMarginSimulationsAPI.RegtMarginSimulationCreateResponse; - export import RegtMarginSimulationCreateParams = RegtMarginSimulationsAPI.RegtMarginSimulationCreateParams; +export declare namespace RegtMarginSimulations { + export { + type SimulationID as SimulationID, + type RegtMarginSimulationCreateResponse as RegtMarginSimulationCreateResponse, + type RegtMarginSimulationCreateParams as RegtMarginSimulationCreateParams, + }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 7047f51..22073bb 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './shared'; -export { Account, AccountListResponse, Accounts } from './accounts/accounts'; +export { Accounts, type Account, type AccountListResponse } from './accounts/accounts'; export { - Entity, - PnlSummary, - PortfolioMargin, - RegtMargin, - EntityListResponse, Entities, + type Entity, + type PnlSummary, + type PortfolioMargin, + type RegtMargin, + type EntityListResponse, } from './entities/entities'; -export { Instrument, InstrumentRetrieveParams, Instruments } from './instruments'; +export { Instruments, type Instrument, type InstrumentRetrieveParams } from './instruments'; diff --git a/src/resources/instruments.ts b/src/resources/instruments.ts index a0c0a64..09d4d4a 100644 --- a/src/resources/instruments.ts +++ b/src/resources/instruments.ts @@ -3,7 +3,6 @@ import { APIResource } from '../resource'; import { isRequestOptions } from '../core'; import * as Core from '../core'; -import * as InstrumentsAPI from './instruments'; export class Instruments extends APIResource { /** @@ -64,7 +63,6 @@ export interface InstrumentRetrieveParams { symbol_format?: 'cms' | 'osi'; } -export namespace Instruments { - export import Instrument = InstrumentsAPI.Instrument; - export import InstrumentRetrieveParams = InstrumentsAPI.InstrumentRetrieveParams; +export declare namespace Instruments { + export { type Instrument as Instrument, type InstrumentRetrieveParams as InstrumentRetrieveParams }; } diff --git a/src/version.ts b/src/version.ts index de5a5a5..97229ce 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.1.0-alpha.12'; // x-release-please-version +export const VERSION = '0.1.0-alpha.13'; // x-release-please-version diff --git a/tests/api-resources/entities/regt-margin-simulations.test.ts b/tests/api-resources/entities/regt-margin-simulations.test.ts index 630f345..c679237 100644 --- a/tests/api-resources/entities/regt-margin-simulations.test.ts +++ b/tests/api-resources/entities/regt-margin-simulations.test.ts @@ -24,16 +24,8 @@ describe('resource regtMarginSimulations', () => { const response = await client.entities.regtMarginSimulations.create('x', { name: 'name', ignore_existing: true, - prices: [ - { price: 'x', symbol: 'AAPL', symbol_format: 'cms' }, - { price: 'x', symbol: 'AAPL', symbol_format: 'cms' }, - { price: 'x', symbol: 'AAPL', symbol_format: 'cms' }, - ], - trades: [ - { price: 'x', quantity: 'x', side: 'buy', symbol: 'AAPL', symbol_format: 'cms' }, - { price: 'x', quantity: 'x', side: 'buy', symbol: 'AAPL', symbol_format: 'cms' }, - { price: 'x', quantity: 'x', side: 'buy', symbol: 'AAPL', symbol_format: 'cms' }, - ], + prices: [{ price: 'x', symbol: 'AAPL', symbol_format: 'cms' }], + trades: [{ price: 'x', quantity: 'x', side: 'buy', symbol: 'AAPL', symbol_format: 'cms' }], }); }); diff --git a/tsconfig.deno.json b/tsconfig.deno.json index 2975c8c..849e070 100644 --- a/tsconfig.deno.json +++ b/tsconfig.deno.json @@ -1,19 +1,14 @@ { "extends": "./tsconfig.json", - "include": ["deno"], + "include": ["dist-deno"], "exclude": [], "compilerOptions": { - "rootDir": "./deno", + "rootDir": "./dist-deno", "lib": ["es2020", "DOM"], - "paths": { - "@clear-street/studio-sdk/_shims/auto/*": ["deno/_shims/auto/*-deno"], - "@clear-street/studio-sdk/*": ["deno/*"], - "@clear-street/studio-sdk": ["deno/index.ts"], - }, "noEmit": true, "declaration": true, "declarationMap": true, - "outDir": "deno", + "outDir": "dist-deno", "pretty": true, "sourceMap": true } diff --git a/tsconfig.json b/tsconfig.json index fc39911..da55d5b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "paths": { "@clear-street/studio-sdk/_shims/auto/*": ["src/_shims/auto/*-node"], "@clear-street/studio-sdk/*": ["src/*"], - "@clear-street/studio-sdk": ["src/index.ts"], + "@clear-street/studio-sdk": ["src/index.ts"] }, "noEmit": true, @@ -32,6 +32,7 @@ "noUncheckedIndexedAccess": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, + "isolatedModules": false, "skipLibCheck": true } diff --git a/yarn.lock b/yarn.lock index 14e8a75..bfd47d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -759,16 +759,6 @@ dependencies: "@swc/counter" "^0.1.3" -"@ts-morph/common@~0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.20.0.tgz#3f161996b085ba4519731e4d24c35f6cba5b80af" - integrity sha512-7uKjByfbPpwuzkstL3L5MQyuXPSKdoNG93Fmi2JoDcTf3pEP731JdRFAduRVkOs8oqxPsXKA+ScrWkdQ8t/I+Q== - dependencies: - fast-glob "^3.2.12" - minimatch "^7.4.3" - mkdirp "^2.1.6" - path-browserify "^1.0.1" - "@tsconfig/node10@^1.0.7": version "1.0.8" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" @@ -1315,11 +1305,6 @@ co@^4.6.0: resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== -code-block-writer@^12.0.0: - version "12.0.0" - resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-12.0.0.tgz#4dd58946eb4234105aff7f0035977b2afdc2a770" - integrity sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w== - collect-v8-coverage@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" @@ -2680,23 +2665,11 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" -minimatch@^7.4.3: - version "7.4.6" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.6.tgz#845d6f254d8f4a5e4fd6baf44d5f10c8448365fb" - integrity sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw== - dependencies: - brace-expansion "^2.0.1" - minimist@^1.2.6: version "1.2.6" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== -mkdirp@^2.1.6: - version "2.1.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-2.1.6.tgz#964fbcb12b2d8c5d6fbc62a963ac95a273e2cc19" - integrity sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A== - ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -2860,11 +2833,6 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" -path-browserify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" - integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== - path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -3283,14 +3251,6 @@ ts-jest@^29.1.0: semver "^7.5.3" yargs-parser "^21.0.1" -ts-morph@^19.0.0: - version "19.0.0" - resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-19.0.0.tgz#43e95fb0156c3fe3c77c814ac26b7d0be2f93169" - integrity sha512-D6qcpiJdn46tUqV45vr5UGM2dnIEuTGNxVhg0sk5NX11orcouwj6i1bMqZIz2mZTZB1Hcgy7C3oEVhAT+f6mbQ== - dependencies: - "@ts-morph/common" "~0.20.0" - code-block-writer "^12.0.0" - ts-node@^10.5.0: version "10.7.0" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.7.0.tgz#35d503d0fab3e2baa672a0e94f4b40653c2463f5"