sentisense 0.28.0 → 0.29.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.mts 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;
@@ -692,7 +751,11 @@ interface LockedInsight {
692
751
  urgency: string;
693
752
  generatedAt: number;
694
753
  }
695
- /** Preview response returned to free/unauthenticated users on insights endpoints. */
754
+ /**
755
+ * @deprecated The insights endpoints return `PreviewResponse<Insight[]>`, not this shape.
756
+ * No endpoint emits `insights` or `locked`. Kept only so an existing import resolves;
757
+ * will be removed in a future release.
758
+ */
696
759
  interface InsightPreviewResponse {
697
760
  isPreview: true;
698
761
  previewReason: "PRO_REQUIRED";
@@ -1031,16 +1094,16 @@ declare class Calendar {
1031
1094
  declare class Documents {
1032
1095
  private client;
1033
1096
  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[]>;
1097
+ /** Get document metrics for a stock. The rows are in `documents`. */
1098
+ getByTicker(ticker: string, options?: GetByTickerOptions): Promise<DocumentSearchResponse>;
1099
+ /** Get document metrics for a stock within a date range. The rows are in `documents`. */
1100
+ getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<DocumentSearchResponse>;
1101
+ /** Get document metrics for a KB entity. The rows are in `documents`. */
1102
+ getByEntity(entityId: string, options?: GetByEntityOptions): Promise<DocumentSearchResponse>;
1103
+ /** Smart search with natural language query parsing. The rows are in `documents`. */
1104
+ search(query: string, options?: SearchDocumentsOptions): Promise<DocumentSearchResponse>;
1105
+ /** Get latest document metrics from a source type. The rows are in `documents`. */
1106
+ getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<DocumentSearchResponse>;
1044
1107
  /** Get AI-curated news story clusters. */
1045
1108
  getStories(options?: GetStoriesOptions): Promise<Story[]>;
1046
1109
  /** Get full story detail by cluster ID. */
@@ -1333,40 +1396,42 @@ declare class Insights {
1333
1396
  /**
1334
1397
  * Get AI-generated insights for a specific stock, sorted by urgency then confidence.
1335
1398
  *
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.
1399
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
1400
+ * full list with `isPreview: false`; free callers get the top 3 with `isPreview: true`
1401
+ * and `totalCount` carrying the untruncated size.
1340
1402
  */
1341
- stock(ticker: string, options?: GetInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1403
+ stock(ticker: string, options?: GetInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1342
1404
  /**
1343
1405
  * Get AI insights for a stock within a date range.
1344
1406
  *
1345
- * Free users receive the top 3; PRO users receive the full list.
1346
- * The server returns 400 if `startDate` is after `endDate`.
1407
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
1408
+ * the top 3, PRO callers the full list. The server returns 400 if `startDate` is
1409
+ * after `endDate`.
1347
1410
  */
1348
- stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<Insight[] | InsightPreviewResponse>;
1411
+ stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<PreviewResponse<Insight[]>>;
1349
1412
  /**
1350
1413
  * Get AI-generated market-level insights, sorted by urgency then confidence.
1351
1414
  *
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.
1415
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
1416
+ * full list with `isPreview: false`; free callers get the top 5 with `isPreview: true`
1417
+ * and `totalCount` carrying the untruncated size.
1355
1418
  */
1356
- market(): Promise<Insight[] | InsightPreviewResponse>;
1419
+ market(): Promise<PreviewResponse<Insight[]>>;
1357
1420
  /**
1358
1421
  * Get the latest AI insights across all tracked stocks, newest first.
1359
1422
  *
1360
- * Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).
1423
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
1424
+ * the top 5, PRO callers up to `limit` (clamped to 1-200).
1361
1425
  */
1362
- latest(options?: GetLatestInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1426
+ latest(options?: GetLatestInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1363
1427
  /**
1364
1428
  * Get personalized insights for the authenticated user.
1365
1429
  *
1366
1430
  * Biased toward the user's watchlist and portfolio when available; falls back
1367
1431
  * to market-level insights otherwise. API key authentication required.
1432
+ * Returns the preview envelope: read the insights as `.data`.
1368
1433
  */
1369
- user(options?: GetUserInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1434
+ user(options?: GetUserInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1370
1435
  /**
1371
1436
  * Get available insight types for a specific stock.
1372
1437
  * No authentication required.
@@ -1387,12 +1452,26 @@ declare class Institutional {
1387
1452
  * `reportDate` is optional: omit it to get the latest available quarter, which may be
1388
1453
  * a still-open one holding only early filers. The response then carries `reportDate`
1389
1454
  * plus `isPending` and filer coverage counts so a partial quarter is clearly labeled.
1455
+ *
1456
+ * Returns the preview envelope, so the flows are one level down:
1457
+ * `const { data } = await client.institutional.getFlows(); data.inflows`.
1390
1458
  */
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[]>;
1459
+ getFlows(reportDate?: string, options?: GetFlowsOptions): Promise<PreviewResponse<InstitutionalFlows>>;
1460
+ /**
1461
+ * Get institutional holders for a specific stock.
1462
+ *
1463
+ * Returns the preview envelope wrapping a {@link TickerHolders} object, so the rows
1464
+ * are two levels down: `(await getHolders(t, d)).data.holders`, alongside ticker-level
1465
+ * totals like `holderCount`. Free callers get a truncated `holders` array with
1466
+ * `isPreview: true`.
1467
+ */
1468
+ getHolders(ticker: string, reportDate: string): Promise<PreviewResponse<TickerHolders>>;
1469
+ /**
1470
+ * Get activist investor positions (NEW or INCREASED).
1471
+ *
1472
+ * Returns the preview envelope, so read the rows as `.data`.
1473
+ */
1474
+ getActivists(reportDate: string): Promise<PreviewResponse<Holder[]>>;
1396
1475
  /**
1397
1476
  * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)
1398
1477
  * so you can find what to query without knowing slugs upfront.
@@ -1488,10 +1567,13 @@ declare class Stocks {
1488
1567
  getMarketStatus(): Promise<MarketStatus>;
1489
1568
  /** Get financial statement data. */
1490
1569
  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>;
1570
+ /** Get available fiscal periods. The periods are in `periods`. */
1571
+ getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriodsResponse>;
1572
+ /**
1573
+ * Get the trailing-twelve-month fundamentals snapshot: TTM ratios, a different
1574
+ * shape from the per-period statement data `getFundamentals()` returns.
1575
+ */
1576
+ getCurrentFundamentals(ticker: string): Promise<TtmFundamentals>;
1495
1577
  /** Get historical revenue data. */
1496
1578
  getHistoricalRevenue(ticker: string): Promise<unknown>;
1497
1579
  /** Get short interest metrics (FINRA). */
@@ -1615,6 +1697,6 @@ declare class APIError extends SentiSenseError {
1615
1697
  constructor(message: string, status: number, code?: string);
1616
1698
  }
1617
1699
 
1618
- declare const VERSION = "0.28.0";
1700
+ declare const VERSION = "0.29.0";
1619
1701
 
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 };
1702
+ 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 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 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.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;
@@ -692,7 +751,11 @@ interface LockedInsight {
692
751
  urgency: string;
693
752
  generatedAt: number;
694
753
  }
695
- /** Preview response returned to free/unauthenticated users on insights endpoints. */
754
+ /**
755
+ * @deprecated The insights endpoints return `PreviewResponse<Insight[]>`, not this shape.
756
+ * No endpoint emits `insights` or `locked`. Kept only so an existing import resolves;
757
+ * will be removed in a future release.
758
+ */
696
759
  interface InsightPreviewResponse {
697
760
  isPreview: true;
698
761
  previewReason: "PRO_REQUIRED";
@@ -1031,16 +1094,16 @@ declare class Calendar {
1031
1094
  declare class Documents {
1032
1095
  private client;
1033
1096
  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[]>;
1097
+ /** Get document metrics for a stock. The rows are in `documents`. */
1098
+ getByTicker(ticker: string, options?: GetByTickerOptions): Promise<DocumentSearchResponse>;
1099
+ /** Get document metrics for a stock within a date range. The rows are in `documents`. */
1100
+ getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<DocumentSearchResponse>;
1101
+ /** Get document metrics for a KB entity. The rows are in `documents`. */
1102
+ getByEntity(entityId: string, options?: GetByEntityOptions): Promise<DocumentSearchResponse>;
1103
+ /** Smart search with natural language query parsing. The rows are in `documents`. */
1104
+ search(query: string, options?: SearchDocumentsOptions): Promise<DocumentSearchResponse>;
1105
+ /** Get latest document metrics from a source type. The rows are in `documents`. */
1106
+ getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<DocumentSearchResponse>;
1044
1107
  /** Get AI-curated news story clusters. */
1045
1108
  getStories(options?: GetStoriesOptions): Promise<Story[]>;
1046
1109
  /** Get full story detail by cluster ID. */
@@ -1333,40 +1396,42 @@ declare class Insights {
1333
1396
  /**
1334
1397
  * Get AI-generated insights for a specific stock, sorted by urgency then confidence.
1335
1398
  *
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.
1399
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
1400
+ * full list with `isPreview: false`; free callers get the top 3 with `isPreview: true`
1401
+ * and `totalCount` carrying the untruncated size.
1340
1402
  */
1341
- stock(ticker: string, options?: GetInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1403
+ stock(ticker: string, options?: GetInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1342
1404
  /**
1343
1405
  * Get AI insights for a stock within a date range.
1344
1406
  *
1345
- * Free users receive the top 3; PRO users receive the full list.
1346
- * The server returns 400 if `startDate` is after `endDate`.
1407
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
1408
+ * the top 3, PRO callers the full list. The server returns 400 if `startDate` is
1409
+ * after `endDate`.
1347
1410
  */
1348
- stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<Insight[] | InsightPreviewResponse>;
1411
+ stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<PreviewResponse<Insight[]>>;
1349
1412
  /**
1350
1413
  * Get AI-generated market-level insights, sorted by urgency then confidence.
1351
1414
  *
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.
1415
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
1416
+ * full list with `isPreview: false`; free callers get the top 5 with `isPreview: true`
1417
+ * and `totalCount` carrying the untruncated size.
1355
1418
  */
1356
- market(): Promise<Insight[] | InsightPreviewResponse>;
1419
+ market(): Promise<PreviewResponse<Insight[]>>;
1357
1420
  /**
1358
1421
  * Get the latest AI insights across all tracked stocks, newest first.
1359
1422
  *
1360
- * Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).
1423
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
1424
+ * the top 5, PRO callers up to `limit` (clamped to 1-200).
1361
1425
  */
1362
- latest(options?: GetLatestInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1426
+ latest(options?: GetLatestInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1363
1427
  /**
1364
1428
  * Get personalized insights for the authenticated user.
1365
1429
  *
1366
1430
  * Biased toward the user's watchlist and portfolio when available; falls back
1367
1431
  * to market-level insights otherwise. API key authentication required.
1432
+ * Returns the preview envelope: read the insights as `.data`.
1368
1433
  */
1369
- user(options?: GetUserInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1434
+ user(options?: GetUserInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1370
1435
  /**
1371
1436
  * Get available insight types for a specific stock.
1372
1437
  * No authentication required.
@@ -1387,12 +1452,26 @@ declare class Institutional {
1387
1452
  * `reportDate` is optional: omit it to get the latest available quarter, which may be
1388
1453
  * a still-open one holding only early filers. The response then carries `reportDate`
1389
1454
  * plus `isPending` and filer coverage counts so a partial quarter is clearly labeled.
1455
+ *
1456
+ * Returns the preview envelope, so the flows are one level down:
1457
+ * `const { data } = await client.institutional.getFlows(); data.inflows`.
1390
1458
  */
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[]>;
1459
+ getFlows(reportDate?: string, options?: GetFlowsOptions): Promise<PreviewResponse<InstitutionalFlows>>;
1460
+ /**
1461
+ * Get institutional holders for a specific stock.
1462
+ *
1463
+ * Returns the preview envelope wrapping a {@link TickerHolders} object, so the rows
1464
+ * are two levels down: `(await getHolders(t, d)).data.holders`, alongside ticker-level
1465
+ * totals like `holderCount`. Free callers get a truncated `holders` array with
1466
+ * `isPreview: true`.
1467
+ */
1468
+ getHolders(ticker: string, reportDate: string): Promise<PreviewResponse<TickerHolders>>;
1469
+ /**
1470
+ * Get activist investor positions (NEW or INCREASED).
1471
+ *
1472
+ * Returns the preview envelope, so read the rows as `.data`.
1473
+ */
1474
+ getActivists(reportDate: string): Promise<PreviewResponse<Holder[]>>;
1396
1475
  /**
1397
1476
  * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)
1398
1477
  * so you can find what to query without knowing slugs upfront.
@@ -1488,10 +1567,13 @@ declare class Stocks {
1488
1567
  getMarketStatus(): Promise<MarketStatus>;
1489
1568
  /** Get financial statement data. */
1490
1569
  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>;
1570
+ /** Get available fiscal periods. The periods are in `periods`. */
1571
+ getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriodsResponse>;
1572
+ /**
1573
+ * Get the trailing-twelve-month fundamentals snapshot: TTM ratios, a different
1574
+ * shape from the per-period statement data `getFundamentals()` returns.
1575
+ */
1576
+ getCurrentFundamentals(ticker: string): Promise<TtmFundamentals>;
1495
1577
  /** Get historical revenue data. */
1496
1578
  getHistoricalRevenue(ticker: string): Promise<unknown>;
1497
1579
  /** Get short interest metrics (FINRA). */
@@ -1615,6 +1697,6 @@ declare class APIError extends SentiSenseError {
1615
1697
  constructor(message: string, status: number, code?: string);
1616
1698
  }
1617
1699
 
1618
- declare const VERSION = "0.28.0";
1700
+ declare const VERSION = "0.29.0";
1619
1701
 
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 };
1702
+ 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 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 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 };