sentisense 0.18.0 → 0.20.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 CHANGED
@@ -16,14 +16,12 @@ npm install sentisense
16
16
  ```typescript
17
17
  import SentiSense from "sentisense";
18
18
 
19
- // Public endpoints work without an API key
20
- const client = new SentiSense();
19
+ const client = new SentiSense({ apiKey: "ss_live_YOUR_KEY" });
20
+
21
21
  const price = await client.stocks.getPrice("AAPL");
22
- console.log(price);
22
+ console.log(price.currentPrice);
23
23
 
24
- // Use an API key for authenticated endpoints
25
- const authed = new SentiSense({ apiKey: "ssk_YOUR_KEY" });
26
- const flows = await authed.institutional.getFlows("2025-02-14");
24
+ const flows = await client.institutional.getFlows("2025-02-14");
27
25
  ```
28
26
 
29
27
  ## Features
@@ -86,7 +84,7 @@ client.entityMetrics.getDistribution("AAPL", "sentiment")
86
84
  client.entityMetrics.getDistribution("AAPL", "mentions", { dimension: "source" })
87
85
  ```
88
86
 
89
- Available metric types: `mentions`, `sentiment`, `sentisense_score`, `social_dominance`, `creators`.
87
+ Available metric types: `mentions`, `sentiment`, `sentisense`, `social_dominance`, `creators`.
90
88
 
91
89
  ### Knowledge Base
92
90
 
@@ -161,7 +159,7 @@ All errors extend `SentiSenseError` and include `status`, `code`, and `message`
161
159
 
162
160
  ```typescript
163
161
  const client = new SentiSense({
164
- apiKey: "ssk_YOUR_KEY", // Optional for public endpoints
162
+ apiKey: "ss_live_YOUR_KEY", // Get yours at app.sentisense.ai/settings/developer
165
163
  baseUrl: "https://...", // Default: https://app.sentisense.ai
166
164
  timeout: 30000, // Default: 30s (in milliseconds)
167
165
  });
package/dist/index.cjs CHANGED
@@ -484,6 +484,24 @@ var Institutional = class {
484
484
  async getActivists(reportDate) {
485
485
  return this.client.get("/api/v1/institutional/activist", { reportDate });
486
486
  }
487
+ /**
488
+ * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)
489
+ * so you can find what to query without knowing slugs upfront.
490
+ *
491
+ * Each institution is rolled up by parent filer, so a multi-filer manager
492
+ * (e.g. Vanguard) appears once with combined AUM. Summary only; use
493
+ * `getInstitutionDetail` for a filer's full holdings.
494
+ *
495
+ * Requires an API key but does not consume monthly quota (per-minute rate
496
+ * limits still apply). Returns the unwrapped list payload.
497
+ */
498
+ async listInstitutions(options) {
499
+ const resp = await this.client.get(
500
+ "/api/v1/institutional/institutions",
501
+ { ...options }
502
+ );
503
+ return resp.data;
504
+ }
487
505
  /**
488
506
  * Get the full profile, summary stats, and current-quarter holdings for a
489
507
  * specific institutional filer.
@@ -527,6 +545,8 @@ var MarketMoodResource = class {
527
545
  async get() {
528
546
  return this.client.get("/api/v2/market-mood");
529
547
  }
548
+ // TODO: accept a `days` param to control history length (the endpoint supports ?days=N).
549
+ // TODO: add a sibling `indexes` resource for /api/v1/indexes/{id} (+ /history), e.g. fed-sentiment.
530
550
  };
531
551
 
532
552
  // src/resources/marketSummary.ts
@@ -674,7 +694,7 @@ var Stocks = class {
674
694
  * Sorted alphabetically by ticker.
675
695
  *
676
696
  * Auth: API key required, but the call does NOT consume your monthly quota
677
- * (rate-limit-per-minute still applies). [COMP-421]
697
+ * (rate-limit-per-minute still applies).
678
698
  */
679
699
  async listKpiCoverage() {
680
700
  return this.client.get("/api/v1/stocks/with-kpis");
@@ -694,7 +714,7 @@ var Stocks = class {
694
714
  };
695
715
 
696
716
  // src/version.ts
697
- var VERSION = "0.18.0";
717
+ var VERSION = "0.20.0";
698
718
 
699
719
  // src/client.ts
700
720
  var DEFAULT_BASE_URL = "https://app.sentisense.ai";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/resources/analyst.ts","../src/resources/documents.ts","../src/resources/entityMetrics.ts","../src/resources/etfs.ts","../src/resources/insider.ts","../src/resources/politicians.ts","../src/resources/insights.ts","../src/resources/institutional.ts","../src/resources/kb.ts","../src/resources/marketMood.ts","../src/resources/marketSummary.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 type {\n AnalystConsensus,\n AnalystAction,\n AnalystEstimate,\n AnalystEarningsSurprise,\n AnalystEstimatesResponse,\n GetAnalystActionsOptions,\n GetAnalystMarketActivityOptions,\n} from \"./resources/analyst.js\";\n\nexport type {\n GetStockInsightsRangeOptions,\n GetLatestInsightsOptions,\n GetUserInsightsOptions,\n} from \"./resources/insights.js\";\n\n// COMP-481 ETF aggregate types\nexport type {\n EtfInfo,\n EtfHolding,\n EtfHoldings,\n EtfAggregateCoverage,\n WeightedConsensus,\n EtfAnalystContributor,\n EtfAnalystAggregate,\n WeightedNetFlow,\n EtfInsiderContributor,\n EtfInsiderAggregate,\n EtfSentimentReading,\n EtfSentimentAggregate,\n GetEtfInsiderAggregateOptions,\n} from \"./resources/etfs.js\";\n\n// COMP-356 / COMP-421 KPI types\nexport type {\n KpiDataPoint,\n KpiSeries,\n CompanyKpisData,\n KpiCoverageEntry,\n KpiCoverageResponse,\n KpiTypeEntry,\n} from \"./types.js\";\n\nexport {\n SentiSenseError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n APIError,\n} from \"./errors.js\";\n\nexport type {\n SentiSenseOptions,\n Insight,\n InsightPreviewResponse,\n LockedInsight,\n GetInsightsOptions,\n InsiderActivitySummary,\n InsiderActivityResponse,\n InsiderTrade,\n ClusterBuy,\n GetInsiderOptions,\n CongressTrade,\n PoliticianSummary,\n PoliticianDetail,\n GetPoliticiansOptions,\n PreviewResponse,\n StockPrice,\n StockQuote,\n StockDetail,\n SimilarStock,\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 MarketSummary,\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 retryAfter?: number;\n\n constructor(message: string, code?: string, retryAfter?: number) {\n super(message, 429, code);\n this.name = \"RateLimitError\";\n this.retryAfter = retryAfter;\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 { PreviewResponse } from \"../types.js\";\n\nexport interface AnalystConsensus {\n ticker: string;\n currentPrice: number | null;\n targetLow: number | null;\n targetMean: number | null;\n targetHigh: number | null;\n targetMedian: number | null;\n numberOfAnalysts: number;\n upsidePercent: number | null;\n consensusLabel: string | null;\n recommendationMean: number | null;\n /** PRO-only; zero in the free preview. */\n strongBuy: number;\n /** PRO-only; zero in the free preview. */\n buy: number;\n /** PRO-only; zero in the free preview. */\n hold: number;\n /** PRO-only; zero in the free preview. */\n sell: number;\n /** PRO-only; zero in the free preview. */\n strongSell: number;\n updatedAt: string | null;\n}\n\nexport interface AnalystAction {\n ticker: string;\n actionDate: string;\n firm: string;\n /** UPGRADE, DOWNGRADE, INITIATE, REITERATE, OTHER */\n actionType: string;\n fromGrade: string | null;\n toGrade: string | null;\n}\n\nexport interface AnalystEstimate {\n /** Fiscal period descriptor (provider-specific shape). */\n [key: string]: unknown;\n}\n\nexport interface AnalystEarningsSurprise {\n /** Past report descriptor (provider-specific shape). */\n [key: string]: unknown;\n}\n\nexport interface AnalystEstimatesResponse {\n estimates: AnalystEstimate[];\n surprises: AnalystEarningsSurprise[];\n}\n\nexport interface GetAnalystActionsOptions {\n /** Days of history to return. Default 90. */\n lookbackDays?: number;\n}\n\nexport interface GetAnalystMarketActivityOptions {\n /** Days of history to return. Default 30. */\n lookbackDays?: number;\n}\n\n/**\n * Wall Street analyst coverage: aggregate price targets, recommendation distribution,\n * recent upgrade/downgrade actions, and forward EPS estimates with earnings surprise history.\n *\n * Free users receive the price target band (low/mean/high + analyst count + consensus label)\n * in full -- it powers the public projection cone. The buy/hold/sell distribution counts\n * and full action/estimate history are PRO-only.\n */\nexport class Analyst {\n constructor(private client: APIClient) {}\n\n /**\n * Get the aggregate Wall Street consensus for a ticker. Returns 404 if no\n * coverage exists.\n */\n async consensus(\n ticker: string,\n ): Promise<PreviewResponse<AnalystConsensus>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/consensus`,\n );\n }\n\n /**\n * Get recent analyst upgrade/downgrade actions for a ticker, newest first.\n * Free users receive the 3 most recent.\n */\n async actions(\n ticker: string,\n options?: GetAnalystActionsOptions,\n ): Promise<PreviewResponse<AnalystAction[]>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/actions`,\n options,\n );\n }\n\n /**\n * Get forward EPS estimates and earnings surprise history for a ticker.\n * Free users receive 1 estimate (current quarter) plus the 2 most recent surprises.\n */\n async estimates(\n ticker: string,\n ): Promise<PreviewResponse<AnalystEstimatesResponse>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/estimates`,\n );\n }\n\n /**\n * Get market-wide recent analyst actions across all covered tickers, newest first.\n * Free users receive the 5 most recent.\n */\n async marketActivity(\n options?: GetAnalystMarketActivityOptions,\n ): Promise<PreviewResponse<AnalystAction[]>> {\n return this.client.get(\"/api/v1/analyst/activity\", options);\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 full story detail by cluster ID. */\n async getStoryDetail(clusterId: string): Promise<unknown> {\n return this.client.get(`/api/v1/documents/stories/${encodeURIComponent(clusterId)}`);\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 { PreviewResponse } from \"../types.js\";\n\nexport interface EtfInfo {\n ticker: string;\n name: string;\n kbEntityId: string | null;\n urlSlug: string | null;\n issuer: string | null;\n trackedIndex: string | null;\n assetClass: string | null;\n}\n\nexport interface EtfHolding {\n ticker: string;\n name: string | null;\n /** Weight in the fund as a percentage (0-100). */\n weightPct: number;\n /** ISO date \"YYYY-MM-DD\" — first date this holding appeared in the composition. */\n firstSeen: string | null;\n}\n\nexport interface EtfHoldings {\n ticker: string;\n issuer: string;\n issuerEndpoint: string | null;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date from the issuer. */\n asOfDate: string;\n /** Epoch seconds when SentiSense refreshed the composition. */\n fetchedAt: number | null;\n /** ISO date \"YYYY-MM-DD\" — when the composition is scheduled to be refreshed next. */\n nextRefreshDue: string;\n totalHoldings: number;\n holdings: EtfHolding[];\n /** True when this is a top-N view rather than the full fund. */\n partial?: boolean | null;\n /** Issuer's reported total holdings when `partial=true`. */\n totalKnownHoldings?: number | null;\n}\n\nexport interface EtfAggregateCoverage {\n holdingsCount: number;\n holdingsCovered: number;\n /** Sum of weights (0-100) for the covered holdings. */\n weightCovered: number;\n partial?: boolean | null;\n totalKnownHoldings?: number | null;\n}\n\nexport interface WeightedConsensus {\n upsidePercent: number | null;\n consensusLabel: string | null;\n /** Fractions of covered AUM in each bucket. Sums to ~1.0. */\n distribution: Record<string, number>;\n totalAnalysts: number;\n}\n\nexport interface EtfAnalystContributor {\n ticker: string;\n weightPct: number;\n upsidePercent: number | null;\n consensusLabel: string | null;\n /** Signed contribution to the fund's weighted upside in percentage points. */\n contributionPp: number;\n}\n\nexport interface EtfAnalystAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this rollup was computed. */\n computedAt: number;\n coverage: EtfAggregateCoverage;\n weightedConsensus: WeightedConsensus;\n /** Top contributors (up to 10) by absolute contribution to the weighted upside. */\n topContributors: EtfAnalystContributor[];\n}\n\nexport interface WeightedNetFlow {\n /** Weighted net dollar flow (buys - sells). Negative = net selling. */\n netDollars: number;\n buyDollars: number;\n sellDollars: number;\n /** Unweighted; for context. */\n buyTradeCount: number;\n /** Unweighted; for context. */\n sellTradeCount: number;\n distinctInsiderCount: number;\n}\n\nexport interface EtfInsiderContributor {\n ticker: string;\n weightPct: number;\n /** Per-stock net flow over the window (signed). */\n netDollars: number;\n /** Signed contribution to the weighted headline. */\n weightedNetDollars: number;\n tradeCount: number;\n}\n\nexport interface EtfInsiderAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this rollup was computed. */\n computedAt: number;\n lookbackDays: number;\n coverage: EtfAggregateCoverage;\n weightedNetFlow: WeightedNetFlow;\n /** Top contributors (up to 10) by absolute weighted-net-dollar contribution. */\n topContributors: EtfInsiderContributor[];\n}\n\nexport interface EtfSentimentReading {\n sentiSenseScore: number | null;\n /** BULLISH / NEUTRAL / BEARISH. */\n scoreLabel: string;\n /** Epoch seconds when the underlying metric was produced. */\n asOfTimestamp: number | null;\n}\n\nexport interface EtfSentimentAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this aggregate was assembled. */\n computedAt: number;\n coverage: EtfAggregateCoverage;\n /** Holdings-weighted SentiSense across the fund's constituents. */\n constituentsWeighted: EtfSentimentReading;\n /** Direct reading from mentions of the fund's own ticker. Null for low-mention funds. */\n direct: EtfSentimentReading | null;\n}\n\nexport interface GetEtfInsiderAggregateOptions {\n /** Trailing window for the trade aggregation. Typical values: 30, 90. Default 30. */\n lookbackDays?: number;\n}\n\n/**\n * ETF discovery, composition (holdings), and holdings-weighted aggregate views.\n *\n * Funds aren't rated by analysts directly, don't have insiders of their own, and\n * may not get many direct news mentions -- but the companies inside them do. The\n * aggregate endpoints synthesize fund-level views from each constituent's per-stock\n * data, weighted by allocation, with a coverage block so consumers see how much of\n * the fund's AUM the underlying data covered.\n *\n * Beta as of 2026-05-15: starting with a limited set of widely-traded funds.\n */\nexport class Etfs {\n constructor(private client: APIClient) {}\n\n /**\n * List every ETF tracked by SentiSense, sorted by ticker.\n */\n async list(): Promise<EtfInfo[]> {\n return this.client.get(\"/api/v1/etfs\");\n }\n\n /**\n * Get the full holdings composition for an ETF, including per-holding weights\n * and freshness metadata. Returns 404 for unknown ETFs or commodity-only funds.\n */\n async holdings(ticker: string): Promise<EtfHoldings> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/holdings`,\n );\n }\n\n /**\n * Get the holdings-weighted analyst consensus for an ETF, including the\n * top per-holding contributors that drive the weighted upside.\n */\n async analystAggregate(\n ticker: string,\n ): Promise<PreviewResponse<EtfAnalystAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/analyst`,\n );\n }\n\n /**\n * Get the holdings-weighted SEC Form 4 insider aggregate for an ETF over a\n * configurable trailing window, including per-holding `topContributors` with\n * signed contribution to the weighted headline.\n */\n async insiderAggregate(\n ticker: string,\n options?: GetEtfInsiderAggregateOptions,\n ): Promise<PreviewResponse<EtfInsiderAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/insider`,\n options,\n );\n }\n\n /**\n * Get two SentiSense Score readings side-by-side: `constituentsWeighted`\n * (precomputed daily weighted average across the fund's holdings) and `direct`\n * (score from mentions of the fund's own ticker). The two can diverge, and the\n * gap is itself information.\n */\n async sentimentAggregate(\n ticker: string,\n ): Promise<PreviewResponse<EtfSentimentAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/sentiment`,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n InsiderActivityResponse,\n InsiderTrade,\n ClusterBuy,\n GetInsiderOptions,\n PreviewResponse,\n} from \"../types.js\";\n\nexport class Insider {\n constructor(private client: APIClient) {}\n\n /**\n * Get market-wide insider activity: top buys and sells aggregated by ticker.\n *\n * PRO-gated. Free/unauthenticated users receive a preview (top 5 per direction)\n * with `isPreview: true` in the response.\n */\n async getActivity(options?: GetInsiderOptions): Promise<PreviewResponse<InsiderActivityResponse>> {\n return this.client.get(\"/api/v1/insider/activity\", options);\n }\n\n /**\n * Get individual insider transactions for a specific stock.\n *\n * PRO-gated. Free users receive a preview of the top 5 transactions.\n */\n async getTrades(ticker: string, options?: GetInsiderOptions): Promise<PreviewResponse<InsiderTrade[]>> {\n return this.client.get(\n `/api/v1/insider/trades/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get cluster buy signals: stocks where 3+ distinct insiders bought recently.\n *\n * PRO-gated. Free users receive a preview of the top 3 signals.\n */\n async getClusterBuys(options?: GetInsiderOptions): Promise<PreviewResponse<ClusterBuy[]>> {\n return this.client.get(\"/api/v1/insider/cluster-buys\", options);\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n CongressTrade,\n PoliticianSummary,\n PoliticianDetail,\n GetPoliticiansOptions,\n PreviewResponse,\n} from \"../types.js\";\n\nexport class Politicians {\n constructor(private client: APIClient) {}\n\n /**\n * Get recent congressional STOCK Act trading activity across all politicians.\n *\n * PRO-gated. Free/unauthenticated users receive a preview (top 5 trades)\n * with `isPreview: true` in the response.\n */\n async getActivity(\n options?: GetPoliticiansOptions,\n ): Promise<PreviewResponse<CongressTrade[]>> {\n return this.client.get(\"/api/v1/politicians/activity\", options);\n }\n\n /**\n * Get congressional trades for a specific stock.\n *\n * PRO-gated. Free users receive a preview of the top 3 trades.\n */\n async getFilings(\n ticker: string,\n options?: GetPoliticiansOptions,\n ): Promise<PreviewResponse<CongressTrade[]>> {\n return this.client.get(\n `/api/v1/politicians/filings/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get all tracked politicians with trading summary statistics.\n *\n * PRO-gated. Free users receive a preview of the top 5 members.\n */\n async getMembers(): Promise<PreviewResponse<PoliticianSummary[]>> {\n return this.client.get(\"/api/v1/politicians/members\");\n }\n\n /**\n * Get detailed profile for a single politician: summary, recent trades, top tickers.\n *\n * PRO-gated. Free users receive a preview-wrapped response.\n */\n async getMember(slug: string): Promise<PreviewResponse<PoliticianDetail>> {\n return this.client.get(\n `/api/v1/politicians/member/${encodeURIComponent(slug)}`,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Insight,\n InsightPreviewResponse,\n GetInsightsOptions,\n} from \"../types.js\";\n\nexport interface GetStockInsightsRangeOptions {\n startDate: string;\n endDate: string;\n urgency?: \"low\" | \"medium\" | \"high\";\n insightType?: string;\n}\n\nexport interface GetLatestInsightsOptions {\n limit?: number;\n urgency?: \"low\" | \"medium\" | \"high\";\n}\n\nexport interface GetUserInsightsOptions {\n limit?: number;\n category?: string;\n}\n\nexport class Insights {\n constructor(private client: APIClient) {}\n\n /**\n * Get AI-generated insights for a specific stock, sorted by urgency then confidence.\n *\n * PRO users receive a flat array of Insight objects.\n * Free/unauthenticated users receive a preview with `isPreview: true`,\n * the top 3 insights in full, and a `locked` array with metadata-only entries\n * (type, urgency, timestamp) showing what additional signals exist.\n */\n async stock(\n ticker: string,\n options?: GetInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get AI insights for a stock within a date range.\n *\n * Free users receive the top 3; PRO users receive the full list.\n * The server returns 400 if `startDate` is after `endDate`.\n */\n async stockRange(\n ticker: string,\n options: GetStockInsightsRangeOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}/range`,\n options,\n );\n }\n\n /**\n * Get AI-generated market-level insights, sorted by urgency then confidence.\n *\n * PRO users receive a flat array of Insight objects.\n * Free/unauthenticated users receive a preview with `isPreview: true`,\n * the top 5 insights in full, and a `locked` array with metadata-only entries.\n */\n async market(): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/market\");\n }\n\n /**\n * Get the latest AI insights across all tracked stocks, newest first.\n *\n * Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).\n */\n async latest(\n options?: GetLatestInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/latest\", options);\n }\n\n /**\n * Get personalized insights for the authenticated user.\n *\n * Biased toward the user's watchlist and portfolio when available; falls back\n * to market-level insights otherwise. API key authentication required.\n */\n async user(\n options?: GetUserInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/user\", options);\n }\n\n /**\n * Get available insight types for a specific stock.\n * No authentication required.\n *\n * Returns an array of insight type strings (e.g., `[\"sentiment_shift\", \"options_activity\"]`).\n */\n async types(ticker: string): Promise<string[]> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}/types`,\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 /**\n * Get the full profile, summary stats, and current-quarter holdings for a\n * specific institutional filer.\n *\n * Resolved by URL slug (e.g. `Berkshire-Hathaway`) or numeric SEC CIK.\n * Free users receive the profile and top 10 holdings; PRO users receive the\n * full holdings array. Returns 404 if the slug or CIK is unknown.\n */\n async getInstitutionDetail(slugOrCik: string): Promise<unknown> {\n return this.client.get(\n `/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}`,\n );\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 { MarketSummary } from \"../types.js\";\n\nexport class MarketSummaryResource {\n constructor(private client: APIClient) {}\n\n /** Get the AI-generated market summary with headline and analysis. */\n async get(): Promise<MarketSummary> {\n return this.client.get(\"/api/v1/market-summary\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n AISummary,\n ChartData,\n CompanyKpisData,\n FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n KpiCoverageResponse,\n KpiTypeEntry,\n MarketStatus,\n MetricsBreakdown,\n PreviewResponse,\n SimilarStock,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n StockQuote,\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 /**\n * Get aggregate quote snapshot: live price, today OHLC, 52-week range,\n * market cap, P/E, EPS TTM, and dividend yield in a single call.\n * All fields except `ticker` may be null when upstream data is unavailable.\n */\n async getQuote(ticker: string): Promise<StockQuote> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/quote`);\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<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<SimilarStock[]> {\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 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 /**\n * Get company-specific KPI time-series for a ticker. Returns curated GAAP and\n * non-GAAP metrics from earnings filings (e.g. iPhone unit sales, Tesla deliveries,\n * AWS revenue).\n *\n * Free users receive metadata only with an empty `kpis` list; PRO users receive\n * the full series. Returns 404 for tickers that do not yet have curated coverage.\n *\n * Coverage today: near-complete for the S&P 500 plus extended universe\n * (~500 tickers). Use `listKpiCoverage()` to enumerate.\n */\n async getKpis(ticker: string): Promise<PreviewResponse<CompanyKpisData>> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/kpis`,\n );\n }\n\n /**\n * List every ticker with curated KPI coverage. Returns `{count, tickers: [...]}`\n * with lightweight metadata (ticker, companyName, lastUpdated, kpiCount).\n * Sorted alphabetically by ticker.\n *\n * Auth: API key required, but the call does NOT consume your monthly quota\n * (rate-limit-per-minute still applies). [COMP-421]\n */\n async listKpiCoverage(): Promise<KpiCoverageResponse> {\n return this.client.get(\"/api/v1/stocks/with-kpis\");\n }\n\n /**\n * List the KPI metadata tuples available for a ticker — `id, name, category,\n * chartType` — without paying the cost of the full series payload. Mirrors\n * the `/api/v1/insights/stock/{ticker}/types` precedent.\n *\n * Auth: API key required, no quota cost. 404 if the ticker has no curated KPIs.\n */\n async getKpiTypes(ticker: string): Promise<KpiTypeEntry[]> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/kpis/types`,\n );\n }\n}\n","export const VERSION = \"0.18.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Analyst } from \"./resources/analyst.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { Etfs } from \"./resources/etfs.js\";\nimport { Insider } from \"./resources/insider.js\";\nimport { Politicians } from \"./resources/politicians.js\";\nimport { Insights } from \"./resources/insights.js\";\nimport { Institutional } from \"./resources/institutional.js\";\nimport { KB } from \"./resources/kb.js\";\nimport { MarketMoodResource } from \"./resources/marketMood.js\";\nimport { MarketSummaryResource } from \"./resources/marketSummary.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;\nconst DEFAULT_MAX_RETRIES = 3;\nconst BASE_DELAY_MS = 1_000;\nconst MAX_DELAY_MS = 60_000;\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/** @internal HTTP interface exposed to resource classes. */\nexport interface APIClient {\n get<T = unknown>(path: string, params?: object): Promise<T>;\n post<T = unknown>(path: string, body: unknown): Promise<T>;\n}\n\nexport class SentiSense implements APIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeout: number;\n private maxRetries: number;\n\n readonly stocks: Stocks;\n readonly documents: Documents;\n readonly etfs: Etfs;\n readonly institutional: Institutional;\n readonly insider: Insider;\n readonly politicians: Politicians;\n readonly insights: Insights;\n readonly analyst: Analyst;\n readonly entityMetrics: EntityMetrics;\n readonly marketMood: MarketMoodResource;\n readonly marketSummary: MarketSummaryResource;\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 this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;\n\n this.stocks = new Stocks(this);\n this.documents = new Documents(this);\n this.etfs = new Etfs(this);\n this.institutional = new Institutional(this);\n this.insider = new Insider(this);\n this.politicians = new Politicians(this);\n this.insights = new Insights(this);\n this.analyst = new Analyst(this);\n this.entityMetrics = new EntityMetrics(this);\n this.marketMood = new MarketMoodResource(this);\n this.marketSummary = new MarketSummaryResource(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 \"Accept\": \"application/json\",\n };\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 let delayMs = 0;\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (delayMs > 0) {\n await sleep(delayMs);\n delayMs = 0;\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 const isRetryable = response.status === 429 || response.status >= 500;\n if (isRetryable && attempt < this.maxRetries) {\n if (response.status === 429) {\n const ra = response.headers.get(\"Retry-After\");\n delayMs = (ra ? parseInt(ra, 10) : 60) * 1000;\n } else {\n delayMs = Math.min(BASE_DELAY_MS * Math.pow(2, attempt), MAX_DELAY_MS) + Math.random() * 1000;\n }\n try { await response.body?.cancel(); } catch { /* ignore */ }\n continue;\n }\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 throw new SentiSenseError(\"All retries exhausted\");\n }\n\n /** @internal */\n async post<T = unknown>(path: string, body: unknown): Promise<T> {\n const url = this.buildUrl(path);\n const headers: Record<string, string> = {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/json\",\n };\n\n if (this.apiKey) {\n headers[\"X-SentiSense-API-Key\"] = this.apiKey;\n }\n\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: \"POST\",\n headers,\n body: JSON.stringify(body),\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 const ra = response.headers.get(\"Retry-After\");\n throw new RateLimitError(message, code, ra ? parseInt(ra, 10) : undefined);\n }\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,cAA8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AS,IAAI;AAAA,MACvC,KAAK,KAAK;AACR,cAAM,KAAK,SAAS,QAAQ,IAAI,aAAa;AAC7C,cAAM,IAAI,eAAe,SAAS,MAAM,KAAK,SAAS,IAAI,EAAE,IAAI,MAAS;AAAA,MAC3E;AAAA,MACA;AACE,cAAM,IAAI,SAAS,SAAS,SAAS,QAAQ,IAAI;AAAA,IACrD;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/resources/analyst.ts","../src/resources/documents.ts","../src/resources/entityMetrics.ts","../src/resources/etfs.ts","../src/resources/insider.ts","../src/resources/politicians.ts","../src/resources/insights.ts","../src/resources/institutional.ts","../src/resources/kb.ts","../src/resources/marketMood.ts","../src/resources/marketSummary.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 type {\n AnalystConsensus,\n AnalystAction,\n AnalystEstimate,\n AnalystEarningsSurprise,\n AnalystEstimatesResponse,\n GetAnalystActionsOptions,\n GetAnalystMarketActivityOptions,\n} from \"./resources/analyst.js\";\n\nexport type {\n GetStockInsightsRangeOptions,\n GetLatestInsightsOptions,\n GetUserInsightsOptions,\n} from \"./resources/insights.js\";\n\n// ETF aggregate types\nexport type {\n EtfInfo,\n EtfHolding,\n EtfHoldings,\n EtfAggregateCoverage,\n WeightedConsensus,\n EtfAnalystContributor,\n EtfAnalystAggregate,\n WeightedNetFlow,\n EtfInsiderContributor,\n EtfInsiderAggregate,\n EtfSentimentReading,\n EtfSentimentAggregate,\n GetEtfInsiderAggregateOptions,\n} from \"./resources/etfs.js\";\n\n// KPI types\nexport type {\n KpiDataPoint,\n KpiSeries,\n CompanyKpisData,\n KpiCoverageEntry,\n KpiCoverageResponse,\n KpiTypeEntry,\n} from \"./types.js\";\n\nexport {\n SentiSenseError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n APIError,\n} from \"./errors.js\";\n\nexport type {\n SentiSenseOptions,\n Insight,\n InsightPreviewResponse,\n LockedInsight,\n GetInsightsOptions,\n InsiderActivitySummary,\n InsiderActivityResponse,\n InsiderTrade,\n ClusterBuy,\n GetInsiderOptions,\n CongressTrade,\n PoliticianSummary,\n PoliticianDetail,\n GetPoliticiansOptions,\n PreviewResponse,\n StockPrice,\n StockQuote,\n StockDetail,\n SimilarStock,\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 InstitutionSummary,\n InstitutionList,\n InstitutionListResponse,\n ListInstitutionsOptions,\n MetricType,\n MetricsOptions,\n MetricDistributionOptions,\n ServingMetric,\n MetricDistribution,\n MentionData,\n MentionCount,\n SentimentData,\n MarketMood,\n MarketSummary,\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 retryAfter?: number;\n\n constructor(message: string, code?: string, retryAfter?: number) {\n super(message, 429, code);\n this.name = \"RateLimitError\";\n this.retryAfter = retryAfter;\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 { PreviewResponse } from \"../types.js\";\n\nexport interface AnalystConsensus {\n ticker: string;\n currentPrice: number | null;\n targetLow: number | null;\n targetMean: number | null;\n targetHigh: number | null;\n targetMedian: number | null;\n numberOfAnalysts: number;\n upsidePercent: number | null;\n consensusLabel: string | null;\n recommendationMean: number | null;\n /** PRO-only; zero in the free preview. */\n strongBuy: number;\n /** PRO-only; zero in the free preview. */\n buy: number;\n /** PRO-only; zero in the free preview. */\n hold: number;\n /** PRO-only; zero in the free preview. */\n sell: number;\n /** PRO-only; zero in the free preview. */\n strongSell: number;\n updatedAt: string | null;\n}\n\nexport interface AnalystAction {\n ticker: string;\n actionDate: string;\n firm: string;\n /** UPGRADE, DOWNGRADE, INITIATE, REITERATE, OTHER */\n actionType: string;\n fromGrade: string | null;\n toGrade: string | null;\n}\n\nexport interface AnalystEstimate {\n /** Fiscal period descriptor (provider-specific shape). */\n [key: string]: unknown;\n}\n\nexport interface AnalystEarningsSurprise {\n /** Past report descriptor (provider-specific shape). */\n [key: string]: unknown;\n}\n\nexport interface AnalystEstimatesResponse {\n estimates: AnalystEstimate[];\n surprises: AnalystEarningsSurprise[];\n}\n\nexport interface GetAnalystActionsOptions {\n /** Days of history to return. Default 90. */\n lookbackDays?: number;\n}\n\nexport interface GetAnalystMarketActivityOptions {\n /** Days of history to return. Default 30. */\n lookbackDays?: number;\n}\n\n/**\n * Wall Street analyst coverage: aggregate price targets, recommendation distribution,\n * recent upgrade/downgrade actions, and forward EPS estimates with earnings surprise history.\n *\n * Free users receive the price target band (low/mean/high + analyst count + consensus label)\n * in full -- it powers the public projection cone. The buy/hold/sell distribution counts\n * and full action/estimate history are PRO-only.\n */\nexport class Analyst {\n constructor(private client: APIClient) {}\n\n /**\n * Get the aggregate Wall Street consensus for a ticker. Returns 404 if no\n * coverage exists.\n */\n async consensus(\n ticker: string,\n ): Promise<PreviewResponse<AnalystConsensus>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/consensus`,\n );\n }\n\n /**\n * Get recent analyst upgrade/downgrade actions for a ticker, newest first.\n * Free users receive the 3 most recent.\n */\n async actions(\n ticker: string,\n options?: GetAnalystActionsOptions,\n ): Promise<PreviewResponse<AnalystAction[]>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/actions`,\n options,\n );\n }\n\n /**\n * Get forward EPS estimates and earnings surprise history for a ticker.\n * Free users receive 1 estimate (current quarter) plus the 2 most recent surprises.\n */\n async estimates(\n ticker: string,\n ): Promise<PreviewResponse<AnalystEstimatesResponse>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/estimates`,\n );\n }\n\n /**\n * Get market-wide recent analyst actions across all covered tickers, newest first.\n * Free users receive the 5 most recent.\n */\n async marketActivity(\n options?: GetAnalystMarketActivityOptions,\n ): Promise<PreviewResponse<AnalystAction[]>> {\n return this.client.get(\"/api/v1/analyst/activity\", options);\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 full story detail by cluster ID. */\n async getStoryDetail(clusterId: string): Promise<unknown> {\n return this.client.get(`/api/v1/documents/stories/${encodeURIComponent(clusterId)}`);\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 { PreviewResponse } from \"../types.js\";\n\nexport interface EtfInfo {\n ticker: string;\n name: string;\n kbEntityId: string | null;\n urlSlug: string | null;\n issuer: string | null;\n trackedIndex: string | null;\n assetClass: string | null;\n}\n\nexport interface EtfHolding {\n ticker: string;\n name: string | null;\n /** Weight in the fund as a percentage (0-100). */\n weightPct: number;\n /** ISO date \"YYYY-MM-DD\" — first date this holding appeared in the composition. */\n firstSeen: string | null;\n}\n\nexport interface EtfHoldings {\n ticker: string;\n issuer: string;\n issuerEndpoint: string | null;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date from the issuer. */\n asOfDate: string;\n /** Epoch seconds when SentiSense refreshed the composition. */\n fetchedAt: number | null;\n /** ISO date \"YYYY-MM-DD\" — when the composition is scheduled to be refreshed next. */\n nextRefreshDue: string;\n totalHoldings: number;\n holdings: EtfHolding[];\n /** True when this is a top-N view rather than the full fund. */\n partial?: boolean | null;\n /** Issuer's reported total holdings when `partial=true`. */\n totalKnownHoldings?: number | null;\n}\n\nexport interface EtfAggregateCoverage {\n holdingsCount: number;\n holdingsCovered: number;\n /** Sum of weights (0-100) for the covered holdings. */\n weightCovered: number;\n partial?: boolean | null;\n totalKnownHoldings?: number | null;\n}\n\nexport interface WeightedConsensus {\n upsidePercent: number | null;\n consensusLabel: string | null;\n /** Fractions of covered AUM in each bucket. Sums to ~1.0. */\n distribution: Record<string, number>;\n totalAnalysts: number;\n}\n\nexport interface EtfAnalystContributor {\n ticker: string;\n weightPct: number;\n upsidePercent: number | null;\n consensusLabel: string | null;\n /** Signed contribution to the fund's weighted upside in percentage points. */\n contributionPp: number;\n}\n\nexport interface EtfAnalystAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this rollup was computed. */\n computedAt: number;\n coverage: EtfAggregateCoverage;\n weightedConsensus: WeightedConsensus;\n /** Top contributors (up to 10) by absolute contribution to the weighted upside. */\n topContributors: EtfAnalystContributor[];\n}\n\nexport interface WeightedNetFlow {\n /** Weighted net dollar flow (buys - sells). Negative = net selling. */\n netDollars: number;\n buyDollars: number;\n sellDollars: number;\n /** Unweighted; for context. */\n buyTradeCount: number;\n /** Unweighted; for context. */\n sellTradeCount: number;\n distinctInsiderCount: number;\n}\n\nexport interface EtfInsiderContributor {\n ticker: string;\n weightPct: number;\n /** Per-stock net flow over the window (signed). */\n netDollars: number;\n /** Signed contribution to the weighted headline. */\n weightedNetDollars: number;\n tradeCount: number;\n}\n\nexport interface EtfInsiderAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this rollup was computed. */\n computedAt: number;\n lookbackDays: number;\n coverage: EtfAggregateCoverage;\n weightedNetFlow: WeightedNetFlow;\n /** Top contributors (up to 10) by absolute weighted-net-dollar contribution. */\n topContributors: EtfInsiderContributor[];\n}\n\nexport interface EtfSentimentReading {\n sentiSenseScore: number | null;\n /** BULLISH / NEUTRAL / BEARISH. */\n scoreLabel: string;\n /** Epoch seconds when the underlying metric was produced. */\n asOfTimestamp: number | null;\n}\n\nexport interface EtfSentimentAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this aggregate was assembled. */\n computedAt: number;\n coverage: EtfAggregateCoverage;\n /** Holdings-weighted SentiSense across the fund's constituents. */\n constituentsWeighted: EtfSentimentReading;\n /** Direct reading from mentions of the fund's own ticker. Null for low-mention funds. */\n direct: EtfSentimentReading | null;\n}\n\nexport interface GetEtfInsiderAggregateOptions {\n /** Trailing window for the trade aggregation. Typical values: 30, 90. Default 30. */\n lookbackDays?: number;\n}\n\n/**\n * ETF discovery, composition (holdings), and holdings-weighted aggregate views.\n *\n * Funds aren't rated by analysts directly, don't have insiders of their own, and\n * may not get many direct news mentions -- but the companies inside them do. The\n * aggregate endpoints synthesize fund-level views from each constituent's per-stock\n * data, weighted by allocation, with a coverage block so consumers see how much of\n * the fund's AUM the underlying data covered.\n *\n * Beta as of 2026-05-15: starting with a limited set of widely-traded funds.\n */\nexport class Etfs {\n constructor(private client: APIClient) {}\n\n /**\n * List every ETF tracked by SentiSense, sorted by ticker.\n */\n async list(): Promise<EtfInfo[]> {\n return this.client.get(\"/api/v1/etfs\");\n }\n\n /**\n * Get the full holdings composition for an ETF, including per-holding weights\n * and freshness metadata. Returns 404 for unknown ETFs or commodity-only funds.\n */\n async holdings(ticker: string): Promise<EtfHoldings> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/holdings`,\n );\n }\n\n /**\n * Get the holdings-weighted analyst consensus for an ETF, including the\n * top per-holding contributors that drive the weighted upside.\n */\n async analystAggregate(\n ticker: string,\n ): Promise<PreviewResponse<EtfAnalystAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/analyst`,\n );\n }\n\n /**\n * Get the holdings-weighted SEC Form 4 insider aggregate for an ETF over a\n * configurable trailing window, including per-holding `topContributors` with\n * signed contribution to the weighted headline.\n */\n async insiderAggregate(\n ticker: string,\n options?: GetEtfInsiderAggregateOptions,\n ): Promise<PreviewResponse<EtfInsiderAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/insider`,\n options,\n );\n }\n\n /**\n * Get two SentiSense Score readings side-by-side: `constituentsWeighted`\n * (precomputed daily weighted average across the fund's holdings) and `direct`\n * (score from mentions of the fund's own ticker). The two can diverge, and the\n * gap is itself information.\n */\n async sentimentAggregate(\n ticker: string,\n ): Promise<PreviewResponse<EtfSentimentAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/sentiment`,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n InsiderActivityResponse,\n InsiderTrade,\n ClusterBuy,\n GetInsiderOptions,\n PreviewResponse,\n} from \"../types.js\";\n\nexport class Insider {\n constructor(private client: APIClient) {}\n\n /**\n * Get market-wide insider activity: top buys and sells aggregated by ticker.\n *\n * PRO-gated. Free/unauthenticated users receive a preview (top 5 per direction)\n * with `isPreview: true` in the response.\n */\n async getActivity(options?: GetInsiderOptions): Promise<PreviewResponse<InsiderActivityResponse>> {\n return this.client.get(\"/api/v1/insider/activity\", options);\n }\n\n /**\n * Get individual insider transactions for a specific stock.\n *\n * PRO-gated. Free users receive a preview of the top 5 transactions.\n */\n async getTrades(ticker: string, options?: GetInsiderOptions): Promise<PreviewResponse<InsiderTrade[]>> {\n return this.client.get(\n `/api/v1/insider/trades/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get cluster buy signals: stocks where 3+ distinct insiders bought recently.\n *\n * PRO-gated. Free users receive a preview of the top 3 signals.\n */\n async getClusterBuys(options?: GetInsiderOptions): Promise<PreviewResponse<ClusterBuy[]>> {\n return this.client.get(\"/api/v1/insider/cluster-buys\", options);\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n CongressTrade,\n PoliticianSummary,\n PoliticianDetail,\n GetPoliticiansOptions,\n PreviewResponse,\n} from \"../types.js\";\n\nexport class Politicians {\n constructor(private client: APIClient) {}\n\n /**\n * Get recent congressional STOCK Act trading activity across all politicians.\n *\n * PRO-gated. Free/unauthenticated users receive a preview (top 5 trades)\n * with `isPreview: true` in the response.\n */\n async getActivity(\n options?: GetPoliticiansOptions,\n ): Promise<PreviewResponse<CongressTrade[]>> {\n return this.client.get(\"/api/v1/politicians/activity\", options);\n }\n\n /**\n * Get congressional trades for a specific stock.\n *\n * PRO-gated. Free users receive a preview of the top 3 trades.\n */\n async getFilings(\n ticker: string,\n options?: GetPoliticiansOptions,\n ): Promise<PreviewResponse<CongressTrade[]>> {\n return this.client.get(\n `/api/v1/politicians/filings/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get all tracked politicians with trading summary statistics.\n *\n * PRO-gated. Free users receive a preview of the top 5 members.\n */\n async getMembers(): Promise<PreviewResponse<PoliticianSummary[]>> {\n return this.client.get(\"/api/v1/politicians/members\");\n }\n\n /**\n * Get detailed profile for a single politician: summary, recent trades, top tickers.\n *\n * PRO-gated. Free users receive a preview-wrapped response.\n */\n async getMember(slug: string): Promise<PreviewResponse<PoliticianDetail>> {\n return this.client.get(\n `/api/v1/politicians/member/${encodeURIComponent(slug)}`,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Insight,\n InsightPreviewResponse,\n GetInsightsOptions,\n} from \"../types.js\";\n\nexport interface GetStockInsightsRangeOptions {\n startDate: string;\n endDate: string;\n urgency?: \"low\" | \"medium\" | \"high\";\n insightType?: string;\n}\n\nexport interface GetLatestInsightsOptions {\n limit?: number;\n urgency?: \"low\" | \"medium\" | \"high\";\n}\n\nexport interface GetUserInsightsOptions {\n limit?: number;\n category?: string;\n}\n\nexport class Insights {\n constructor(private client: APIClient) {}\n\n /**\n * Get AI-generated insights for a specific stock, sorted by urgency then confidence.\n *\n * PRO users receive a flat array of Insight objects.\n * Free/unauthenticated users receive a preview with `isPreview: true`,\n * the top 3 insights in full, and a `locked` array with metadata-only entries\n * (type, urgency, timestamp) showing what additional signals exist.\n */\n async stock(\n ticker: string,\n options?: GetInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get AI insights for a stock within a date range.\n *\n * Free users receive the top 3; PRO users receive the full list.\n * The server returns 400 if `startDate` is after `endDate`.\n */\n async stockRange(\n ticker: string,\n options: GetStockInsightsRangeOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}/range`,\n options,\n );\n }\n\n /**\n * Get AI-generated market-level insights, sorted by urgency then confidence.\n *\n * PRO users receive a flat array of Insight objects.\n * Free/unauthenticated users receive a preview with `isPreview: true`,\n * the top 5 insights in full, and a `locked` array with metadata-only entries.\n */\n async market(): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/market\");\n }\n\n /**\n * Get the latest AI insights across all tracked stocks, newest first.\n *\n * Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).\n */\n async latest(\n options?: GetLatestInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/latest\", options);\n }\n\n /**\n * Get personalized insights for the authenticated user.\n *\n * Biased toward the user's watchlist and portfolio when available; falls back\n * to market-level insights otherwise. API key authentication required.\n */\n async user(\n options?: GetUserInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/user\", options);\n }\n\n /**\n * Get available insight types for a specific stock.\n * No authentication required.\n *\n * Returns an array of insight type strings (e.g., `[\"sentiment_shift\", \"options_activity\"]`).\n */\n async types(ticker: string): Promise<string[]> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}/types`,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n GetFlowsOptions,\n Holder,\n InstitutionList,\n InstitutionListResponse,\n InstitutionalFlowsResponse,\n ListInstitutionsOptions,\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 /**\n * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)\n * so you can find what to query without knowing slugs upfront.\n *\n * Each institution is rolled up by parent filer, so a multi-filer manager\n * (e.g. Vanguard) appears once with combined AUM. Summary only; use\n * `getInstitutionDetail` for a filer's full holdings.\n *\n * Requires an API key but does not consume monthly quota (per-minute rate\n * limits still apply). Returns the unwrapped list payload.\n */\n async listInstitutions(options?: ListInstitutionsOptions): Promise<InstitutionList> {\n const resp = await this.client.get<InstitutionListResponse>(\n \"/api/v1/institutional/institutions\",\n { ...options },\n );\n return resp.data;\n }\n\n /**\n * Get the full profile, summary stats, and current-quarter holdings for a\n * specific institutional filer.\n *\n * Resolved by URL slug (e.g. `Berkshire-Hathaway`) or numeric SEC CIK.\n * Free users receive the profile and top 10 holdings; PRO users receive the\n * full holdings array. Returns 404 if the slug or CIK is unknown.\n */\n async getInstitutionDetail(slugOrCik: string): Promise<unknown> {\n return this.client.get(\n `/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}`,\n );\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 // TODO: accept a `days` param to control history length (the endpoint supports ?days=N).\n // TODO: add a sibling `indexes` resource for /api/v1/indexes/{id} (+ /history), e.g. fed-sentiment.\n}\n","import type { APIClient } from \"../client.js\";\nimport type { MarketSummary } from \"../types.js\";\n\nexport class MarketSummaryResource {\n constructor(private client: APIClient) {}\n\n /** Get the AI-generated market summary with headline and analysis. */\n async get(): Promise<MarketSummary> {\n return this.client.get(\"/api/v1/market-summary\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n AISummary,\n ChartData,\n CompanyKpisData,\n FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n KpiCoverageResponse,\n KpiTypeEntry,\n MarketStatus,\n MetricsBreakdown,\n PreviewResponse,\n SimilarStock,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n StockQuote,\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 /**\n * Get aggregate quote snapshot: live price, today OHLC, 52-week range,\n * market cap, P/E, EPS TTM, and dividend yield in a single call.\n * All fields except `ticker` may be null when upstream data is unavailable.\n */\n async getQuote(ticker: string): Promise<StockQuote> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/quote`);\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<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<SimilarStock[]> {\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 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 /**\n * Get company-specific KPI time-series for a ticker. Returns curated GAAP and\n * non-GAAP metrics from earnings filings (e.g. iPhone unit sales, Tesla deliveries,\n * AWS revenue).\n *\n * Free users receive metadata only with an empty `kpis` list; PRO users receive\n * the full series. Returns 404 for tickers that do not yet have curated coverage.\n *\n * Coverage today: near-complete for the S&P 500 plus extended universe\n * (~500 tickers). Use `listKpiCoverage()` to enumerate.\n */\n async getKpis(ticker: string): Promise<PreviewResponse<CompanyKpisData>> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/kpis`,\n );\n }\n\n /**\n * List every ticker with curated KPI coverage. Returns `{count, tickers: [...]}`\n * with lightweight metadata (ticker, companyName, lastUpdated, kpiCount).\n * Sorted alphabetically by ticker.\n *\n * Auth: API key required, but the call does NOT consume your monthly quota\n * (rate-limit-per-minute still applies).\n */\n async listKpiCoverage(): Promise<KpiCoverageResponse> {\n return this.client.get(\"/api/v1/stocks/with-kpis\");\n }\n\n /**\n * List the KPI metadata tuples available for a ticker — `id, name, category,\n * chartType` — without paying the cost of the full series payload. Mirrors\n * the `/api/v1/insights/stock/{ticker}/types` precedent.\n *\n * Auth: API key required, no quota cost. 404 if the ticker has no curated KPIs.\n */\n async getKpiTypes(ticker: string): Promise<KpiTypeEntry[]> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/kpis/types`,\n );\n }\n}\n","export const VERSION = \"0.20.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Analyst } from \"./resources/analyst.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { Etfs } from \"./resources/etfs.js\";\nimport { Insider } from \"./resources/insider.js\";\nimport { Politicians } from \"./resources/politicians.js\";\nimport { Insights } from \"./resources/insights.js\";\nimport { Institutional } from \"./resources/institutional.js\";\nimport { KB } from \"./resources/kb.js\";\nimport { MarketMoodResource } from \"./resources/marketMood.js\";\nimport { MarketSummaryResource } from \"./resources/marketSummary.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;\nconst DEFAULT_MAX_RETRIES = 3;\nconst BASE_DELAY_MS = 1_000;\nconst MAX_DELAY_MS = 60_000;\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/** @internal HTTP interface exposed to resource classes. */\nexport interface APIClient {\n get<T = unknown>(path: string, params?: object): Promise<T>;\n post<T = unknown>(path: string, body: unknown): Promise<T>;\n}\n\nexport class SentiSense implements APIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeout: number;\n private maxRetries: number;\n\n readonly stocks: Stocks;\n readonly documents: Documents;\n readonly etfs: Etfs;\n readonly institutional: Institutional;\n readonly insider: Insider;\n readonly politicians: Politicians;\n readonly insights: Insights;\n readonly analyst: Analyst;\n readonly entityMetrics: EntityMetrics;\n readonly marketMood: MarketMoodResource;\n readonly marketSummary: MarketSummaryResource;\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 this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;\n\n this.stocks = new Stocks(this);\n this.documents = new Documents(this);\n this.etfs = new Etfs(this);\n this.institutional = new Institutional(this);\n this.insider = new Insider(this);\n this.politicians = new Politicians(this);\n this.insights = new Insights(this);\n this.analyst = new Analyst(this);\n this.entityMetrics = new EntityMetrics(this);\n this.marketMood = new MarketMoodResource(this);\n this.marketSummary = new MarketSummaryResource(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 \"Accept\": \"application/json\",\n };\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 let delayMs = 0;\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (delayMs > 0) {\n await sleep(delayMs);\n delayMs = 0;\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 const isRetryable = response.status === 429 || response.status >= 500;\n if (isRetryable && attempt < this.maxRetries) {\n if (response.status === 429) {\n const ra = response.headers.get(\"Retry-After\");\n delayMs = (ra ? parseInt(ra, 10) : 60) * 1000;\n } else {\n delayMs = Math.min(BASE_DELAY_MS * Math.pow(2, attempt), MAX_DELAY_MS) + Math.random() * 1000;\n }\n try { await response.body?.cancel(); } catch { /* ignore */ }\n continue;\n }\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 throw new SentiSenseError(\"All retries exhausted\");\n }\n\n /** @internal */\n async post<T = unknown>(path: string, body: unknown): Promise<T> {\n const url = this.buildUrl(path);\n const headers: Record<string, string> = {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/json\",\n };\n\n if (this.apiKey) {\n headers[\"X-SentiSense-API-Key\"] = this.apiKey;\n }\n\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: \"POST\",\n headers,\n body: JSON.stringify(body),\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 const ra = response.headers.get(\"Retry-After\");\n throw new RateLimitError(message, code, ra ? parseInt(ra, 10) : undefined);\n }\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;AAC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cAAM,IAAI,cAAc,SAAS,IAAI;AAAA,MACvC,KAAK,KAAK;AACR,cAAM,KAAK,SAAS,QAAQ,IAAI,aAAa;AAC7C,cAAM,IAAI,eAAe,SAAS,MAAM,KAAK,SAAS,IAAI,EAAE,IAAI,MAAS;AAAA,MAC3E;AAAA,MACA;AACE,cAAM,IAAI,SAAS,SAAS,SAAS,QAAQ,IAAI;AAAA,IACrD;AAAA,EACF;AACF;","names":[]}
package/dist/index.d.mts CHANGED
@@ -60,6 +60,7 @@ interface StockDetail {
60
60
  interface SimilarStock {
61
61
  symbol: string;
62
62
  name: string;
63
+ /** @deprecated No longer returned by the API; use `symbol` to identify the peer. Will be removed in a future release. */
63
64
  kbEntityId?: string;
64
65
  price: number | null;
65
66
  changePercent: number | null;
@@ -286,6 +287,54 @@ interface InstitutionalFlowsResponse {
286
287
  interface GetFlowsOptions {
287
288
  limit?: number;
288
289
  }
290
+ /** A single institution summary from the discovery list. */
291
+ interface InstitutionSummary {
292
+ /** SEC Central Index Key of the (rolled-up) institution. */
293
+ cik: string;
294
+ /** URL slug for routing to `getInstitutionDetail`. */
295
+ urlSlug: string;
296
+ displayName: string;
297
+ /** Filer category, or null if unclassified. */
298
+ filerCategory: string | null;
299
+ /** Total AUM in USD for the quarter (rolled-up across the filer group). */
300
+ totalValueUsd: number;
301
+ /** Distinct equity tickers held this quarter (rolled-up, de-duped). */
302
+ holdingsCount: number;
303
+ /** True when this institution aggregates multiple related filer CIKs. */
304
+ multiCikRollup: boolean;
305
+ /** Number of subsidiary filers rolled up under this institution (0 when not a rollup). */
306
+ childCikCount: number;
307
+ }
308
+ /** The `data` payload of the institution discovery list. */
309
+ interface InstitutionList {
310
+ /** Quarter of the AUM snapshot, e.g. `"2026Q1"`. */
311
+ quarter: string;
312
+ /** Total institutions matching the filters, before pagination. */
313
+ totalCount: number;
314
+ offset: number;
315
+ limit: number;
316
+ institutions: InstitutionSummary[];
317
+ }
318
+ /** Wire envelope for the discovery list (always full, never a preview). */
319
+ interface InstitutionListResponse {
320
+ isPreview: boolean;
321
+ previewReason: "PRO_REQUIRED" | null;
322
+ data: InstitutionList;
323
+ }
324
+ interface ListInstitutionsOptions {
325
+ /** Filer category filter (e.g. `"HEDGE_FUND"`). */
326
+ category?: string;
327
+ /** Minimum total AUM in USD (e.g. `10_000_000_000`). */
328
+ minAumUsd?: number;
329
+ /** Page size (default 50, max 200). */
330
+ limit?: number;
331
+ /** Pagination offset (default 0). */
332
+ offset?: number;
333
+ /** `"aumDesc"` (default), `"aumAsc"`, or `"nameAsc"`. */
334
+ sort?: "aumDesc" | "aumAsc" | "nameAsc";
335
+ /** AUM snapshot quarter as `YYYYQN` (e.g. `"2026Q1"`); defaults to latest. */
336
+ quarter?: string;
337
+ }
289
338
  interface InsiderActivitySummary {
290
339
  ticker: string;
291
340
  companyName: string;
@@ -394,6 +443,12 @@ interface GetPoliticiansOptions {
394
443
  interface PreviewResponse<T> {
395
444
  isPreview: boolean;
396
445
  previewReason: "LOGIN_REQUIRED" | "PRO_REQUIRED" | null;
446
+ /**
447
+ * Number of items in the full PRO dataset, before preview truncation.
448
+ * Present on preview (free-tier) list responses so callers can show
449
+ * "showing N of totalCount". Absent on full PRO responses.
450
+ */
451
+ totalCount?: number;
397
452
  data: T;
398
453
  }
399
454
  /** Supported metric types for the v2 Serving Metrics API. */
@@ -1021,6 +1076,18 @@ declare class Institutional {
1021
1076
  getHolders(ticker: string, reportDate: string): Promise<Holder[]>;
1022
1077
  /** Get activist investor positions (NEW or INCREASED). */
1023
1078
  getActivists(reportDate: string): Promise<Holder[]>;
1079
+ /**
1080
+ * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)
1081
+ * so you can find what to query without knowing slugs upfront.
1082
+ *
1083
+ * Each institution is rolled up by parent filer, so a multi-filer manager
1084
+ * (e.g. Vanguard) appears once with combined AUM. Summary only; use
1085
+ * `getInstitutionDetail` for a filer's full holdings.
1086
+ *
1087
+ * Requires an API key but does not consume monthly quota (per-minute rate
1088
+ * limits still apply). Returns the unwrapped list payload.
1089
+ */
1090
+ listInstitutions(options?: ListInstitutionsOptions): Promise<InstitutionList>;
1024
1091
  /**
1025
1092
  * Get the full profile, summary stats, and current-quarter holdings for a
1026
1093
  * specific institutional filer.
@@ -1128,7 +1195,7 @@ declare class Stocks {
1128
1195
  * Sorted alphabetically by ticker.
1129
1196
  *
1130
1197
  * Auth: API key required, but the call does NOT consume your monthly quota
1131
- * (rate-limit-per-minute still applies). [COMP-421]
1198
+ * (rate-limit-per-minute still applies).
1132
1199
  */
1133
1200
  listKpiCoverage(): Promise<KpiCoverageResponse>;
1134
1201
  /**
@@ -1191,6 +1258,6 @@ declare class APIError extends SentiSenseError {
1191
1258
  constructor(message: string, status: number, code?: string);
1192
1259
  }
1193
1260
 
1194
- declare const VERSION = "0.18.0";
1261
+ declare const VERSION = "0.20.0";
1195
1262
 
1196
- export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, AuthenticationError, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSource, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfSentimentAggregate, type EtfSentimentReading, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetAnalystActionsOptions, type GetAnalystMarketActivityOptions, type GetEtfInsiderAggregateOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetPoliticiansOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type KpiCoverageEntry, type KpiCoverageResponse, type KpiDataPoint, type KpiSeries, type KpiTypeEntry, type LockedInsight, type MarketMood, type MarketStatus, type MarketSummary, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type PoliticianDetail, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type Story, type StoryCluster, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
1263
+ export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, AuthenticationError, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSource, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfSentimentAggregate, type EtfSentimentReading, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetAnalystActionsOptions, type GetAnalystMarketActivityOptions, type GetEtfInsiderAggregateOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetPoliticiansOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionList, type InstitutionListResponse, type InstitutionSummary, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type KpiCoverageEntry, type KpiCoverageResponse, type KpiDataPoint, type KpiSeries, type KpiTypeEntry, type ListInstitutionsOptions, type LockedInsight, type MarketMood, type MarketStatus, type MarketSummary, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type PoliticianDetail, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type Story, type StoryCluster, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
package/dist/index.d.ts CHANGED
@@ -60,6 +60,7 @@ interface StockDetail {
60
60
  interface SimilarStock {
61
61
  symbol: string;
62
62
  name: string;
63
+ /** @deprecated No longer returned by the API; use `symbol` to identify the peer. Will be removed in a future release. */
63
64
  kbEntityId?: string;
64
65
  price: number | null;
65
66
  changePercent: number | null;
@@ -286,6 +287,54 @@ interface InstitutionalFlowsResponse {
286
287
  interface GetFlowsOptions {
287
288
  limit?: number;
288
289
  }
290
+ /** A single institution summary from the discovery list. */
291
+ interface InstitutionSummary {
292
+ /** SEC Central Index Key of the (rolled-up) institution. */
293
+ cik: string;
294
+ /** URL slug for routing to `getInstitutionDetail`. */
295
+ urlSlug: string;
296
+ displayName: string;
297
+ /** Filer category, or null if unclassified. */
298
+ filerCategory: string | null;
299
+ /** Total AUM in USD for the quarter (rolled-up across the filer group). */
300
+ totalValueUsd: number;
301
+ /** Distinct equity tickers held this quarter (rolled-up, de-duped). */
302
+ holdingsCount: number;
303
+ /** True when this institution aggregates multiple related filer CIKs. */
304
+ multiCikRollup: boolean;
305
+ /** Number of subsidiary filers rolled up under this institution (0 when not a rollup). */
306
+ childCikCount: number;
307
+ }
308
+ /** The `data` payload of the institution discovery list. */
309
+ interface InstitutionList {
310
+ /** Quarter of the AUM snapshot, e.g. `"2026Q1"`. */
311
+ quarter: string;
312
+ /** Total institutions matching the filters, before pagination. */
313
+ totalCount: number;
314
+ offset: number;
315
+ limit: number;
316
+ institutions: InstitutionSummary[];
317
+ }
318
+ /** Wire envelope for the discovery list (always full, never a preview). */
319
+ interface InstitutionListResponse {
320
+ isPreview: boolean;
321
+ previewReason: "PRO_REQUIRED" | null;
322
+ data: InstitutionList;
323
+ }
324
+ interface ListInstitutionsOptions {
325
+ /** Filer category filter (e.g. `"HEDGE_FUND"`). */
326
+ category?: string;
327
+ /** Minimum total AUM in USD (e.g. `10_000_000_000`). */
328
+ minAumUsd?: number;
329
+ /** Page size (default 50, max 200). */
330
+ limit?: number;
331
+ /** Pagination offset (default 0). */
332
+ offset?: number;
333
+ /** `"aumDesc"` (default), `"aumAsc"`, or `"nameAsc"`. */
334
+ sort?: "aumDesc" | "aumAsc" | "nameAsc";
335
+ /** AUM snapshot quarter as `YYYYQN` (e.g. `"2026Q1"`); defaults to latest. */
336
+ quarter?: string;
337
+ }
289
338
  interface InsiderActivitySummary {
290
339
  ticker: string;
291
340
  companyName: string;
@@ -394,6 +443,12 @@ interface GetPoliticiansOptions {
394
443
  interface PreviewResponse<T> {
395
444
  isPreview: boolean;
396
445
  previewReason: "LOGIN_REQUIRED" | "PRO_REQUIRED" | null;
446
+ /**
447
+ * Number of items in the full PRO dataset, before preview truncation.
448
+ * Present on preview (free-tier) list responses so callers can show
449
+ * "showing N of totalCount". Absent on full PRO responses.
450
+ */
451
+ totalCount?: number;
397
452
  data: T;
398
453
  }
399
454
  /** Supported metric types for the v2 Serving Metrics API. */
@@ -1021,6 +1076,18 @@ declare class Institutional {
1021
1076
  getHolders(ticker: string, reportDate: string): Promise<Holder[]>;
1022
1077
  /** Get activist investor positions (NEW or INCREASED). */
1023
1078
  getActivists(reportDate: string): Promise<Holder[]>;
1079
+ /**
1080
+ * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)
1081
+ * so you can find what to query without knowing slugs upfront.
1082
+ *
1083
+ * Each institution is rolled up by parent filer, so a multi-filer manager
1084
+ * (e.g. Vanguard) appears once with combined AUM. Summary only; use
1085
+ * `getInstitutionDetail` for a filer's full holdings.
1086
+ *
1087
+ * Requires an API key but does not consume monthly quota (per-minute rate
1088
+ * limits still apply). Returns the unwrapped list payload.
1089
+ */
1090
+ listInstitutions(options?: ListInstitutionsOptions): Promise<InstitutionList>;
1024
1091
  /**
1025
1092
  * Get the full profile, summary stats, and current-quarter holdings for a
1026
1093
  * specific institutional filer.
@@ -1128,7 +1195,7 @@ declare class Stocks {
1128
1195
  * Sorted alphabetically by ticker.
1129
1196
  *
1130
1197
  * Auth: API key required, but the call does NOT consume your monthly quota
1131
- * (rate-limit-per-minute still applies). [COMP-421]
1198
+ * (rate-limit-per-minute still applies).
1132
1199
  */
1133
1200
  listKpiCoverage(): Promise<KpiCoverageResponse>;
1134
1201
  /**
@@ -1191,6 +1258,6 @@ declare class APIError extends SentiSenseError {
1191
1258
  constructor(message: string, status: number, code?: string);
1192
1259
  }
1193
1260
 
1194
- declare const VERSION = "0.18.0";
1261
+ declare const VERSION = "0.20.0";
1195
1262
 
1196
- export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, AuthenticationError, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSource, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfSentimentAggregate, type EtfSentimentReading, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetAnalystActionsOptions, type GetAnalystMarketActivityOptions, type GetEtfInsiderAggregateOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetPoliticiansOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type KpiCoverageEntry, type KpiCoverageResponse, type KpiDataPoint, type KpiSeries, type KpiTypeEntry, type LockedInsight, type MarketMood, type MarketStatus, type MarketSummary, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type PoliticianDetail, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type Story, type StoryCluster, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
1263
+ export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, AuthenticationError, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSource, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfSentimentAggregate, type EtfSentimentReading, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetAnalystActionsOptions, type GetAnalystMarketActivityOptions, type GetEtfInsiderAggregateOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetPoliticiansOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionList, type InstitutionListResponse, type InstitutionSummary, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type KpiCoverageEntry, type KpiCoverageResponse, type KpiDataPoint, type KpiSeries, type KpiTypeEntry, type ListInstitutionsOptions, type LockedInsight, type MarketMood, type MarketStatus, type MarketSummary, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type PoliticianDetail, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type Story, type StoryCluster, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
package/dist/index.mjs CHANGED
@@ -451,6 +451,24 @@ var Institutional = class {
451
451
  async getActivists(reportDate) {
452
452
  return this.client.get("/api/v1/institutional/activist", { reportDate });
453
453
  }
454
+ /**
455
+ * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)
456
+ * so you can find what to query without knowing slugs upfront.
457
+ *
458
+ * Each institution is rolled up by parent filer, so a multi-filer manager
459
+ * (e.g. Vanguard) appears once with combined AUM. Summary only; use
460
+ * `getInstitutionDetail` for a filer's full holdings.
461
+ *
462
+ * Requires an API key but does not consume monthly quota (per-minute rate
463
+ * limits still apply). Returns the unwrapped list payload.
464
+ */
465
+ async listInstitutions(options) {
466
+ const resp = await this.client.get(
467
+ "/api/v1/institutional/institutions",
468
+ { ...options }
469
+ );
470
+ return resp.data;
471
+ }
454
472
  /**
455
473
  * Get the full profile, summary stats, and current-quarter holdings for a
456
474
  * specific institutional filer.
@@ -494,6 +512,8 @@ var MarketMoodResource = class {
494
512
  async get() {
495
513
  return this.client.get("/api/v2/market-mood");
496
514
  }
515
+ // TODO: accept a `days` param to control history length (the endpoint supports ?days=N).
516
+ // TODO: add a sibling `indexes` resource for /api/v1/indexes/{id} (+ /history), e.g. fed-sentiment.
497
517
  };
498
518
 
499
519
  // src/resources/marketSummary.ts
@@ -641,7 +661,7 @@ var Stocks = class {
641
661
  * Sorted alphabetically by ticker.
642
662
  *
643
663
  * Auth: API key required, but the call does NOT consume your monthly quota
644
- * (rate-limit-per-minute still applies). [COMP-421]
664
+ * (rate-limit-per-minute still applies).
645
665
  */
646
666
  async listKpiCoverage() {
647
667
  return this.client.get("/api/v1/stocks/with-kpis");
@@ -661,7 +681,7 @@ var Stocks = class {
661
681
  };
662
682
 
663
683
  // src/version.ts
664
- var VERSION = "0.18.0";
684
+ var VERSION = "0.20.0";
665
685
 
666
686
  // src/client.ts
667
687
  var DEFAULT_BASE_URL = "https://app.sentisense.ai";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts","../src/resources/analyst.ts","../src/resources/documents.ts","../src/resources/entityMetrics.ts","../src/resources/etfs.ts","../src/resources/insider.ts","../src/resources/politicians.ts","../src/resources/insights.ts","../src/resources/institutional.ts","../src/resources/kb.ts","../src/resources/marketMood.ts","../src/resources/marketSummary.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 retryAfter?: number;\n\n constructor(message: string, code?: string, retryAfter?: number) {\n super(message, 429, code);\n this.name = \"RateLimitError\";\n this.retryAfter = retryAfter;\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 { PreviewResponse } from \"../types.js\";\n\nexport interface AnalystConsensus {\n ticker: string;\n currentPrice: number | null;\n targetLow: number | null;\n targetMean: number | null;\n targetHigh: number | null;\n targetMedian: number | null;\n numberOfAnalysts: number;\n upsidePercent: number | null;\n consensusLabel: string | null;\n recommendationMean: number | null;\n /** PRO-only; zero in the free preview. */\n strongBuy: number;\n /** PRO-only; zero in the free preview. */\n buy: number;\n /** PRO-only; zero in the free preview. */\n hold: number;\n /** PRO-only; zero in the free preview. */\n sell: number;\n /** PRO-only; zero in the free preview. */\n strongSell: number;\n updatedAt: string | null;\n}\n\nexport interface AnalystAction {\n ticker: string;\n actionDate: string;\n firm: string;\n /** UPGRADE, DOWNGRADE, INITIATE, REITERATE, OTHER */\n actionType: string;\n fromGrade: string | null;\n toGrade: string | null;\n}\n\nexport interface AnalystEstimate {\n /** Fiscal period descriptor (provider-specific shape). */\n [key: string]: unknown;\n}\n\nexport interface AnalystEarningsSurprise {\n /** Past report descriptor (provider-specific shape). */\n [key: string]: unknown;\n}\n\nexport interface AnalystEstimatesResponse {\n estimates: AnalystEstimate[];\n surprises: AnalystEarningsSurprise[];\n}\n\nexport interface GetAnalystActionsOptions {\n /** Days of history to return. Default 90. */\n lookbackDays?: number;\n}\n\nexport interface GetAnalystMarketActivityOptions {\n /** Days of history to return. Default 30. */\n lookbackDays?: number;\n}\n\n/**\n * Wall Street analyst coverage: aggregate price targets, recommendation distribution,\n * recent upgrade/downgrade actions, and forward EPS estimates with earnings surprise history.\n *\n * Free users receive the price target band (low/mean/high + analyst count + consensus label)\n * in full -- it powers the public projection cone. The buy/hold/sell distribution counts\n * and full action/estimate history are PRO-only.\n */\nexport class Analyst {\n constructor(private client: APIClient) {}\n\n /**\n * Get the aggregate Wall Street consensus for a ticker. Returns 404 if no\n * coverage exists.\n */\n async consensus(\n ticker: string,\n ): Promise<PreviewResponse<AnalystConsensus>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/consensus`,\n );\n }\n\n /**\n * Get recent analyst upgrade/downgrade actions for a ticker, newest first.\n * Free users receive the 3 most recent.\n */\n async actions(\n ticker: string,\n options?: GetAnalystActionsOptions,\n ): Promise<PreviewResponse<AnalystAction[]>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/actions`,\n options,\n );\n }\n\n /**\n * Get forward EPS estimates and earnings surprise history for a ticker.\n * Free users receive 1 estimate (current quarter) plus the 2 most recent surprises.\n */\n async estimates(\n ticker: string,\n ): Promise<PreviewResponse<AnalystEstimatesResponse>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/estimates`,\n );\n }\n\n /**\n * Get market-wide recent analyst actions across all covered tickers, newest first.\n * Free users receive the 5 most recent.\n */\n async marketActivity(\n options?: GetAnalystMarketActivityOptions,\n ): Promise<PreviewResponse<AnalystAction[]>> {\n return this.client.get(\"/api/v1/analyst/activity\", options);\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 full story detail by cluster ID. */\n async getStoryDetail(clusterId: string): Promise<unknown> {\n return this.client.get(`/api/v1/documents/stories/${encodeURIComponent(clusterId)}`);\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 { PreviewResponse } from \"../types.js\";\n\nexport interface EtfInfo {\n ticker: string;\n name: string;\n kbEntityId: string | null;\n urlSlug: string | null;\n issuer: string | null;\n trackedIndex: string | null;\n assetClass: string | null;\n}\n\nexport interface EtfHolding {\n ticker: string;\n name: string | null;\n /** Weight in the fund as a percentage (0-100). */\n weightPct: number;\n /** ISO date \"YYYY-MM-DD\" — first date this holding appeared in the composition. */\n firstSeen: string | null;\n}\n\nexport interface EtfHoldings {\n ticker: string;\n issuer: string;\n issuerEndpoint: string | null;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date from the issuer. */\n asOfDate: string;\n /** Epoch seconds when SentiSense refreshed the composition. */\n fetchedAt: number | null;\n /** ISO date \"YYYY-MM-DD\" — when the composition is scheduled to be refreshed next. */\n nextRefreshDue: string;\n totalHoldings: number;\n holdings: EtfHolding[];\n /** True when this is a top-N view rather than the full fund. */\n partial?: boolean | null;\n /** Issuer's reported total holdings when `partial=true`. */\n totalKnownHoldings?: number | null;\n}\n\nexport interface EtfAggregateCoverage {\n holdingsCount: number;\n holdingsCovered: number;\n /** Sum of weights (0-100) for the covered holdings. */\n weightCovered: number;\n partial?: boolean | null;\n totalKnownHoldings?: number | null;\n}\n\nexport interface WeightedConsensus {\n upsidePercent: number | null;\n consensusLabel: string | null;\n /** Fractions of covered AUM in each bucket. Sums to ~1.0. */\n distribution: Record<string, number>;\n totalAnalysts: number;\n}\n\nexport interface EtfAnalystContributor {\n ticker: string;\n weightPct: number;\n upsidePercent: number | null;\n consensusLabel: string | null;\n /** Signed contribution to the fund's weighted upside in percentage points. */\n contributionPp: number;\n}\n\nexport interface EtfAnalystAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this rollup was computed. */\n computedAt: number;\n coverage: EtfAggregateCoverage;\n weightedConsensus: WeightedConsensus;\n /** Top contributors (up to 10) by absolute contribution to the weighted upside. */\n topContributors: EtfAnalystContributor[];\n}\n\nexport interface WeightedNetFlow {\n /** Weighted net dollar flow (buys - sells). Negative = net selling. */\n netDollars: number;\n buyDollars: number;\n sellDollars: number;\n /** Unweighted; for context. */\n buyTradeCount: number;\n /** Unweighted; for context. */\n sellTradeCount: number;\n distinctInsiderCount: number;\n}\n\nexport interface EtfInsiderContributor {\n ticker: string;\n weightPct: number;\n /** Per-stock net flow over the window (signed). */\n netDollars: number;\n /** Signed contribution to the weighted headline. */\n weightedNetDollars: number;\n tradeCount: number;\n}\n\nexport interface EtfInsiderAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this rollup was computed. */\n computedAt: number;\n lookbackDays: number;\n coverage: EtfAggregateCoverage;\n weightedNetFlow: WeightedNetFlow;\n /** Top contributors (up to 10) by absolute weighted-net-dollar contribution. */\n topContributors: EtfInsiderContributor[];\n}\n\nexport interface EtfSentimentReading {\n sentiSenseScore: number | null;\n /** BULLISH / NEUTRAL / BEARISH. */\n scoreLabel: string;\n /** Epoch seconds when the underlying metric was produced. */\n asOfTimestamp: number | null;\n}\n\nexport interface EtfSentimentAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this aggregate was assembled. */\n computedAt: number;\n coverage: EtfAggregateCoverage;\n /** Holdings-weighted SentiSense across the fund's constituents. */\n constituentsWeighted: EtfSentimentReading;\n /** Direct reading from mentions of the fund's own ticker. Null for low-mention funds. */\n direct: EtfSentimentReading | null;\n}\n\nexport interface GetEtfInsiderAggregateOptions {\n /** Trailing window for the trade aggregation. Typical values: 30, 90. Default 30. */\n lookbackDays?: number;\n}\n\n/**\n * ETF discovery, composition (holdings), and holdings-weighted aggregate views.\n *\n * Funds aren't rated by analysts directly, don't have insiders of their own, and\n * may not get many direct news mentions -- but the companies inside them do. The\n * aggregate endpoints synthesize fund-level views from each constituent's per-stock\n * data, weighted by allocation, with a coverage block so consumers see how much of\n * the fund's AUM the underlying data covered.\n *\n * Beta as of 2026-05-15: starting with a limited set of widely-traded funds.\n */\nexport class Etfs {\n constructor(private client: APIClient) {}\n\n /**\n * List every ETF tracked by SentiSense, sorted by ticker.\n */\n async list(): Promise<EtfInfo[]> {\n return this.client.get(\"/api/v1/etfs\");\n }\n\n /**\n * Get the full holdings composition for an ETF, including per-holding weights\n * and freshness metadata. Returns 404 for unknown ETFs or commodity-only funds.\n */\n async holdings(ticker: string): Promise<EtfHoldings> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/holdings`,\n );\n }\n\n /**\n * Get the holdings-weighted analyst consensus for an ETF, including the\n * top per-holding contributors that drive the weighted upside.\n */\n async analystAggregate(\n ticker: string,\n ): Promise<PreviewResponse<EtfAnalystAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/analyst`,\n );\n }\n\n /**\n * Get the holdings-weighted SEC Form 4 insider aggregate for an ETF over a\n * configurable trailing window, including per-holding `topContributors` with\n * signed contribution to the weighted headline.\n */\n async insiderAggregate(\n ticker: string,\n options?: GetEtfInsiderAggregateOptions,\n ): Promise<PreviewResponse<EtfInsiderAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/insider`,\n options,\n );\n }\n\n /**\n * Get two SentiSense Score readings side-by-side: `constituentsWeighted`\n * (precomputed daily weighted average across the fund's holdings) and `direct`\n * (score from mentions of the fund's own ticker). The two can diverge, and the\n * gap is itself information.\n */\n async sentimentAggregate(\n ticker: string,\n ): Promise<PreviewResponse<EtfSentimentAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/sentiment`,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n InsiderActivityResponse,\n InsiderTrade,\n ClusterBuy,\n GetInsiderOptions,\n PreviewResponse,\n} from \"../types.js\";\n\nexport class Insider {\n constructor(private client: APIClient) {}\n\n /**\n * Get market-wide insider activity: top buys and sells aggregated by ticker.\n *\n * PRO-gated. Free/unauthenticated users receive a preview (top 5 per direction)\n * with `isPreview: true` in the response.\n */\n async getActivity(options?: GetInsiderOptions): Promise<PreviewResponse<InsiderActivityResponse>> {\n return this.client.get(\"/api/v1/insider/activity\", options);\n }\n\n /**\n * Get individual insider transactions for a specific stock.\n *\n * PRO-gated. Free users receive a preview of the top 5 transactions.\n */\n async getTrades(ticker: string, options?: GetInsiderOptions): Promise<PreviewResponse<InsiderTrade[]>> {\n return this.client.get(\n `/api/v1/insider/trades/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get cluster buy signals: stocks where 3+ distinct insiders bought recently.\n *\n * PRO-gated. Free users receive a preview of the top 3 signals.\n */\n async getClusterBuys(options?: GetInsiderOptions): Promise<PreviewResponse<ClusterBuy[]>> {\n return this.client.get(\"/api/v1/insider/cluster-buys\", options);\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n CongressTrade,\n PoliticianSummary,\n PoliticianDetail,\n GetPoliticiansOptions,\n PreviewResponse,\n} from \"../types.js\";\n\nexport class Politicians {\n constructor(private client: APIClient) {}\n\n /**\n * Get recent congressional STOCK Act trading activity across all politicians.\n *\n * PRO-gated. Free/unauthenticated users receive a preview (top 5 trades)\n * with `isPreview: true` in the response.\n */\n async getActivity(\n options?: GetPoliticiansOptions,\n ): Promise<PreviewResponse<CongressTrade[]>> {\n return this.client.get(\"/api/v1/politicians/activity\", options);\n }\n\n /**\n * Get congressional trades for a specific stock.\n *\n * PRO-gated. Free users receive a preview of the top 3 trades.\n */\n async getFilings(\n ticker: string,\n options?: GetPoliticiansOptions,\n ): Promise<PreviewResponse<CongressTrade[]>> {\n return this.client.get(\n `/api/v1/politicians/filings/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get all tracked politicians with trading summary statistics.\n *\n * PRO-gated. Free users receive a preview of the top 5 members.\n */\n async getMembers(): Promise<PreviewResponse<PoliticianSummary[]>> {\n return this.client.get(\"/api/v1/politicians/members\");\n }\n\n /**\n * Get detailed profile for a single politician: summary, recent trades, top tickers.\n *\n * PRO-gated. Free users receive a preview-wrapped response.\n */\n async getMember(slug: string): Promise<PreviewResponse<PoliticianDetail>> {\n return this.client.get(\n `/api/v1/politicians/member/${encodeURIComponent(slug)}`,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Insight,\n InsightPreviewResponse,\n GetInsightsOptions,\n} from \"../types.js\";\n\nexport interface GetStockInsightsRangeOptions {\n startDate: string;\n endDate: string;\n urgency?: \"low\" | \"medium\" | \"high\";\n insightType?: string;\n}\n\nexport interface GetLatestInsightsOptions {\n limit?: number;\n urgency?: \"low\" | \"medium\" | \"high\";\n}\n\nexport interface GetUserInsightsOptions {\n limit?: number;\n category?: string;\n}\n\nexport class Insights {\n constructor(private client: APIClient) {}\n\n /**\n * Get AI-generated insights for a specific stock, sorted by urgency then confidence.\n *\n * PRO users receive a flat array of Insight objects.\n * Free/unauthenticated users receive a preview with `isPreview: true`,\n * the top 3 insights in full, and a `locked` array with metadata-only entries\n * (type, urgency, timestamp) showing what additional signals exist.\n */\n async stock(\n ticker: string,\n options?: GetInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get AI insights for a stock within a date range.\n *\n * Free users receive the top 3; PRO users receive the full list.\n * The server returns 400 if `startDate` is after `endDate`.\n */\n async stockRange(\n ticker: string,\n options: GetStockInsightsRangeOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}/range`,\n options,\n );\n }\n\n /**\n * Get AI-generated market-level insights, sorted by urgency then confidence.\n *\n * PRO users receive a flat array of Insight objects.\n * Free/unauthenticated users receive a preview with `isPreview: true`,\n * the top 5 insights in full, and a `locked` array with metadata-only entries.\n */\n async market(): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/market\");\n }\n\n /**\n * Get the latest AI insights across all tracked stocks, newest first.\n *\n * Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).\n */\n async latest(\n options?: GetLatestInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/latest\", options);\n }\n\n /**\n * Get personalized insights for the authenticated user.\n *\n * Biased toward the user's watchlist and portfolio when available; falls back\n * to market-level insights otherwise. API key authentication required.\n */\n async user(\n options?: GetUserInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/user\", options);\n }\n\n /**\n * Get available insight types for a specific stock.\n * No authentication required.\n *\n * Returns an array of insight type strings (e.g., `[\"sentiment_shift\", \"options_activity\"]`).\n */\n async types(ticker: string): Promise<string[]> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}/types`,\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 /**\n * Get the full profile, summary stats, and current-quarter holdings for a\n * specific institutional filer.\n *\n * Resolved by URL slug (e.g. `Berkshire-Hathaway`) or numeric SEC CIK.\n * Free users receive the profile and top 10 holdings; PRO users receive the\n * full holdings array. Returns 404 if the slug or CIK is unknown.\n */\n async getInstitutionDetail(slugOrCik: string): Promise<unknown> {\n return this.client.get(\n `/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}`,\n );\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 { MarketSummary } from \"../types.js\";\n\nexport class MarketSummaryResource {\n constructor(private client: APIClient) {}\n\n /** Get the AI-generated market summary with headline and analysis. */\n async get(): Promise<MarketSummary> {\n return this.client.get(\"/api/v1/market-summary\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n AISummary,\n ChartData,\n CompanyKpisData,\n FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n KpiCoverageResponse,\n KpiTypeEntry,\n MarketStatus,\n MetricsBreakdown,\n PreviewResponse,\n SimilarStock,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n StockQuote,\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 /**\n * Get aggregate quote snapshot: live price, today OHLC, 52-week range,\n * market cap, P/E, EPS TTM, and dividend yield in a single call.\n * All fields except `ticker` may be null when upstream data is unavailable.\n */\n async getQuote(ticker: string): Promise<StockQuote> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/quote`);\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<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<SimilarStock[]> {\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 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 /**\n * Get company-specific KPI time-series for a ticker. Returns curated GAAP and\n * non-GAAP metrics from earnings filings (e.g. iPhone unit sales, Tesla deliveries,\n * AWS revenue).\n *\n * Free users receive metadata only with an empty `kpis` list; PRO users receive\n * the full series. Returns 404 for tickers that do not yet have curated coverage.\n *\n * Coverage today: near-complete for the S&P 500 plus extended universe\n * (~500 tickers). Use `listKpiCoverage()` to enumerate.\n */\n async getKpis(ticker: string): Promise<PreviewResponse<CompanyKpisData>> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/kpis`,\n );\n }\n\n /**\n * List every ticker with curated KPI coverage. Returns `{count, tickers: [...]}`\n * with lightweight metadata (ticker, companyName, lastUpdated, kpiCount).\n * Sorted alphabetically by ticker.\n *\n * Auth: API key required, but the call does NOT consume your monthly quota\n * (rate-limit-per-minute still applies). [COMP-421]\n */\n async listKpiCoverage(): Promise<KpiCoverageResponse> {\n return this.client.get(\"/api/v1/stocks/with-kpis\");\n }\n\n /**\n * List the KPI metadata tuples available for a ticker — `id, name, category,\n * chartType` — without paying the cost of the full series payload. Mirrors\n * the `/api/v1/insights/stock/{ticker}/types` precedent.\n *\n * Auth: API key required, no quota cost. 404 if the ticker has no curated KPIs.\n */\n async getKpiTypes(ticker: string): Promise<KpiTypeEntry[]> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/kpis/types`,\n );\n }\n}\n","export const VERSION = \"0.18.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Analyst } from \"./resources/analyst.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { Etfs } from \"./resources/etfs.js\";\nimport { Insider } from \"./resources/insider.js\";\nimport { Politicians } from \"./resources/politicians.js\";\nimport { Insights } from \"./resources/insights.js\";\nimport { Institutional } from \"./resources/institutional.js\";\nimport { KB } from \"./resources/kb.js\";\nimport { MarketMoodResource } from \"./resources/marketMood.js\";\nimport { MarketSummaryResource } from \"./resources/marketSummary.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;\nconst DEFAULT_MAX_RETRIES = 3;\nconst BASE_DELAY_MS = 1_000;\nconst MAX_DELAY_MS = 60_000;\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/** @internal HTTP interface exposed to resource classes. */\nexport interface APIClient {\n get<T = unknown>(path: string, params?: object): Promise<T>;\n post<T = unknown>(path: string, body: unknown): Promise<T>;\n}\n\nexport class SentiSense implements APIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeout: number;\n private maxRetries: number;\n\n readonly stocks: Stocks;\n readonly documents: Documents;\n readonly etfs: Etfs;\n readonly institutional: Institutional;\n readonly insider: Insider;\n readonly politicians: Politicians;\n readonly insights: Insights;\n readonly analyst: Analyst;\n readonly entityMetrics: EntityMetrics;\n readonly marketMood: MarketMoodResource;\n readonly marketSummary: MarketSummaryResource;\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 this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;\n\n this.stocks = new Stocks(this);\n this.documents = new Documents(this);\n this.etfs = new Etfs(this);\n this.institutional = new Institutional(this);\n this.insider = new Insider(this);\n this.politicians = new Politicians(this);\n this.insights = new Insights(this);\n this.analyst = new Analyst(this);\n this.entityMetrics = new EntityMetrics(this);\n this.marketMood = new MarketMoodResource(this);\n this.marketSummary = new MarketSummaryResource(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 \"Accept\": \"application/json\",\n };\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 let delayMs = 0;\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (delayMs > 0) {\n await sleep(delayMs);\n delayMs = 0;\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 const isRetryable = response.status === 429 || response.status >= 500;\n if (isRetryable && attempt < this.maxRetries) {\n if (response.status === 429) {\n const ra = response.headers.get(\"Retry-After\");\n delayMs = (ra ? parseInt(ra, 10) : 60) * 1000;\n } else {\n delayMs = Math.min(BASE_DELAY_MS * Math.pow(2, attempt), MAX_DELAY_MS) + Math.random() * 1000;\n }\n try { await response.body?.cancel(); } catch { /* ignore */ }\n continue;\n }\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 throw new SentiSenseError(\"All retries exhausted\");\n }\n\n /** @internal */\n async post<T = unknown>(path: string, body: unknown): Promise<T> {\n const url = this.buildUrl(path);\n const headers: Record<string, string> = {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/json\",\n };\n\n if (this.apiKey) {\n headers[\"X-SentiSense-API-Key\"] = this.apiKey;\n }\n\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: \"POST\",\n headers,\n body: JSON.stringify(body),\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 const ra = response.headers.get(\"Retry-After\");\n throw new RateLimitError(message, code, ra ? parseInt(ra, 10) : undefined);\n }\n default:\n throw new APIError(message, response.status, code);\n }\n }\n}\n"],"mappings":";AAAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EAIzC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,KAAK,KAAK;AACR,cAAM,KAAK,SAAS,QAAQ,IAAI,aAAa;AAC7C,cAAM,IAAI,eAAe,SAAS,MAAM,KAAK,SAAS,IAAI,EAAE,IAAI,MAAS;AAAA,MAC3E;AAAA,MACA;AACE,cAAM,IAAI,SAAS,SAAS,SAAS,QAAQ,IAAI;AAAA,IACrD;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/errors.ts","../src/resources/analyst.ts","../src/resources/documents.ts","../src/resources/entityMetrics.ts","../src/resources/etfs.ts","../src/resources/insider.ts","../src/resources/politicians.ts","../src/resources/insights.ts","../src/resources/institutional.ts","../src/resources/kb.ts","../src/resources/marketMood.ts","../src/resources/marketSummary.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 retryAfter?: number;\n\n constructor(message: string, code?: string, retryAfter?: number) {\n super(message, 429, code);\n this.name = \"RateLimitError\";\n this.retryAfter = retryAfter;\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 { PreviewResponse } from \"../types.js\";\n\nexport interface AnalystConsensus {\n ticker: string;\n currentPrice: number | null;\n targetLow: number | null;\n targetMean: number | null;\n targetHigh: number | null;\n targetMedian: number | null;\n numberOfAnalysts: number;\n upsidePercent: number | null;\n consensusLabel: string | null;\n recommendationMean: number | null;\n /** PRO-only; zero in the free preview. */\n strongBuy: number;\n /** PRO-only; zero in the free preview. */\n buy: number;\n /** PRO-only; zero in the free preview. */\n hold: number;\n /** PRO-only; zero in the free preview. */\n sell: number;\n /** PRO-only; zero in the free preview. */\n strongSell: number;\n updatedAt: string | null;\n}\n\nexport interface AnalystAction {\n ticker: string;\n actionDate: string;\n firm: string;\n /** UPGRADE, DOWNGRADE, INITIATE, REITERATE, OTHER */\n actionType: string;\n fromGrade: string | null;\n toGrade: string | null;\n}\n\nexport interface AnalystEstimate {\n /** Fiscal period descriptor (provider-specific shape). */\n [key: string]: unknown;\n}\n\nexport interface AnalystEarningsSurprise {\n /** Past report descriptor (provider-specific shape). */\n [key: string]: unknown;\n}\n\nexport interface AnalystEstimatesResponse {\n estimates: AnalystEstimate[];\n surprises: AnalystEarningsSurprise[];\n}\n\nexport interface GetAnalystActionsOptions {\n /** Days of history to return. Default 90. */\n lookbackDays?: number;\n}\n\nexport interface GetAnalystMarketActivityOptions {\n /** Days of history to return. Default 30. */\n lookbackDays?: number;\n}\n\n/**\n * Wall Street analyst coverage: aggregate price targets, recommendation distribution,\n * recent upgrade/downgrade actions, and forward EPS estimates with earnings surprise history.\n *\n * Free users receive the price target band (low/mean/high + analyst count + consensus label)\n * in full -- it powers the public projection cone. The buy/hold/sell distribution counts\n * and full action/estimate history are PRO-only.\n */\nexport class Analyst {\n constructor(private client: APIClient) {}\n\n /**\n * Get the aggregate Wall Street consensus for a ticker. Returns 404 if no\n * coverage exists.\n */\n async consensus(\n ticker: string,\n ): Promise<PreviewResponse<AnalystConsensus>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/consensus`,\n );\n }\n\n /**\n * Get recent analyst upgrade/downgrade actions for a ticker, newest first.\n * Free users receive the 3 most recent.\n */\n async actions(\n ticker: string,\n options?: GetAnalystActionsOptions,\n ): Promise<PreviewResponse<AnalystAction[]>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/actions`,\n options,\n );\n }\n\n /**\n * Get forward EPS estimates and earnings surprise history for a ticker.\n * Free users receive 1 estimate (current quarter) plus the 2 most recent surprises.\n */\n async estimates(\n ticker: string,\n ): Promise<PreviewResponse<AnalystEstimatesResponse>> {\n return this.client.get(\n `/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/estimates`,\n );\n }\n\n /**\n * Get market-wide recent analyst actions across all covered tickers, newest first.\n * Free users receive the 5 most recent.\n */\n async marketActivity(\n options?: GetAnalystMarketActivityOptions,\n ): Promise<PreviewResponse<AnalystAction[]>> {\n return this.client.get(\"/api/v1/analyst/activity\", options);\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 full story detail by cluster ID. */\n async getStoryDetail(clusterId: string): Promise<unknown> {\n return this.client.get(`/api/v1/documents/stories/${encodeURIComponent(clusterId)}`);\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 { PreviewResponse } from \"../types.js\";\n\nexport interface EtfInfo {\n ticker: string;\n name: string;\n kbEntityId: string | null;\n urlSlug: string | null;\n issuer: string | null;\n trackedIndex: string | null;\n assetClass: string | null;\n}\n\nexport interface EtfHolding {\n ticker: string;\n name: string | null;\n /** Weight in the fund as a percentage (0-100). */\n weightPct: number;\n /** ISO date \"YYYY-MM-DD\" — first date this holding appeared in the composition. */\n firstSeen: string | null;\n}\n\nexport interface EtfHoldings {\n ticker: string;\n issuer: string;\n issuerEndpoint: string | null;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date from the issuer. */\n asOfDate: string;\n /** Epoch seconds when SentiSense refreshed the composition. */\n fetchedAt: number | null;\n /** ISO date \"YYYY-MM-DD\" — when the composition is scheduled to be refreshed next. */\n nextRefreshDue: string;\n totalHoldings: number;\n holdings: EtfHolding[];\n /** True when this is a top-N view rather than the full fund. */\n partial?: boolean | null;\n /** Issuer's reported total holdings when `partial=true`. */\n totalKnownHoldings?: number | null;\n}\n\nexport interface EtfAggregateCoverage {\n holdingsCount: number;\n holdingsCovered: number;\n /** Sum of weights (0-100) for the covered holdings. */\n weightCovered: number;\n partial?: boolean | null;\n totalKnownHoldings?: number | null;\n}\n\nexport interface WeightedConsensus {\n upsidePercent: number | null;\n consensusLabel: string | null;\n /** Fractions of covered AUM in each bucket. Sums to ~1.0. */\n distribution: Record<string, number>;\n totalAnalysts: number;\n}\n\nexport interface EtfAnalystContributor {\n ticker: string;\n weightPct: number;\n upsidePercent: number | null;\n consensusLabel: string | null;\n /** Signed contribution to the fund's weighted upside in percentage points. */\n contributionPp: number;\n}\n\nexport interface EtfAnalystAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this rollup was computed. */\n computedAt: number;\n coverage: EtfAggregateCoverage;\n weightedConsensus: WeightedConsensus;\n /** Top contributors (up to 10) by absolute contribution to the weighted upside. */\n topContributors: EtfAnalystContributor[];\n}\n\nexport interface WeightedNetFlow {\n /** Weighted net dollar flow (buys - sells). Negative = net selling. */\n netDollars: number;\n buyDollars: number;\n sellDollars: number;\n /** Unweighted; for context. */\n buyTradeCount: number;\n /** Unweighted; for context. */\n sellTradeCount: number;\n distinctInsiderCount: number;\n}\n\nexport interface EtfInsiderContributor {\n ticker: string;\n weightPct: number;\n /** Per-stock net flow over the window (signed). */\n netDollars: number;\n /** Signed contribution to the weighted headline. */\n weightedNetDollars: number;\n tradeCount: number;\n}\n\nexport interface EtfInsiderAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this rollup was computed. */\n computedAt: number;\n lookbackDays: number;\n coverage: EtfAggregateCoverage;\n weightedNetFlow: WeightedNetFlow;\n /** Top contributors (up to 10) by absolute weighted-net-dollar contribution. */\n topContributors: EtfInsiderContributor[];\n}\n\nexport interface EtfSentimentReading {\n sentiSenseScore: number | null;\n /** BULLISH / NEUTRAL / BEARISH. */\n scoreLabel: string;\n /** Epoch seconds when the underlying metric was produced. */\n asOfTimestamp: number | null;\n}\n\nexport interface EtfSentimentAggregate {\n ticker: string;\n /** ISO date \"YYYY-MM-DD\" — composition snapshot date. */\n asOfDate: string | null;\n /** Epoch seconds when this aggregate was assembled. */\n computedAt: number;\n coverage: EtfAggregateCoverage;\n /** Holdings-weighted SentiSense across the fund's constituents. */\n constituentsWeighted: EtfSentimentReading;\n /** Direct reading from mentions of the fund's own ticker. Null for low-mention funds. */\n direct: EtfSentimentReading | null;\n}\n\nexport interface GetEtfInsiderAggregateOptions {\n /** Trailing window for the trade aggregation. Typical values: 30, 90. Default 30. */\n lookbackDays?: number;\n}\n\n/**\n * ETF discovery, composition (holdings), and holdings-weighted aggregate views.\n *\n * Funds aren't rated by analysts directly, don't have insiders of their own, and\n * may not get many direct news mentions -- but the companies inside them do. The\n * aggregate endpoints synthesize fund-level views from each constituent's per-stock\n * data, weighted by allocation, with a coverage block so consumers see how much of\n * the fund's AUM the underlying data covered.\n *\n * Beta as of 2026-05-15: starting with a limited set of widely-traded funds.\n */\nexport class Etfs {\n constructor(private client: APIClient) {}\n\n /**\n * List every ETF tracked by SentiSense, sorted by ticker.\n */\n async list(): Promise<EtfInfo[]> {\n return this.client.get(\"/api/v1/etfs\");\n }\n\n /**\n * Get the full holdings composition for an ETF, including per-holding weights\n * and freshness metadata. Returns 404 for unknown ETFs or commodity-only funds.\n */\n async holdings(ticker: string): Promise<EtfHoldings> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/holdings`,\n );\n }\n\n /**\n * Get the holdings-weighted analyst consensus for an ETF, including the\n * top per-holding contributors that drive the weighted upside.\n */\n async analystAggregate(\n ticker: string,\n ): Promise<PreviewResponse<EtfAnalystAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/analyst`,\n );\n }\n\n /**\n * Get the holdings-weighted SEC Form 4 insider aggregate for an ETF over a\n * configurable trailing window, including per-holding `topContributors` with\n * signed contribution to the weighted headline.\n */\n async insiderAggregate(\n ticker: string,\n options?: GetEtfInsiderAggregateOptions,\n ): Promise<PreviewResponse<EtfInsiderAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/insider`,\n options,\n );\n }\n\n /**\n * Get two SentiSense Score readings side-by-side: `constituentsWeighted`\n * (precomputed daily weighted average across the fund's holdings) and `direct`\n * (score from mentions of the fund's own ticker). The two can diverge, and the\n * gap is itself information.\n */\n async sentimentAggregate(\n ticker: string,\n ): Promise<PreviewResponse<EtfSentimentAggregate>> {\n return this.client.get(\n `/api/v1/etfs/${encodeURIComponent(ticker.toUpperCase())}/aggregates/sentiment`,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n InsiderActivityResponse,\n InsiderTrade,\n ClusterBuy,\n GetInsiderOptions,\n PreviewResponse,\n} from \"../types.js\";\n\nexport class Insider {\n constructor(private client: APIClient) {}\n\n /**\n * Get market-wide insider activity: top buys and sells aggregated by ticker.\n *\n * PRO-gated. Free/unauthenticated users receive a preview (top 5 per direction)\n * with `isPreview: true` in the response.\n */\n async getActivity(options?: GetInsiderOptions): Promise<PreviewResponse<InsiderActivityResponse>> {\n return this.client.get(\"/api/v1/insider/activity\", options);\n }\n\n /**\n * Get individual insider transactions for a specific stock.\n *\n * PRO-gated. Free users receive a preview of the top 5 transactions.\n */\n async getTrades(ticker: string, options?: GetInsiderOptions): Promise<PreviewResponse<InsiderTrade[]>> {\n return this.client.get(\n `/api/v1/insider/trades/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get cluster buy signals: stocks where 3+ distinct insiders bought recently.\n *\n * PRO-gated. Free users receive a preview of the top 3 signals.\n */\n async getClusterBuys(options?: GetInsiderOptions): Promise<PreviewResponse<ClusterBuy[]>> {\n return this.client.get(\"/api/v1/insider/cluster-buys\", options);\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n CongressTrade,\n PoliticianSummary,\n PoliticianDetail,\n GetPoliticiansOptions,\n PreviewResponse,\n} from \"../types.js\";\n\nexport class Politicians {\n constructor(private client: APIClient) {}\n\n /**\n * Get recent congressional STOCK Act trading activity across all politicians.\n *\n * PRO-gated. Free/unauthenticated users receive a preview (top 5 trades)\n * with `isPreview: true` in the response.\n */\n async getActivity(\n options?: GetPoliticiansOptions,\n ): Promise<PreviewResponse<CongressTrade[]>> {\n return this.client.get(\"/api/v1/politicians/activity\", options);\n }\n\n /**\n * Get congressional trades for a specific stock.\n *\n * PRO-gated. Free users receive a preview of the top 3 trades.\n */\n async getFilings(\n ticker: string,\n options?: GetPoliticiansOptions,\n ): Promise<PreviewResponse<CongressTrade[]>> {\n return this.client.get(\n `/api/v1/politicians/filings/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get all tracked politicians with trading summary statistics.\n *\n * PRO-gated. Free users receive a preview of the top 5 members.\n */\n async getMembers(): Promise<PreviewResponse<PoliticianSummary[]>> {\n return this.client.get(\"/api/v1/politicians/members\");\n }\n\n /**\n * Get detailed profile for a single politician: summary, recent trades, top tickers.\n *\n * PRO-gated. Free users receive a preview-wrapped response.\n */\n async getMember(slug: string): Promise<PreviewResponse<PoliticianDetail>> {\n return this.client.get(\n `/api/v1/politicians/member/${encodeURIComponent(slug)}`,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Insight,\n InsightPreviewResponse,\n GetInsightsOptions,\n} from \"../types.js\";\n\nexport interface GetStockInsightsRangeOptions {\n startDate: string;\n endDate: string;\n urgency?: \"low\" | \"medium\" | \"high\";\n insightType?: string;\n}\n\nexport interface GetLatestInsightsOptions {\n limit?: number;\n urgency?: \"low\" | \"medium\" | \"high\";\n}\n\nexport interface GetUserInsightsOptions {\n limit?: number;\n category?: string;\n}\n\nexport class Insights {\n constructor(private client: APIClient) {}\n\n /**\n * Get AI-generated insights for a specific stock, sorted by urgency then confidence.\n *\n * PRO users receive a flat array of Insight objects.\n * Free/unauthenticated users receive a preview with `isPreview: true`,\n * the top 3 insights in full, and a `locked` array with metadata-only entries\n * (type, urgency, timestamp) showing what additional signals exist.\n */\n async stock(\n ticker: string,\n options?: GetInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}`,\n options,\n );\n }\n\n /**\n * Get AI insights for a stock within a date range.\n *\n * Free users receive the top 3; PRO users receive the full list.\n * The server returns 400 if `startDate` is after `endDate`.\n */\n async stockRange(\n ticker: string,\n options: GetStockInsightsRangeOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}/range`,\n options,\n );\n }\n\n /**\n * Get AI-generated market-level insights, sorted by urgency then confidence.\n *\n * PRO users receive a flat array of Insight objects.\n * Free/unauthenticated users receive a preview with `isPreview: true`,\n * the top 5 insights in full, and a `locked` array with metadata-only entries.\n */\n async market(): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/market\");\n }\n\n /**\n * Get the latest AI insights across all tracked stocks, newest first.\n *\n * Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).\n */\n async latest(\n options?: GetLatestInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/latest\", options);\n }\n\n /**\n * Get personalized insights for the authenticated user.\n *\n * Biased toward the user's watchlist and portfolio when available; falls back\n * to market-level insights otherwise. API key authentication required.\n */\n async user(\n options?: GetUserInsightsOptions,\n ): Promise<Insight[] | InsightPreviewResponse> {\n return this.client.get(\"/api/v1/insights/user\", options);\n }\n\n /**\n * Get available insight types for a specific stock.\n * No authentication required.\n *\n * Returns an array of insight type strings (e.g., `[\"sentiment_shift\", \"options_activity\"]`).\n */\n async types(ticker: string): Promise<string[]> {\n return this.client.get(\n `/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}/types`,\n );\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n GetFlowsOptions,\n Holder,\n InstitutionList,\n InstitutionListResponse,\n InstitutionalFlowsResponse,\n ListInstitutionsOptions,\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 /**\n * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)\n * so you can find what to query without knowing slugs upfront.\n *\n * Each institution is rolled up by parent filer, so a multi-filer manager\n * (e.g. Vanguard) appears once with combined AUM. Summary only; use\n * `getInstitutionDetail` for a filer's full holdings.\n *\n * Requires an API key but does not consume monthly quota (per-minute rate\n * limits still apply). Returns the unwrapped list payload.\n */\n async listInstitutions(options?: ListInstitutionsOptions): Promise<InstitutionList> {\n const resp = await this.client.get<InstitutionListResponse>(\n \"/api/v1/institutional/institutions\",\n { ...options },\n );\n return resp.data;\n }\n\n /**\n * Get the full profile, summary stats, and current-quarter holdings for a\n * specific institutional filer.\n *\n * Resolved by URL slug (e.g. `Berkshire-Hathaway`) or numeric SEC CIK.\n * Free users receive the profile and top 10 holdings; PRO users receive the\n * full holdings array. Returns 404 if the slug or CIK is unknown.\n */\n async getInstitutionDetail(slugOrCik: string): Promise<unknown> {\n return this.client.get(\n `/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}`,\n );\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 // TODO: accept a `days` param to control history length (the endpoint supports ?days=N).\n // TODO: add a sibling `indexes` resource for /api/v1/indexes/{id} (+ /history), e.g. fed-sentiment.\n}\n","import type { APIClient } from \"../client.js\";\nimport type { MarketSummary } from \"../types.js\";\n\nexport class MarketSummaryResource {\n constructor(private client: APIClient) {}\n\n /** Get the AI-generated market summary with headline and analysis. */\n async get(): Promise<MarketSummary> {\n return this.client.get(\"/api/v1/market-summary\");\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n AISummary,\n ChartData,\n CompanyKpisData,\n FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n KpiCoverageResponse,\n KpiTypeEntry,\n MarketStatus,\n MetricsBreakdown,\n PreviewResponse,\n SimilarStock,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n StockQuote,\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 /**\n * Get aggregate quote snapshot: live price, today OHLC, 52-week range,\n * market cap, P/E, EPS TTM, and dividend yield in a single call.\n * All fields except `ticker` may be null when upstream data is unavailable.\n */\n async getQuote(ticker: string): Promise<StockQuote> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/quote`);\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<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<SimilarStock[]> {\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 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 /**\n * Get company-specific KPI time-series for a ticker. Returns curated GAAP and\n * non-GAAP metrics from earnings filings (e.g. iPhone unit sales, Tesla deliveries,\n * AWS revenue).\n *\n * Free users receive metadata only with an empty `kpis` list; PRO users receive\n * the full series. Returns 404 for tickers that do not yet have curated coverage.\n *\n * Coverage today: near-complete for the S&P 500 plus extended universe\n * (~500 tickers). Use `listKpiCoverage()` to enumerate.\n */\n async getKpis(ticker: string): Promise<PreviewResponse<CompanyKpisData>> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/kpis`,\n );\n }\n\n /**\n * List every ticker with curated KPI coverage. Returns `{count, tickers: [...]}`\n * with lightweight metadata (ticker, companyName, lastUpdated, kpiCount).\n * Sorted alphabetically by ticker.\n *\n * Auth: API key required, but the call does NOT consume your monthly quota\n * (rate-limit-per-minute still applies).\n */\n async listKpiCoverage(): Promise<KpiCoverageResponse> {\n return this.client.get(\"/api/v1/stocks/with-kpis\");\n }\n\n /**\n * List the KPI metadata tuples available for a ticker — `id, name, category,\n * chartType` — without paying the cost of the full series payload. Mirrors\n * the `/api/v1/insights/stock/{ticker}/types` precedent.\n *\n * Auth: API key required, no quota cost. 404 if the ticker has no curated KPIs.\n */\n async getKpiTypes(ticker: string): Promise<KpiTypeEntry[]> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/kpis/types`,\n );\n }\n}\n","export const VERSION = \"0.20.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Analyst } from \"./resources/analyst.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { Etfs } from \"./resources/etfs.js\";\nimport { Insider } from \"./resources/insider.js\";\nimport { Politicians } from \"./resources/politicians.js\";\nimport { Insights } from \"./resources/insights.js\";\nimport { Institutional } from \"./resources/institutional.js\";\nimport { KB } from \"./resources/kb.js\";\nimport { MarketMoodResource } from \"./resources/marketMood.js\";\nimport { MarketSummaryResource } from \"./resources/marketSummary.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;\nconst DEFAULT_MAX_RETRIES = 3;\nconst BASE_DELAY_MS = 1_000;\nconst MAX_DELAY_MS = 60_000;\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/** @internal HTTP interface exposed to resource classes. */\nexport interface APIClient {\n get<T = unknown>(path: string, params?: object): Promise<T>;\n post<T = unknown>(path: string, body: unknown): Promise<T>;\n}\n\nexport class SentiSense implements APIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeout: number;\n private maxRetries: number;\n\n readonly stocks: Stocks;\n readonly documents: Documents;\n readonly etfs: Etfs;\n readonly institutional: Institutional;\n readonly insider: Insider;\n readonly politicians: Politicians;\n readonly insights: Insights;\n readonly analyst: Analyst;\n readonly entityMetrics: EntityMetrics;\n readonly marketMood: MarketMoodResource;\n readonly marketSummary: MarketSummaryResource;\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 this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;\n\n this.stocks = new Stocks(this);\n this.documents = new Documents(this);\n this.etfs = new Etfs(this);\n this.institutional = new Institutional(this);\n this.insider = new Insider(this);\n this.politicians = new Politicians(this);\n this.insights = new Insights(this);\n this.analyst = new Analyst(this);\n this.entityMetrics = new EntityMetrics(this);\n this.marketMood = new MarketMoodResource(this);\n this.marketSummary = new MarketSummaryResource(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 \"Accept\": \"application/json\",\n };\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 let delayMs = 0;\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (delayMs > 0) {\n await sleep(delayMs);\n delayMs = 0;\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 const isRetryable = response.status === 429 || response.status >= 500;\n if (isRetryable && attempt < this.maxRetries) {\n if (response.status === 429) {\n const ra = response.headers.get(\"Retry-After\");\n delayMs = (ra ? parseInt(ra, 10) : 60) * 1000;\n } else {\n delayMs = Math.min(BASE_DELAY_MS * Math.pow(2, attempt), MAX_DELAY_MS) + Math.random() * 1000;\n }\n try { await response.body?.cancel(); } catch { /* ignore */ }\n continue;\n }\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 throw new SentiSenseError(\"All retries exhausted\");\n }\n\n /** @internal */\n async post<T = unknown>(path: string, body: unknown): Promise<T> {\n const url = this.buildUrl(path);\n const headers: Record<string, string> = {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/json\",\n };\n\n if (this.apiKey) {\n headers[\"X-SentiSense-API-Key\"] = this.apiKey;\n }\n\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: \"POST\",\n headers,\n body: JSON.stringify(body),\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 const ra = response.headers.get(\"Retry-After\");\n throw new RateLimitError(message, code, ra ? parseInt(ra, 10) : undefined);\n }\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,EAGlD,YAAY,SAAiB,MAAe,YAAqB;AAC/D,UAAM,SAAS,KAAK,IAAI;AAC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,6 @@
1
1
  {
2
2
  "name": "sentisense",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Official JavaScript/TypeScript SDK for the SentiSense market intelligence API",
5
5
  "author": "SentiSense <support@sentisense.ai>",
6
6
  "license": "MIT",