From 23aa3e57751cb8d3122ab9b8575bbb44062b80cd Mon Sep 17 00:00:00 2001 From: Shotaro Nakamura Date: Fri, 10 Jul 2026 19:03:57 +0900 Subject: [PATCH] refactor --- apps/mnie-app/package.json | 1 + apps/mnie-app/tsconfig.json | 2 +- apps/mnie-server/package.json | 1 + apps/mnie-server/src/config.ts | 2 +- apps/mnie-server/src/context.ts | 2 +- apps/mnie-server/src/routes/admin.ts | 2 +- apps/mnie-server/src/routes/mcp.ts | 2 +- apps/mnie-server/src/rpc/ws.ts | 6 +- apps/mnie-server/src/security/api-keys.ts | 2 +- apps/mnie-server/src/security/trade-limits.ts | 2 +- apps/mnie-server/tsconfig.json | 2 +- apps/mnie-ui/package.json | 1 + apps/mnie-ui/src/api.ts | 6 +- apps/mnie-ui/src/constants/nav.ts | 2 +- .../src/features/oauth/useOAuthApproval.ts | 2 +- apps/mnie-ui/src/features/trade/TradeView.vue | 8 +- .../src/features/trading/trading-data.ts | 2 +- .../src/features/trading/useTradingSession.ts | 10 +- apps/mnie-ui/src/types/trading.ts | 20 +-- apps/mnie-ui/tsconfig.json | 2 +- bun.lock | 16 ++- package.json | 1 + packages/client-sbi/package.json | 1 + packages/client-sbi/src/methods/error-map.ts | 2 +- packages/client-sbi/src/methods/index.ts | 20 +-- packages/client-sbi/src/session/index.ts | 8 +- packages/client-sbi/src/types.ts | 118 +++++++++--------- packages/client-sbi/tsconfig.json | 29 +---- packages/mnie-cli/package.json | 1 + packages/mnie-cli/src/index.ts | 4 +- packages/mnie-cli/tsconfig.json | 2 +- packages/mnie-sdk/package.json | 4 +- packages/mnie-sdk/src/index.ts | 8 +- packages/mnie-sdk/tsconfig.json | 2 +- packages/mnie-types/package.json | 1 + packages/mnie-types/src/methods.ts | 36 +++--- packages/mnie-types/src/types.ts | 118 +++++++++--------- packages/mnie-types/tsconfig.json | 2 +- packages/tsconfig/package.json | 11 ++ packages/tsconfig/tsconfig.json | 22 ++++ tools/analyze-sbi-apk.ts | 4 +- tsconfig.json | 28 +---- 42 files changed, 259 insertions(+), 256 deletions(-) create mode 100644 packages/tsconfig/package.json create mode 100644 packages/tsconfig/tsconfig.json diff --git a/apps/mnie-app/package.json b/apps/mnie-app/package.json index 6b8fd39..d6b37ef 100644 --- a/apps/mnie-app/package.json +++ b/apps/mnie-app/package.json @@ -14,6 +14,7 @@ "hono": "^4.8.3" }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest", "typescript": "^5" } diff --git a/apps/mnie-app/tsconfig.json b/apps/mnie-app/tsconfig.json index 49cc21b..1abe366 100644 --- a/apps/mnie-app/tsconfig.json +++ b/apps/mnie-app/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "@repo/tsconfig/tsconfig.json", "compilerOptions": { "types": ["bun"], "rootDir": "src", diff --git a/apps/mnie-server/package.json b/apps/mnie-server/package.json index ade7b5b..2b92a32 100644 --- a/apps/mnie-server/package.json +++ b/apps/mnie-server/package.json @@ -24,6 +24,7 @@ "zod": "^4.4.3" }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest", "drizzle-kit": "^0.31.1", "typescript": "^5" diff --git a/apps/mnie-server/src/config.ts b/apps/mnie-server/src/config.ts index cbfd854..47026f0 100644 --- a/apps/mnie-server/src/config.ts +++ b/apps/mnie-server/src/config.ts @@ -1,7 +1,7 @@ import { mkdirSync } from 'node:fs' import { dirname, resolve } from 'node:path' -export type ServerConfig = { +export interface ServerConfig { port: number databasePath: string corsOrigin: string diff --git a/apps/mnie-server/src/context.ts b/apps/mnie-server/src/context.ts index 4cc0cdd..5c93a61 100644 --- a/apps/mnie-server/src/context.ts +++ b/apps/mnie-server/src/context.ts @@ -1,7 +1,7 @@ import type { ServerConfig } from './config' import type { Db } from './db' -export type AppBindings = { +export interface AppBindings { Variables: { db: Db config: ServerConfig diff --git a/apps/mnie-server/src/routes/admin.ts b/apps/mnie-server/src/routes/admin.ts index ed61567..8f0c810 100644 --- a/apps/mnie-server/src/routes/admin.ts +++ b/apps/mnie-server/src/routes/admin.ts @@ -14,7 +14,7 @@ import { import { randomId } from '../security/crypto' import { deleteSecret, saveSecret } from '../security/keyring' -export type StoredSbiPasskeySecret = { +export interface StoredSbiPasskeySecret { credential: PlaintextStoredWebAuthnCredential tradePassword?: string deviceId?: string diff --git a/apps/mnie-server/src/routes/mcp.ts b/apps/mnie-server/src/routes/mcp.ts index fa19010..ab6a497 100644 --- a/apps/mnie-server/src/routes/mcp.ts +++ b/apps/mnie-server/src/routes/mcp.ts @@ -32,7 +32,7 @@ const requireAuthenticated = (auth: AuthContext) => { const ORDER_SUBMIT_TICKET_TTL_MS = 10 * 60 * 1000 -type OrderSubmitTicket = { +interface OrderSubmitTicket { passkeyId: string estimateMethod: RpcMethod submitMethod: RpcMethod diff --git a/apps/mnie-server/src/rpc/ws.ts b/apps/mnie-server/src/rpc/ws.ts index 8586642..ff5c167 100644 --- a/apps/mnie-server/src/rpc/ws.ts +++ b/apps/mnie-server/src/rpc/ws.ts @@ -11,14 +11,14 @@ import { import { invokeSbiMethod, isRpcMethod, isTradingMethod, RPC_METHODS } from './methods' import { connectSbi } from './sbi-session' -type JsonRpcRequest = { +interface JsonRpcRequest { jsonrpc?: '2.0' id?: string | number | null method?: string params?: unknown } -type RpcSocketState = { +interface RpcSocketState { client?: SbiClientMethods sbiPasskeyId?: string apiKeyId?: string @@ -26,7 +26,7 @@ type RpcSocketState = { boardPollingSubscriptions: Map } -type BoardPollingParams = { +interface BoardPollingParams { issueCode: string market: MarketCode intervalSeconds?: number diff --git a/apps/mnie-server/src/security/api-keys.ts b/apps/mnie-server/src/security/api-keys.ts index 15de3f8..8791889 100644 --- a/apps/mnie-server/src/security/api-keys.ts +++ b/apps/mnie-server/src/security/api-keys.ts @@ -3,7 +3,7 @@ import type { Db } from '../db' import { apiKeys } from '../db/schema' import { randomId, randomToken, sha256 } from './crypto' -export type ApiKeySettings = { +export interface ApiKeySettings { maxTradesPerHour?: number | null maxTradesPer6Hours?: number | null maxTradesPerDay?: number | null diff --git a/apps/mnie-server/src/security/trade-limits.ts b/apps/mnie-server/src/security/trade-limits.ts index 5433089..2b3d79e 100644 --- a/apps/mnie-server/src/security/trade-limits.ts +++ b/apps/mnie-server/src/security/trade-limits.ts @@ -5,7 +5,7 @@ import type { RpcMethod } from '../rpc/methods' type WindowName = '1h' | '3h' | '1d' -type TradeLimitInput = { +interface TradeLimitInput { apiKeyId: string params: unknown } diff --git a/apps/mnie-server/tsconfig.json b/apps/mnie-server/tsconfig.json index 49cc21b..1abe366 100644 --- a/apps/mnie-server/tsconfig.json +++ b/apps/mnie-server/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "@repo/tsconfig/tsconfig.json", "compilerOptions": { "types": ["bun"], "rootDir": "src", diff --git a/apps/mnie-ui/package.json b/apps/mnie-ui/package.json index 9d2b58e..3f7c491 100644 --- a/apps/mnie-ui/package.json +++ b/apps/mnie-ui/package.json @@ -19,6 +19,7 @@ "vue-router": "^5.1.0" }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@tailwindcss/vite": "^4.3.1", "@types/d3": "^7.4.3", "@vitejs/plugin-vue": "^6.0.7", diff --git a/apps/mnie-ui/src/api.ts b/apps/mnie-ui/src/api.ts index dfcc3cf..b46bd9a 100644 --- a/apps/mnie-ui/src/api.ts +++ b/apps/mnie-ui/src/api.ts @@ -1,9 +1,9 @@ -export type AuthStatus = { +export interface AuthStatus { configured: boolean authenticated: boolean } -export type ApiKey = { +export interface ApiKey { id: string label: string maxTradesPerHour?: number | null @@ -30,7 +30,7 @@ export type ApiKeySettings = Pick< | 'scopes' > -export type SbiPasskey = { +export interface SbiPasskey { id: string label: string createdAt: string diff --git a/apps/mnie-ui/src/constants/nav.ts b/apps/mnie-ui/src/constants/nav.ts index 29ac2e1..71fa2fc 100644 --- a/apps/mnie-ui/src/constants/nav.ts +++ b/apps/mnie-ui/src/constants/nav.ts @@ -2,7 +2,7 @@ import { ArrowLeftRight, History, Settings, WalletCards } from 'lucide-vue-next' import type { Component } from 'vue' import type { RouteName } from '../router' -export type PageMeta = { +export interface PageMeta { title: string icon: Component } diff --git a/apps/mnie-ui/src/features/oauth/useOAuthApproval.ts b/apps/mnie-ui/src/features/oauth/useOAuthApproval.ts index 6cd374e..4ecb999 100644 --- a/apps/mnie-ui/src/features/oauth/useOAuthApproval.ts +++ b/apps/mnie-ui/src/features/oauth/useOAuthApproval.ts @@ -2,7 +2,7 @@ import { ref } from 'vue' import type { ApiKeySettings } from '../../api' import { defaultApiKeyPolicy } from '../auth/api-key-policy' -export type OAuthApprovalState = { +export interface OAuthApprovalState { active: boolean clientId: string clientName: string diff --git a/apps/mnie-ui/src/features/trade/TradeView.vue b/apps/mnie-ui/src/features/trade/TradeView.vue index 69fcf00..fec3ef6 100644 --- a/apps/mnie-ui/src/features/trade/TradeView.vue +++ b/apps/mnie-ui/src/features/trade/TradeView.vue @@ -45,19 +45,19 @@ import { currency, currencyForMarket } from '../../utils/format' import RealtimePriceChart from './RealtimePriceChart.vue' type StockInfoTab = 'detail' | 'holding' -type CashOrderAccountTypeOption = { +interface CashOrderAccountTypeOption { label: string value: CashOrderAccountType } -type CashOrderMarketOption = { +interface CashOrderMarketOption { label: string value: CashOrderMarket } -type CashOrderTermOption = { +interface CashOrderTermOption { label: string value: CashOrderTerm } -type CashOrderDateOption = { +interface CashOrderDateOption { label: string value: string } diff --git a/apps/mnie-ui/src/features/trading/trading-data.ts b/apps/mnie-ui/src/features/trading/trading-data.ts index 74d0719..d36781e 100644 --- a/apps/mnie-ui/src/features/trading/trading-data.ts +++ b/apps/mnie-ui/src/features/trading/trading-data.ts @@ -12,7 +12,7 @@ import type { import { currency } from '../../utils/format' export type RecordLike = Record -type IssueLike = { +interface IssueLike { code: string market: string name: string diff --git a/apps/mnie-ui/src/features/trading/useTradingSession.ts b/apps/mnie-ui/src/features/trading/useTradingSession.ts index 3e715e6..ab8587b 100644 --- a/apps/mnie-ui/src/features/trading/useTradingSession.ts +++ b/apps/mnie-ui/src/features/trading/useTradingSession.ts @@ -54,27 +54,27 @@ import { type RecordLike, } from './trading-data' -type RpcResolver = { +interface RpcResolver { resolve: (value: unknown) => void reject: (reason: Error) => void } -type CashOrderTermOption = { +interface CashOrderTermOption { label: string value: CashOrderTerm } -type CashOrderAccountTypeOption = { +interface CashOrderAccountTypeOption { label: string value: CashOrderAccountType } -type CashOrderMarketOption = { +interface CashOrderMarketOption { label: string value: CashOrderMarket } -type CashOrderDateOption = { +interface CashOrderDateOption { label: string value: string } diff --git a/apps/mnie-ui/src/types/trading.ts b/apps/mnie-ui/src/types/trading.ts index 721d6ee..898de05 100644 --- a/apps/mnie-ui/src/types/trading.ts +++ b/apps/mnie-ui/src/types/trading.ts @@ -27,13 +27,13 @@ export type CashOrderTriggerZone = 'above' | 'below' export type ChartMode = 'line' | 'box' export type ChartRange = '1D' | '3D' | '3M' | '1Y' | 'ALL' -export type RpcMessage = { +export interface RpcMessage { id: number method: string params?: unknown } -export type OrderPreview = { +export interface OrderPreview { issue: { code: string market: string @@ -50,7 +50,7 @@ export type OrderPreview = { message?: string } -export type JsonRpcResponse = { +export interface JsonRpcResponse { id?: number method?: string params?: unknown @@ -60,7 +60,7 @@ export type JsonRpcResponse = { } } -export type RealtimePricePoint = { +export interface RealtimePricePoint { at: string price: number open?: number @@ -70,12 +70,12 @@ export type RealtimePricePoint = { volume?: number | null } -export type ChartNotice = { +export interface ChartNotice { title: string detail?: string } -export type MarketIndex = { +export interface MarketIndex { code?: string name: string value: number | null @@ -88,7 +88,7 @@ export type MarketIndex = { timestamp?: string } -export type Stock = { +export interface Stock { code: string name: string symbol: string @@ -115,7 +115,7 @@ export type Stock = { } } -export type OrderRow = { +export interface OrderRow { id: string code: string date: string @@ -143,7 +143,7 @@ export type OrderDetail = OrderRow & { accountInformation?: string } -export type TradeRecordRow = { +export interface TradeRecordRow { id: string code: string stock: string @@ -158,7 +158,7 @@ export type TradeRecordRow = { settlementCurrencyCode?: string } -export type Position = { +export interface Position { code: string name: string market: string diff --git a/apps/mnie-ui/tsconfig.json b/apps/mnie-ui/tsconfig.json index c4ef22e..904ec86 100644 --- a/apps/mnie-ui/tsconfig.json +++ b/apps/mnie-ui/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "@repo/tsconfig/tsconfig.json", "compilerOptions": { "lib": ["ESNext", "DOM", "DOM.Iterable"], "types": ["vite/client"], diff --git a/bun.lock b/bun.lock index 57a1b8f..ddc16c5 100644 --- a/bun.lock +++ b/bun.lock @@ -5,6 +5,7 @@ "": { "name": "csbi", "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest", "vite-plus": "^0.1.24", }, @@ -19,6 +20,7 @@ "hono": "^4.8.3", }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest", "typescript": "^5", }, @@ -36,6 +38,7 @@ "zod": "^4.4.3", }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest", "drizzle-kit": "^0.31.1", "typescript": "^5", @@ -54,6 +57,7 @@ "vue-router": "^5.1.0", }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@tailwindcss/vite": "^4.3.1", "@types/d3": "^7.4.3", "@vitejs/plugin-vue": "^6.0.7", @@ -68,6 +72,7 @@ "iconv-lite": "^0.7.2", }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest", }, "peerDependencies": { @@ -77,13 +82,14 @@ "packages/mnie-cli": { "name": "@repo/mnie-cli", "bin": { - "mnie": "./src/index.ts", + "mnie": "./dist/index.mjs", }, "dependencies": { "@napi-rs/keyring": "^1.2.0", "@repo/mnie-sdk": "workspace:*", }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest", }, "peerDependencies": { @@ -96,6 +102,7 @@ "@repo/mnie-types": "workspace:*", }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest", }, "peerDependencies": { @@ -105,12 +112,17 @@ "packages/mnie-types": { "name": "@repo/mnie-types", "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest", }, "peerDependencies": { "typescript": "^5", }, }, + "packages/tsconfig": { + "name": "@repo/tsconfig", + "version": "0.0.0", + }, }, "packages": { "@babel/generator": ["@babel/generator@8.0.0", "", { "dependencies": { "@babel/parser": "^8.0.0", "@babel/types": "^8.0.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "@types/jsesc": "^2.5.0", "jsesc": "^3.0.2" } }, "sha512-NT9NrVwJsbSV6Y2FSstWa71EETOnzrjkL5/wX3D2mYHtKM+qvqB1DvR4D0Setb/gDBsHzRICifwEWMO8CnTF6g=="], @@ -371,6 +383,8 @@ "@repo/mnie-ui": ["@repo/mnie-ui@workspace:apps/mnie-ui"], + "@repo/tsconfig": ["@repo/tsconfig@workspace:packages/tsconfig"], + "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.0.3", "", { "os": "android", "cpu": "arm64" }, "sha512-454rs7jHngixp/NMxd5srYD57OnzSlZ/eFTETjORQHLwJG1lRtmNOJcBerZlfu4GjKqeq8aCCIQrMdHyhI51Hw=="], "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.0.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-PcAhP+ynjURNyy8SKGl5DQP94aGuB/7JrXJb/t7P+hanXvQVMWzUvRRhBAcg/lNRadBhoUPqSoP4xw5tR/KBEA=="], diff --git a/package.json b/package.json index 0e74242..63cf40e 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "typecheck": "vp run typecheck:all" }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest", "vite-plus": "^0.1.24" }, diff --git a/packages/client-sbi/package.json b/packages/client-sbi/package.json index 716404e..9da7ab8 100644 --- a/packages/client-sbi/package.json +++ b/packages/client-sbi/package.json @@ -20,6 +20,7 @@ "iconv-lite": "^0.7.2" }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest" }, "peerDependencies": { diff --git a/packages/client-sbi/src/methods/error-map.ts b/packages/client-sbi/src/methods/error-map.ts index 6785725..70dd4b3 100644 --- a/packages/client-sbi/src/methods/error-map.ts +++ b/packages/client-sbi/src/methods/error-map.ts @@ -99,7 +99,7 @@ export const SBI_SERVER_ERROR_MESSAGES: Record = { E_0083: 'An error occurred. Wait a while and try again.', } -export type SbiServerErrorOptions = { +export interface SbiServerErrorOptions { code: string status?: string serverMessage?: string diff --git a/packages/client-sbi/src/methods/index.ts b/packages/client-sbi/src/methods/index.ts index d88a177..bcec000 100644 --- a/packages/client-sbi/src/methods/index.ts +++ b/packages/client-sbi/src/methods/index.ts @@ -125,7 +125,7 @@ const CHART_DEFAULT_UNITS = { } as const satisfies Record const CHART_MINUTE_UNITS = new Set([1, 5, 10, 15]) -type MtsHeader = { +interface MtsHeader { sessionId: string trCode: string resultCode: string @@ -134,7 +134,7 @@ type MtsHeader = { maintenance: string } -type MtsResponse = { +interface MtsResponse { status: number requestUrl: string header: MtsHeader @@ -142,14 +142,14 @@ type MtsResponse = { text: string } -type FixedField = { +interface FixedField { width: number value?: string | number | null align?: 'left' | 'right' pad?: string } -type OrderPreviewInput = { +interface OrderPreviewInput { issueCode: string market?: MarketCode side: TradeSide @@ -157,7 +157,7 @@ type OrderPreviewInput = { price?: number } -type CashPreOrderInfo = { +interface CashPreOrderInfo { issueCode?: string market?: string issueName?: string @@ -170,7 +170,7 @@ const cashCorrectionPreviewInput = { type TradeAuthenticationStatus = 'success' | 'needDial' | 'excessivelyRequested' | 'unexpected' -type TradeAuthenticationInfo = { +interface TradeAuthenticationInfo { status: TradeAuthenticationStatus statusCode: string telNo?: string @@ -258,7 +258,7 @@ const publicDomesticMarket = (market: string | undefined, methodName: string) => return publicMarket } -type IzanagiIssueSearchItem = { +interface IzanagiIssueSearchItem { stockName?: string | null stockCode?: string | null mkt?: string | null @@ -269,7 +269,7 @@ type IzanagiIssueSearchItem = { hitString?: string | null } -type IzanagiIssueSearchResponse = { +interface IzanagiIssueSearchResponse { status?: string | null stocks?: IzanagiIssueSearchItem[] | null } @@ -4100,7 +4100,7 @@ const isCashPreOrderInput = ( options: StockOrderPreOrderInput, ): options is CashOrderOptions | CashOrderPreOrderOptions => 'kind' in options -type AppStockOrderTrinOptions = { +interface AppStockOrderTrinOptions { issueCode: string market: string quantity: number @@ -4122,7 +4122,7 @@ type AppStockOrderTrinOptions = { methodName: string } -type OmitConfirmationOption = { +interface OmitConfirmationOption { omitConfirmation?: boolean } diff --git a/packages/client-sbi/src/session/index.ts b/packages/client-sbi/src/session/index.ts index 3af13f7..b6c4eb0 100644 --- a/packages/client-sbi/src/session/index.ts +++ b/packages/client-sbi/src/session/index.ts @@ -24,24 +24,24 @@ import type { } from '../types' import type { SbiClientMethods } from '../methods/types' -type PasskeyLoginStart = { +interface PasskeyLoginStart { url: string privateKeyPem: string publicKey: string } -type PasskeyAccessToken = { +interface PasskeyAccessToken { callbackUrl: string accessToken: string } -type CredentialRequest = { +interface CredentialRequest { challenge: string rpId: string csrfToken?: string } -type SbiEndpointConfig = { +interface SbiEndpointConfig { authBaseUrl: string mtsBaseUrl: string izanagiBaseUrl?: string diff --git a/packages/client-sbi/src/types.ts b/packages/client-sbi/src/types.ts index b23a09d..8d7d6e6 100644 --- a/packages/client-sbi/src/types.ts +++ b/packages/client-sbi/src/types.ts @@ -4,7 +4,7 @@ export type WebAuthnUserVerification = 'required' | 'preferred' | 'discouraged' export type WebAuthnTransport = 'ble' | 'hybrid' | 'internal' | 'nfc' | 'usb' -export type WebAuthnJwk = { +export interface WebAuthnJwk { kty: string crv?: string x?: string @@ -17,7 +17,7 @@ export type WebAuthnJwk = { [key: string]: unknown } -export type StoredWebAuthnCredentialSecret = { +export interface StoredWebAuthnCredentialSecret { privateKey: { format: 'jwk' jwk: WebAuthnJwk @@ -29,7 +29,7 @@ export type StoredWebAuthnCredentialSecret = { } } -export type StoredWebAuthnCredential = { +export interface StoredWebAuthnCredential { version: 1 kind: 'webauthn-credential' provider: 'sbi-sec' @@ -76,7 +76,7 @@ export type PlaintextStoredWebAuthnCredential = Omit } -export type SbiSession = { +export interface SbiSession { mtsBaseUrl: string izanagiBaseUrl?: string foreignStock?: ForeignStockSession @@ -139,7 +139,7 @@ export type SbiSession = { tradeAuthentication?: SbiTradeAuthenticationOptions } -export type LoginWithPasskeyOptions = { +export interface LoginWithPasskeyOptions { passkeyCredential: PlaintextStoredWebAuthnCredential authBaseUrl?: string mtsBaseUrl?: string @@ -159,13 +159,13 @@ export type LoginWithPasskeyOptions = { mainSiteExchangeOrderCompletePath?: string } -export type SbiClientOptions = { +export interface SbiClientOptions { tradePassword?: string deviceId?: string tradeAuthentication?: SbiTradeAuthenticationOptions } -export type SbiTradeAuthenticationRequest = { +export interface SbiTradeAuthenticationRequest { type: 'phone' telNo?: string phoneNo?: string @@ -173,7 +173,7 @@ export type SbiTradeAuthenticationRequest = { authLimitTime?: string } -export type SbiTradeAuthenticationOptions = { +export interface SbiTradeAuthenticationOptions { onRequired?: (request: SbiTradeAuthenticationRequest) => void | Promise confirmAttempts?: number confirmIntervalMs?: number @@ -189,24 +189,24 @@ export type WatchlistId = string export type PositionId = string export type ThemeId = string -export type CurrencyAmount = { +export interface CurrencyAmount { value: number | null text: string currency: 'JPY' | 'USD' } -export type PercentValue = { +export interface PercentValue { value: number | null text: string } -export type SignedTextValue = { +export interface SignedTextValue { value: number | null text: string sign?: 'positive' | 'negative' | 'zero' } -export type AccountAssetsValuationSummary = { +export interface AccountAssetsValuationSummary { assetsErrorType: unknown valuation: number | null netChange: number | null @@ -223,7 +223,7 @@ export type AccountAssetsValuationDetail = AccountAssetsValuationSummary & { compositionRatio: number | null } -export type AccountAssetsValuations = { +export interface AccountAssetsValuations { fetchedAt: string summary: AccountAssetsValuationSummary summaryWithoutDeposit: AccountAssetsValuationSummary @@ -276,7 +276,7 @@ export type IsaAccountType = | 'nisaTradePermitted' | 'unknown' -export type IssueRef = { +export interface IssueRef { code: IssueCode market?: MarketCode name?: string @@ -292,7 +292,7 @@ export type IssueSearchItem = IssueRef & { export type IssueSearchStatus = 'success' | 'searchError' | 'tooManyResults' | 'unknown' -export type IssueSearchResult = { +export interface IssueSearchResult { status?: string statusText: IssueSearchStatus issues: IssueSearchItem[] @@ -300,7 +300,7 @@ export type IssueSearchResult = { export type ChartPeriod = 'minute' | 'day' | 'week' | 'month' -export type ChartPrice = { +export interface ChartPrice { dateTime: string open: CurrencyAmount high: CurrencyAmount @@ -309,7 +309,7 @@ export type ChartPrice = { volume?: number | null } -export type IssueChart = { +export interface IssueChart { issue: IssueRef period: ChartPeriod unit: number @@ -322,13 +322,13 @@ export type IssueChart = { error?: SbiMethodError } -export type SessionInfo = { +export interface SessionInfo { sessionId: string loginType: LoginType resultCode: string } -export type AccountProfile = { +export interface AccountProfile { session: SessionInfo branchCode?: string butenCode?: string @@ -391,7 +391,7 @@ export type AccountProfile = { } } -export type BuyingPower = { +export interface BuyingPower { cashBuyingPower?: CurrencyAmount marginBuyingPower?: CurrencyAmount withdrawableAmount?: CurrencyAmount @@ -403,7 +403,7 @@ export type BuyingPower = { error?: SbiMethodError } -export type CollateralRatioRecord = { +export interface CollateralRatioRecord { marginRequirements?: CurrencyAmount referenceMarginRequirements?: CurrencyAmount collateralRatioCash?: CurrencyAmount @@ -420,7 +420,7 @@ export type CollateralRatioRecord = { minimumCollateral?: CurrencyAmount } -export type CashPosition = { +export interface CashPosition { issue: IssueRef accountType?: AccountType depositType?: DepositType @@ -449,7 +449,7 @@ export type CashPosition = { accountInformation?: string } -export type CashPositionList = { +export interface CashPositionList { positions: CashPosition[] index?: number totalCount?: number @@ -461,7 +461,7 @@ export type CashPositionList = { error?: SbiMethodError } -export type MarginPosition = { +export interface MarginPosition { id?: PositionId issue: IssueRef side: MarginTradeSide @@ -503,7 +503,7 @@ export type MarginPosition = { bargainMarket?: string } -export type MarginPositionList = { +export interface MarginPositionList { positions: MarginPosition[] index?: number totalCount?: number @@ -515,7 +515,7 @@ export type MarginPositionList = { error?: SbiMethodError } -export type ProfitLossSummary = { +export interface ProfitLossSummary { cash?: SignedTextValue margin?: SignedTextValue total?: SignedTextValue @@ -523,7 +523,7 @@ export type ProfitLossSummary = { error?: SbiMethodError } -export type Quote = { +export interface Quote { issue: IssueRef price?: CurrencyAmount change?: SignedTextValue @@ -539,12 +539,12 @@ export type Quote = { error?: SbiMethodError } -export type BoardPriceLevel = { +export interface BoardPriceLevel { price: CurrencyAmount quantity?: number | null } -export type Board = { +export interface Board { issue: IssueRef bids: BoardPriceLevel[] asks: BoardPriceLevel[] @@ -552,7 +552,7 @@ export type Board = { error?: SbiMethodError } -export type MarketIndex = { +export interface MarketIndex { code?: string categoryCode?: string name: string @@ -568,13 +568,13 @@ export type MarketIndex = { previousClose?: CurrencyAmount } -export type DomesticMarket = { +export interface DomesticMarket { status?: string indexes: MarketIndex[] error?: SbiMethodError } -export type RankingItem = { +export interface RankingItem { rank: number issue: IssueRef value?: number | string | null @@ -585,14 +585,14 @@ export type RankingItem = { colorFlag?: string } -export type Ranking = { +export interface Ranking { items: RankingItem[] category?: string updatedAt?: string error?: SbiMethodError } -export type NewsItem = { +export interface NewsItem { id?: string title: string source?: string @@ -606,26 +606,26 @@ export type NewsItem = { pnac?: string } -export type NewsList = { +export interface NewsList { items: NewsItem[] error?: SbiMethodError } -export type WatchlistItem = { +export interface WatchlistItem { issue: IssueRef sortOrder?: number memo?: string quote?: Quote } -export type Watchlist = { +export interface Watchlist { id: WatchlistId name: string items: WatchlistItem[] error?: SbiMethodError } -export type Order = { +export interface Order { id: OrderId issue: IssueRef side: TradeSide @@ -655,13 +655,13 @@ export type Order = { correctable?: boolean } -export type OrderList = { +export interface OrderList { orders: Order[] hasMore?: boolean error?: SbiMethodError } -export type TradeRecord = { +export interface TradeRecord { id: string issue: IssueRef tradeRecordTypeCode?: string @@ -678,13 +678,13 @@ export type TradeRecord = { marginCloseLimitType?: string } -export type TradeRecordList = { +export interface TradeRecordList { records: TradeRecord[] hasMore?: boolean error?: SbiMethodError } -export type OrderCorrectionPreOrderDetail = { +export interface OrderCorrectionPreOrderDetail { exchangeName?: string marketLoanKbn?: string marketIppanLoanKbn?: string @@ -697,7 +697,7 @@ export type OrderCorrectionPreOrderDetail = { volumeText?: string } -export type OrderCorrectionPreOrder = { +export interface OrderCorrectionPreOrder { issue: IssueRef tradeTitle?: string buyingPowerTotal?: CurrencyAmount @@ -753,7 +753,7 @@ export type OrderCorrectionPreOrder = { exchangeList?: string } -export type OrderPreview = { +export interface OrderPreview { issue: IssueRef side: TradeSide quantity?: number @@ -768,12 +768,12 @@ export type OrderPreview = { error?: SbiMethodError } -export type StockOrderPreOrderPriceStep = { +export interface StockOrderPreOrderPriceStep { from?: CurrencyAmount to?: CurrencyAmount } -export type StockOrderPreOrderPaymentLimit = { +export interface StockOrderPreOrderPaymentLimit { text?: string code?: string } @@ -787,7 +787,7 @@ export type StockOrderPreOrderMarginTradeType = | 'day' | 'hyper' -export type StockOrderPreOrder = { +export interface StockOrderPreOrder { issue: IssueRef tradeTitle?: string buyingPowerTotal?: CurrencyAmount @@ -850,7 +850,7 @@ export type StockOrderPreOrder = { error?: SbiMethodError } -export type OrderReceipt = { +export interface OrderReceipt { accepted: boolean orderId?: OrderId acceptedAt?: string @@ -863,7 +863,7 @@ export type ExchangeSpecificMethod = 'foreign' | 'domestic' export type ExchangeAccountKind = 'GENERAL' | 'JR_NISA' export type ExchangeSellMethod = 'SELL_PART' | 'SELL_ALL' -export type ExchangeOrderPreview = { +export interface ExchangeOrderPreview { currencyCode: string currencyName?: string side: ExchangeOrderSide @@ -882,7 +882,7 @@ export type ExchangeOrderPreview = { csrfToken: string } -export type ExchangeOrderReceipt = { +export interface ExchangeOrderReceipt { accepted: boolean currencyCode?: string side?: ExchangeOrderSide @@ -891,7 +891,7 @@ export type ExchangeOrderReceipt = { rawTitle?: string } -export type ExchangeRateInfo = { +export interface ExchangeRateInfo { currencyCode: string side: ExchangeOrderSide referenceExchangeRate?: string @@ -910,7 +910,7 @@ export type ExchangeRateInfo = { raw: Record } -export type ThemeInvestment = { +export interface ThemeInvestment { id: ThemeId name: string issues: ThemeInvestmentIssue[] @@ -933,7 +933,7 @@ export type ThemeInvestmentIssue = IssueRef & { tradeTime?: string } -export type ThemeInvestmentList = { +export interface ThemeInvestmentList { themes: ThemeInvestment[] buyingPowerTotal?: CurrencyAmount isaBuyLimit?: CurrencyAmount @@ -944,7 +944,7 @@ export type ThemeInvestmentList = { error?: SbiMethodError } -export type SbiMethodError = { +export interface SbiMethodError { status?: string code?: string message?: string diff --git a/packages/client-sbi/tsconfig.json b/packages/client-sbi/tsconfig.json index bfa0fea..6db79af 100644 --- a/packages/client-sbi/tsconfig.json +++ b/packages/client-sbi/tsconfig.json @@ -1,29 +1,4 @@ { - "compilerOptions": { - // Environment setup & latest features - "lib": ["ESNext"], - "target": "ESNext", - "module": "Preserve", - "moduleDetection": "force", - "jsx": "react-jsx", - "allowJs": true, - - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, - - // Best practices - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedIndexedAccess": true, - "noImplicitOverride": true, - - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } + "extends": "@repo/tsconfig/tsconfig.json", + "include": ["src/**/*.ts"] } diff --git a/packages/mnie-cli/package.json b/packages/mnie-cli/package.json index a506e54..97be2b6 100644 --- a/packages/mnie-cli/package.json +++ b/packages/mnie-cli/package.json @@ -17,6 +17,7 @@ "@repo/mnie-sdk": "workspace:*" }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest" }, "peerDependencies": { diff --git a/packages/mnie-cli/src/index.ts b/packages/mnie-cli/src/index.ts index 4c4db9f..adb3da9 100644 --- a/packages/mnie-cli/src/index.ts +++ b/packages/mnie-cli/src/index.ts @@ -7,14 +7,14 @@ import { homedir } from 'node:os' import { dirname, join } from 'node:path' import { createMnieClient } from '@repo/mnie-sdk' -type Profile = { +interface Profile { origin: string apiKeyStorage: 'file' | 'keyring' apiKey?: string keyringAccount?: string } -type ProfilesFile = { +interface ProfilesFile { defaultProfile?: string profiles: Record } diff --git a/packages/mnie-cli/tsconfig.json b/packages/mnie-cli/tsconfig.json index a5cb75c..6db79af 100644 --- a/packages/mnie-cli/tsconfig.json +++ b/packages/mnie-cli/tsconfig.json @@ -1,4 +1,4 @@ { - "extends": "../../tsconfig.json", + "extends": "@repo/tsconfig/tsconfig.json", "include": ["src/**/*.ts"] } diff --git a/packages/mnie-sdk/package.json b/packages/mnie-sdk/package.json index 2309496..da544c5 100644 --- a/packages/mnie-sdk/package.json +++ b/packages/mnie-sdk/package.json @@ -1,6 +1,5 @@ { - "name": "@repo/mnie-sdk", - "private": true, + "name": "mnie", "type": "module", "module": "./dist/index.mjs", "types": "./src/index.ts", @@ -19,6 +18,7 @@ "@repo/mnie-types": "workspace:*" }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest" }, "peerDependencies": { diff --git a/packages/mnie-sdk/src/index.ts b/packages/mnie-sdk/src/index.ts index 7ce14c1..0a4eeb7 100644 --- a/packages/mnie-sdk/src/index.ts +++ b/packages/mnie-sdk/src/index.ts @@ -1,12 +1,12 @@ import type { SbiClientMethods } from '@repo/mnie-types' -export type MnieSdkOptions = { +export interface MnieSdkOptions { origin: string apiKey: string WebSocket?: typeof WebSocket } -export type JsonRpcError = { +export interface JsonRpcError { code: number message: string } @@ -17,14 +17,14 @@ export type MnieClient = SbiClientMethods & { close(): void } -type JsonRpcResponse = { +interface JsonRpcResponse { jsonrpc?: '2.0' id?: string | number | null result?: unknown error?: JsonRpcError } -type PendingCall = { +interface PendingCall { resolve: (value: unknown) => void reject: (error: Error) => void } diff --git a/packages/mnie-sdk/tsconfig.json b/packages/mnie-sdk/tsconfig.json index a5cb75c..6db79af 100644 --- a/packages/mnie-sdk/tsconfig.json +++ b/packages/mnie-sdk/tsconfig.json @@ -1,4 +1,4 @@ { - "extends": "../../tsconfig.json", + "extends": "@repo/tsconfig/tsconfig.json", "include": ["src/**/*.ts"] } diff --git a/packages/mnie-types/package.json b/packages/mnie-types/package.json index 92f8765..64e86a7 100644 --- a/packages/mnie-types/package.json +++ b/packages/mnie-types/package.json @@ -16,6 +16,7 @@ "typecheck": "tsc" }, "devDependencies": { + "@repo/tsconfig": "workspace:*", "@types/bun": "latest" }, "peerDependencies": { diff --git a/packages/mnie-types/src/methods.ts b/packages/mnie-types/src/methods.ts index 377eebb..5e3acff 100644 --- a/packages/mnie-types/src/methods.ts +++ b/packages/mnie-types/src/methods.ts @@ -42,21 +42,21 @@ import type { Watchlist, } from './types' -export type PagingOptions = { +export interface PagingOptions { /** Start index for the result list. Defaults to the first item when omitted. */ index?: number /** Maximum number of items to fetch. Uses the implementation default when omitted. */ limit?: number } -export type DateRangeOptions = { +export interface DateRangeOptions { /** Start date for the inquiry range. */ from?: string /** End date for the inquiry range. */ to?: string } -export type IssueOptions = { +export interface IssueOptions { /** Issue code to request. */ issueCode: IssueCode /** Market code to request. */ @@ -79,7 +79,7 @@ export type IssueChartOptions = IssueOptions & { count?: number } -export type IssueSearchOptions = { +export interface IssueSearchOptions { /** Search text, such as an issue code, name, or keyword. */ query: string /** Market code to search. */ @@ -118,7 +118,7 @@ export type OrderInquiryOptions = PagingOptions & status?: OrderStatus } -export type OrderDetailOptions = { +export interface OrderDetailOptions { /** Order number shown in order inquiry. */ orderNumber?: string /** Order ID from order inquiry. For US stocks this is often `orderSubNo`. */ @@ -149,7 +149,7 @@ export type BoardOptions = IssueOptions & { | 'marginCloseSell' } -export type StockOrderBaseOptions = { +export interface StockOrderBaseOptions { /** Issue code to order. */ issueCode: IssueCode /** Market code to order on. */ @@ -185,7 +185,7 @@ export type CashOrderTriggerZone = 'above' | 'below' export type CashOrderMethod = 'normal' | 'stop' | 'oco' -export type StockOrderMarginPosition = { +export interface StockOrderMarginPosition { /** Open trade date from the margin position record, in yyyyMMdd or yyyy-MM-dd format. */ openTradeDate: string /** Open price from the margin position record. Raw strings are accepted to preserve APK values. */ @@ -284,7 +284,7 @@ export type MarginClosePositionOrder = export type ActualDeliveryKind = 'genbiki' | 'genwatashi' -export type ActualDeliveryOrderOptions = { +export interface ActualDeliveryOrderOptions { /** Issue code to deliver. */ issueCode: IssueCode /** Market code for the issue. */ @@ -339,7 +339,7 @@ export type PlaceActualDeliveryOrderOptions = ActualDeliveryOrderOptions & { allowTrading?: true } -export type OrderCorrectionOptions = { +export interface OrderCorrectionOptions { /** Order number shown in order inquiry. Required by the mobile pre-correction route. */ orderNumber?: string /** Order ID to correct. */ @@ -397,7 +397,7 @@ export type PlaceOrderCorrectionOptions = OrderCorrectionOptions & { allowTrading?: true } -export type OrderCancelOptions = { +export interface OrderCancelOptions { /** Order number shown in order inquiry. */ orderNumber: string /** Original order ID shown in order inquiry. */ @@ -419,7 +419,7 @@ export type PlaceOrderCancelOptions = OrderCancelOptions & { allowTrading?: true } -export type ExchangeOrderOptions = { +export interface ExchangeOrderOptions { /** Currency code, such as USD. */ currencyCode: string /** Buy or sell the foreign currency. */ @@ -438,7 +438,7 @@ export type ExchangeOrderOptions = { tradePassword?: string } -export type ExchangeRateOptions = { +export interface ExchangeRateOptions { /** Currency code, such as USD. */ currencyCode: string /** Buy or sell the foreign currency. */ @@ -513,7 +513,7 @@ export type PlaceIfdOrderOptions = IfdOrderOptions & { allowTrading?: true } -export type ThemeInvestmentOrderOptions = { +export interface ThemeInvestmentOrderOptions { /** Theme ID for the theme investment order. */ themeId: ThemeId /** Theme set year/month (`theme_set_yyyymm`) from the mobile APK handoff. */ @@ -532,21 +532,21 @@ export type ThemeInvestmentOrderOptions = { amount?: number } -export type ThemeInvestmentOrderComponent = { +export interface ThemeInvestmentOrderComponent { /** Component stock issue code. */ issueCode: IssueCode /** Component order quantity. */ quantity: number | string } -export type ThemeInvestmentPreOrderComponent = { +export interface ThemeInvestmentPreOrderComponent { /** Component stock issue code selected by the mobile theme investment flow. */ issueCode: IssueCode /** Component order quantity from the mobile handoff, when already selected. */ quantity?: number | string } -export type ThemeInvestmentPreOrderOptions = { +export interface ThemeInvestmentPreOrderOptions { /** Theme ID for the theme investment order target. */ themeId: ThemeId /** Theme name from the mobile theme investment flow, when available. */ @@ -562,12 +562,12 @@ export type PlaceThemeInvestmentOrderOptions = ThemeInvestmentOrderOptions & { allowTrading?: true } -export type AccountPowerOptions = { +export interface AccountPowerOptions { /** Fetches margin-account collateral details. Disable this for accounts without margin trading. */ includeMarginAccount?: boolean } -export type ProfitLossOptions = { +export interface ProfitLossOptions { /** Market to fetch profit/loss for. Omit for domestic cash/margin summary. */ market?: MarketCode } diff --git a/packages/mnie-types/src/types.ts b/packages/mnie-types/src/types.ts index b23a09d..8d7d6e6 100644 --- a/packages/mnie-types/src/types.ts +++ b/packages/mnie-types/src/types.ts @@ -4,7 +4,7 @@ export type WebAuthnUserVerification = 'required' | 'preferred' | 'discouraged' export type WebAuthnTransport = 'ble' | 'hybrid' | 'internal' | 'nfc' | 'usb' -export type WebAuthnJwk = { +export interface WebAuthnJwk { kty: string crv?: string x?: string @@ -17,7 +17,7 @@ export type WebAuthnJwk = { [key: string]: unknown } -export type StoredWebAuthnCredentialSecret = { +export interface StoredWebAuthnCredentialSecret { privateKey: { format: 'jwk' jwk: WebAuthnJwk @@ -29,7 +29,7 @@ export type StoredWebAuthnCredentialSecret = { } } -export type StoredWebAuthnCredential = { +export interface StoredWebAuthnCredential { version: 1 kind: 'webauthn-credential' provider: 'sbi-sec' @@ -76,7 +76,7 @@ export type PlaintextStoredWebAuthnCredential = Omit } -export type SbiSession = { +export interface SbiSession { mtsBaseUrl: string izanagiBaseUrl?: string foreignStock?: ForeignStockSession @@ -139,7 +139,7 @@ export type SbiSession = { tradeAuthentication?: SbiTradeAuthenticationOptions } -export type LoginWithPasskeyOptions = { +export interface LoginWithPasskeyOptions { passkeyCredential: PlaintextStoredWebAuthnCredential authBaseUrl?: string mtsBaseUrl?: string @@ -159,13 +159,13 @@ export type LoginWithPasskeyOptions = { mainSiteExchangeOrderCompletePath?: string } -export type SbiClientOptions = { +export interface SbiClientOptions { tradePassword?: string deviceId?: string tradeAuthentication?: SbiTradeAuthenticationOptions } -export type SbiTradeAuthenticationRequest = { +export interface SbiTradeAuthenticationRequest { type: 'phone' telNo?: string phoneNo?: string @@ -173,7 +173,7 @@ export type SbiTradeAuthenticationRequest = { authLimitTime?: string } -export type SbiTradeAuthenticationOptions = { +export interface SbiTradeAuthenticationOptions { onRequired?: (request: SbiTradeAuthenticationRequest) => void | Promise confirmAttempts?: number confirmIntervalMs?: number @@ -189,24 +189,24 @@ export type WatchlistId = string export type PositionId = string export type ThemeId = string -export type CurrencyAmount = { +export interface CurrencyAmount { value: number | null text: string currency: 'JPY' | 'USD' } -export type PercentValue = { +export interface PercentValue { value: number | null text: string } -export type SignedTextValue = { +export interface SignedTextValue { value: number | null text: string sign?: 'positive' | 'negative' | 'zero' } -export type AccountAssetsValuationSummary = { +export interface AccountAssetsValuationSummary { assetsErrorType: unknown valuation: number | null netChange: number | null @@ -223,7 +223,7 @@ export type AccountAssetsValuationDetail = AccountAssetsValuationSummary & { compositionRatio: number | null } -export type AccountAssetsValuations = { +export interface AccountAssetsValuations { fetchedAt: string summary: AccountAssetsValuationSummary summaryWithoutDeposit: AccountAssetsValuationSummary @@ -276,7 +276,7 @@ export type IsaAccountType = | 'nisaTradePermitted' | 'unknown' -export type IssueRef = { +export interface IssueRef { code: IssueCode market?: MarketCode name?: string @@ -292,7 +292,7 @@ export type IssueSearchItem = IssueRef & { export type IssueSearchStatus = 'success' | 'searchError' | 'tooManyResults' | 'unknown' -export type IssueSearchResult = { +export interface IssueSearchResult { status?: string statusText: IssueSearchStatus issues: IssueSearchItem[] @@ -300,7 +300,7 @@ export type IssueSearchResult = { export type ChartPeriod = 'minute' | 'day' | 'week' | 'month' -export type ChartPrice = { +export interface ChartPrice { dateTime: string open: CurrencyAmount high: CurrencyAmount @@ -309,7 +309,7 @@ export type ChartPrice = { volume?: number | null } -export type IssueChart = { +export interface IssueChart { issue: IssueRef period: ChartPeriod unit: number @@ -322,13 +322,13 @@ export type IssueChart = { error?: SbiMethodError } -export type SessionInfo = { +export interface SessionInfo { sessionId: string loginType: LoginType resultCode: string } -export type AccountProfile = { +export interface AccountProfile { session: SessionInfo branchCode?: string butenCode?: string @@ -391,7 +391,7 @@ export type AccountProfile = { } } -export type BuyingPower = { +export interface BuyingPower { cashBuyingPower?: CurrencyAmount marginBuyingPower?: CurrencyAmount withdrawableAmount?: CurrencyAmount @@ -403,7 +403,7 @@ export type BuyingPower = { error?: SbiMethodError } -export type CollateralRatioRecord = { +export interface CollateralRatioRecord { marginRequirements?: CurrencyAmount referenceMarginRequirements?: CurrencyAmount collateralRatioCash?: CurrencyAmount @@ -420,7 +420,7 @@ export type CollateralRatioRecord = { minimumCollateral?: CurrencyAmount } -export type CashPosition = { +export interface CashPosition { issue: IssueRef accountType?: AccountType depositType?: DepositType @@ -449,7 +449,7 @@ export type CashPosition = { accountInformation?: string } -export type CashPositionList = { +export interface CashPositionList { positions: CashPosition[] index?: number totalCount?: number @@ -461,7 +461,7 @@ export type CashPositionList = { error?: SbiMethodError } -export type MarginPosition = { +export interface MarginPosition { id?: PositionId issue: IssueRef side: MarginTradeSide @@ -503,7 +503,7 @@ export type MarginPosition = { bargainMarket?: string } -export type MarginPositionList = { +export interface MarginPositionList { positions: MarginPosition[] index?: number totalCount?: number @@ -515,7 +515,7 @@ export type MarginPositionList = { error?: SbiMethodError } -export type ProfitLossSummary = { +export interface ProfitLossSummary { cash?: SignedTextValue margin?: SignedTextValue total?: SignedTextValue @@ -523,7 +523,7 @@ export type ProfitLossSummary = { error?: SbiMethodError } -export type Quote = { +export interface Quote { issue: IssueRef price?: CurrencyAmount change?: SignedTextValue @@ -539,12 +539,12 @@ export type Quote = { error?: SbiMethodError } -export type BoardPriceLevel = { +export interface BoardPriceLevel { price: CurrencyAmount quantity?: number | null } -export type Board = { +export interface Board { issue: IssueRef bids: BoardPriceLevel[] asks: BoardPriceLevel[] @@ -552,7 +552,7 @@ export type Board = { error?: SbiMethodError } -export type MarketIndex = { +export interface MarketIndex { code?: string categoryCode?: string name: string @@ -568,13 +568,13 @@ export type MarketIndex = { previousClose?: CurrencyAmount } -export type DomesticMarket = { +export interface DomesticMarket { status?: string indexes: MarketIndex[] error?: SbiMethodError } -export type RankingItem = { +export interface RankingItem { rank: number issue: IssueRef value?: number | string | null @@ -585,14 +585,14 @@ export type RankingItem = { colorFlag?: string } -export type Ranking = { +export interface Ranking { items: RankingItem[] category?: string updatedAt?: string error?: SbiMethodError } -export type NewsItem = { +export interface NewsItem { id?: string title: string source?: string @@ -606,26 +606,26 @@ export type NewsItem = { pnac?: string } -export type NewsList = { +export interface NewsList { items: NewsItem[] error?: SbiMethodError } -export type WatchlistItem = { +export interface WatchlistItem { issue: IssueRef sortOrder?: number memo?: string quote?: Quote } -export type Watchlist = { +export interface Watchlist { id: WatchlistId name: string items: WatchlistItem[] error?: SbiMethodError } -export type Order = { +export interface Order { id: OrderId issue: IssueRef side: TradeSide @@ -655,13 +655,13 @@ export type Order = { correctable?: boolean } -export type OrderList = { +export interface OrderList { orders: Order[] hasMore?: boolean error?: SbiMethodError } -export type TradeRecord = { +export interface TradeRecord { id: string issue: IssueRef tradeRecordTypeCode?: string @@ -678,13 +678,13 @@ export type TradeRecord = { marginCloseLimitType?: string } -export type TradeRecordList = { +export interface TradeRecordList { records: TradeRecord[] hasMore?: boolean error?: SbiMethodError } -export type OrderCorrectionPreOrderDetail = { +export interface OrderCorrectionPreOrderDetail { exchangeName?: string marketLoanKbn?: string marketIppanLoanKbn?: string @@ -697,7 +697,7 @@ export type OrderCorrectionPreOrderDetail = { volumeText?: string } -export type OrderCorrectionPreOrder = { +export interface OrderCorrectionPreOrder { issue: IssueRef tradeTitle?: string buyingPowerTotal?: CurrencyAmount @@ -753,7 +753,7 @@ export type OrderCorrectionPreOrder = { exchangeList?: string } -export type OrderPreview = { +export interface OrderPreview { issue: IssueRef side: TradeSide quantity?: number @@ -768,12 +768,12 @@ export type OrderPreview = { error?: SbiMethodError } -export type StockOrderPreOrderPriceStep = { +export interface StockOrderPreOrderPriceStep { from?: CurrencyAmount to?: CurrencyAmount } -export type StockOrderPreOrderPaymentLimit = { +export interface StockOrderPreOrderPaymentLimit { text?: string code?: string } @@ -787,7 +787,7 @@ export type StockOrderPreOrderMarginTradeType = | 'day' | 'hyper' -export type StockOrderPreOrder = { +export interface StockOrderPreOrder { issue: IssueRef tradeTitle?: string buyingPowerTotal?: CurrencyAmount @@ -850,7 +850,7 @@ export type StockOrderPreOrder = { error?: SbiMethodError } -export type OrderReceipt = { +export interface OrderReceipt { accepted: boolean orderId?: OrderId acceptedAt?: string @@ -863,7 +863,7 @@ export type ExchangeSpecificMethod = 'foreign' | 'domestic' export type ExchangeAccountKind = 'GENERAL' | 'JR_NISA' export type ExchangeSellMethod = 'SELL_PART' | 'SELL_ALL' -export type ExchangeOrderPreview = { +export interface ExchangeOrderPreview { currencyCode: string currencyName?: string side: ExchangeOrderSide @@ -882,7 +882,7 @@ export type ExchangeOrderPreview = { csrfToken: string } -export type ExchangeOrderReceipt = { +export interface ExchangeOrderReceipt { accepted: boolean currencyCode?: string side?: ExchangeOrderSide @@ -891,7 +891,7 @@ export type ExchangeOrderReceipt = { rawTitle?: string } -export type ExchangeRateInfo = { +export interface ExchangeRateInfo { currencyCode: string side: ExchangeOrderSide referenceExchangeRate?: string @@ -910,7 +910,7 @@ export type ExchangeRateInfo = { raw: Record } -export type ThemeInvestment = { +export interface ThemeInvestment { id: ThemeId name: string issues: ThemeInvestmentIssue[] @@ -933,7 +933,7 @@ export type ThemeInvestmentIssue = IssueRef & { tradeTime?: string } -export type ThemeInvestmentList = { +export interface ThemeInvestmentList { themes: ThemeInvestment[] buyingPowerTotal?: CurrencyAmount isaBuyLimit?: CurrencyAmount @@ -944,7 +944,7 @@ export type ThemeInvestmentList = { error?: SbiMethodError } -export type SbiMethodError = { +export interface SbiMethodError { status?: string code?: string message?: string diff --git a/packages/mnie-types/tsconfig.json b/packages/mnie-types/tsconfig.json index a5cb75c..6db79af 100644 --- a/packages/mnie-types/tsconfig.json +++ b/packages/mnie-types/tsconfig.json @@ -1,4 +1,4 @@ { - "extends": "../../tsconfig.json", + "extends": "@repo/tsconfig/tsconfig.json", "include": ["src/**/*.ts"] } diff --git a/packages/tsconfig/package.json b/packages/tsconfig/package.json new file mode 100644 index 0000000..cf9e9ea --- /dev/null +++ b/packages/tsconfig/package.json @@ -0,0 +1,11 @@ +{ + "name": "@repo/tsconfig", + "version": "0.0.0", + "private": true, + "files": [ + "tsconfig.json" + ], + "exports": { + "./tsconfig.json": "./tsconfig.json" + } +} diff --git a/packages/tsconfig/tsconfig.json b/packages/tsconfig/tsconfig.json new file mode 100644 index 0000000..7664559 --- /dev/null +++ b/packages/tsconfig/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "lib": ["ESNext"], + "target": "ESNext", + "module": "Preserve", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } +} diff --git a/tools/analyze-sbi-apk.ts b/tools/analyze-sbi-apk.ts index 774ef0d..adab74f 100644 --- a/tools/analyze-sbi-apk.ts +++ b/tools/analyze-sbi-apk.ts @@ -1,7 +1,7 @@ import { mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs' import { join, relative } from 'node:path' -type ApiClass = { +interface ApiClass { file: string packageName: string | null className: string | null @@ -15,7 +15,7 @@ type ApiClass = { responseReads: Array<{ line: number; setter: string | null; width: number }> } -type Finding = { +interface Finding { generatedAt: string input: { jadx: string diff --git a/tsconfig.json b/tsconfig.json index bfa0fea..0f10b11 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,29 +1,3 @@ { - "compilerOptions": { - // Environment setup & latest features - "lib": ["ESNext"], - "target": "ESNext", - "module": "Preserve", - "moduleDetection": "force", - "jsx": "react-jsx", - "allowJs": true, - - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, - - // Best practices - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedIndexedAccess": true, - "noImplicitOverride": true, - - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } + "extends": "@repo/tsconfig/tsconfig.json" }