sentisense 0.28.0 → 0.30.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/dist/index.d.ts CHANGED
@@ -117,10 +117,38 @@ interface Fundamentals {
117
117
  timeframe: string;
118
118
  [key: string]: unknown;
119
119
  }
120
+ /**
121
+ * Trailing-twelve-month snapshot from `stocks.getCurrentFundamentals()`: TTM ratios,
122
+ * a different shape from the per-period statement data in {@link Fundamentals}.
123
+ */
124
+ interface TtmFundamentals {
125
+ ticker: string;
126
+ currentPrice?: number;
127
+ peTTM?: number | null;
128
+ psTTM?: number | null;
129
+ epsTTM?: number | null;
130
+ revenueTTM?: number | null;
131
+ quartersIncluded?: number;
132
+ /** False when there is not enough filed history to compute the TTM figures. */
133
+ available?: boolean;
134
+ /** Populated when `available` is false, explaining why. */
135
+ reason?: string | null;
136
+ [key: string]: unknown;
137
+ }
120
138
  interface FundamentalsPeriod {
121
139
  fiscalPeriod: string;
122
140
  fiscalYear: number;
123
141
  }
142
+ /**
143
+ * What `stocks.getFundamentalsPeriods()` returns: the periods are in `periods`, not at
144
+ * the top level.
145
+ */
146
+ interface FundamentalsPeriodsResponse {
147
+ ticker: string;
148
+ periods: FundamentalsPeriod[];
149
+ /** Populated when no periods are available, explaining why. */
150
+ reason?: string | null;
151
+ }
124
152
  interface ShortInterest {
125
153
  ticker: string;
126
154
  [key: string]: unknown;
@@ -187,6 +215,23 @@ interface Document {
187
215
  reliability: number;
188
216
  sentiment: SentimentEntry[];
189
217
  }
218
+ /**
219
+ * What the document-metrics endpoints return: `documents.getByTicker()`,
220
+ * `getByTickerRange()`, `getByEntity()`, `search()` and `getBySource()` all resolve to
221
+ * this. The rows are in `documents`, and this is NOT the {@link PreviewResponse}
222
+ * envelope: there is no `isPreview` or `data`.
223
+ */
224
+ interface DocumentSearchResponse {
225
+ documents: Document[];
226
+ /** Total matching documents before any limit was applied. */
227
+ totalCount: number;
228
+ /** Ticker the query resolved to, or `null` when the query was not ticker-scoped. */
229
+ searchTicker: string | null;
230
+ /** Source filter applied, or `"ALL"` when unfiltered. */
231
+ source: string;
232
+ startDate: string;
233
+ endDate: string;
234
+ }
190
235
  /** Story cluster with title, sentiment, and metrics. */
191
236
  interface StoryCluster {
192
237
  id: string;
@@ -300,13 +345,23 @@ interface Holder {
300
345
  sharesChangePct: number;
301
346
  }
302
347
  /**
303
- * The flows payload itself: what the server puts inside the response envelope.
304
- *
305
- * Note `institutional.getFlows()` is currently declared as returning this shape directly,
306
- * but the endpoint wraps it: the value you get back at runtime is
307
- * `{ isPreview, previewReason, data }` with these fields under `data`. Until the
308
- * declaration is corrected, read the flows as `(result as unknown as
309
- * PreviewResponse<InstitutionalFlows>).data.inflows`.
348
+ * Institutional ownership for one ticker: the `data` payload of
349
+ * `institutional.getHolders()`, which returns `PreviewResponse<TickerHolders>`. The
350
+ * holder rows are in `holders`, so read them as `result.data.holders` (two levels down),
351
+ * alongside ticker-level totals like `holderCount`.
352
+ */
353
+ interface TickerHolders {
354
+ ticker: string;
355
+ companyName: string;
356
+ reportDate: string;
357
+ totalInstitutionalShares: number;
358
+ totalInstitutionalValue: number;
359
+ holderCount: number;
360
+ holders: Holder[];
361
+ }
362
+ /**
363
+ * The flows payload inside the response envelope: `institutional.getFlows()` returns
364
+ * `PreviewResponse<InstitutionalFlows>`, so read the flows as `result.data.inflows`.
310
365
  */
311
366
  interface InstitutionalFlows {
312
367
  inflows: InstitutionalFlow[];
@@ -330,7 +385,11 @@ interface InstitutionalFlows {
330
385
  */
331
386
  baselineFilerCount?: number;
332
387
  }
333
- /** Alias of {@link InstitutionalFlows}; same shape. */
388
+ /**
389
+ * @deprecated Names the INNER flows payload, but `getFlows()` returns the envelope
390
+ * {@link PreviewResponse}<{@link InstitutionalFlows}>. Kept as an alias of the inner
391
+ * shape so an existing import still resolves; will be removed in a future release.
392
+ */
334
393
  type InstitutionalFlowsResponse = InstitutionalFlows;
335
394
  interface GetFlowsOptions {
336
395
  limit?: number;
@@ -622,35 +681,6 @@ interface ServingMetric {
622
681
  interface MetricDistribution {
623
682
  [key: string]: unknown;
624
683
  }
625
- /** @deprecated Use `ServingMetric[]` from the v2 API instead. */
626
- interface MentionData {
627
- [key: string]: unknown;
628
- }
629
- /** @deprecated Use `ServingMetric[]` from the v2 API instead. */
630
- interface MentionCount {
631
- [key: string]: unknown;
632
- }
633
- /** @deprecated Use `ServingMetric[]` from the v2 API instead. */
634
- interface SentimentData {
635
- [key: string]: unknown;
636
- }
637
- /** @deprecated */
638
- interface EntityMetricsDateRange {
639
- startDate?: string;
640
- endDate?: string;
641
- }
642
- /** @deprecated */
643
- interface GetMentionsOptions extends EntityMetricsDateRange {
644
- source?: DocumentSource;
645
- }
646
- /** @deprecated */
647
- interface GetMentionCountOptions extends EntityMetricsDateRange {
648
- source?: DocumentSource;
649
- }
650
- /** @deprecated */
651
- interface GetSentimentBySourceOptions {
652
- date?: string;
653
- }
654
684
  interface MarketMood {
655
685
  [key: string]: unknown;
656
686
  }
@@ -692,7 +722,11 @@ interface LockedInsight {
692
722
  urgency: string;
693
723
  generatedAt: number;
694
724
  }
695
- /** Preview response returned to free/unauthenticated users on insights endpoints. */
725
+ /**
726
+ * @deprecated The insights endpoints return `PreviewResponse<Insight[]>`, not this shape.
727
+ * No endpoint emits `insights` or `locked`. Kept only so an existing import resolves;
728
+ * will be removed in a future release.
729
+ */
696
730
  interface InsightPreviewResponse {
697
731
  isPreview: true;
698
732
  previewReason: "PRO_REQUIRED";
@@ -1031,16 +1065,16 @@ declare class Calendar {
1031
1065
  declare class Documents {
1032
1066
  private client;
1033
1067
  constructor(client: APIClient);
1034
- /** Get document metrics for a stock. */
1035
- getByTicker(ticker: string, options?: GetByTickerOptions): Promise<Document[]>;
1036
- /** Get document metrics for a stock within a date range. */
1037
- getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<Document[]>;
1038
- /** Get document metrics for a KB entity. */
1039
- getByEntity(entityId: string, options?: GetByEntityOptions): Promise<Document[]>;
1040
- /** Smart search with natural language query parsing. */
1041
- search(query: string, options?: SearchDocumentsOptions): Promise<Document[]>;
1042
- /** Get latest document metrics from a source type. */
1043
- getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<Document[]>;
1068
+ /** Get document metrics for a stock. The rows are in `documents`. */
1069
+ getByTicker(ticker: string, options?: GetByTickerOptions): Promise<DocumentSearchResponse>;
1070
+ /** Get document metrics for a stock within a date range. The rows are in `documents`. */
1071
+ getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<DocumentSearchResponse>;
1072
+ /** Get document metrics for a KB entity. The rows are in `documents`. */
1073
+ getByEntity(entityId: string, options?: GetByEntityOptions): Promise<DocumentSearchResponse>;
1074
+ /** Smart search with natural language query parsing. The rows are in `documents`. */
1075
+ search(query: string, options?: SearchDocumentsOptions): Promise<DocumentSearchResponse>;
1076
+ /** Get latest document metrics from a source type. The rows are in `documents`. */
1077
+ getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<DocumentSearchResponse>;
1044
1078
  /** Get AI-curated news story clusters. */
1045
1079
  getStories(options?: GetStoriesOptions): Promise<Story[]>;
1046
1080
  /** Get full story detail by cluster ID. */
@@ -1067,30 +1101,6 @@ declare class EntityMetrics {
1067
1101
  * @param options Optional dimension parameter.
1068
1102
  */
1069
1103
  getDistribution(symbol: string, metricType: MetricType, options?: MetricDistributionOptions): Promise<MetricDistribution>;
1070
- /**
1071
- * @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
1072
- */
1073
- getMentions(symbol: string, options?: GetMentionsOptions): Promise<MentionData>;
1074
- /**
1075
- * @deprecated Use `getDistribution(symbol, "mentions", { dimension: "source" })` instead.
1076
- */
1077
- getMentionCountBySource(symbol: string, options?: EntityMetricsDateRange): Promise<MentionCount>;
1078
- /**
1079
- * @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
1080
- */
1081
- getMentionCount(symbol: string, options?: GetMentionCountOptions): Promise<MentionCount>;
1082
- /**
1083
- * @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
1084
- */
1085
- getSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData>;
1086
- /**
1087
- * @deprecated Use `getDistribution(symbol, "sentiment", { dimension: "source" })` instead.
1088
- */
1089
- getSentimentBySource(symbol: string, options?: GetSentimentBySourceOptions): Promise<SentimentData>;
1090
- /**
1091
- * @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
1092
- */
1093
- getAverageSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData>;
1094
1104
  }
1095
1105
 
1096
1106
  interface EtfInfo {
@@ -1333,40 +1343,42 @@ declare class Insights {
1333
1343
  /**
1334
1344
  * Get AI-generated insights for a specific stock, sorted by urgency then confidence.
1335
1345
  *
1336
- * PRO users receive a flat array of Insight objects.
1337
- * Free/unauthenticated users receive a preview with `isPreview: true`,
1338
- * the top 3 insights in full, and a `locked` array with metadata-only entries
1339
- * (type, urgency, timestamp) showing what additional signals exist.
1346
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
1347
+ * full list with `isPreview: false`; free callers get the top 3 with `isPreview: true`
1348
+ * and `totalCount` carrying the untruncated size.
1340
1349
  */
1341
- stock(ticker: string, options?: GetInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1350
+ stock(ticker: string, options?: GetInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1342
1351
  /**
1343
1352
  * Get AI insights for a stock within a date range.
1344
1353
  *
1345
- * Free users receive the top 3; PRO users receive the full list.
1346
- * The server returns 400 if `startDate` is after `endDate`.
1354
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
1355
+ * the top 3, PRO callers the full list. The server returns 400 if `startDate` is
1356
+ * after `endDate`.
1347
1357
  */
1348
- stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<Insight[] | InsightPreviewResponse>;
1358
+ stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<PreviewResponse<Insight[]>>;
1349
1359
  /**
1350
1360
  * Get AI-generated market-level insights, sorted by urgency then confidence.
1351
1361
  *
1352
- * PRO users receive a flat array of Insight objects.
1353
- * Free/unauthenticated users receive a preview with `isPreview: true`,
1354
- * the top 5 insights in full, and a `locked` array with metadata-only entries.
1362
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
1363
+ * full list with `isPreview: false`; free callers get the top 5 with `isPreview: true`
1364
+ * and `totalCount` carrying the untruncated size.
1355
1365
  */
1356
- market(): Promise<Insight[] | InsightPreviewResponse>;
1366
+ market(): Promise<PreviewResponse<Insight[]>>;
1357
1367
  /**
1358
1368
  * Get the latest AI insights across all tracked stocks, newest first.
1359
1369
  *
1360
- * Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).
1370
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
1371
+ * the top 5, PRO callers up to `limit` (clamped to 1-200).
1361
1372
  */
1362
- latest(options?: GetLatestInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1373
+ latest(options?: GetLatestInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1363
1374
  /**
1364
1375
  * Get personalized insights for the authenticated user.
1365
1376
  *
1366
1377
  * Biased toward the user's watchlist and portfolio when available; falls back
1367
1378
  * to market-level insights otherwise. API key authentication required.
1379
+ * Returns the preview envelope: read the insights as `.data`.
1368
1380
  */
1369
- user(options?: GetUserInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1381
+ user(options?: GetUserInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1370
1382
  /**
1371
1383
  * Get available insight types for a specific stock.
1372
1384
  * No authentication required.
@@ -1387,12 +1399,26 @@ declare class Institutional {
1387
1399
  * `reportDate` is optional: omit it to get the latest available quarter, which may be
1388
1400
  * a still-open one holding only early filers. The response then carries `reportDate`
1389
1401
  * plus `isPending` and filer coverage counts so a partial quarter is clearly labeled.
1402
+ *
1403
+ * Returns the preview envelope, so the flows are one level down:
1404
+ * `const { data } = await client.institutional.getFlows(); data.inflows`.
1390
1405
  */
1391
- getFlows(reportDate?: string, options?: GetFlowsOptions): Promise<InstitutionalFlowsResponse>;
1392
- /** Get institutional holders for a specific stock. */
1393
- getHolders(ticker: string, reportDate: string): Promise<Holder[]>;
1394
- /** Get activist investor positions (NEW or INCREASED). */
1395
- getActivists(reportDate: string): Promise<Holder[]>;
1406
+ getFlows(reportDate?: string, options?: GetFlowsOptions): Promise<PreviewResponse<InstitutionalFlows>>;
1407
+ /**
1408
+ * Get institutional holders for a specific stock.
1409
+ *
1410
+ * Returns the preview envelope wrapping a {@link TickerHolders} object, so the rows
1411
+ * are two levels down: `(await getHolders(t, d)).data.holders`, alongside ticker-level
1412
+ * totals like `holderCount`. Free callers get a truncated `holders` array with
1413
+ * `isPreview: true`.
1414
+ */
1415
+ getHolders(ticker: string, reportDate: string): Promise<PreviewResponse<TickerHolders>>;
1416
+ /**
1417
+ * Get activist investor positions (NEW or INCREASED).
1418
+ *
1419
+ * Returns the preview envelope, so read the rows as `.data`.
1420
+ */
1421
+ getActivists(reportDate: string): Promise<PreviewResponse<Holder[]>>;
1396
1422
  /**
1397
1423
  * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)
1398
1424
  * so you can find what to query without knowing slugs upfront.
@@ -1421,8 +1447,6 @@ declare class KB {
1421
1447
  constructor(client: APIClient);
1422
1448
  /** Get popular entities for search suggestions. */
1423
1449
  getPopularEntities(): Promise<KBEntity[]>;
1424
- /** Get entity detail with metrics and relationships. */
1425
- getEntity(entityId: string): Promise<KBEntity>;
1426
1450
  /** Get all tracked entities. */
1427
1451
  getAllEntities(): Promise<KBEntity[]>;
1428
1452
  }
@@ -1488,10 +1512,13 @@ declare class Stocks {
1488
1512
  getMarketStatus(): Promise<MarketStatus>;
1489
1513
  /** Get financial statement data. */
1490
1514
  getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals>;
1491
- /** Get available fiscal periods. */
1492
- getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]>;
1493
- /** Get most recent fundamentals snapshot. */
1494
- getCurrentFundamentals(ticker: string): Promise<Fundamentals>;
1515
+ /** Get available fiscal periods. The periods are in `periods`. */
1516
+ getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriodsResponse>;
1517
+ /**
1518
+ * Get the trailing-twelve-month fundamentals snapshot: TTM ratios, a different
1519
+ * shape from the per-period statement data `getFundamentals()` returns.
1520
+ */
1521
+ getCurrentFundamentals(ticker: string): Promise<TtmFundamentals>;
1495
1522
  /** Get historical revenue data. */
1496
1523
  getHistoricalRevenue(ticker: string): Promise<unknown>;
1497
1524
  /** Get short interest metrics (FINRA). */
@@ -1615,6 +1642,6 @@ declare class APIError extends SentiSenseError {
1615
1642
  constructor(message: string, status: number, code?: string);
1616
1643
  }
1617
1644
 
1618
- declare const VERSION = "0.28.0";
1645
+ declare const VERSION = "0.30.0";
1619
1646
 
1620
- export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, type AssetMetadata, AuthenticationError, type CalendarMeta, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSource, type EarningsCalendarResponse, type EarningsEvent, 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 GetEarningsCalendarOptions, 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, type TrackerEvent, type TrackerGeoEntry, type TrackerHeadlineMetric, type TrackerListResponse, type TrackerListing, type TrackerMetricValue, type TrackerSignal, type TrackerSnapshot, type TrackerSnapshotResponse, type TrackerSourceRef, type TrackerTableRow, type TrackerTimeSeriesPoint, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
1647
+ export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, type AssetMetadata, AuthenticationError, type CalendarMeta, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSearchResponse, type DocumentSource, type EarningsCalendarResponse, type EarningsEvent, 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 FundamentalsPeriodsResponse, type GetAnalystActionsOptions, type GetAnalystMarketActivityOptions, type GetEarningsCalendarOptions, 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 InstitutionalFlows, 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 MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type PoliticianDetail, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, 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, type TickerHolders, type TrackerEvent, type TrackerGeoEntry, type TrackerHeadlineMetric, type TrackerListResponse, type TrackerListing, type TrackerMetricValue, type TrackerSignal, type TrackerSnapshot, type TrackerSnapshotResponse, type TrackerSourceRef, type TrackerTableRow, type TrackerTimeSeriesPoint, type TtmFundamentals, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
package/dist/index.mjs CHANGED
@@ -98,29 +98,29 @@ var Documents = class {
98
98
  constructor(client) {
99
99
  this.client = client;
100
100
  }
101
- /** Get document metrics for a stock. */
101
+ /** Get document metrics for a stock. The rows are in `documents`. */
102
102
  async getByTicker(ticker, options) {
103
103
  return this.client.get(`/api/v1/documents/ticker/${encodeURIComponent(ticker)}`, options);
104
104
  }
105
- /** Get document metrics for a stock within a date range. */
105
+ /** Get document metrics for a stock within a date range. The rows are in `documents`. */
106
106
  async getByTickerRange(ticker, options) {
107
107
  return this.client.get(
108
108
  `/api/v1/documents/ticker/${encodeURIComponent(ticker)}/range`,
109
109
  options
110
110
  );
111
111
  }
112
- /** Get document metrics for a KB entity. */
112
+ /** Get document metrics for a KB entity. The rows are in `documents`. */
113
113
  async getByEntity(entityId, options) {
114
114
  return this.client.get(
115
115
  `/api/v1/documents/entity/${encodeURIComponent(entityId)}`,
116
116
  options
117
117
  );
118
118
  }
119
- /** Smart search with natural language query parsing. */
119
+ /** Smart search with natural language query parsing. The rows are in `documents`. */
120
120
  async search(query, options) {
121
121
  return this.client.get("/api/v1/documents/search", { query, ...options });
122
122
  }
123
- /** Get latest document metrics from a source type. */
123
+ /** Get latest document metrics from a source type. The rows are in `documents`. */
124
124
  async getBySource(source, options) {
125
125
  return this.client.get(
126
126
  `/api/v1/documents/source/${encodeURIComponent(source)}`,
@@ -149,7 +149,6 @@ var EntityMetrics = class {
149
149
  constructor(client) {
150
150
  this.client = client;
151
151
  }
152
- // ── v2 API methods ──────────────────────────────────────────
153
152
  /**
154
153
  * Get time-series metric data for an entity using the v2 Serving Metrics API.
155
154
  *
@@ -181,61 +180,6 @@ var EntityMetrics = class {
181
180
  { dimension }
182
181
  );
183
182
  }
184
- // ── Deprecated v1 methods (kept for backward compatibility) ─
185
- /**
186
- * @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
187
- */
188
- async getMentions(symbol, options) {
189
- return this.client.get(
190
- `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions`,
191
- options
192
- );
193
- }
194
- /**
195
- * @deprecated Use `getDistribution(symbol, "mentions", { dimension: "source" })` instead.
196
- */
197
- async getMentionCountBySource(symbol, options) {
198
- return this.client.get(
199
- `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count/by-source`,
200
- options
201
- );
202
- }
203
- /**
204
- * @deprecated Use `getMetrics(symbol, { metricType: "mentions" })` instead.
205
- */
206
- async getMentionCount(symbol, options) {
207
- return this.client.get(
208
- `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/mentions/count`,
209
- options
210
- );
211
- }
212
- /**
213
- * @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
214
- */
215
- async getSentiment(symbol, options) {
216
- return this.client.get(
217
- `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment`,
218
- options
219
- );
220
- }
221
- /**
222
- * @deprecated Use `getDistribution(symbol, "sentiment", { dimension: "source" })` instead.
223
- */
224
- async getSentimentBySource(symbol, options) {
225
- return this.client.get(
226
- `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/by-source`,
227
- options
228
- );
229
- }
230
- /**
231
- * @deprecated Use `getMetrics(symbol, { metricType: "sentiment" })` instead.
232
- */
233
- async getAverageSentiment(symbol, options) {
234
- return this.client.get(
235
- `/api/v1/entity-metrics/stocks/${encodeURIComponent(symbol)}/sentiment/average`,
236
- options
237
- );
238
- }
239
183
  };
240
184
 
241
185
  // src/resources/etfs.ts
@@ -379,10 +323,9 @@ var Insights = class {
379
323
  /**
380
324
  * Get AI-generated insights for a specific stock, sorted by urgency then confidence.
381
325
  *
382
- * PRO users receive a flat array of Insight objects.
383
- * Free/unauthenticated users receive a preview with `isPreview: true`,
384
- * the top 3 insights in full, and a `locked` array with metadata-only entries
385
- * (type, urgency, timestamp) showing what additional signals exist.
326
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
327
+ * full list with `isPreview: false`; free callers get the top 3 with `isPreview: true`
328
+ * and `totalCount` carrying the untruncated size.
386
329
  */
387
330
  async stock(ticker, options) {
388
331
  return this.client.get(
@@ -393,8 +336,9 @@ var Insights = class {
393
336
  /**
394
337
  * Get AI insights for a stock within a date range.
395
338
  *
396
- * Free users receive the top 3; PRO users receive the full list.
397
- * The server returns 400 if `startDate` is after `endDate`.
339
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
340
+ * the top 3, PRO callers the full list. The server returns 400 if `startDate` is
341
+ * after `endDate`.
398
342
  */
399
343
  async stockRange(ticker, options) {
400
344
  return this.client.get(
@@ -405,9 +349,9 @@ var Insights = class {
405
349
  /**
406
350
  * Get AI-generated market-level insights, sorted by urgency then confidence.
407
351
  *
408
- * PRO users receive a flat array of Insight objects.
409
- * Free/unauthenticated users receive a preview with `isPreview: true`,
410
- * the top 5 insights in full, and a `locked` array with metadata-only entries.
352
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
353
+ * full list with `isPreview: false`; free callers get the top 5 with `isPreview: true`
354
+ * and `totalCount` carrying the untruncated size.
411
355
  */
412
356
  async market() {
413
357
  return this.client.get("/api/v1/insights/market");
@@ -415,7 +359,8 @@ var Insights = class {
415
359
  /**
416
360
  * Get the latest AI insights across all tracked stocks, newest first.
417
361
  *
418
- * Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).
362
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
363
+ * the top 5, PRO callers up to `limit` (clamped to 1-200).
419
364
  */
420
365
  async latest(options) {
421
366
  return this.client.get("/api/v1/insights/latest", options);
@@ -425,6 +370,7 @@ var Insights = class {
425
370
  *
426
371
  * Biased toward the user's watchlist and portfolio when available; falls back
427
372
  * to market-level insights otherwise. API key authentication required.
373
+ * Returns the preview envelope: read the insights as `.data`.
428
374
  */
429
375
  async user(options) {
430
376
  return this.client.get("/api/v1/insights/user", options);
@@ -457,6 +403,9 @@ var Institutional = class {
457
403
  * `reportDate` is optional: omit it to get the latest available quarter, which may be
458
404
  * a still-open one holding only early filers. The response then carries `reportDate`
459
405
  * plus `isPending` and filer coverage counts so a partial quarter is clearly labeled.
406
+ *
407
+ * Returns the preview envelope, so the flows are one level down:
408
+ * `const { data } = await client.institutional.getFlows(); data.inflows`.
460
409
  */
461
410
  async getFlows(reportDate, options) {
462
411
  return this.client.get("/api/v1/institutional/flows", {
@@ -464,14 +413,25 @@ var Institutional = class {
464
413
  ...options
465
414
  });
466
415
  }
467
- /** Get institutional holders for a specific stock. */
416
+ /**
417
+ * Get institutional holders for a specific stock.
418
+ *
419
+ * Returns the preview envelope wrapping a {@link TickerHolders} object, so the rows
420
+ * are two levels down: `(await getHolders(t, d)).data.holders`, alongside ticker-level
421
+ * totals like `holderCount`. Free callers get a truncated `holders` array with
422
+ * `isPreview: true`.
423
+ */
468
424
  async getHolders(ticker, reportDate) {
469
425
  return this.client.get(
470
426
  `/api/v1/institutional/holders/${encodeURIComponent(ticker)}`,
471
427
  { reportDate }
472
428
  );
473
429
  }
474
- /** Get activist investor positions (NEW or INCREASED). */
430
+ /**
431
+ * Get activist investor positions (NEW or INCREASED).
432
+ *
433
+ * Returns the preview envelope, so read the rows as `.data`.
434
+ */
475
435
  async getActivists(reportDate) {
476
436
  return this.client.get("/api/v1/institutional/activist", { reportDate });
477
437
  }
@@ -517,10 +477,6 @@ var KB = class {
517
477
  async getPopularEntities() {
518
478
  return this.client.get("/api/v1/kb/entities/popular");
519
479
  }
520
- /** Get entity detail with metrics and relationships. */
521
- async getEntity(entityId) {
522
- return this.client.get(`/api/v1/kb/entities/${encodeURIComponent(entityId)}`);
523
- }
524
480
  /** Get all tracked entities. */
525
481
  async getAllEntities() {
526
482
  return this.client.get("/api/v1/kb/entities/all");
@@ -649,11 +605,14 @@ var Stocks = class {
649
605
  async getFundamentals(ticker, options) {
650
606
  return this.client.get("/api/v1/stocks/fundamentals", { ticker, ...options });
651
607
  }
652
- /** Get available fiscal periods. */
608
+ /** Get available fiscal periods. The periods are in `periods`. */
653
609
  async getFundamentalsPeriods(ticker) {
654
610
  return this.client.get("/api/v1/stocks/fundamentals/periods", { ticker });
655
611
  }
656
- /** Get most recent fundamentals snapshot. */
612
+ /**
613
+ * Get the trailing-twelve-month fundamentals snapshot: TTM ratios, a different
614
+ * shape from the per-period statement data `getFundamentals()` returns.
615
+ */
657
616
  async getCurrentFundamentals(ticker) {
658
617
  return this.client.get("/api/v1/stocks/fundamentals/current", { ticker });
659
618
  }
@@ -744,7 +703,7 @@ var Trackers = class {
744
703
  };
745
704
 
746
705
  // src/version.ts
747
- var VERSION = "0.28.0";
706
+ var VERSION = "0.30.0";
748
707
 
749
708
  // src/client.ts
750
709
  var DEFAULT_BASE_URL = "https://app.sentisense.ai";