sentisense 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -3
- package/dist/index.cjs +52 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +70 -8
- package/dist/index.d.ts +70 -8
- package/dist/index.mjs +52 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,11 +72,22 @@ client.institutional.getActivists("2025-02-14")
|
|
|
72
72
|
### Entity Metrics
|
|
73
73
|
|
|
74
74
|
```typescript
|
|
75
|
-
|
|
76
|
-
client.entityMetrics.
|
|
77
|
-
client.entityMetrics.
|
|
75
|
+
// Time-series metrics (v2 API)
|
|
76
|
+
client.entityMetrics.getMetrics("AAPL", { metricType: "sentiment" })
|
|
77
|
+
client.entityMetrics.getMetrics("AAPL", {
|
|
78
|
+
metricType: "mentions",
|
|
79
|
+
startTime: Date.now() - 7 * 86400000,
|
|
80
|
+
endTime: Date.now(),
|
|
81
|
+
maxDataPoints: 100,
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// Distribution by source
|
|
85
|
+
client.entityMetrics.getDistribution("AAPL", "sentiment")
|
|
86
|
+
client.entityMetrics.getDistribution("AAPL", "mentions", { dimension: "source" })
|
|
78
87
|
```
|
|
79
88
|
|
|
89
|
+
Available metric types: `mentions`, `sentiment`, `sentisense_score`, `social_dominance`, `creators`.
|
|
90
|
+
|
|
80
91
|
### Knowledge Base
|
|
81
92
|
|
|
82
93
|
```typescript
|
package/dist/index.cjs
CHANGED
|
@@ -117,42 +117,87 @@ var EntityMetrics = class {
|
|
|
117
117
|
constructor(client) {
|
|
118
118
|
this.client = client;
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
// ── v2 API methods ──────────────────────────────────────────
|
|
121
|
+
/**
|
|
122
|
+
* Get time-series metric data for an entity using the v2 Serving Metrics API.
|
|
123
|
+
*
|
|
124
|
+
* @param symbol Ticker symbol (e.g. "AAPL") — the backend resolves the entity.
|
|
125
|
+
* @param options Metric type and optional time range / resolution.
|
|
126
|
+
*/
|
|
127
|
+
async getMetrics(symbol, options = {}) {
|
|
128
|
+
const { metricType = "sentiment", startTime, endTime, maxDataPoints } = options;
|
|
129
|
+
return this.client.get(
|
|
130
|
+
`/api/v2/metrics/entity/${encodeURIComponent(symbol)}/metric/${encodeURIComponent(metricType)}`,
|
|
131
|
+
{
|
|
132
|
+
...startTime !== void 0 && { startTime },
|
|
133
|
+
...endTime !== void 0 && { endTime },
|
|
134
|
+
...maxDataPoints !== void 0 && { maxDataPoints }
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Get distribution data for a metric, broken down by a dimension (default: source).
|
|
140
|
+
*
|
|
141
|
+
* @param symbol Ticker symbol (e.g. "AAPL").
|
|
142
|
+
* @param metricType The metric to break down (e.g. "mentions", "sentiment").
|
|
143
|
+
* @param options Optional dimension parameter.
|
|
144
|
+
*/
|
|
145
|
+
async getDistribution(symbol, metricType, options = {}) {
|
|
146
|
+
const { dimension = "source" } = options;
|
|
147
|
+
return this.client.get(
|
|
148
|
+
`/api/v2/metrics/entity/${encodeURIComponent(symbol)}/distribution/${encodeURIComponent(metricType)}`,
|
|
149
|
+
{ dimension }
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
// ── Deprecated v1 methods (kept for backward compatibility) ─
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
|
|
155
|
+
*/
|
|
121
156
|
async getMentions(symbol, options) {
|
|
122
157
|
return this.client.get(
|
|
123
158
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions`,
|
|
124
159
|
options
|
|
125
160
|
);
|
|
126
161
|
}
|
|
127
|
-
/**
|
|
162
|
+
/**
|
|
163
|
+
* @deprecated Use `getDistribution(symbol, "mentions", { dimension: "source" })` instead.
|
|
164
|
+
*/
|
|
128
165
|
async getMentionCountBySource(symbol, options) {
|
|
129
166
|
return this.client.get(
|
|
130
167
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count/by-source`,
|
|
131
168
|
options
|
|
132
169
|
);
|
|
133
170
|
}
|
|
134
|
-
/**
|
|
171
|
+
/**
|
|
172
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
|
|
173
|
+
*/
|
|
135
174
|
async getMentionCount(symbol, options) {
|
|
136
175
|
return this.client.get(
|
|
137
176
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count`,
|
|
138
177
|
options
|
|
139
178
|
);
|
|
140
179
|
}
|
|
141
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
|
|
182
|
+
*/
|
|
142
183
|
async getSentiment(symbol, options) {
|
|
143
184
|
return this.client.get(
|
|
144
185
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment`,
|
|
145
186
|
options
|
|
146
187
|
);
|
|
147
188
|
}
|
|
148
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* @deprecated Use `getDistribution(symbol, "sentiment", { dimension: "source" })` instead.
|
|
191
|
+
*/
|
|
149
192
|
async getSentimentBySource(symbol, options) {
|
|
150
193
|
return this.client.get(
|
|
151
194
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/by-source`,
|
|
152
195
|
options
|
|
153
196
|
);
|
|
154
197
|
}
|
|
155
|
-
/**
|
|
198
|
+
/**
|
|
199
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
|
|
200
|
+
*/
|
|
156
201
|
async getAverageSentiment(symbol, options) {
|
|
157
202
|
return this.client.get(
|
|
158
203
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/average`,
|
|
@@ -331,7 +376,7 @@ var Stocks = class {
|
|
|
331
376
|
};
|
|
332
377
|
|
|
333
378
|
// src/version.ts
|
|
334
|
-
var VERSION = "0.
|
|
379
|
+
var VERSION = "0.4.0";
|
|
335
380
|
|
|
336
381
|
// src/client.ts
|
|
337
382
|
var DEFAULT_BASE_URL = "https://app.sentisense.ai";
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/resources/documents.ts","../src/resources/entityMetrics.ts","../src/resources/institutional.ts","../src/resources/kb.ts","../src/resources/marketMood.ts","../src/resources/stocks.ts","../src/version.ts","../src/client.ts"],"sourcesContent":["export { SentiSense } from \"./client.js\";\nexport { SentiSense as default } from \"./client.js\";\n\nexport {\n SentiSenseError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n APIError,\n} from \"./errors.js\";\n\nexport type {\n SentiSenseOptions,\n StockPrice,\n StockDetail,\n StockImage,\n StockProfile,\n StockEntity,\n ChartData,\n ChartDataPoint,\n MarketStatus,\n Fundamentals,\n FundamentalsPeriod,\n ShortInterest,\n FloatInfo,\n ShortVolume,\n AISummary,\n MetricsBreakdown,\n Document,\n DocumentSource,\n SentimentEntry,\n Story,\n StoryCluster,\n Quarter,\n InstitutionalFlow,\n InstitutionalFlowsResponse,\n Holder,\n MentionData,\n MentionCount,\n SentimentData,\n MarketMood,\n KBEntity,\n} from \"./types.js\";\n\nexport { VERSION } from \"./version.js\";\n","export class SentiSenseError extends Error {\n status?: number;\n code?: string;\n\n constructor(message: string, status?: number, code?: string) {\n super(message);\n this.name = \"SentiSenseError\";\n this.status = status;\n this.code = code;\n }\n}\n\nexport class AuthenticationError extends SentiSenseError {\n constructor(message: string, status: number, code?: string) {\n super(message, status, code);\n this.name = \"AuthenticationError\";\n }\n}\n\nexport class NotFoundError extends SentiSenseError {\n constructor(message: string, code?: string) {\n super(message, 404, code);\n this.name = \"NotFoundError\";\n }\n}\n\nexport class RateLimitError extends SentiSenseError {\n constructor(message: string, code?: string) {\n super(message, 429, code);\n this.name = \"RateLimitError\";\n }\n}\n\nexport class APIError extends SentiSenseError {\n constructor(message: string, status: number, code?: string) {\n super(message, status, code);\n this.name = \"APIError\";\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Document,\n DocumentSource,\n GetByEntityOptions,\n GetBySourceOptions,\n GetByTickerOptions,\n GetByTickerRangeOptions,\n GetStoriesByTickerOptions,\n GetStoriesOptions,\n SearchDocumentsOptions,\n Story,\n} from \"../types.js\";\n\nexport class Documents {\n constructor(private client: APIClient) {}\n\n /** Get document metrics for a stock. */\n async getByTicker(ticker: string, options?: GetByTickerOptions): Promise<Document[]> {\n return this.client.get(`/api/v1/documents/ticker/${encodeURIComponent(ticker)}`, options);\n }\n\n /** Get document metrics for a stock within a date range. */\n async getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/ticker/${encodeURIComponent(ticker)}/range`,\n options,\n );\n }\n\n /** Get document metrics for a KB entity. */\n async getByEntity(entityId: string, options?: GetByEntityOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/entity/${encodeURIComponent(entityId)}`,\n options,\n );\n }\n\n /** Smart search with natural language query parsing. */\n async search(query: string, options?: SearchDocumentsOptions): Promise<Document[]> {\n return this.client.get(\"/api/v1/documents/search\", { query, ...options });\n }\n\n /** Get latest document metrics from a source type. */\n async getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/source/${encodeURIComponent(source)}`,\n options,\n );\n }\n\n /** Get AI-curated news story clusters. */\n async getStories(options?: GetStoriesOptions): Promise<Story[]> {\n return this.client.get(\"/api/v1/documents/stories\", options);\n }\n\n /** Get stories for a specific stock. */\n async getStoriesByTicker(\n ticker: string,\n options?: GetStoriesByTickerOptions,\n ): Promise<Story[]> {\n return this.client.get(\n `/api/v1/documents/stories/ticker/${encodeURIComponent(ticker)}`,\n options,\n );\n }\n\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n EntityMetricsDateRange,\n GetMentionCountOptions,\n GetMentionsOptions,\n GetSentimentBySourceOptions,\n MentionCount,\n MentionData,\n SentimentData,\n} from \"../types.js\";\n\nexport class EntityMetrics {\n constructor(private client: APIClient) {}\n\n /** Get mention data for a stock. */\n async getMentions(symbol: string, options?: GetMentionsOptions): Promise<MentionData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions`,\n options,\n );\n }\n\n /** Get mention counts broken down by source. */\n async getMentionCountBySource(\n symbol: string,\n options?: EntityMetricsDateRange,\n ): Promise<MentionCount> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count/by-source`,\n options,\n );\n }\n\n /** Get total mention count. */\n async getMentionCount(symbol: string, options?: GetMentionCountOptions): Promise<MentionCount> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count`,\n options,\n );\n }\n\n /** Get sentiment data for a stock. */\n async getSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment`,\n options,\n );\n }\n\n /** Get sentiment broken down by source. */\n async getSentimentBySource(\n symbol: string,\n options?: GetSentimentBySourceOptions,\n ): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/by-source`,\n options,\n );\n }\n\n /** Get average sentiment score. */\n async getAverageSentiment(\n symbol: string,\n options?: EntityMetricsDateRange,\n ): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/average`,\n options,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n GetFlowsOptions,\n Holder,\n InstitutionalFlowsResponse,\n Quarter,\n} from \"../types.js\";\n\nexport class Institutional {\n constructor(private client: APIClient) {}\n\n /** Get available 13F reporting quarters. */\n async getQuarters(): Promise<Quarter[]> {\n return this.client.get(\"/api/v1/institutional/quarters\");\n }\n\n /** Get aggregate institutional activity per ticker for a quarter. */\n async getFlows(reportDate: string, options?: GetFlowsOptions): Promise<InstitutionalFlowsResponse> {\n return this.client.get(\"/api/v1/institutional/flows\", {\n reportDate,\n ...options,\n });\n }\n\n /** Get institutional holders for a specific stock. */\n async getHolders(ticker: string, reportDate: string): Promise<Holder[]> {\n return this.client.get(\n `/api/v1/institutional/holders/${encodeURIComponent(ticker)}`,\n { reportDate },\n );\n }\n\n /** Get activist investor positions (NEW or INCREASED). */\n async getActivists(reportDate: string): Promise<Holder[]> {\n return this.client.get(\"/api/v1/institutional/activist\", { reportDate });\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type { KBEntity } from \"../types.js\";\n\nexport class KB {\n constructor(private client: APIClient) {}\n\n /** Get popular entities for search suggestions. */\n async getPopularEntities(): Promise<KBEntity[]> {\n return this.client.get(\"/api/v1/kb/entities/popular\");\n }\n\n /** Get entity detail with metrics and relationships. */\n async getEntity(entityId: string): Promise<KBEntity> {\n return this.client.get(`/api/v1/kb/entities/${encodeURIComponent(entityId)}`);\n }\n\n /** Get all tracked entities. */\n async getAllEntities(): Promise<KBEntity[]> {\n return this.client.get(\"/api/v1/kb/entities/all\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type { MarketMood } from \"../types.js\";\n\nexport class MarketMoodResource {\n constructor(private client: APIClient) {}\n\n /** Get market mood data (scores, history, sectors). */\n async get(): Promise<MarketMood> {\n return this.client.get(\"/api/v2/market-mood\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n AISummary,\n ChartData,\n FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n MarketStatus,\n MetricsBreakdown,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n} from \"../types.js\";\n\nexport class Stocks {\n constructor(private client: APIClient) {}\n\n /** List all available ticker symbols. */\n async list(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks\");\n }\n\n /** List all stocks with name, kbEntityId, urlSlug. */\n async listDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/detailed\");\n }\n\n /** Get popular ticker symbols. */\n async listPopular(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks/popular\");\n }\n\n /** Get popular stocks with details. */\n async listPopularDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/popular/detailed\");\n }\n\n /** Get real-time price for a single ticker. */\n async getPrice(ticker: string): Promise<StockPrice> {\n return this.client.get(\"/api/v1/stocks/price\", { ticker });\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<Record<string, StockPrice>> {\n return this.client.get(\"/api/v1/stocks/prices\", {\n tickers: tickers.join(\",\"),\n });\n }\n\n /** Get batch company logo URLs. */\n async getImages(\n tickers: string[],\n options?: GetImagesOptions,\n ): Promise<Record<string, StockImage>> {\n return this.client.get(\"/api/v1/stocks/images\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get company profiles with branding, market cap, sector. */\n async getDescriptions(\n tickers: string[],\n options?: GetDescriptionsOptions,\n ): Promise<Record<string, StockProfile>> {\n return this.client.get(\"/api/v1/stocks/descriptions\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get peer/similar stocks. */\n async getSimilar(ticker: string, options?: GetSimilarOptions): Promise<StockDetail[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/similar`, options);\n }\n\n /** Get company profile (CEO, sector, industry, market data). */\n async getProfile(ticker: string, options?: GetProfileOptions): Promise<StockProfile> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/profile`, options);\n }\n\n /** Get related KB entities (people, products, partners). */\n async getEntities(ticker: string): Promise<StockEntity[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/entities`);\n }\n\n /** Get AI-generated stock analysis report. Requires PRO tier. */\n async getAISummary(ticker: string, options?: GetAISummaryOptions): Promise<AISummary> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/ai-summary`, options);\n }\n\n /** Get sentiment/mention metrics breakdown by entity. */\n async getMetricsBreakdown(\n ticker: string,\n metricType: string,\n options?: GetMetricsBreakdownOptions,\n ): Promise<MetricsBreakdown> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker)}/metrics/${encodeURIComponent(metricType)}/breakdown`,\n options,\n );\n }\n\n /** Get historical OHLCV chart data. */\n async getChart(ticker: string, options?: GetChartOptions): Promise<ChartData> {\n return this.client.get(\"/api/v1/stocks/chart\", { ticker, ...options });\n }\n\n /** Get current market open/closed/pre-market/after-hours status. */\n async getMarketStatus(): Promise<MarketStatus> {\n return this.client.get(\"/api/v1/stocks/market-status\");\n }\n\n /** Get financial statement data. */\n async getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals\", { ticker, ...options });\n }\n\n /** Get available fiscal periods. */\n async getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]> {\n return this.client.get(\"/api/v1/stocks/fundamentals/periods\", { ticker });\n }\n\n /** Get most recent fundamentals snapshot. */\n async getCurrentFundamentals(ticker: string): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals/current\", { ticker });\n }\n\n /** Get historical P/E, P/B, P/S ratios. */\n async getHistoricalRatios(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/ratios\", { ticker });\n }\n\n /** Get historical revenue data. */\n async getHistoricalRevenue(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/revenue\", { ticker });\n }\n\n /** Get short interest metrics (FINRA). */\n async getShortInterest(ticker: string): Promise<ShortInterest> {\n return this.client.get(\"/api/v1/stocks/short-interest\", { ticker });\n }\n\n /** Get float information. */\n async getFloat(ticker: string): Promise<FloatInfo> {\n return this.client.get(\"/api/v1/stocks/float\", { ticker });\n }\n\n /** Get short volume trading data. */\n async getShortVolume(ticker: string): Promise<ShortVolume> {\n return this.client.get(\"/api/v1/stocks/short-volume\", { ticker });\n }\n}\n","export const VERSION = \"0.3.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { Institutional } from \"./resources/institutional.js\";\nimport { KB } from \"./resources/kb.js\";\nimport { MarketMoodResource } from \"./resources/marketMood.js\";\nimport { Stocks } from \"./resources/stocks.js\";\nimport type { SentiSenseOptions } from \"./types.js\";\nimport { VERSION } from \"./version.js\";\n\nconst DEFAULT_BASE_URL = \"https://app.sentisense.ai\";\nconst DEFAULT_TIMEOUT = 30_000;\n\n/** @internal HTTP interface exposed to resource classes. */\nexport interface APIClient {\n get<T = unknown>(path: string, params?: object): Promise<T>;\n}\n\nexport class SentiSense implements APIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeout: number;\n\n readonly stocks: Stocks;\n readonly documents: Documents;\n readonly institutional: Institutional;\n readonly entityMetrics: EntityMetrics;\n readonly marketMood: MarketMoodResource;\n readonly kb: KB;\n\n constructor(options: SentiSenseOptions = {}) {\n this.apiKey = options.apiKey;\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT;\n\n this.stocks = new Stocks(this);\n this.documents = new Documents(this);\n this.institutional = new Institutional(this);\n this.entityMetrics = new EntityMetrics(this);\n this.marketMood = new MarketMoodResource(this);\n this.kb = new KB(this);\n }\n\n /** @internal */\n async get<T = unknown>(path: string, params?: object): Promise<T> {\n const url = this.buildUrl(path, params);\n const headers: Record<string, string> = {};\n\n if (this.apiKey) {\n headers[\"X-SentiSense-API-Key\"] = this.apiKey;\n }\n\n // User-Agent is only set in Node.js (browsers disallow it)\n if (typeof process !== \"undefined\" && process.versions?.node) {\n headers[\"User-Agent\"] = `sentisense-node/${VERSION}`;\n }\n\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n const response = await fetch(url, {\n method: \"GET\",\n headers,\n signal: controller.signal,\n });\n\n if (!response.ok) {\n await this.handleErrorResponse(response);\n }\n\n return (await response.json()) as T;\n } catch (error) {\n if (error instanceof SentiSenseError) throw error;\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new SentiSenseError(`Request timed out after ${this.timeout}ms`);\n }\n throw new SentiSenseError(\n error instanceof Error ? error.message : \"Unknown error\",\n );\n } finally {\n clearTimeout(timer);\n }\n }\n\n private buildUrl(path: string, params?: object): string {\n const url = new URL(path, this.baseUrl);\n if (params) {\n for (const [key, value] of Object.entries(params as Record<string, unknown>)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n return url.toString();\n }\n\n private async handleErrorResponse(response: Response): Promise<never> {\n let body: { error?: string; message?: string } = {};\n try {\n body = await response.json();\n } catch {\n // Response may not be JSON\n }\n\n const message = body.message ?? response.statusText ?? \"API request failed\";\n const code = body.error;\n\n switch (response.status) {\n case 401:\n case 403:\n throw new AuthenticationError(message, response.status, code);\n case 404:\n throw new NotFoundError(message, code);\n case 429:\n throw new RateLimitError(message, code);\n default:\n throw new APIError(message, response.status, code);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EAIzC,YAAY,SAAiB,QAAiB,MAAe;AAC3D,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,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","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/resources/documents.ts","../src/resources/entityMetrics.ts","../src/resources/institutional.ts","../src/resources/kb.ts","../src/resources/marketMood.ts","../src/resources/stocks.ts","../src/version.ts","../src/client.ts"],"sourcesContent":["export { SentiSense } from \"./client.js\";\nexport { SentiSense as default } from \"./client.js\";\n\nexport {\n SentiSenseError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n APIError,\n} from \"./errors.js\";\n\nexport type {\n SentiSenseOptions,\n StockPrice,\n StockDetail,\n StockImage,\n StockProfile,\n StockEntity,\n ChartData,\n ChartDataPoint,\n MarketStatus,\n Fundamentals,\n FundamentalsPeriod,\n ShortInterest,\n FloatInfo,\n ShortVolume,\n AISummary,\n MetricsBreakdown,\n Document,\n DocumentSource,\n SentimentEntry,\n Story,\n StoryCluster,\n Quarter,\n InstitutionalFlow,\n InstitutionalFlowsResponse,\n Holder,\n MetricType,\n MetricsOptions,\n MetricDistributionOptions,\n ServingMetric,\n MetricDistribution,\n MentionData,\n MentionCount,\n SentimentData,\n MarketMood,\n KBEntity,\n} from \"./types.js\";\n\nexport { VERSION } from \"./version.js\";\n","export class SentiSenseError extends Error {\n status?: number;\n code?: string;\n\n constructor(message: string, status?: number, code?: string) {\n super(message);\n this.name = \"SentiSenseError\";\n this.status = status;\n this.code = code;\n }\n}\n\nexport class AuthenticationError extends SentiSenseError {\n constructor(message: string, status: number, code?: string) {\n super(message, status, code);\n this.name = \"AuthenticationError\";\n }\n}\n\nexport class NotFoundError extends SentiSenseError {\n constructor(message: string, code?: string) {\n super(message, 404, code);\n this.name = \"NotFoundError\";\n }\n}\n\nexport class RateLimitError extends SentiSenseError {\n constructor(message: string, code?: string) {\n super(message, 429, code);\n this.name = \"RateLimitError\";\n }\n}\n\nexport class APIError extends SentiSenseError {\n constructor(message: string, status: number, code?: string) {\n super(message, status, code);\n this.name = \"APIError\";\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Document,\n DocumentSource,\n GetByEntityOptions,\n GetBySourceOptions,\n GetByTickerOptions,\n GetByTickerRangeOptions,\n GetStoriesByTickerOptions,\n GetStoriesOptions,\n SearchDocumentsOptions,\n Story,\n} from \"../types.js\";\n\nexport class Documents {\n constructor(private client: APIClient) {}\n\n /** Get document metrics for a stock. */\n async getByTicker(ticker: string, options?: GetByTickerOptions): Promise<Document[]> {\n return this.client.get(`/api/v1/documents/ticker/${encodeURIComponent(ticker)}`, options);\n }\n\n /** Get document metrics for a stock within a date range. */\n async getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/ticker/${encodeURIComponent(ticker)}/range`,\n options,\n );\n }\n\n /** Get document metrics for a KB entity. */\n async getByEntity(entityId: string, options?: GetByEntityOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/entity/${encodeURIComponent(entityId)}`,\n options,\n );\n }\n\n /** Smart search with natural language query parsing. */\n async search(query: string, options?: SearchDocumentsOptions): Promise<Document[]> {\n return this.client.get(\"/api/v1/documents/search\", { query, ...options });\n }\n\n /** Get latest document metrics from a source type. */\n async getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/source/${encodeURIComponent(source)}`,\n options,\n );\n }\n\n /** Get AI-curated news story clusters. */\n async getStories(options?: GetStoriesOptions): Promise<Story[]> {\n return this.client.get(\"/api/v1/documents/stories\", options);\n }\n\n /** Get stories for a specific stock. */\n async getStoriesByTicker(\n ticker: string,\n options?: GetStoriesByTickerOptions,\n ): Promise<Story[]> {\n return this.client.get(\n `/api/v1/documents/stories/ticker/${encodeURIComponent(ticker)}`,\n options,\n );\n }\n\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n EntityMetricsDateRange,\n GetMentionCountOptions,\n GetMentionsOptions,\n GetSentimentBySourceOptions,\n MentionCount,\n MentionData,\n MetricType,\n MetricsOptions,\n MetricDistributionOptions,\n SentimentData,\n ServingMetric,\n MetricDistribution,\n} from \"../types.js\";\n\nexport class EntityMetrics {\n constructor(private client: APIClient) {}\n\n // ── v2 API methods ──────────────────────────────────────────\n\n /**\n * Get time-series metric data for an entity using the v2 Serving Metrics API.\n *\n * @param symbol Ticker symbol (e.g. \"AAPL\") — the backend resolves the entity.\n * @param options Metric type and optional time range / resolution.\n */\n async getMetrics(\n symbol: string,\n options: MetricsOptions = {},\n ): Promise<ServingMetric[]> {\n const { metricType = \"sentiment\", startTime, endTime, maxDataPoints } = options;\n return this.client.get(\n `/api/v2/metrics/entity/${encodeURIComponent(symbol)}/metric/${encodeURIComponent(metricType)}`,\n {\n ...(startTime !== undefined && { startTime }),\n ...(endTime !== undefined && { endTime }),\n ...(maxDataPoints !== undefined && { maxDataPoints }),\n },\n );\n }\n\n /**\n * Get distribution data for a metric, broken down by a dimension (default: source).\n *\n * @param symbol Ticker symbol (e.g. \"AAPL\").\n * @param metricType The metric to break down (e.g. \"mentions\", \"sentiment\").\n * @param options Optional dimension parameter.\n */\n async getDistribution(\n symbol: string,\n metricType: MetricType,\n options: MetricDistributionOptions = {},\n ): Promise<MetricDistribution> {\n const { dimension = \"source\" } = options;\n return this.client.get(\n `/api/v2/metrics/entity/${encodeURIComponent(symbol)}/distribution/${encodeURIComponent(metricType)}`,\n { dimension },\n );\n }\n\n // ── Deprecated v1 methods (kept for backward compatibility) ─\n\n /**\n * @deprecated Use `getMetrics(symbol, { metricType: \"mentions\" })` instead.\n */\n async getMentions(symbol: string, options?: GetMentionsOptions): Promise<MentionData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions`,\n options,\n );\n }\n\n /**\n * @deprecated Use `getDistribution(symbol, \"mentions\", { dimension: \"source\" })` instead.\n */\n async getMentionCountBySource(\n symbol: string,\n options?: EntityMetricsDateRange,\n ): Promise<MentionCount> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count/by-source`,\n options,\n );\n }\n\n /**\n * @deprecated Use `getMetrics(symbol, { metricType: \"mentions\" })` instead.\n */\n async getMentionCount(symbol: string, options?: GetMentionCountOptions): Promise<MentionCount> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count`,\n options,\n );\n }\n\n /**\n * @deprecated Use `getMetrics(symbol, { metricType: \"sentiment\" })` instead.\n */\n async getSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment`,\n options,\n );\n }\n\n /**\n * @deprecated Use `getDistribution(symbol, \"sentiment\", { dimension: \"source\" })` instead.\n */\n async getSentimentBySource(\n symbol: string,\n options?: GetSentimentBySourceOptions,\n ): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/by-source`,\n options,\n );\n }\n\n /**\n * @deprecated Use `getMetrics(symbol, { metricType: \"sentiment\" })` instead.\n */\n async getAverageSentiment(\n symbol: string,\n options?: EntityMetricsDateRange,\n ): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/average`,\n options,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n GetFlowsOptions,\n Holder,\n InstitutionalFlowsResponse,\n Quarter,\n} from \"../types.js\";\n\nexport class Institutional {\n constructor(private client: APIClient) {}\n\n /** Get available 13F reporting quarters. */\n async getQuarters(): Promise<Quarter[]> {\n return this.client.get(\"/api/v1/institutional/quarters\");\n }\n\n /** Get aggregate institutional activity per ticker for a quarter. */\n async getFlows(reportDate: string, options?: GetFlowsOptions): Promise<InstitutionalFlowsResponse> {\n return this.client.get(\"/api/v1/institutional/flows\", {\n reportDate,\n ...options,\n });\n }\n\n /** Get institutional holders for a specific stock. */\n async getHolders(ticker: string, reportDate: string): Promise<Holder[]> {\n return this.client.get(\n `/api/v1/institutional/holders/${encodeURIComponent(ticker)}`,\n { reportDate },\n );\n }\n\n /** Get activist investor positions (NEW or INCREASED). */\n async getActivists(reportDate: string): Promise<Holder[]> {\n return this.client.get(\"/api/v1/institutional/activist\", { reportDate });\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type { KBEntity } from \"../types.js\";\n\nexport class KB {\n constructor(private client: APIClient) {}\n\n /** Get popular entities for search suggestions. */\n async getPopularEntities(): Promise<KBEntity[]> {\n return this.client.get(\"/api/v1/kb/entities/popular\");\n }\n\n /** Get entity detail with metrics and relationships. */\n async getEntity(entityId: string): Promise<KBEntity> {\n return this.client.get(`/api/v1/kb/entities/${encodeURIComponent(entityId)}`);\n }\n\n /** Get all tracked entities. */\n async getAllEntities(): Promise<KBEntity[]> {\n return this.client.get(\"/api/v1/kb/entities/all\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type { MarketMood } from \"../types.js\";\n\nexport class MarketMoodResource {\n constructor(private client: APIClient) {}\n\n /** Get market mood data (scores, history, sectors). */\n async get(): Promise<MarketMood> {\n return this.client.get(\"/api/v2/market-mood\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n AISummary,\n ChartData,\n FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n MarketStatus,\n MetricsBreakdown,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n} from \"../types.js\";\n\nexport class Stocks {\n constructor(private client: APIClient) {}\n\n /** List all available ticker symbols. */\n async list(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks\");\n }\n\n /** List all stocks with name, kbEntityId, urlSlug. */\n async listDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/detailed\");\n }\n\n /** Get popular ticker symbols. */\n async listPopular(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks/popular\");\n }\n\n /** Get popular stocks with details. */\n async listPopularDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/popular/detailed\");\n }\n\n /** Get real-time price for a single ticker. */\n async getPrice(ticker: string): Promise<StockPrice> {\n return this.client.get(\"/api/v1/stocks/price\", { ticker });\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<Record<string, StockPrice>> {\n return this.client.get(\"/api/v1/stocks/prices\", {\n tickers: tickers.join(\",\"),\n });\n }\n\n /** Get batch company logo URLs. */\n async getImages(\n tickers: string[],\n options?: GetImagesOptions,\n ): Promise<Record<string, StockImage>> {\n return this.client.get(\"/api/v1/stocks/images\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get company profiles with branding, market cap, sector. */\n async getDescriptions(\n tickers: string[],\n options?: GetDescriptionsOptions,\n ): Promise<Record<string, StockProfile>> {\n return this.client.get(\"/api/v1/stocks/descriptions\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get peer/similar stocks. */\n async getSimilar(ticker: string, options?: GetSimilarOptions): Promise<StockDetail[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/similar`, options);\n }\n\n /** Get company profile (CEO, sector, industry, market data). */\n async getProfile(ticker: string, options?: GetProfileOptions): Promise<StockProfile> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/profile`, options);\n }\n\n /** Get related KB entities (people, products, partners). */\n async getEntities(ticker: string): Promise<StockEntity[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/entities`);\n }\n\n /** Get AI-generated stock analysis report. Requires PRO tier. */\n async getAISummary(ticker: string, options?: GetAISummaryOptions): Promise<AISummary> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/ai-summary`, options);\n }\n\n /** Get sentiment/mention metrics breakdown by entity. */\n async getMetricsBreakdown(\n ticker: string,\n metricType: string,\n options?: GetMetricsBreakdownOptions,\n ): Promise<MetricsBreakdown> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker)}/metrics/${encodeURIComponent(metricType)}/breakdown`,\n options,\n );\n }\n\n /** Get historical OHLCV chart data. */\n async getChart(ticker: string, options?: GetChartOptions): Promise<ChartData> {\n return this.client.get(\"/api/v1/stocks/chart\", { ticker, ...options });\n }\n\n /** Get current market open/closed/pre-market/after-hours status. */\n async getMarketStatus(): Promise<MarketStatus> {\n return this.client.get(\"/api/v1/stocks/market-status\");\n }\n\n /** Get financial statement data. */\n async getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals\", { ticker, ...options });\n }\n\n /** Get available fiscal periods. */\n async getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]> {\n return this.client.get(\"/api/v1/stocks/fundamentals/periods\", { ticker });\n }\n\n /** Get most recent fundamentals snapshot. */\n async getCurrentFundamentals(ticker: string): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals/current\", { ticker });\n }\n\n /** Get historical P/E, P/B, P/S ratios. */\n async getHistoricalRatios(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/ratios\", { ticker });\n }\n\n /** Get historical revenue data. */\n async getHistoricalRevenue(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/revenue\", { ticker });\n }\n\n /** Get short interest metrics (FINRA). */\n async getShortInterest(ticker: string): Promise<ShortInterest> {\n return this.client.get(\"/api/v1/stocks/short-interest\", { ticker });\n }\n\n /** Get float information. */\n async getFloat(ticker: string): Promise<FloatInfo> {\n return this.client.get(\"/api/v1/stocks/float\", { ticker });\n }\n\n /** Get short volume trading data. */\n async getShortVolume(ticker: string): Promise<ShortVolume> {\n return this.client.get(\"/api/v1/stocks/short-volume\", { ticker });\n }\n}\n","export const VERSION = \"0.4.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { Institutional } from \"./resources/institutional.js\";\nimport { KB } from \"./resources/kb.js\";\nimport { MarketMoodResource } from \"./resources/marketMood.js\";\nimport { Stocks } from \"./resources/stocks.js\";\nimport type { SentiSenseOptions } from \"./types.js\";\nimport { VERSION } from \"./version.js\";\n\nconst DEFAULT_BASE_URL = \"https://app.sentisense.ai\";\nconst DEFAULT_TIMEOUT = 30_000;\n\n/** @internal HTTP interface exposed to resource classes. */\nexport interface APIClient {\n get<T = unknown>(path: string, params?: object): Promise<T>;\n}\n\nexport class SentiSense implements APIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeout: number;\n\n readonly stocks: Stocks;\n readonly documents: Documents;\n readonly institutional: Institutional;\n readonly entityMetrics: EntityMetrics;\n readonly marketMood: MarketMoodResource;\n readonly kb: KB;\n\n constructor(options: SentiSenseOptions = {}) {\n this.apiKey = options.apiKey;\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT;\n\n this.stocks = new Stocks(this);\n this.documents = new Documents(this);\n this.institutional = new Institutional(this);\n this.entityMetrics = new EntityMetrics(this);\n this.marketMood = new MarketMoodResource(this);\n this.kb = new KB(this);\n }\n\n /** @internal */\n async get<T = unknown>(path: string, params?: object): Promise<T> {\n const url = this.buildUrl(path, params);\n const headers: Record<string, string> = {};\n\n if (this.apiKey) {\n headers[\"X-SentiSense-API-Key\"] = this.apiKey;\n }\n\n // User-Agent is only set in Node.js (browsers disallow it)\n if (typeof process !== \"undefined\" && process.versions?.node) {\n headers[\"User-Agent\"] = `sentisense-node/${VERSION}`;\n }\n\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n const response = await fetch(url, {\n method: \"GET\",\n headers,\n signal: controller.signal,\n });\n\n if (!response.ok) {\n await this.handleErrorResponse(response);\n }\n\n return (await response.json()) as T;\n } catch (error) {\n if (error instanceof SentiSenseError) throw error;\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new SentiSenseError(`Request timed out after ${this.timeout}ms`);\n }\n throw new SentiSenseError(\n error instanceof Error ? error.message : \"Unknown error\",\n );\n } finally {\n clearTimeout(timer);\n }\n }\n\n private buildUrl(path: string, params?: object): string {\n const url = new URL(path, this.baseUrl);\n if (params) {\n for (const [key, value] of Object.entries(params as Record<string, unknown>)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n return url.toString();\n }\n\n private async handleErrorResponse(response: Response): Promise<never> {\n let body: { error?: string; message?: string } = {};\n try {\n body = await response.json();\n } catch {\n // Response may not be JSON\n }\n\n const message = body.message ?? response.statusText ?? \"API request failed\";\n const code = body.error;\n\n switch (response.status) {\n case 401:\n case 403:\n throw new AuthenticationError(message, response.status, code);\n case 404:\n throw new NotFoundError(message, code);\n case 429:\n throw new RateLimitError(message, code);\n default:\n throw new APIError(message, response.status, code);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EAIzC,YAAY,SAAiB,QAAiB,MAAe;AAC3D,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,sBAAN,cAAkC,gBAAgB;AAAA,EACvD,YAAY,SAAiB,QAAgB,MAAe;AAC1D,UAAM,SAAS,QAAQ,IAAI;AAC3B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAAN,cAA4B,gBAAgB;AAAA,EACjD,YAAY,SAAiB,MAAe;AAC1C,UAAM,SAAS,KAAK,IAAI;AACxB,SAAK,OAAO;AAAA,EACd;AACF;AAE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C;AAClD,QAAI;AACF,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B,QAAQ;AAAA,IAER;AAEA,UAAM,UAAU,KAAK,WAAW,SAAS,cAAc;AACvD,UAAM,OAAO,KAAK;AAElB,YAAQ,SAAS,QAAQ;AAAA,MACvB,KAAK;AAAA,MACL,KAAK;AACH,cAAM,IAAI,oBAAoB,SAAS,SAAS,QAAQ,IAAI;AAAA,MAC9D,KAAK;AACH,cAAM,IAAI,cAAc,SAAS,IAAI;AAAA,MACvC,KAAK;AACH,cAAM,IAAI,eAAe,SAAS,IAAI;AAAA,MACxC;AACE,cAAM,IAAI,SAAS,SAAS,SAAS,QAAQ,IAAI;AAAA,IACrD;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -219,25 +219,60 @@ interface InstitutionalFlowsResponse {
|
|
|
219
219
|
interface GetFlowsOptions {
|
|
220
220
|
limit?: number;
|
|
221
221
|
}
|
|
222
|
+
/** Supported metric types for the v2 Serving Metrics API. */
|
|
223
|
+
type MetricType = "mentions" | "sentiment" | "sentisense_score" | "social_dominance" | "creators";
|
|
224
|
+
/** Options for `EntityMetrics.getMetrics()`. */
|
|
225
|
+
interface MetricsOptions {
|
|
226
|
+
/** Metric to retrieve. Defaults to `"sentiment"`. */
|
|
227
|
+
metricType?: MetricType;
|
|
228
|
+
/** Start of the time range (epoch milliseconds). */
|
|
229
|
+
startTime?: number;
|
|
230
|
+
/** End of the time range (epoch milliseconds). */
|
|
231
|
+
endTime?: number;
|
|
232
|
+
/** Maximum number of data points to return. */
|
|
233
|
+
maxDataPoints?: number;
|
|
234
|
+
}
|
|
235
|
+
/** Options for `EntityMetrics.getDistribution()`. */
|
|
236
|
+
interface MetricDistributionOptions {
|
|
237
|
+
/** Dimension to break the metric down by. Defaults to `"source"`. */
|
|
238
|
+
dimension?: string;
|
|
239
|
+
}
|
|
240
|
+
/** A single data point returned by the v2 time-series metrics endpoint. */
|
|
241
|
+
interface ServingMetric {
|
|
242
|
+
timestamp: number;
|
|
243
|
+
value: number;
|
|
244
|
+
[key: string]: unknown;
|
|
245
|
+
}
|
|
246
|
+
/** Distribution data returned by the v2 distribution endpoint. */
|
|
247
|
+
interface MetricDistribution {
|
|
248
|
+
[key: string]: unknown;
|
|
249
|
+
}
|
|
250
|
+
/** @deprecated Use `ServingMetric[]` from the v2 API instead. */
|
|
222
251
|
interface MentionData {
|
|
223
252
|
[key: string]: unknown;
|
|
224
253
|
}
|
|
254
|
+
/** @deprecated Use `ServingMetric[]` from the v2 API instead. */
|
|
225
255
|
interface MentionCount {
|
|
226
256
|
[key: string]: unknown;
|
|
227
257
|
}
|
|
258
|
+
/** @deprecated Use `ServingMetric[]` from the v2 API instead. */
|
|
228
259
|
interface SentimentData {
|
|
229
260
|
[key: string]: unknown;
|
|
230
261
|
}
|
|
262
|
+
/** @deprecated */
|
|
231
263
|
interface EntityMetricsDateRange {
|
|
232
264
|
startDate?: string;
|
|
233
265
|
endDate?: string;
|
|
234
266
|
}
|
|
267
|
+
/** @deprecated */
|
|
235
268
|
interface GetMentionsOptions extends EntityMetricsDateRange {
|
|
236
269
|
source?: DocumentSource;
|
|
237
270
|
}
|
|
271
|
+
/** @deprecated */
|
|
238
272
|
interface GetMentionCountOptions extends EntityMetricsDateRange {
|
|
239
273
|
source?: DocumentSource;
|
|
240
274
|
}
|
|
275
|
+
/** @deprecated */
|
|
241
276
|
interface GetSentimentBySourceOptions {
|
|
242
277
|
date?: string;
|
|
243
278
|
}
|
|
@@ -272,17 +307,44 @@ declare class Documents {
|
|
|
272
307
|
declare class EntityMetrics {
|
|
273
308
|
private client;
|
|
274
309
|
constructor(client: APIClient);
|
|
275
|
-
/**
|
|
310
|
+
/**
|
|
311
|
+
* Get time-series metric data for an entity using the v2 Serving Metrics API.
|
|
312
|
+
*
|
|
313
|
+
* @param symbol Ticker symbol (e.g. "AAPL") — the backend resolves the entity.
|
|
314
|
+
* @param options Metric type and optional time range / resolution.
|
|
315
|
+
*/
|
|
316
|
+
getMetrics(symbol: string, options?: MetricsOptions): Promise<ServingMetric[]>;
|
|
317
|
+
/**
|
|
318
|
+
* Get distribution data for a metric, broken down by a dimension (default: source).
|
|
319
|
+
*
|
|
320
|
+
* @param symbol Ticker symbol (e.g. "AAPL").
|
|
321
|
+
* @param metricType The metric to break down (e.g. "mentions", "sentiment").
|
|
322
|
+
* @param options Optional dimension parameter.
|
|
323
|
+
*/
|
|
324
|
+
getDistribution(symbol: string, metricType: MetricType, options?: MetricDistributionOptions): Promise<MetricDistribution>;
|
|
325
|
+
/**
|
|
326
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
|
|
327
|
+
*/
|
|
276
328
|
getMentions(symbol: string, options?: GetMentionsOptions): Promise<MentionData>;
|
|
277
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* @deprecated Use `getDistribution(symbol, "mentions", { dimension: "source" })` instead.
|
|
331
|
+
*/
|
|
278
332
|
getMentionCountBySource(symbol: string, options?: EntityMetricsDateRange): Promise<MentionCount>;
|
|
279
|
-
/**
|
|
333
|
+
/**
|
|
334
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
|
|
335
|
+
*/
|
|
280
336
|
getMentionCount(symbol: string, options?: GetMentionCountOptions): Promise<MentionCount>;
|
|
281
|
-
/**
|
|
337
|
+
/**
|
|
338
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
|
|
339
|
+
*/
|
|
282
340
|
getSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData>;
|
|
283
|
-
/**
|
|
341
|
+
/**
|
|
342
|
+
* @deprecated Use `getDistribution(symbol, "sentiment", { dimension: "source" })` instead.
|
|
343
|
+
*/
|
|
284
344
|
getSentimentBySource(symbol: string, options?: GetSentimentBySourceOptions): Promise<SentimentData>;
|
|
285
|
-
/**
|
|
345
|
+
/**
|
|
346
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
|
|
347
|
+
*/
|
|
286
348
|
getAverageSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData>;
|
|
287
349
|
}
|
|
288
350
|
|
|
@@ -407,6 +469,6 @@ declare class APIError extends SentiSenseError {
|
|
|
407
469
|
constructor(message: string, status: number, code?: string);
|
|
408
470
|
}
|
|
409
471
|
|
|
410
|
-
declare const VERSION = "0.
|
|
472
|
+
declare const VERSION = "0.4.0";
|
|
411
473
|
|
|
412
|
-
export { type AISummary, APIError, AuthenticationError, type ChartData, type ChartDataPoint, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type Holder, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type MarketMood, type MarketStatus, type MentionCount, type MentionData, type MetricsBreakdown, NotFoundError, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ShortInterest, type ShortVolume, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type Story, type StoryCluster, VERSION, SentiSense as default };
|
|
474
|
+
export { type AISummary, APIError, AuthenticationError, type ChartData, type ChartDataPoint, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type Holder, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type MarketMood, type MarketStatus, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type Story, type StoryCluster, VERSION, SentiSense as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -219,25 +219,60 @@ interface InstitutionalFlowsResponse {
|
|
|
219
219
|
interface GetFlowsOptions {
|
|
220
220
|
limit?: number;
|
|
221
221
|
}
|
|
222
|
+
/** Supported metric types for the v2 Serving Metrics API. */
|
|
223
|
+
type MetricType = "mentions" | "sentiment" | "sentisense_score" | "social_dominance" | "creators";
|
|
224
|
+
/** Options for `EntityMetrics.getMetrics()`. */
|
|
225
|
+
interface MetricsOptions {
|
|
226
|
+
/** Metric to retrieve. Defaults to `"sentiment"`. */
|
|
227
|
+
metricType?: MetricType;
|
|
228
|
+
/** Start of the time range (epoch milliseconds). */
|
|
229
|
+
startTime?: number;
|
|
230
|
+
/** End of the time range (epoch milliseconds). */
|
|
231
|
+
endTime?: number;
|
|
232
|
+
/** Maximum number of data points to return. */
|
|
233
|
+
maxDataPoints?: number;
|
|
234
|
+
}
|
|
235
|
+
/** Options for `EntityMetrics.getDistribution()`. */
|
|
236
|
+
interface MetricDistributionOptions {
|
|
237
|
+
/** Dimension to break the metric down by. Defaults to `"source"`. */
|
|
238
|
+
dimension?: string;
|
|
239
|
+
}
|
|
240
|
+
/** A single data point returned by the v2 time-series metrics endpoint. */
|
|
241
|
+
interface ServingMetric {
|
|
242
|
+
timestamp: number;
|
|
243
|
+
value: number;
|
|
244
|
+
[key: string]: unknown;
|
|
245
|
+
}
|
|
246
|
+
/** Distribution data returned by the v2 distribution endpoint. */
|
|
247
|
+
interface MetricDistribution {
|
|
248
|
+
[key: string]: unknown;
|
|
249
|
+
}
|
|
250
|
+
/** @deprecated Use `ServingMetric[]` from the v2 API instead. */
|
|
222
251
|
interface MentionData {
|
|
223
252
|
[key: string]: unknown;
|
|
224
253
|
}
|
|
254
|
+
/** @deprecated Use `ServingMetric[]` from the v2 API instead. */
|
|
225
255
|
interface MentionCount {
|
|
226
256
|
[key: string]: unknown;
|
|
227
257
|
}
|
|
258
|
+
/** @deprecated Use `ServingMetric[]` from the v2 API instead. */
|
|
228
259
|
interface SentimentData {
|
|
229
260
|
[key: string]: unknown;
|
|
230
261
|
}
|
|
262
|
+
/** @deprecated */
|
|
231
263
|
interface EntityMetricsDateRange {
|
|
232
264
|
startDate?: string;
|
|
233
265
|
endDate?: string;
|
|
234
266
|
}
|
|
267
|
+
/** @deprecated */
|
|
235
268
|
interface GetMentionsOptions extends EntityMetricsDateRange {
|
|
236
269
|
source?: DocumentSource;
|
|
237
270
|
}
|
|
271
|
+
/** @deprecated */
|
|
238
272
|
interface GetMentionCountOptions extends EntityMetricsDateRange {
|
|
239
273
|
source?: DocumentSource;
|
|
240
274
|
}
|
|
275
|
+
/** @deprecated */
|
|
241
276
|
interface GetSentimentBySourceOptions {
|
|
242
277
|
date?: string;
|
|
243
278
|
}
|
|
@@ -272,17 +307,44 @@ declare class Documents {
|
|
|
272
307
|
declare class EntityMetrics {
|
|
273
308
|
private client;
|
|
274
309
|
constructor(client: APIClient);
|
|
275
|
-
/**
|
|
310
|
+
/**
|
|
311
|
+
* Get time-series metric data for an entity using the v2 Serving Metrics API.
|
|
312
|
+
*
|
|
313
|
+
* @param symbol Ticker symbol (e.g. "AAPL") — the backend resolves the entity.
|
|
314
|
+
* @param options Metric type and optional time range / resolution.
|
|
315
|
+
*/
|
|
316
|
+
getMetrics(symbol: string, options?: MetricsOptions): Promise<ServingMetric[]>;
|
|
317
|
+
/**
|
|
318
|
+
* Get distribution data for a metric, broken down by a dimension (default: source).
|
|
319
|
+
*
|
|
320
|
+
* @param symbol Ticker symbol (e.g. "AAPL").
|
|
321
|
+
* @param metricType The metric to break down (e.g. "mentions", "sentiment").
|
|
322
|
+
* @param options Optional dimension parameter.
|
|
323
|
+
*/
|
|
324
|
+
getDistribution(symbol: string, metricType: MetricType, options?: MetricDistributionOptions): Promise<MetricDistribution>;
|
|
325
|
+
/**
|
|
326
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
|
|
327
|
+
*/
|
|
276
328
|
getMentions(symbol: string, options?: GetMentionsOptions): Promise<MentionData>;
|
|
277
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* @deprecated Use `getDistribution(symbol, "mentions", { dimension: "source" })` instead.
|
|
331
|
+
*/
|
|
278
332
|
getMentionCountBySource(symbol: string, options?: EntityMetricsDateRange): Promise<MentionCount>;
|
|
279
|
-
/**
|
|
333
|
+
/**
|
|
334
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
|
|
335
|
+
*/
|
|
280
336
|
getMentionCount(symbol: string, options?: GetMentionCountOptions): Promise<MentionCount>;
|
|
281
|
-
/**
|
|
337
|
+
/**
|
|
338
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
|
|
339
|
+
*/
|
|
282
340
|
getSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData>;
|
|
283
|
-
/**
|
|
341
|
+
/**
|
|
342
|
+
* @deprecated Use `getDistribution(symbol, "sentiment", { dimension: "source" })` instead.
|
|
343
|
+
*/
|
|
284
344
|
getSentimentBySource(symbol: string, options?: GetSentimentBySourceOptions): Promise<SentimentData>;
|
|
285
|
-
/**
|
|
345
|
+
/**
|
|
346
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
|
|
347
|
+
*/
|
|
286
348
|
getAverageSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData>;
|
|
287
349
|
}
|
|
288
350
|
|
|
@@ -407,6 +469,6 @@ declare class APIError extends SentiSenseError {
|
|
|
407
469
|
constructor(message: string, status: number, code?: string);
|
|
408
470
|
}
|
|
409
471
|
|
|
410
|
-
declare const VERSION = "0.
|
|
472
|
+
declare const VERSION = "0.4.0";
|
|
411
473
|
|
|
412
|
-
export { type AISummary, APIError, AuthenticationError, type ChartData, type ChartDataPoint, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type Holder, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type MarketMood, type MarketStatus, type MentionCount, type MentionData, type MetricsBreakdown, NotFoundError, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ShortInterest, type ShortVolume, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type Story, type StoryCluster, VERSION, SentiSense as default };
|
|
474
|
+
export { type AISummary, APIError, AuthenticationError, type ChartData, type ChartDataPoint, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type Holder, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type MarketMood, type MarketStatus, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type Story, type StoryCluster, VERSION, SentiSense as default };
|
package/dist/index.mjs
CHANGED
|
@@ -84,42 +84,87 @@ var EntityMetrics = class {
|
|
|
84
84
|
constructor(client) {
|
|
85
85
|
this.client = client;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
// ── v2 API methods ──────────────────────────────────────────
|
|
88
|
+
/**
|
|
89
|
+
* Get time-series metric data for an entity using the v2 Serving Metrics API.
|
|
90
|
+
*
|
|
91
|
+
* @param symbol Ticker symbol (e.g. "AAPL") — the backend resolves the entity.
|
|
92
|
+
* @param options Metric type and optional time range / resolution.
|
|
93
|
+
*/
|
|
94
|
+
async getMetrics(symbol, options = {}) {
|
|
95
|
+
const { metricType = "sentiment", startTime, endTime, maxDataPoints } = options;
|
|
96
|
+
return this.client.get(
|
|
97
|
+
`/api/v2/metrics/entity/${encodeURIComponent(symbol)}/metric/${encodeURIComponent(metricType)}`,
|
|
98
|
+
{
|
|
99
|
+
...startTime !== void 0 && { startTime },
|
|
100
|
+
...endTime !== void 0 && { endTime },
|
|
101
|
+
...maxDataPoints !== void 0 && { maxDataPoints }
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get distribution data for a metric, broken down by a dimension (default: source).
|
|
107
|
+
*
|
|
108
|
+
* @param symbol Ticker symbol (e.g. "AAPL").
|
|
109
|
+
* @param metricType The metric to break down (e.g. "mentions", "sentiment").
|
|
110
|
+
* @param options Optional dimension parameter.
|
|
111
|
+
*/
|
|
112
|
+
async getDistribution(symbol, metricType, options = {}) {
|
|
113
|
+
const { dimension = "source" } = options;
|
|
114
|
+
return this.client.get(
|
|
115
|
+
`/api/v2/metrics/entity/${encodeURIComponent(symbol)}/distribution/${encodeURIComponent(metricType)}`,
|
|
116
|
+
{ dimension }
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
// ── Deprecated v1 methods (kept for backward compatibility) ─
|
|
120
|
+
/**
|
|
121
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
|
|
122
|
+
*/
|
|
88
123
|
async getMentions(symbol, options) {
|
|
89
124
|
return this.client.get(
|
|
90
125
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions`,
|
|
91
126
|
options
|
|
92
127
|
);
|
|
93
128
|
}
|
|
94
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* @deprecated Use `getDistribution(symbol, "mentions", { dimension: "source" })` instead.
|
|
131
|
+
*/
|
|
95
132
|
async getMentionCountBySource(symbol, options) {
|
|
96
133
|
return this.client.get(
|
|
97
134
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count/by-source`,
|
|
98
135
|
options
|
|
99
136
|
);
|
|
100
137
|
}
|
|
101
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
|
|
140
|
+
*/
|
|
102
141
|
async getMentionCount(symbol, options) {
|
|
103
142
|
return this.client.get(
|
|
104
143
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count`,
|
|
105
144
|
options
|
|
106
145
|
);
|
|
107
146
|
}
|
|
108
|
-
/**
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
|
|
149
|
+
*/
|
|
109
150
|
async getSentiment(symbol, options) {
|
|
110
151
|
return this.client.get(
|
|
111
152
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment`,
|
|
112
153
|
options
|
|
113
154
|
);
|
|
114
155
|
}
|
|
115
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* @deprecated Use `getDistribution(symbol, "sentiment", { dimension: "source" })` instead.
|
|
158
|
+
*/
|
|
116
159
|
async getSentimentBySource(symbol, options) {
|
|
117
160
|
return this.client.get(
|
|
118
161
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/by-source`,
|
|
119
162
|
options
|
|
120
163
|
);
|
|
121
164
|
}
|
|
122
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
|
|
167
|
+
*/
|
|
123
168
|
async getAverageSentiment(symbol, options) {
|
|
124
169
|
return this.client.get(
|
|
125
170
|
`/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/average`,
|
|
@@ -298,7 +343,7 @@ var Stocks = class {
|
|
|
298
343
|
};
|
|
299
344
|
|
|
300
345
|
// src/version.ts
|
|
301
|
-
var VERSION = "0.
|
|
346
|
+
var VERSION = "0.4.0";
|
|
302
347
|
|
|
303
348
|
// src/client.ts
|
|
304
349
|
var DEFAULT_BASE_URL = "https://app.sentisense.ai";
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/resources/documents.ts","../src/resources/entityMetrics.ts","../src/resources/institutional.ts","../src/resources/kb.ts","../src/resources/marketMood.ts","../src/resources/stocks.ts","../src/version.ts","../src/client.ts"],"sourcesContent":["export class SentiSenseError extends Error {\n status?: number;\n code?: string;\n\n constructor(message: string, status?: number, code?: string) {\n super(message);\n this.name = \"SentiSenseError\";\n this.status = status;\n this.code = code;\n }\n}\n\nexport class AuthenticationError extends SentiSenseError {\n constructor(message: string, status: number, code?: string) {\n super(message, status, code);\n this.name = \"AuthenticationError\";\n }\n}\n\nexport class NotFoundError extends SentiSenseError {\n constructor(message: string, code?: string) {\n super(message, 404, code);\n this.name = \"NotFoundError\";\n }\n}\n\nexport class RateLimitError extends SentiSenseError {\n constructor(message: string, code?: string) {\n super(message, 429, code);\n this.name = \"RateLimitError\";\n }\n}\n\nexport class APIError extends SentiSenseError {\n constructor(message: string, status: number, code?: string) {\n super(message, status, code);\n this.name = \"APIError\";\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Document,\n DocumentSource,\n GetByEntityOptions,\n GetBySourceOptions,\n GetByTickerOptions,\n GetByTickerRangeOptions,\n GetStoriesByTickerOptions,\n GetStoriesOptions,\n SearchDocumentsOptions,\n Story,\n} from \"../types.js\";\n\nexport class Documents {\n constructor(private client: APIClient) {}\n\n /** Get document metrics for a stock. */\n async getByTicker(ticker: string, options?: GetByTickerOptions): Promise<Document[]> {\n return this.client.get(`/api/v1/documents/ticker/${encodeURIComponent(ticker)}`, options);\n }\n\n /** Get document metrics for a stock within a date range. */\n async getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/ticker/${encodeURIComponent(ticker)}/range`,\n options,\n );\n }\n\n /** Get document metrics for a KB entity. */\n async getByEntity(entityId: string, options?: GetByEntityOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/entity/${encodeURIComponent(entityId)}`,\n options,\n );\n }\n\n /** Smart search with natural language query parsing. */\n async search(query: string, options?: SearchDocumentsOptions): Promise<Document[]> {\n return this.client.get(\"/api/v1/documents/search\", { query, ...options });\n }\n\n /** Get latest document metrics from a source type. */\n async getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/source/${encodeURIComponent(source)}`,\n options,\n );\n }\n\n /** Get AI-curated news story clusters. */\n async getStories(options?: GetStoriesOptions): Promise<Story[]> {\n return this.client.get(\"/api/v1/documents/stories\", options);\n }\n\n /** Get stories for a specific stock. */\n async getStoriesByTicker(\n ticker: string,\n options?: GetStoriesByTickerOptions,\n ): Promise<Story[]> {\n return this.client.get(\n `/api/v1/documents/stories/ticker/${encodeURIComponent(ticker)}`,\n options,\n );\n }\n\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n EntityMetricsDateRange,\n GetMentionCountOptions,\n GetMentionsOptions,\n GetSentimentBySourceOptions,\n MentionCount,\n MentionData,\n SentimentData,\n} from \"../types.js\";\n\nexport class EntityMetrics {\n constructor(private client: APIClient) {}\n\n /** Get mention data for a stock. */\n async getMentions(symbol: string, options?: GetMentionsOptions): Promise<MentionData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions`,\n options,\n );\n }\n\n /** Get mention counts broken down by source. */\n async getMentionCountBySource(\n symbol: string,\n options?: EntityMetricsDateRange,\n ): Promise<MentionCount> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count/by-source`,\n options,\n );\n }\n\n /** Get total mention count. */\n async getMentionCount(symbol: string, options?: GetMentionCountOptions): Promise<MentionCount> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count`,\n options,\n );\n }\n\n /** Get sentiment data for a stock. */\n async getSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment`,\n options,\n );\n }\n\n /** Get sentiment broken down by source. */\n async getSentimentBySource(\n symbol: string,\n options?: GetSentimentBySourceOptions,\n ): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/by-source`,\n options,\n );\n }\n\n /** Get average sentiment score. */\n async getAverageSentiment(\n symbol: string,\n options?: EntityMetricsDateRange,\n ): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/average`,\n options,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n GetFlowsOptions,\n Holder,\n InstitutionalFlowsResponse,\n Quarter,\n} from \"../types.js\";\n\nexport class Institutional {\n constructor(private client: APIClient) {}\n\n /** Get available 13F reporting quarters. */\n async getQuarters(): Promise<Quarter[]> {\n return this.client.get(\"/api/v1/institutional/quarters\");\n }\n\n /** Get aggregate institutional activity per ticker for a quarter. */\n async getFlows(reportDate: string, options?: GetFlowsOptions): Promise<InstitutionalFlowsResponse> {\n return this.client.get(\"/api/v1/institutional/flows\", {\n reportDate,\n ...options,\n });\n }\n\n /** Get institutional holders for a specific stock. */\n async getHolders(ticker: string, reportDate: string): Promise<Holder[]> {\n return this.client.get(\n `/api/v1/institutional/holders/${encodeURIComponent(ticker)}`,\n { reportDate },\n );\n }\n\n /** Get activist investor positions (NEW or INCREASED). */\n async getActivists(reportDate: string): Promise<Holder[]> {\n return this.client.get(\"/api/v1/institutional/activist\", { reportDate });\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type { KBEntity } from \"../types.js\";\n\nexport class KB {\n constructor(private client: APIClient) {}\n\n /** Get popular entities for search suggestions. */\n async getPopularEntities(): Promise<KBEntity[]> {\n return this.client.get(\"/api/v1/kb/entities/popular\");\n }\n\n /** Get entity detail with metrics and relationships. */\n async getEntity(entityId: string): Promise<KBEntity> {\n return this.client.get(`/api/v1/kb/entities/${encodeURIComponent(entityId)}`);\n }\n\n /** Get all tracked entities. */\n async getAllEntities(): Promise<KBEntity[]> {\n return this.client.get(\"/api/v1/kb/entities/all\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type { MarketMood } from \"../types.js\";\n\nexport class MarketMoodResource {\n constructor(private client: APIClient) {}\n\n /** Get market mood data (scores, history, sectors). */\n async get(): Promise<MarketMood> {\n return this.client.get(\"/api/v2/market-mood\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n AISummary,\n ChartData,\n FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n MarketStatus,\n MetricsBreakdown,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n} from \"../types.js\";\n\nexport class Stocks {\n constructor(private client: APIClient) {}\n\n /** List all available ticker symbols. */\n async list(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks\");\n }\n\n /** List all stocks with name, kbEntityId, urlSlug. */\n async listDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/detailed\");\n }\n\n /** Get popular ticker symbols. */\n async listPopular(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks/popular\");\n }\n\n /** Get popular stocks with details. */\n async listPopularDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/popular/detailed\");\n }\n\n /** Get real-time price for a single ticker. */\n async getPrice(ticker: string): Promise<StockPrice> {\n return this.client.get(\"/api/v1/stocks/price\", { ticker });\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<Record<string, StockPrice>> {\n return this.client.get(\"/api/v1/stocks/prices\", {\n tickers: tickers.join(\",\"),\n });\n }\n\n /** Get batch company logo URLs. */\n async getImages(\n tickers: string[],\n options?: GetImagesOptions,\n ): Promise<Record<string, StockImage>> {\n return this.client.get(\"/api/v1/stocks/images\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get company profiles with branding, market cap, sector. */\n async getDescriptions(\n tickers: string[],\n options?: GetDescriptionsOptions,\n ): Promise<Record<string, StockProfile>> {\n return this.client.get(\"/api/v1/stocks/descriptions\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get peer/similar stocks. */\n async getSimilar(ticker: string, options?: GetSimilarOptions): Promise<StockDetail[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/similar`, options);\n }\n\n /** Get company profile (CEO, sector, industry, market data). */\n async getProfile(ticker: string, options?: GetProfileOptions): Promise<StockProfile> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/profile`, options);\n }\n\n /** Get related KB entities (people, products, partners). */\n async getEntities(ticker: string): Promise<StockEntity[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/entities`);\n }\n\n /** Get AI-generated stock analysis report. Requires PRO tier. */\n async getAISummary(ticker: string, options?: GetAISummaryOptions): Promise<AISummary> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/ai-summary`, options);\n }\n\n /** Get sentiment/mention metrics breakdown by entity. */\n async getMetricsBreakdown(\n ticker: string,\n metricType: string,\n options?: GetMetricsBreakdownOptions,\n ): Promise<MetricsBreakdown> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker)}/metrics/${encodeURIComponent(metricType)}/breakdown`,\n options,\n );\n }\n\n /** Get historical OHLCV chart data. */\n async getChart(ticker: string, options?: GetChartOptions): Promise<ChartData> {\n return this.client.get(\"/api/v1/stocks/chart\", { ticker, ...options });\n }\n\n /** Get current market open/closed/pre-market/after-hours status. */\n async getMarketStatus(): Promise<MarketStatus> {\n return this.client.get(\"/api/v1/stocks/market-status\");\n }\n\n /** Get financial statement data. */\n async getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals\", { ticker, ...options });\n }\n\n /** Get available fiscal periods. */\n async getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]> {\n return this.client.get(\"/api/v1/stocks/fundamentals/periods\", { ticker });\n }\n\n /** Get most recent fundamentals snapshot. */\n async getCurrentFundamentals(ticker: string): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals/current\", { ticker });\n }\n\n /** Get historical P/E, P/B, P/S ratios. */\n async getHistoricalRatios(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/ratios\", { ticker });\n }\n\n /** Get historical revenue data. */\n async getHistoricalRevenue(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/revenue\", { ticker });\n }\n\n /** Get short interest metrics (FINRA). */\n async getShortInterest(ticker: string): Promise<ShortInterest> {\n return this.client.get(\"/api/v1/stocks/short-interest\", { ticker });\n }\n\n /** Get float information. */\n async getFloat(ticker: string): Promise<FloatInfo> {\n return this.client.get(\"/api/v1/stocks/float\", { ticker });\n }\n\n /** Get short volume trading data. */\n async getShortVolume(ticker: string): Promise<ShortVolume> {\n return this.client.get(\"/api/v1/stocks/short-volume\", { ticker });\n }\n}\n","export const VERSION = \"0.3.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { Institutional } from \"./resources/institutional.js\";\nimport { KB } from \"./resources/kb.js\";\nimport { MarketMoodResource } from \"./resources/marketMood.js\";\nimport { Stocks } from \"./resources/stocks.js\";\nimport type { SentiSenseOptions } from \"./types.js\";\nimport { VERSION } from \"./version.js\";\n\nconst DEFAULT_BASE_URL = \"https://app.sentisense.ai\";\nconst DEFAULT_TIMEOUT = 30_000;\n\n/** @internal HTTP interface exposed to resource classes. */\nexport interface APIClient {\n get<T = unknown>(path: string, params?: object): Promise<T>;\n}\n\nexport class SentiSense implements APIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeout: number;\n\n readonly stocks: Stocks;\n readonly documents: Documents;\n readonly institutional: Institutional;\n readonly entityMetrics: EntityMetrics;\n readonly marketMood: MarketMoodResource;\n readonly kb: KB;\n\n constructor(options: SentiSenseOptions = {}) {\n this.apiKey = options.apiKey;\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT;\n\n this.stocks = new Stocks(this);\n this.documents = new Documents(this);\n this.institutional = new Institutional(this);\n this.entityMetrics = new EntityMetrics(this);\n this.marketMood = new MarketMoodResource(this);\n this.kb = new KB(this);\n }\n\n /** @internal */\n async get<T = unknown>(path: string, params?: object): Promise<T> {\n const url = this.buildUrl(path, params);\n const headers: Record<string, string> = {};\n\n if (this.apiKey) {\n headers[\"X-SentiSense-API-Key\"] = this.apiKey;\n }\n\n // User-Agent is only set in Node.js (browsers disallow it)\n if (typeof process !== \"undefined\" && process.versions?.node) {\n headers[\"User-Agent\"] = `sentisense-node/${VERSION}`;\n }\n\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n const response = await fetch(url, {\n method: \"GET\",\n headers,\n signal: controller.signal,\n });\n\n if (!response.ok) {\n await this.handleErrorResponse(response);\n }\n\n return (await response.json()) as T;\n } catch (error) {\n if (error instanceof SentiSenseError) throw error;\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new SentiSenseError(`Request timed out after ${this.timeout}ms`);\n }\n throw new SentiSenseError(\n error instanceof Error ? error.message : \"Unknown error\",\n );\n } finally {\n clearTimeout(timer);\n }\n }\n\n private buildUrl(path: string, params?: object): string {\n const url = new URL(path, this.baseUrl);\n if (params) {\n for (const [key, value] of Object.entries(params as Record<string, unknown>)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n return url.toString();\n }\n\n private async handleErrorResponse(response: Response): Promise<never> {\n let body: { error?: string; message?: string } = {};\n try {\n body = await response.json();\n } catch {\n // Response may not be JSON\n }\n\n const message = body.message ?? response.statusText ?? \"API request failed\";\n const code = body.error;\n\n switch (response.status) {\n case 401:\n case 403:\n throw new AuthenticationError(message, response.status, code);\n case 404:\n throw new NotFoundError(message, code);\n case 429:\n throw new RateLimitError(message, code);\n default:\n throw new APIError(message, response.status, code);\n }\n }\n}\n"],"mappings":";AAAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EAIzC,YAAY,SAAiB,QA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SAAS,SAAS,SAAS,QAAQ,IAAI;AAAA,IACrD;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/resources/documents.ts","../src/resources/entityMetrics.ts","../src/resources/institutional.ts","../src/resources/kb.ts","../src/resources/marketMood.ts","../src/resources/stocks.ts","../src/version.ts","../src/client.ts"],"sourcesContent":["export class SentiSenseError extends Error {\n status?: number;\n code?: string;\n\n constructor(message: string, status?: number, code?: string) {\n super(message);\n this.name = \"SentiSenseError\";\n this.status = status;\n this.code = code;\n }\n}\n\nexport class AuthenticationError extends SentiSenseError {\n constructor(message: string, status: number, code?: string) {\n super(message, status, code);\n this.name = \"AuthenticationError\";\n }\n}\n\nexport class NotFoundError extends SentiSenseError {\n constructor(message: string, code?: string) {\n super(message, 404, code);\n this.name = \"NotFoundError\";\n }\n}\n\nexport class RateLimitError extends SentiSenseError {\n constructor(message: string, code?: string) {\n super(message, 429, code);\n this.name = \"RateLimitError\";\n }\n}\n\nexport class APIError extends SentiSenseError {\n constructor(message: string, status: number, code?: string) {\n super(message, status, code);\n this.name = \"APIError\";\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Document,\n DocumentSource,\n GetByEntityOptions,\n GetBySourceOptions,\n GetByTickerOptions,\n GetByTickerRangeOptions,\n GetStoriesByTickerOptions,\n GetStoriesOptions,\n SearchDocumentsOptions,\n Story,\n} from \"../types.js\";\n\nexport class Documents {\n constructor(private client: APIClient) {}\n\n /** Get document metrics for a stock. */\n async getByTicker(ticker: string, options?: GetByTickerOptions): Promise<Document[]> {\n return this.client.get(`/api/v1/documents/ticker/${encodeURIComponent(ticker)}`, options);\n }\n\n /** Get document metrics for a stock within a date range. */\n async getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/ticker/${encodeURIComponent(ticker)}/range`,\n options,\n );\n }\n\n /** Get document metrics for a KB entity. */\n async getByEntity(entityId: string, options?: GetByEntityOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/entity/${encodeURIComponent(entityId)}`,\n options,\n );\n }\n\n /** Smart search with natural language query parsing. */\n async search(query: string, options?: SearchDocumentsOptions): Promise<Document[]> {\n return this.client.get(\"/api/v1/documents/search\", { query, ...options });\n }\n\n /** Get latest document metrics from a source type. */\n async getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/source/${encodeURIComponent(source)}`,\n options,\n );\n }\n\n /** Get AI-curated news story clusters. */\n async getStories(options?: GetStoriesOptions): Promise<Story[]> {\n return this.client.get(\"/api/v1/documents/stories\", options);\n }\n\n /** Get stories for a specific stock. */\n async getStoriesByTicker(\n ticker: string,\n options?: GetStoriesByTickerOptions,\n ): Promise<Story[]> {\n return this.client.get(\n `/api/v1/documents/stories/ticker/${encodeURIComponent(ticker)}`,\n options,\n );\n }\n\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n EntityMetricsDateRange,\n GetMentionCountOptions,\n GetMentionsOptions,\n GetSentimentBySourceOptions,\n MentionCount,\n MentionData,\n MetricType,\n MetricsOptions,\n MetricDistributionOptions,\n SentimentData,\n ServingMetric,\n MetricDistribution,\n} from \"../types.js\";\n\nexport class EntityMetrics {\n constructor(private client: APIClient) {}\n\n // ── v2 API methods ──────────────────────────────────────────\n\n /**\n * Get time-series metric data for an entity using the v2 Serving Metrics API.\n *\n * @param symbol Ticker symbol (e.g. \"AAPL\") — the backend resolves the entity.\n * @param options Metric type and optional time range / resolution.\n */\n async getMetrics(\n symbol: string,\n options: MetricsOptions = {},\n ): Promise<ServingMetric[]> {\n const { metricType = \"sentiment\", startTime, endTime, maxDataPoints } = options;\n return this.client.get(\n `/api/v2/metrics/entity/${encodeURIComponent(symbol)}/metric/${encodeURIComponent(metricType)}`,\n {\n ...(startTime !== undefined && { startTime }),\n ...(endTime !== undefined && { endTime }),\n ...(maxDataPoints !== undefined && { maxDataPoints }),\n },\n );\n }\n\n /**\n * Get distribution data for a metric, broken down by a dimension (default: source).\n *\n * @param symbol Ticker symbol (e.g. \"AAPL\").\n * @param metricType The metric to break down (e.g. \"mentions\", \"sentiment\").\n * @param options Optional dimension parameter.\n */\n async getDistribution(\n symbol: string,\n metricType: MetricType,\n options: MetricDistributionOptions = {},\n ): Promise<MetricDistribution> {\n const { dimension = \"source\" } = options;\n return this.client.get(\n `/api/v2/metrics/entity/${encodeURIComponent(symbol)}/distribution/${encodeURIComponent(metricType)}`,\n { dimension },\n );\n }\n\n // ── Deprecated v1 methods (kept for backward compatibility) ─\n\n /**\n * @deprecated Use `getMetrics(symbol, { metricType: \"mentions\" })` instead.\n */\n async getMentions(symbol: string, options?: GetMentionsOptions): Promise<MentionData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions`,\n options,\n );\n }\n\n /**\n * @deprecated Use `getDistribution(symbol, \"mentions\", { dimension: \"source\" })` instead.\n */\n async getMentionCountBySource(\n symbol: string,\n options?: EntityMetricsDateRange,\n ): Promise<MentionCount> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count/by-source`,\n options,\n );\n }\n\n /**\n * @deprecated Use `getMetrics(symbol, { metricType: \"mentions\" })` instead.\n */\n async getMentionCount(symbol: string, options?: GetMentionCountOptions): Promise<MentionCount> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count`,\n options,\n );\n }\n\n /**\n * @deprecated Use `getMetrics(symbol, { metricType: \"sentiment\" })` instead.\n */\n async getSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment`,\n options,\n );\n }\n\n /**\n * @deprecated Use `getDistribution(symbol, \"sentiment\", { dimension: \"source\" })` instead.\n */\n async getSentimentBySource(\n symbol: string,\n options?: GetSentimentBySourceOptions,\n ): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/by-source`,\n options,\n );\n }\n\n /**\n * @deprecated Use `getMetrics(symbol, { metricType: \"sentiment\" })` instead.\n */\n async getAverageSentiment(\n symbol: string,\n options?: EntityMetricsDateRange,\n ): Promise<SentimentData> {\n return this.client.get(\n `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/average`,\n options,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n GetFlowsOptions,\n Holder,\n InstitutionalFlowsResponse,\n Quarter,\n} from \"../types.js\";\n\nexport class Institutional {\n constructor(private client: APIClient) {}\n\n /** Get available 13F reporting quarters. */\n async getQuarters(): Promise<Quarter[]> {\n return this.client.get(\"/api/v1/institutional/quarters\");\n }\n\n /** Get aggregate institutional activity per ticker for a quarter. */\n async getFlows(reportDate: string, options?: GetFlowsOptions): Promise<InstitutionalFlowsResponse> {\n return this.client.get(\"/api/v1/institutional/flows\", {\n reportDate,\n ...options,\n });\n }\n\n /** Get institutional holders for a specific stock. */\n async getHolders(ticker: string, reportDate: string): Promise<Holder[]> {\n return this.client.get(\n `/api/v1/institutional/holders/${encodeURIComponent(ticker)}`,\n { reportDate },\n );\n }\n\n /** Get activist investor positions (NEW or INCREASED). */\n async getActivists(reportDate: string): Promise<Holder[]> {\n return this.client.get(\"/api/v1/institutional/activist\", { reportDate });\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type { KBEntity } from \"../types.js\";\n\nexport class KB {\n constructor(private client: APIClient) {}\n\n /** Get popular entities for search suggestions. */\n async getPopularEntities(): Promise<KBEntity[]> {\n return this.client.get(\"/api/v1/kb/entities/popular\");\n }\n\n /** Get entity detail with metrics and relationships. */\n async getEntity(entityId: string): Promise<KBEntity> {\n return this.client.get(`/api/v1/kb/entities/${encodeURIComponent(entityId)}`);\n }\n\n /** Get all tracked entities. */\n async getAllEntities(): Promise<KBEntity[]> {\n return this.client.get(\"/api/v1/kb/entities/all\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type { MarketMood } from \"../types.js\";\n\nexport class MarketMoodResource {\n constructor(private client: APIClient) {}\n\n /** Get market mood data (scores, history, sectors). */\n async get(): Promise<MarketMood> {\n return this.client.get(\"/api/v2/market-mood\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n AISummary,\n ChartData,\n FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n MarketStatus,\n MetricsBreakdown,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n} from \"../types.js\";\n\nexport class Stocks {\n constructor(private client: APIClient) {}\n\n /** List all available ticker symbols. */\n async list(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks\");\n }\n\n /** List all stocks with name, kbEntityId, urlSlug. */\n async listDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/detailed\");\n }\n\n /** Get popular ticker symbols. */\n async listPopular(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks/popular\");\n }\n\n /** Get popular stocks with details. */\n async listPopularDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/popular/detailed\");\n }\n\n /** Get real-time price for a single ticker. */\n async getPrice(ticker: string): Promise<StockPrice> {\n return this.client.get(\"/api/v1/stocks/price\", { ticker });\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<Record<string, StockPrice>> {\n return this.client.get(\"/api/v1/stocks/prices\", {\n tickers: tickers.join(\",\"),\n });\n }\n\n /** Get batch company logo URLs. */\n async getImages(\n tickers: string[],\n options?: GetImagesOptions,\n ): Promise<Record<string, StockImage>> {\n return this.client.get(\"/api/v1/stocks/images\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get company profiles with branding, market cap, sector. */\n async getDescriptions(\n tickers: string[],\n options?: GetDescriptionsOptions,\n ): Promise<Record<string, StockProfile>> {\n return this.client.get(\"/api/v1/stocks/descriptions\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get peer/similar stocks. */\n async getSimilar(ticker: string, options?: GetSimilarOptions): Promise<StockDetail[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/similar`, options);\n }\n\n /** Get company profile (CEO, sector, industry, market data). */\n async getProfile(ticker: string, options?: GetProfileOptions): Promise<StockProfile> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/profile`, options);\n }\n\n /** Get related KB entities (people, products, partners). */\n async getEntities(ticker: string): Promise<StockEntity[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/entities`);\n }\n\n /** Get AI-generated stock analysis report. Requires PRO tier. */\n async getAISummary(ticker: string, options?: GetAISummaryOptions): Promise<AISummary> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/ai-summary`, options);\n }\n\n /** Get sentiment/mention metrics breakdown by entity. */\n async getMetricsBreakdown(\n ticker: string,\n metricType: string,\n options?: GetMetricsBreakdownOptions,\n ): Promise<MetricsBreakdown> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker)}/metrics/${encodeURIComponent(metricType)}/breakdown`,\n options,\n );\n }\n\n /** Get historical OHLCV chart data. */\n async getChart(ticker: string, options?: GetChartOptions): Promise<ChartData> {\n return this.client.get(\"/api/v1/stocks/chart\", { ticker, ...options });\n }\n\n /** Get current market open/closed/pre-market/after-hours status. */\n async getMarketStatus(): Promise<MarketStatus> {\n return this.client.get(\"/api/v1/stocks/market-status\");\n }\n\n /** Get financial statement data. */\n async getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals\", { ticker, ...options });\n }\n\n /** Get available fiscal periods. */\n async getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]> {\n return this.client.get(\"/api/v1/stocks/fundamentals/periods\", { ticker });\n }\n\n /** Get most recent fundamentals snapshot. */\n async getCurrentFundamentals(ticker: string): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals/current\", { ticker });\n }\n\n /** Get historical P/E, P/B, P/S ratios. */\n async getHistoricalRatios(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/ratios\", { ticker });\n }\n\n /** Get historical revenue data. */\n async getHistoricalRevenue(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/revenue\", { ticker });\n }\n\n /** Get short interest metrics (FINRA). */\n async getShortInterest(ticker: string): Promise<ShortInterest> {\n return this.client.get(\"/api/v1/stocks/short-interest\", { ticker });\n }\n\n /** Get float information. */\n async getFloat(ticker: string): Promise<FloatInfo> {\n return this.client.get(\"/api/v1/stocks/float\", { ticker });\n }\n\n /** Get short volume trading data. */\n async getShortVolume(ticker: string): Promise<ShortVolume> {\n return this.client.get(\"/api/v1/stocks/short-volume\", { ticker });\n }\n}\n","export const VERSION = \"0.4.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { Institutional } from \"./resources/institutional.js\";\nimport { KB } from \"./resources/kb.js\";\nimport { MarketMoodResource } from \"./resources/marketMood.js\";\nimport { Stocks } from \"./resources/stocks.js\";\nimport type { SentiSenseOptions } from \"./types.js\";\nimport { VERSION } from \"./version.js\";\n\nconst DEFAULT_BASE_URL = \"https://app.sentisense.ai\";\nconst DEFAULT_TIMEOUT = 30_000;\n\n/** @internal HTTP interface exposed to resource classes. */\nexport interface APIClient {\n get<T = unknown>(path: string, params?: object): Promise<T>;\n}\n\nexport class SentiSense implements APIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeout: number;\n\n readonly stocks: Stocks;\n readonly documents: Documents;\n readonly institutional: Institutional;\n readonly entityMetrics: EntityMetrics;\n readonly marketMood: MarketMoodResource;\n readonly kb: KB;\n\n constructor(options: SentiSenseOptions = {}) {\n this.apiKey = options.apiKey;\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT;\n\n this.stocks = new Stocks(this);\n this.documents = new Documents(this);\n this.institutional = new Institutional(this);\n this.entityMetrics = new EntityMetrics(this);\n this.marketMood = new MarketMoodResource(this);\n this.kb = new KB(this);\n }\n\n /** @internal */\n async get<T = unknown>(path: string, params?: object): Promise<T> {\n const url = this.buildUrl(path, params);\n const headers: Record<string, string> = {};\n\n if (this.apiKey) {\n headers[\"X-SentiSense-API-Key\"] = this.apiKey;\n }\n\n // User-Agent is only set in Node.js (browsers disallow it)\n if (typeof process !== \"undefined\" && process.versions?.node) {\n headers[\"User-Agent\"] = `sentisense-node/${VERSION}`;\n }\n\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n const response = await fetch(url, {\n method: \"GET\",\n headers,\n signal: controller.signal,\n });\n\n if (!response.ok) {\n await this.handleErrorResponse(response);\n }\n\n return (await response.json()) as T;\n } catch (error) {\n if (error instanceof SentiSenseError) throw error;\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new SentiSenseError(`Request timed out after ${this.timeout}ms`);\n }\n throw new SentiSenseError(\n error instanceof Error ? error.message : \"Unknown error\",\n );\n } finally {\n clearTimeout(timer);\n }\n }\n\n private buildUrl(path: string, params?: object): string {\n const url = new URL(path, this.baseUrl);\n if (params) {\n for (const [key, value] of Object.entries(params as Record<string, unknown>)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n return url.toString();\n }\n\n private async handleErrorResponse(response: Response): Promise<never> {\n let body: { error?: string; message?: string } = {};\n try {\n body = await response.json();\n } catch {\n // Response may not be JSON\n }\n\n const message = body.message ?? response.statusText ?? \"API request failed\";\n const code = body.error;\n\n switch (response.status) {\n case 401:\n case 403:\n throw new AuthenticationError(message, response.status, code);\n case 404:\n throw new NotFoundError(message, code);\n case 429:\n throw new RateLimitError(message, code);\n default:\n throw new APIError(message, response.status, code);\n }\n }\n}\n"],"mappings":";AAAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EAIzC,YAAY,SAAiB,QAAiB,MAAe;AAC3D,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,sBAAN,cAAkC,gBAAgB;AAAA,EACvD,YAAY,SAAiB,QAAgB,MAAe;AAC1D,UAAM,SAAS,QAAQ,IAAI;AAC3B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAAN,cAA4B,gBAAgB;AAAA,EACjD,YAAY,SAAiB,MAAe;AAC1C,UAAM,SAAS,KAAK,IAAI;AACxB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,iBAAN,cAA6B,gBAAgB;AAAA,EAClD,YAAY,SAAiB,MAAe;AAC1C,UAAM,SAAS,KAAK,IAAI;AACxB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,WAAN,cAAuB,gBAAgB;AAAA,EAC5C,YAAY,SAAiB,QAAgB,MAAe;AAC1D,UAAM,SAAS,QAAQ,IAAI;AAC3B,SAAK,OAAO;AAAA,EACd;AACF;;;ACxBO,IAAM,YAAN,MAAgB;AAAA,EACrB,YAAoB,QAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA,EAGxC,MAAM,YAAY,QAAgB,SAAmD;AACnF,WAAO,KAAK,OAAO,IAAI,4BAA4B,mBAAmB,MAAM,CAAC,IAAI,OAAO;AAAA,EAC1F;AAAA;AAAA,EAGA,MAAM,iBAAiB,QAAgB,SAAuD;AAC5F,WAAO,KAAK,OAAO;AAAA,MACjB,4BAA4B,mBAAmB,MAAM,CAAC;AAAA,MACtD;AA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