sentisense 0.7.0 → 0.8.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.cjs +102 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +100 -7
- package/dist/index.d.ts +100 -7
- package/dist/index.mjs +102 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -53,9 +53,10 @@ var NotFoundError = class extends SentiSenseError {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
var RateLimitError = class extends SentiSenseError {
|
|
56
|
-
constructor(message, code) {
|
|
56
|
+
constructor(message, code, retryAfter) {
|
|
57
57
|
super(message, 429, code);
|
|
58
58
|
this.name = "RateLimitError";
|
|
59
|
+
this.retryAfter = retryAfter;
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
62
|
var APIError = class extends SentiSenseError {
|
|
@@ -245,6 +246,51 @@ var Insider = class {
|
|
|
245
246
|
}
|
|
246
247
|
};
|
|
247
248
|
|
|
249
|
+
// src/resources/politicians.ts
|
|
250
|
+
var Politicians = class {
|
|
251
|
+
constructor(client) {
|
|
252
|
+
this.client = client;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Get recent congressional STOCK Act trading activity across all politicians.
|
|
256
|
+
*
|
|
257
|
+
* PRO-gated. Free/unauthenticated users receive a preview (top 5 trades)
|
|
258
|
+
* with `isPreview: true` in the response.
|
|
259
|
+
*/
|
|
260
|
+
async getActivity(options) {
|
|
261
|
+
return this.client.get("/api/v1/politicians/activity", options);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get congressional trades for a specific stock.
|
|
265
|
+
*
|
|
266
|
+
* PRO-gated. Free users receive a preview of the top 3 trades.
|
|
267
|
+
*/
|
|
268
|
+
async getFilings(ticker, options) {
|
|
269
|
+
return this.client.get(
|
|
270
|
+
`/api/v1/politicians/filings/${encodeURIComponent(ticker.toUpperCase())}`,
|
|
271
|
+
options
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Get all tracked politicians with trading summary statistics.
|
|
276
|
+
*
|
|
277
|
+
* PRO-gated. Free users receive a preview of the top 5 members.
|
|
278
|
+
*/
|
|
279
|
+
async getMembers() {
|
|
280
|
+
return this.client.get("/api/v1/politicians/members");
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Get detailed profile for a single politician: summary, recent trades, top tickers.
|
|
284
|
+
*
|
|
285
|
+
* PRO-gated. Free users receive a preview-wrapped response.
|
|
286
|
+
*/
|
|
287
|
+
async getMember(slug) {
|
|
288
|
+
return this.client.get(
|
|
289
|
+
`/api/v1/politicians/member/${encodeURIComponent(slug)}`
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
248
294
|
// src/resources/insights.ts
|
|
249
295
|
var Insights = class {
|
|
250
296
|
constructor(client) {
|
|
@@ -468,20 +514,28 @@ var Stocks = class {
|
|
|
468
514
|
};
|
|
469
515
|
|
|
470
516
|
// src/version.ts
|
|
471
|
-
var VERSION = "0.
|
|
517
|
+
var VERSION = "0.8.0";
|
|
472
518
|
|
|
473
519
|
// src/client.ts
|
|
474
520
|
var DEFAULT_BASE_URL = "https://app.sentisense.ai";
|
|
475
521
|
var DEFAULT_TIMEOUT = 3e4;
|
|
522
|
+
var DEFAULT_MAX_RETRIES = 3;
|
|
523
|
+
var BASE_DELAY_MS = 1e3;
|
|
524
|
+
var MAX_DELAY_MS = 6e4;
|
|
525
|
+
function sleep(ms) {
|
|
526
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
527
|
+
}
|
|
476
528
|
var SentiSense = class {
|
|
477
529
|
constructor(options = {}) {
|
|
478
530
|
this.apiKey = options.apiKey;
|
|
479
531
|
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
480
532
|
this.timeout = options.timeout ?? DEFAULT_TIMEOUT;
|
|
533
|
+
this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
481
534
|
this.stocks = new Stocks(this);
|
|
482
535
|
this.documents = new Documents(this);
|
|
483
536
|
this.institutional = new Institutional(this);
|
|
484
537
|
this.insider = new Insider(this);
|
|
538
|
+
this.politicians = new Politicians(this);
|
|
485
539
|
this.insights = new Insights(this);
|
|
486
540
|
this.entityMetrics = new EntityMetrics(this);
|
|
487
541
|
this.marketMood = new MarketMoodResource(this);
|
|
@@ -500,29 +554,51 @@ var SentiSense = class {
|
|
|
500
554
|
if (typeof process !== "undefined" && process.versions?.node) {
|
|
501
555
|
headers["User-Agent"] = `sentisense-node/${VERSION}`;
|
|
502
556
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
headers,
|
|
509
|
-
signal: controller.signal
|
|
510
|
-
});
|
|
511
|
-
if (!response.ok) {
|
|
512
|
-
await this.handleErrorResponse(response);
|
|
557
|
+
let delayMs = 0;
|
|
558
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
559
|
+
if (delayMs > 0) {
|
|
560
|
+
await sleep(delayMs);
|
|
561
|
+
delayMs = 0;
|
|
513
562
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
563
|
+
const controller = new AbortController();
|
|
564
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
565
|
+
try {
|
|
566
|
+
const response = await fetch(url, {
|
|
567
|
+
method: "GET",
|
|
568
|
+
headers,
|
|
569
|
+
signal: controller.signal
|
|
570
|
+
});
|
|
571
|
+
if (!response.ok) {
|
|
572
|
+
const isRetryable = response.status === 429 || response.status >= 500;
|
|
573
|
+
if (isRetryable && attempt < this.maxRetries) {
|
|
574
|
+
if (response.status === 429) {
|
|
575
|
+
const ra = response.headers.get("Retry-After");
|
|
576
|
+
delayMs = (ra ? parseInt(ra, 10) : 60) * 1e3;
|
|
577
|
+
} else {
|
|
578
|
+
delayMs = Math.min(BASE_DELAY_MS * Math.pow(2, attempt), MAX_DELAY_MS) + Math.random() * 1e3;
|
|
579
|
+
}
|
|
580
|
+
try {
|
|
581
|
+
await response.body?.cancel();
|
|
582
|
+
} catch {
|
|
583
|
+
}
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
await this.handleErrorResponse(response);
|
|
587
|
+
}
|
|
588
|
+
return await response.json();
|
|
589
|
+
} catch (error) {
|
|
590
|
+
if (error instanceof SentiSenseError) throw error;
|
|
591
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
592
|
+
throw new SentiSenseError(`Request timed out after ${this.timeout}ms`);
|
|
593
|
+
}
|
|
594
|
+
throw new SentiSenseError(
|
|
595
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
596
|
+
);
|
|
597
|
+
} finally {
|
|
598
|
+
clearTimeout(timer);
|
|
519
599
|
}
|
|
520
|
-
throw new SentiSenseError(
|
|
521
|
-
error instanceof Error ? error.message : "Unknown error"
|
|
522
|
-
);
|
|
523
|
-
} finally {
|
|
524
|
-
clearTimeout(timer);
|
|
525
600
|
}
|
|
601
|
+
throw new SentiSenseError("All retries exhausted");
|
|
526
602
|
}
|
|
527
603
|
buildUrl(path, params) {
|
|
528
604
|
const url = new URL(path, this.baseUrl);
|
|
@@ -549,8 +625,10 @@ var SentiSense = class {
|
|
|
549
625
|
throw new AuthenticationError(message, response.status, code);
|
|
550
626
|
case 404:
|
|
551
627
|
throw new NotFoundError(message, code);
|
|
552
|
-
case 429:
|
|
553
|
-
|
|
628
|
+
case 429: {
|
|
629
|
+
const ra = response.headers.get("Retry-After");
|
|
630
|
+
throw new RateLimitError(message, code, ra ? parseInt(ra, 10) : void 0);
|
|
631
|
+
}
|
|
554
632
|
default:
|
|
555
633
|
throw new APIError(message, response.status, code);
|
|
556
634
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/resources/documents.ts","../src/resources/entityMetrics.ts","../src/resources/insider.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 {\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 StockPrice,\n StockDetail,\n StockImage,\n StockProfile,\n StockEntity,\n ChartData,\n ChartDataPoint,\n MarketStatus,\n Fundamentals,\n FundamentalsPeriod,\n ShortInterest,\n FloatInfo,\n ShortVolume,\n AISummary,\n MetricsBreakdown,\n Document,\n DocumentSource,\n SentimentEntry,\n Story,\n StoryCluster,\n Quarter,\n InstitutionalFlow,\n InstitutionalFlowsResponse,\n Holder,\n MetricType,\n MetricsOptions,\n MetricDistributionOptions,\n ServingMetric,\n MetricDistribution,\n MentionData,\n MentionCount,\n SentimentData,\n MarketMood,\n 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 constructor(message: string, code?: string) {\n super(message, 429, code);\n this.name = \"RateLimitError\";\n }\n}\n\nexport class APIError extends SentiSenseError {\n constructor(message: string, status: number, code?: string) {\n super(message, status, code);\n this.name = \"APIError\";\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Document,\n DocumentSource,\n GetByEntityOptions,\n GetBySourceOptions,\n GetByTickerOptions,\n GetByTickerRangeOptions,\n GetStoriesByTickerOptions,\n GetStoriesOptions,\n SearchDocumentsOptions,\n Story,\n} from \"../types.js\";\n\nexport class Documents {\n constructor(private client: APIClient) {}\n\n /** Get document metrics for a stock. */\n async getByTicker(ticker: string, options?: GetByTickerOptions): Promise<Document[]> {\n return this.client.get(`/api/v1/documents/ticker/${encodeURIComponent(ticker)}`, options);\n }\n\n /** Get document metrics for a stock within a date range. */\n async getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/ticker/${encodeURIComponent(ticker)}/range`,\n options,\n );\n }\n\n /** Get document metrics for a KB entity. */\n async getByEntity(entityId: string, options?: GetByEntityOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/entity/${encodeURIComponent(entityId)}`,\n options,\n );\n }\n\n /** Smart search with natural language query parsing. */\n async search(query: string, options?: SearchDocumentsOptions): Promise<Document[]> {\n return this.client.get(\"/api/v1/documents/search\", { query, ...options });\n }\n\n /** Get latest document metrics from a source type. */\n async getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/source/${encodeURIComponent(source)}`,\n options,\n );\n }\n\n /** Get AI-curated news story clusters. */\n async getStories(options?: GetStoriesOptions): Promise<Story[]> {\n return this.client.get(\"/api/v1/documents/stories\", options);\n }\n\n /** Get 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 {\n InsiderActivityResponse,\n InsiderTrade,\n ClusterBuy,\n GetInsiderOptions,\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<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<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<ClusterBuy[]> {\n return this.client.get(\"/api/v1/insider/cluster-buys\", options);\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Insight,\n InsightPreviewResponse,\n GetInsightsOptions,\n} from \"../types.js\";\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-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 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","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 FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n MarketStatus,\n MetricsBreakdown,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n} from \"../types.js\";\n\nexport class Stocks {\n constructor(private client: APIClient) {}\n\n /** List all available ticker symbols. */\n async list(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks\");\n }\n\n /** List all stocks with name, kbEntityId, urlSlug. */\n async listDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/detailed\");\n }\n\n /** Get popular ticker symbols. */\n async listPopular(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks/popular\");\n }\n\n /** Get popular stocks with details. */\n async listPopularDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/popular/detailed\");\n }\n\n /** Get real-time price for a single ticker. */\n async getPrice(ticker: string): Promise<StockPrice> {\n return this.client.get(\"/api/v1/stocks/price\", { ticker });\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<Record<string, StockPrice>> {\n return this.client.get(\"/api/v1/stocks/prices\", {\n tickers: tickers.join(\",\"),\n });\n }\n\n /** Get batch company logo URLs. */\n async getImages(\n tickers: string[],\n options?: GetImagesOptions,\n ): Promise<Record<string, StockImage>> {\n return this.client.get(\"/api/v1/stocks/images\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get company profiles with branding, market cap, sector. */\n async getDescriptions(\n tickers: string[],\n options?: GetDescriptionsOptions,\n ): Promise<Record<string, StockProfile>> {\n return this.client.get(\"/api/v1/stocks/descriptions\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get peer/similar stocks. */\n async getSimilar(ticker: string, options?: GetSimilarOptions): Promise<StockDetail[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/similar`, options);\n }\n\n /** Get company profile (CEO, sector, industry, market data). */\n async getProfile(ticker: string, options?: GetProfileOptions): Promise<StockProfile> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/profile`, options);\n }\n\n /** Get related KB entities (people, products, partners). */\n async getEntities(ticker: string): Promise<StockEntity[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/entities`);\n }\n\n /** Get AI-generated stock analysis report. Requires PRO tier. */\n async getAISummary(ticker: string, options?: GetAISummaryOptions): Promise<AISummary> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/ai-summary`, options);\n }\n\n /** Get sentiment/mention metrics breakdown by entity. */\n async getMetricsBreakdown(\n ticker: string,\n metricType: string,\n options?: GetMetricsBreakdownOptions,\n ): Promise<MetricsBreakdown> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker)}/metrics/${encodeURIComponent(metricType)}/breakdown`,\n options,\n );\n }\n\n /** Get historical OHLCV chart data. */\n async getChart(ticker: string, options?: GetChartOptions): Promise<ChartData> {\n return this.client.get(\"/api/v1/stocks/chart\", { ticker, ...options });\n }\n\n /** Get current market open/closed/pre-market/after-hours status. */\n async getMarketStatus(): Promise<MarketStatus> {\n return this.client.get(\"/api/v1/stocks/market-status\");\n }\n\n /** Get financial statement data. */\n async getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals\", { ticker, ...options });\n }\n\n /** Get available fiscal periods. */\n async getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]> {\n return this.client.get(\"/api/v1/stocks/fundamentals/periods\", { ticker });\n }\n\n /** Get most recent fundamentals snapshot. */\n async getCurrentFundamentals(ticker: string): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals/current\", { ticker });\n }\n\n /** Get historical P/E, P/B, P/S ratios. */\n async getHistoricalRatios(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/ratios\", { ticker });\n }\n\n /** Get historical revenue data. */\n async getHistoricalRevenue(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/revenue\", { ticker });\n }\n\n /** Get short interest metrics (FINRA). */\n async getShortInterest(ticker: string): Promise<ShortInterest> {\n return this.client.get(\"/api/v1/stocks/short-interest\", { ticker });\n }\n\n /** Get float information. */\n async getFloat(ticker: string): Promise<FloatInfo> {\n return this.client.get(\"/api/v1/stocks/float\", { ticker });\n }\n\n /** Get short volume trading data. */\n async getShortVolume(ticker: string): Promise<ShortVolume> {\n return this.client.get(\"/api/v1/stocks/short-volume\", { ticker });\n }\n}\n","export const VERSION = \"0.7.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { Insider } from \"./resources/insider.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;\n\n/** @internal HTTP interface exposed to resource classes. */\nexport interface APIClient {\n get<T = unknown>(path: string, params?: object): Promise<T>;\n}\n\nexport class SentiSense implements APIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeout: number;\n\n readonly stocks: Stocks;\n readonly documents: Documents;\n readonly institutional: Institutional;\n readonly insider: Insider;\n readonly insights: Insights;\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\n this.stocks = new Stocks(this);\n this.documents = new Documents(this);\n this.institutional = new Institutional(this);\n this.insider = new Insider(this);\n this.insights = new Insights(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 const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n const response = await fetch(url, {\n method: \"GET\",\n headers,\n signal: controller.signal,\n });\n\n if (!response.ok) {\n await this.handleErrorResponse(response);\n }\n\n return (await response.json()) as T;\n } catch (error) {\n if (error instanceof SentiSenseError) throw error;\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new SentiSenseError(`Request timed out after ${this.timeout}ms`);\n }\n throw new SentiSenseError(\n error instanceof Error ? error.message : \"Unknown error\",\n );\n } finally {\n clearTimeout(timer);\n }\n }\n\n private buildUrl(path: string, params?: object): string {\n const url = new URL(path, this.baseUrl);\n if (params) {\n for (const [key, value] of Object.entries(params as Record<string, unknown>)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n return url.toString();\n }\n\n private async handleErrorResponse(response: Response): Promise<never> {\n let body: { error?: string; message?: string } = {};\n try {\n body = await response.json();\n } catch {\n // Response may not be JSON\n }\n\n const message = body.message ?? response.statusText ?? \"API request failed\";\n const code = body.error;\n\n switch (response.status) {\n case 401:\n case 403:\n throw new AuthenticationError(message, response.status, code);\n case 404:\n throw new NotFoundError(message, code);\n case 429:\n throw new RateLimitError(message, code);\n default:\n throw new APIError(message, response.status, code);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EAIzC,YAAY,SAAiB,QAAiB,MAAe;AAC3D,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,sBAAN,cAAkC,gBAAgB;AAAA,EACvD,YAAY,SAAiB,QAAgB,MAAe;AAC1D,UAAM,SAAS,QAAQ,IAAI;AAC3B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAAN,cAA4B,gBAAgB;AAAA,EACjD,YAAY,SAAiB,MAAe;AAC1C,UAAM,SAAS,KAAK,IAAI;AACxB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,iBAAN,cAA6B,gBAAgB;AAAA,EAClD,YAAY,SAAiB,MAAe;AAC1C,UAAM,SAAS,KAAK,IAAI;AACxB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,WAAN,cAAuB,gBAAgB;AAAA,EAC5C,YAAY,SAAiB,QAAgB,MAAe;AAC1D,UAAM,SAAS,QAAQ,IAAI;AAC3B,SAAK,OAAO;AAAA,EACd;AACF;;;ACxBO,IAAM,YAAN,M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K;AAAA,IAC7B,QAAQ;AAAA,IAER;AAEA,UAAM,UAAU,KAAK,WAAW,SAAS,cAAc;AACvD,UAAM,OAAO,KAAK;AAElB,YAAQ,SAAS,QAAQ;AAAA,MACvB,KAAK;AAAA,MACL,KAAK;AACH,cAAM,IAAI,oBAAoB,SAAS,SAAS,QAAQ,IAAI;AAAA,MAC9D,KAAK;AACH,cAAM,IAAI,cAAc,SAAS,IAAI;AAAA,MACvC,KAAK;AACH,cAAM,IAAI,eAAe,SAAS,IAAI;AAAA,MACxC;AACE,cAAM,IAAI,SAAS,SAAS,SAAS,QAAQ,IAAI;AAAA,IACrD;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/resources/documents.ts","../src/resources/entityMetrics.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 {\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 StockDetail,\n StockImage,\n StockProfile,\n StockEntity,\n ChartData,\n ChartDataPoint,\n MarketStatus,\n Fundamentals,\n FundamentalsPeriod,\n ShortInterest,\n FloatInfo,\n ShortVolume,\n AISummary,\n MetricsBreakdown,\n Document,\n DocumentSource,\n SentimentEntry,\n Story,\n StoryCluster,\n Quarter,\n InstitutionalFlow,\n InstitutionalFlowsResponse,\n Holder,\n MetricType,\n MetricsOptions,\n MetricDistributionOptions,\n ServingMetric,\n MetricDistribution,\n MentionData,\n MentionCount,\n SentimentData,\n MarketMood,\n 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 {\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 {\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 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-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 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","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 FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n MarketStatus,\n MetricsBreakdown,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n} from \"../types.js\";\n\nexport class Stocks {\n constructor(private client: APIClient) {}\n\n /** List all available ticker symbols. */\n async list(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks\");\n }\n\n /** List all stocks with name, kbEntityId, urlSlug. */\n async listDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/detailed\");\n }\n\n /** Get popular ticker symbols. */\n async listPopular(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks/popular\");\n }\n\n /** Get popular stocks with details. */\n async listPopularDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/popular/detailed\");\n }\n\n /** Get real-time price for a single ticker. */\n async getPrice(ticker: string): Promise<StockPrice> {\n return this.client.get(\"/api/v1/stocks/price\", { ticker });\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<StockPrice[]> {\n return this.client.get(\"/api/v1/stocks/prices\", {\n tickers: tickers.join(\",\"),\n });\n }\n\n /** Get batch company logo URLs. */\n async getImages(\n tickers: string[],\n options?: GetImagesOptions,\n ): Promise<Record<string, StockImage>> {\n return this.client.get(\"/api/v1/stocks/images\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get company profiles with branding, market cap, sector. */\n async getDescriptions(\n tickers: string[],\n options?: GetDescriptionsOptions,\n ): Promise<Record<string, StockProfile>> {\n return this.client.get(\"/api/v1/stocks/descriptions\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get peer/similar stocks. */\n async getSimilar(ticker: string, options?: GetSimilarOptions): Promise<StockDetail[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/similar`, options);\n }\n\n /** Get company profile (CEO, sector, industry, market data). */\n async getProfile(ticker: string, options?: GetProfileOptions): Promise<StockProfile> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/profile`, options);\n }\n\n /** Get related KB entities (people, products, partners). */\n async getEntities(ticker: string): Promise<StockEntity[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/entities`);\n }\n\n /** Get AI-generated stock analysis report. Requires PRO tier. */\n async getAISummary(ticker: string, options?: GetAISummaryOptions): Promise<AISummary> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/ai-summary`, options);\n }\n\n /** Get sentiment/mention metrics breakdown by entity. */\n async getMetricsBreakdown(\n ticker: string,\n metricType: string,\n options?: GetMetricsBreakdownOptions,\n ): Promise<MetricsBreakdown> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker)}/metrics/${encodeURIComponent(metricType)}/breakdown`,\n options,\n );\n }\n\n /** Get historical OHLCV chart data. */\n async getChart(ticker: string, options?: GetChartOptions): Promise<ChartData> {\n return this.client.get(\"/api/v1/stocks/chart\", { ticker, ...options });\n }\n\n /** Get current market open/closed/pre-market/after-hours status. */\n async getMarketStatus(): Promise<MarketStatus> {\n return this.client.get(\"/api/v1/stocks/market-status\");\n }\n\n /** Get financial statement data. */\n async getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals\", { ticker, ...options });\n }\n\n /** Get available fiscal periods. */\n async getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]> {\n return this.client.get(\"/api/v1/stocks/fundamentals/periods\", { ticker });\n }\n\n /** Get most recent fundamentals snapshot. */\n async getCurrentFundamentals(ticker: string): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals/current\", { ticker });\n }\n\n /** Get historical P/E, P/B, P/S ratios. */\n async getHistoricalRatios(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/ratios\", { ticker });\n }\n\n /** Get historical revenue data. */\n async getHistoricalRevenue(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/revenue\", { ticker });\n }\n\n /** Get short interest metrics (FINRA). */\n async getShortInterest(ticker: string): Promise<ShortInterest> {\n return this.client.get(\"/api/v1/stocks/short-interest\", { ticker });\n }\n\n /** Get float information. */\n async getFloat(ticker: string): Promise<FloatInfo> {\n return this.client.get(\"/api/v1/stocks/float\", { ticker });\n }\n\n /** Get short volume trading data. */\n async getShortVolume(ticker: string): Promise<ShortVolume> {\n return this.client.get(\"/api/v1/stocks/short-volume\", { ticker });\n }\n}\n","export const VERSION = \"0.8.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { 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}\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 institutional: Institutional;\n readonly insider: Insider;\n readonly politicians: Politicians;\n readonly insights: Insights;\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.institutional = new Institutional(this);\n this.insider = new Insider(this);\n this.politicians = new Politicians(this);\n this.insights = new Insights(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 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;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;AACxB,SAAK,OAAO;AACZ,SAAK,aAAa;AAAA,EACpB;AACF;AAEO,IAAM,WAAN,cAAuB,gBAAgB;AAAA,EAC5C,YAAY,SAAiB,QAAgB,MAAe;AAC1D,UAAM,SAAS,QAAQ,IAAI;AAC3B,SAAK,OAAO;AAAA,EACd;AACF;;;AC3BO,IAAM,YAAN,MAAgB;AAAA,EACrB,YAAoB,QAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA,EAGxC,MAAM,YAAY,QAAgB,SAAmD;AACnF,WAAO,KAAK,OAAO,IAAI,4BAA4B,mBAAmB,MAAM,CAAC,IAAI,OAAO;AAAA,EAC1F;AAAA;AAAA,EAGA,MAAM,iBAAiB,QAAgB,SAAuD;AAC5F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M,SAAS,KAAK;AAAA,IAC7B,QAAQ;AAAA,IAER;AAEA,UAAM,UAAU,KAAK,WAAW,SAAS,cAAc;AACvD,UAAM,OAAO,KAAK;AAElB,YAAQ,SAAS,QAAQ;AAAA,MACvB,KAAK;AAAA,MACL,KAAK;AACH,cAAM,IAAI,oBAAoB,SAAS,SAAS,QAAQ,IAAI;AAAA,MAC9D,KAAK;AACH,cAAM,IAAI,cAAc,SAAS,IAAI;AAAA,MACvC,KAAK,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
|
@@ -2,6 +2,7 @@ interface SentiSenseOptions {
|
|
|
2
2
|
apiKey?: string;
|
|
3
3
|
baseUrl?: string;
|
|
4
4
|
timeout?: number;
|
|
5
|
+
maxRetries?: number;
|
|
5
6
|
}
|
|
6
7
|
interface StockPrice {
|
|
7
8
|
ticker: string;
|
|
@@ -270,6 +271,65 @@ interface GetInsiderOptions {
|
|
|
270
271
|
/** Number of days to look back (1–365). Defaults to 90. */
|
|
271
272
|
lookbackDays?: number;
|
|
272
273
|
}
|
|
274
|
+
/** A congressional STOCK Act trade disclosure. */
|
|
275
|
+
interface CongressTrade {
|
|
276
|
+
politicianName: string;
|
|
277
|
+
firstName: string;
|
|
278
|
+
lastName: string;
|
|
279
|
+
chamber: "SENATE" | "HOUSE";
|
|
280
|
+
party: string;
|
|
281
|
+
state: string;
|
|
282
|
+
bioguideId: string;
|
|
283
|
+
imageUrl: string | null;
|
|
284
|
+
ticker: string;
|
|
285
|
+
assetDescription: string;
|
|
286
|
+
assetType: "Stock" | "ETF";
|
|
287
|
+
transactionType: "PURCHASE" | "SALE" | "EXCHANGE" | "OTHER";
|
|
288
|
+
transactionDate: string;
|
|
289
|
+
disclosureDate: string;
|
|
290
|
+
disclosureDelayDays: number;
|
|
291
|
+
/** Raw STOCK Act range (e.g., "$1,001 - $15,000"). */
|
|
292
|
+
amountRange: string;
|
|
293
|
+
amountMin: number;
|
|
294
|
+
amountMax: number;
|
|
295
|
+
owner: "Self" | "Spouse" | "Child" | "Joint";
|
|
296
|
+
urlSlug: string;
|
|
297
|
+
sentiSenseScore: number | null;
|
|
298
|
+
}
|
|
299
|
+
/** Summary statistics for a tracked politician. */
|
|
300
|
+
interface PoliticianSummary {
|
|
301
|
+
urlSlug: string;
|
|
302
|
+
displayName: string;
|
|
303
|
+
firstName: string;
|
|
304
|
+
lastName: string;
|
|
305
|
+
chamber: "SENATE" | "HOUSE";
|
|
306
|
+
party: string;
|
|
307
|
+
state: string;
|
|
308
|
+
bioguideId: string;
|
|
309
|
+
imageUrl: string | null;
|
|
310
|
+
kbEntityId: string | null;
|
|
311
|
+
totalTrades: number;
|
|
312
|
+
purchaseCount: number;
|
|
313
|
+
saleCount: number;
|
|
314
|
+
latestTradeDate: string | null;
|
|
315
|
+
sentiSenseScore: number | null;
|
|
316
|
+
}
|
|
317
|
+
/** Detailed politician profile with recent trades and top tickers. */
|
|
318
|
+
interface PoliticianDetail {
|
|
319
|
+
profile: PoliticianSummary;
|
|
320
|
+
recentTrades: CongressTrade[];
|
|
321
|
+
topTickers: string[];
|
|
322
|
+
}
|
|
323
|
+
interface GetPoliticiansOptions {
|
|
324
|
+
/** Number of days to look back (1-365). Defaults to 90. */
|
|
325
|
+
lookbackDays?: number;
|
|
326
|
+
}
|
|
327
|
+
/** Generic preview wrapper used by PRO-gated endpoints. */
|
|
328
|
+
interface PreviewResponse<T> {
|
|
329
|
+
isPreview: boolean;
|
|
330
|
+
previewReason: "LOGIN_REQUIRED" | "PRO_REQUIRED" | null;
|
|
331
|
+
data: T;
|
|
332
|
+
}
|
|
273
333
|
/** Supported metric types for the v2 Serving Metrics API. */
|
|
274
334
|
type MetricType = "mentions" | "sentiment" | "sentisense_score" | "social_dominance" | "creators";
|
|
275
335
|
/** Options for `EntityMetrics.getMetrics()`. */
|
|
@@ -464,19 +524,49 @@ declare class Insider {
|
|
|
464
524
|
* PRO-gated. Free/unauthenticated users receive a preview (top 5 per direction)
|
|
465
525
|
* with `isPreview: true` in the response.
|
|
466
526
|
*/
|
|
467
|
-
getActivity(options?: GetInsiderOptions): Promise<InsiderActivityResponse
|
|
527
|
+
getActivity(options?: GetInsiderOptions): Promise<PreviewResponse<InsiderActivityResponse>>;
|
|
468
528
|
/**
|
|
469
529
|
* Get individual insider transactions for a specific stock.
|
|
470
530
|
*
|
|
471
531
|
* PRO-gated. Free users receive a preview of the top 5 transactions.
|
|
472
532
|
*/
|
|
473
|
-
getTrades(ticker: string, options?: GetInsiderOptions): Promise<InsiderTrade[]
|
|
533
|
+
getTrades(ticker: string, options?: GetInsiderOptions): Promise<PreviewResponse<InsiderTrade[]>>;
|
|
474
534
|
/**
|
|
475
535
|
* Get cluster buy signals: stocks where 3+ distinct insiders bought recently.
|
|
476
536
|
*
|
|
477
537
|
* PRO-gated. Free users receive a preview of the top 3 signals.
|
|
478
538
|
*/
|
|
479
|
-
getClusterBuys(options?: GetInsiderOptions): Promise<ClusterBuy[]
|
|
539
|
+
getClusterBuys(options?: GetInsiderOptions): Promise<PreviewResponse<ClusterBuy[]>>;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
declare class Politicians {
|
|
543
|
+
private client;
|
|
544
|
+
constructor(client: APIClient);
|
|
545
|
+
/**
|
|
546
|
+
* Get recent congressional STOCK Act trading activity across all politicians.
|
|
547
|
+
*
|
|
548
|
+
* PRO-gated. Free/unauthenticated users receive a preview (top 5 trades)
|
|
549
|
+
* with `isPreview: true` in the response.
|
|
550
|
+
*/
|
|
551
|
+
getActivity(options?: GetPoliticiansOptions): Promise<PreviewResponse<CongressTrade[]>>;
|
|
552
|
+
/**
|
|
553
|
+
* Get congressional trades for a specific stock.
|
|
554
|
+
*
|
|
555
|
+
* PRO-gated. Free users receive a preview of the top 3 trades.
|
|
556
|
+
*/
|
|
557
|
+
getFilings(ticker: string, options?: GetPoliticiansOptions): Promise<PreviewResponse<CongressTrade[]>>;
|
|
558
|
+
/**
|
|
559
|
+
* Get all tracked politicians with trading summary statistics.
|
|
560
|
+
*
|
|
561
|
+
* PRO-gated. Free users receive a preview of the top 5 members.
|
|
562
|
+
*/
|
|
563
|
+
getMembers(): Promise<PreviewResponse<PoliticianSummary[]>>;
|
|
564
|
+
/**
|
|
565
|
+
* Get detailed profile for a single politician: summary, recent trades, top tickers.
|
|
566
|
+
*
|
|
567
|
+
* PRO-gated. Free users receive a preview-wrapped response.
|
|
568
|
+
*/
|
|
569
|
+
getMember(slug: string): Promise<PreviewResponse<PoliticianDetail>>;
|
|
480
570
|
}
|
|
481
571
|
|
|
482
572
|
declare class Insights {
|
|
@@ -560,7 +650,7 @@ declare class Stocks {
|
|
|
560
650
|
/** Get real-time price for a single ticker. */
|
|
561
651
|
getPrice(ticker: string): Promise<StockPrice>;
|
|
562
652
|
/** Get real-time prices for multiple tickers. */
|
|
563
|
-
getPrices(tickers: string[]): Promise<
|
|
653
|
+
getPrices(tickers: string[]): Promise<StockPrice[]>;
|
|
564
654
|
/** Get batch company logo URLs. */
|
|
565
655
|
getImages(tickers: string[], options?: GetImagesOptions): Promise<Record<string, StockImage>>;
|
|
566
656
|
/** Get company profiles with branding, market cap, sector. */
|
|
@@ -605,10 +695,12 @@ declare class SentiSense implements APIClient {
|
|
|
605
695
|
private baseUrl;
|
|
606
696
|
private apiKey;
|
|
607
697
|
private timeout;
|
|
698
|
+
private maxRetries;
|
|
608
699
|
readonly stocks: Stocks;
|
|
609
700
|
readonly documents: Documents;
|
|
610
701
|
readonly institutional: Institutional;
|
|
611
702
|
readonly insider: Insider;
|
|
703
|
+
readonly politicians: Politicians;
|
|
612
704
|
readonly insights: Insights;
|
|
613
705
|
readonly entityMetrics: EntityMetrics;
|
|
614
706
|
readonly marketMood: MarketMoodResource;
|
|
@@ -633,12 +725,13 @@ declare class NotFoundError extends SentiSenseError {
|
|
|
633
725
|
constructor(message: string, code?: string);
|
|
634
726
|
}
|
|
635
727
|
declare class RateLimitError extends SentiSenseError {
|
|
636
|
-
|
|
728
|
+
retryAfter?: number;
|
|
729
|
+
constructor(message: string, code?: string, retryAfter?: number);
|
|
637
730
|
}
|
|
638
731
|
declare class APIError extends SentiSenseError {
|
|
639
732
|
constructor(message: string, status: number, code?: string);
|
|
640
733
|
}
|
|
641
734
|
|
|
642
|
-
declare const VERSION = "0.
|
|
735
|
+
declare const VERSION = "0.8.0";
|
|
643
736
|
|
|
644
|
-
export { type AISummary, APIError, AuthenticationError, type ChartData, type ChartDataPoint, type ClusterBuy, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetInsiderOptions, type GetInsightsOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type LockedInsight, type MarketMood, type MarketStatus, type MarketSummary, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type Story, type StoryCluster, VERSION, SentiSense as default };
|
|
737
|
+
export { type AISummary, APIError, AuthenticationError, type ChartData, type ChartDataPoint, type ClusterBuy, type CongressTrade, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetInsiderOptions, type GetInsightsOptions, type GetPoliticiansOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, 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 StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type Story, type StoryCluster, VERSION, SentiSense as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ interface SentiSenseOptions {
|
|
|
2
2
|
apiKey?: string;
|
|
3
3
|
baseUrl?: string;
|
|
4
4
|
timeout?: number;
|
|
5
|
+
maxRetries?: number;
|
|
5
6
|
}
|
|
6
7
|
interface StockPrice {
|
|
7
8
|
ticker: string;
|
|
@@ -270,6 +271,65 @@ interface GetInsiderOptions {
|
|
|
270
271
|
/** Number of days to look back (1–365). Defaults to 90. */
|
|
271
272
|
lookbackDays?: number;
|
|
272
273
|
}
|
|
274
|
+
/** A congressional STOCK Act trade disclosure. */
|
|
275
|
+
interface CongressTrade {
|
|
276
|
+
politicianName: string;
|
|
277
|
+
firstName: string;
|
|
278
|
+
lastName: string;
|
|
279
|
+
chamber: "SENATE" | "HOUSE";
|
|
280
|
+
party: string;
|
|
281
|
+
state: string;
|
|
282
|
+
bioguideId: string;
|
|
283
|
+
imageUrl: string | null;
|
|
284
|
+
ticker: string;
|
|
285
|
+
assetDescription: string;
|
|
286
|
+
assetType: "Stock" | "ETF";
|
|
287
|
+
transactionType: "PURCHASE" | "SALE" | "EXCHANGE" | "OTHER";
|
|
288
|
+
transactionDate: string;
|
|
289
|
+
disclosureDate: string;
|
|
290
|
+
disclosureDelayDays: number;
|
|
291
|
+
/** Raw STOCK Act range (e.g., "$1,001 - $15,000"). */
|
|
292
|
+
amountRange: string;
|
|
293
|
+
amountMin: number;
|
|
294
|
+
amountMax: number;
|
|
295
|
+
owner: "Self" | "Spouse" | "Child" | "Joint";
|
|
296
|
+
urlSlug: string;
|
|
297
|
+
sentiSenseScore: number | null;
|
|
298
|
+
}
|
|
299
|
+
/** Summary statistics for a tracked politician. */
|
|
300
|
+
interface PoliticianSummary {
|
|
301
|
+
urlSlug: string;
|
|
302
|
+
displayName: string;
|
|
303
|
+
firstName: string;
|
|
304
|
+
lastName: string;
|
|
305
|
+
chamber: "SENATE" | "HOUSE";
|
|
306
|
+
party: string;
|
|
307
|
+
state: string;
|
|
308
|
+
bioguideId: string;
|
|
309
|
+
imageUrl: string | null;
|
|
310
|
+
kbEntityId: string | null;
|
|
311
|
+
totalTrades: number;
|
|
312
|
+
purchaseCount: number;
|
|
313
|
+
saleCount: number;
|
|
314
|
+
latestTradeDate: string | null;
|
|
315
|
+
sentiSenseScore: number | null;
|
|
316
|
+
}
|
|
317
|
+
/** Detailed politician profile with recent trades and top tickers. */
|
|
318
|
+
interface PoliticianDetail {
|
|
319
|
+
profile: PoliticianSummary;
|
|
320
|
+
recentTrades: CongressTrade[];
|
|
321
|
+
topTickers: string[];
|
|
322
|
+
}
|
|
323
|
+
interface GetPoliticiansOptions {
|
|
324
|
+
/** Number of days to look back (1-365). Defaults to 90. */
|
|
325
|
+
lookbackDays?: number;
|
|
326
|
+
}
|
|
327
|
+
/** Generic preview wrapper used by PRO-gated endpoints. */
|
|
328
|
+
interface PreviewResponse<T> {
|
|
329
|
+
isPreview: boolean;
|
|
330
|
+
previewReason: "LOGIN_REQUIRED" | "PRO_REQUIRED" | null;
|
|
331
|
+
data: T;
|
|
332
|
+
}
|
|
273
333
|
/** Supported metric types for the v2 Serving Metrics API. */
|
|
274
334
|
type MetricType = "mentions" | "sentiment" | "sentisense_score" | "social_dominance" | "creators";
|
|
275
335
|
/** Options for `EntityMetrics.getMetrics()`. */
|
|
@@ -464,19 +524,49 @@ declare class Insider {
|
|
|
464
524
|
* PRO-gated. Free/unauthenticated users receive a preview (top 5 per direction)
|
|
465
525
|
* with `isPreview: true` in the response.
|
|
466
526
|
*/
|
|
467
|
-
getActivity(options?: GetInsiderOptions): Promise<InsiderActivityResponse
|
|
527
|
+
getActivity(options?: GetInsiderOptions): Promise<PreviewResponse<InsiderActivityResponse>>;
|
|
468
528
|
/**
|
|
469
529
|
* Get individual insider transactions for a specific stock.
|
|
470
530
|
*
|
|
471
531
|
* PRO-gated. Free users receive a preview of the top 5 transactions.
|
|
472
532
|
*/
|
|
473
|
-
getTrades(ticker: string, options?: GetInsiderOptions): Promise<InsiderTrade[]
|
|
533
|
+
getTrades(ticker: string, options?: GetInsiderOptions): Promise<PreviewResponse<InsiderTrade[]>>;
|
|
474
534
|
/**
|
|
475
535
|
* Get cluster buy signals: stocks where 3+ distinct insiders bought recently.
|
|
476
536
|
*
|
|
477
537
|
* PRO-gated. Free users receive a preview of the top 3 signals.
|
|
478
538
|
*/
|
|
479
|
-
getClusterBuys(options?: GetInsiderOptions): Promise<ClusterBuy[]
|
|
539
|
+
getClusterBuys(options?: GetInsiderOptions): Promise<PreviewResponse<ClusterBuy[]>>;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
declare class Politicians {
|
|
543
|
+
private client;
|
|
544
|
+
constructor(client: APIClient);
|
|
545
|
+
/**
|
|
546
|
+
* Get recent congressional STOCK Act trading activity across all politicians.
|
|
547
|
+
*
|
|
548
|
+
* PRO-gated. Free/unauthenticated users receive a preview (top 5 trades)
|
|
549
|
+
* with `isPreview: true` in the response.
|
|
550
|
+
*/
|
|
551
|
+
getActivity(options?: GetPoliticiansOptions): Promise<PreviewResponse<CongressTrade[]>>;
|
|
552
|
+
/**
|
|
553
|
+
* Get congressional trades for a specific stock.
|
|
554
|
+
*
|
|
555
|
+
* PRO-gated. Free users receive a preview of the top 3 trades.
|
|
556
|
+
*/
|
|
557
|
+
getFilings(ticker: string, options?: GetPoliticiansOptions): Promise<PreviewResponse<CongressTrade[]>>;
|
|
558
|
+
/**
|
|
559
|
+
* Get all tracked politicians with trading summary statistics.
|
|
560
|
+
*
|
|
561
|
+
* PRO-gated. Free users receive a preview of the top 5 members.
|
|
562
|
+
*/
|
|
563
|
+
getMembers(): Promise<PreviewResponse<PoliticianSummary[]>>;
|
|
564
|
+
/**
|
|
565
|
+
* Get detailed profile for a single politician: summary, recent trades, top tickers.
|
|
566
|
+
*
|
|
567
|
+
* PRO-gated. Free users receive a preview-wrapped response.
|
|
568
|
+
*/
|
|
569
|
+
getMember(slug: string): Promise<PreviewResponse<PoliticianDetail>>;
|
|
480
570
|
}
|
|
481
571
|
|
|
482
572
|
declare class Insights {
|
|
@@ -560,7 +650,7 @@ declare class Stocks {
|
|
|
560
650
|
/** Get real-time price for a single ticker. */
|
|
561
651
|
getPrice(ticker: string): Promise<StockPrice>;
|
|
562
652
|
/** Get real-time prices for multiple tickers. */
|
|
563
|
-
getPrices(tickers: string[]): Promise<
|
|
653
|
+
getPrices(tickers: string[]): Promise<StockPrice[]>;
|
|
564
654
|
/** Get batch company logo URLs. */
|
|
565
655
|
getImages(tickers: string[], options?: GetImagesOptions): Promise<Record<string, StockImage>>;
|
|
566
656
|
/** Get company profiles with branding, market cap, sector. */
|
|
@@ -605,10 +695,12 @@ declare class SentiSense implements APIClient {
|
|
|
605
695
|
private baseUrl;
|
|
606
696
|
private apiKey;
|
|
607
697
|
private timeout;
|
|
698
|
+
private maxRetries;
|
|
608
699
|
readonly stocks: Stocks;
|
|
609
700
|
readonly documents: Documents;
|
|
610
701
|
readonly institutional: Institutional;
|
|
611
702
|
readonly insider: Insider;
|
|
703
|
+
readonly politicians: Politicians;
|
|
612
704
|
readonly insights: Insights;
|
|
613
705
|
readonly entityMetrics: EntityMetrics;
|
|
614
706
|
readonly marketMood: MarketMoodResource;
|
|
@@ -633,12 +725,13 @@ declare class NotFoundError extends SentiSenseError {
|
|
|
633
725
|
constructor(message: string, code?: string);
|
|
634
726
|
}
|
|
635
727
|
declare class RateLimitError extends SentiSenseError {
|
|
636
|
-
|
|
728
|
+
retryAfter?: number;
|
|
729
|
+
constructor(message: string, code?: string, retryAfter?: number);
|
|
637
730
|
}
|
|
638
731
|
declare class APIError extends SentiSenseError {
|
|
639
732
|
constructor(message: string, status: number, code?: string);
|
|
640
733
|
}
|
|
641
734
|
|
|
642
|
-
declare const VERSION = "0.
|
|
735
|
+
declare const VERSION = "0.8.0";
|
|
643
736
|
|
|
644
|
-
export { type AISummary, APIError, AuthenticationError, type ChartData, type ChartDataPoint, type ClusterBuy, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetInsiderOptions, type GetInsightsOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type LockedInsight, type MarketMood, type MarketStatus, type MarketSummary, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type Story, type StoryCluster, VERSION, SentiSense as default };
|
|
737
|
+
export { type AISummary, APIError, AuthenticationError, type ChartData, type ChartDataPoint, type ClusterBuy, type CongressTrade, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetInsiderOptions, type GetInsightsOptions, type GetPoliticiansOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, 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 StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type Story, type StoryCluster, VERSION, SentiSense as default };
|
package/dist/index.mjs
CHANGED
|
@@ -20,9 +20,10 @@ var NotFoundError = class extends SentiSenseError {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
var RateLimitError = class extends SentiSenseError {
|
|
23
|
-
constructor(message, code) {
|
|
23
|
+
constructor(message, code, retryAfter) {
|
|
24
24
|
super(message, 429, code);
|
|
25
25
|
this.name = "RateLimitError";
|
|
26
|
+
this.retryAfter = retryAfter;
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
29
|
var APIError = class extends SentiSenseError {
|
|
@@ -212,6 +213,51 @@ var Insider = class {
|
|
|
212
213
|
}
|
|
213
214
|
};
|
|
214
215
|
|
|
216
|
+
// src/resources/politicians.ts
|
|
217
|
+
var Politicians = class {
|
|
218
|
+
constructor(client) {
|
|
219
|
+
this.client = client;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get recent congressional STOCK Act trading activity across all politicians.
|
|
223
|
+
*
|
|
224
|
+
* PRO-gated. Free/unauthenticated users receive a preview (top 5 trades)
|
|
225
|
+
* with `isPreview: true` in the response.
|
|
226
|
+
*/
|
|
227
|
+
async getActivity(options) {
|
|
228
|
+
return this.client.get("/api/v1/politicians/activity", options);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get congressional trades for a specific stock.
|
|
232
|
+
*
|
|
233
|
+
* PRO-gated. Free users receive a preview of the top 3 trades.
|
|
234
|
+
*/
|
|
235
|
+
async getFilings(ticker, options) {
|
|
236
|
+
return this.client.get(
|
|
237
|
+
`/api/v1/politicians/filings/${encodeURIComponent(ticker.toUpperCase())}`,
|
|
238
|
+
options
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get all tracked politicians with trading summary statistics.
|
|
243
|
+
*
|
|
244
|
+
* PRO-gated. Free users receive a preview of the top 5 members.
|
|
245
|
+
*/
|
|
246
|
+
async getMembers() {
|
|
247
|
+
return this.client.get("/api/v1/politicians/members");
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get detailed profile for a single politician: summary, recent trades, top tickers.
|
|
251
|
+
*
|
|
252
|
+
* PRO-gated. Free users receive a preview-wrapped response.
|
|
253
|
+
*/
|
|
254
|
+
async getMember(slug) {
|
|
255
|
+
return this.client.get(
|
|
256
|
+
`/api/v1/politicians/member/${encodeURIComponent(slug)}`
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
215
261
|
// src/resources/insights.ts
|
|
216
262
|
var Insights = class {
|
|
217
263
|
constructor(client) {
|
|
@@ -435,20 +481,28 @@ var Stocks = class {
|
|
|
435
481
|
};
|
|
436
482
|
|
|
437
483
|
// src/version.ts
|
|
438
|
-
var VERSION = "0.
|
|
484
|
+
var VERSION = "0.8.0";
|
|
439
485
|
|
|
440
486
|
// src/client.ts
|
|
441
487
|
var DEFAULT_BASE_URL = "https://app.sentisense.ai";
|
|
442
488
|
var DEFAULT_TIMEOUT = 3e4;
|
|
489
|
+
var DEFAULT_MAX_RETRIES = 3;
|
|
490
|
+
var BASE_DELAY_MS = 1e3;
|
|
491
|
+
var MAX_DELAY_MS = 6e4;
|
|
492
|
+
function sleep(ms) {
|
|
493
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
494
|
+
}
|
|
443
495
|
var SentiSense = class {
|
|
444
496
|
constructor(options = {}) {
|
|
445
497
|
this.apiKey = options.apiKey;
|
|
446
498
|
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
447
499
|
this.timeout = options.timeout ?? DEFAULT_TIMEOUT;
|
|
500
|
+
this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
448
501
|
this.stocks = new Stocks(this);
|
|
449
502
|
this.documents = new Documents(this);
|
|
450
503
|
this.institutional = new Institutional(this);
|
|
451
504
|
this.insider = new Insider(this);
|
|
505
|
+
this.politicians = new Politicians(this);
|
|
452
506
|
this.insights = new Insights(this);
|
|
453
507
|
this.entityMetrics = new EntityMetrics(this);
|
|
454
508
|
this.marketMood = new MarketMoodResource(this);
|
|
@@ -467,29 +521,51 @@ var SentiSense = class {
|
|
|
467
521
|
if (typeof process !== "undefined" && process.versions?.node) {
|
|
468
522
|
headers["User-Agent"] = `sentisense-node/${VERSION}`;
|
|
469
523
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
headers,
|
|
476
|
-
signal: controller.signal
|
|
477
|
-
});
|
|
478
|
-
if (!response.ok) {
|
|
479
|
-
await this.handleErrorResponse(response);
|
|
524
|
+
let delayMs = 0;
|
|
525
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
526
|
+
if (delayMs > 0) {
|
|
527
|
+
await sleep(delayMs);
|
|
528
|
+
delayMs = 0;
|
|
480
529
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
530
|
+
const controller = new AbortController();
|
|
531
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
532
|
+
try {
|
|
533
|
+
const response = await fetch(url, {
|
|
534
|
+
method: "GET",
|
|
535
|
+
headers,
|
|
536
|
+
signal: controller.signal
|
|
537
|
+
});
|
|
538
|
+
if (!response.ok) {
|
|
539
|
+
const isRetryable = response.status === 429 || response.status >= 500;
|
|
540
|
+
if (isRetryable && attempt < this.maxRetries) {
|
|
541
|
+
if (response.status === 429) {
|
|
542
|
+
const ra = response.headers.get("Retry-After");
|
|
543
|
+
delayMs = (ra ? parseInt(ra, 10) : 60) * 1e3;
|
|
544
|
+
} else {
|
|
545
|
+
delayMs = Math.min(BASE_DELAY_MS * Math.pow(2, attempt), MAX_DELAY_MS) + Math.random() * 1e3;
|
|
546
|
+
}
|
|
547
|
+
try {
|
|
548
|
+
await response.body?.cancel();
|
|
549
|
+
} catch {
|
|
550
|
+
}
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
await this.handleErrorResponse(response);
|
|
554
|
+
}
|
|
555
|
+
return await response.json();
|
|
556
|
+
} catch (error) {
|
|
557
|
+
if (error instanceof SentiSenseError) throw error;
|
|
558
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
559
|
+
throw new SentiSenseError(`Request timed out after ${this.timeout}ms`);
|
|
560
|
+
}
|
|
561
|
+
throw new SentiSenseError(
|
|
562
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
563
|
+
);
|
|
564
|
+
} finally {
|
|
565
|
+
clearTimeout(timer);
|
|
486
566
|
}
|
|
487
|
-
throw new SentiSenseError(
|
|
488
|
-
error instanceof Error ? error.message : "Unknown error"
|
|
489
|
-
);
|
|
490
|
-
} finally {
|
|
491
|
-
clearTimeout(timer);
|
|
492
567
|
}
|
|
568
|
+
throw new SentiSenseError("All retries exhausted");
|
|
493
569
|
}
|
|
494
570
|
buildUrl(path, params) {
|
|
495
571
|
const url = new URL(path, this.baseUrl);
|
|
@@ -516,8 +592,10 @@ var SentiSense = class {
|
|
|
516
592
|
throw new AuthenticationError(message, response.status, code);
|
|
517
593
|
case 404:
|
|
518
594
|
throw new NotFoundError(message, code);
|
|
519
|
-
case 429:
|
|
520
|
-
|
|
595
|
+
case 429: {
|
|
596
|
+
const ra = response.headers.get("Retry-After");
|
|
597
|
+
throw new RateLimitError(message, code, ra ? parseInt(ra, 10) : void 0);
|
|
598
|
+
}
|
|
521
599
|
default:
|
|
522
600
|
throw new APIError(message, response.status, code);
|
|
523
601
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/resources/documents.ts","../src/resources/entityMetrics.ts","../src/resources/insider.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 constructor(message: string, code?: string) {\n super(message, 429, code);\n this.name = \"RateLimitError\";\n }\n}\n\nexport class APIError extends SentiSenseError {\n constructor(message: string, status: number, code?: string) {\n super(message, status, code);\n this.name = \"APIError\";\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Document,\n DocumentSource,\n GetByEntityOptions,\n GetBySourceOptions,\n GetByTickerOptions,\n GetByTickerRangeOptions,\n GetStoriesByTickerOptions,\n GetStoriesOptions,\n SearchDocumentsOptions,\n Story,\n} from \"../types.js\";\n\nexport class Documents {\n constructor(private client: APIClient) {}\n\n /** Get document metrics for a stock. */\n async getByTicker(ticker: string, options?: GetByTickerOptions): Promise<Document[]> {\n return this.client.get(`/api/v1/documents/ticker/${encodeURIComponent(ticker)}`, options);\n }\n\n /** Get document metrics for a stock within a date range. */\n async getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/ticker/${encodeURIComponent(ticker)}/range`,\n options,\n );\n }\n\n /** Get document metrics for a KB entity. */\n async getByEntity(entityId: string, options?: GetByEntityOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/entity/${encodeURIComponent(entityId)}`,\n options,\n );\n }\n\n /** Smart search with natural language query parsing. */\n async search(query: string, options?: SearchDocumentsOptions): Promise<Document[]> {\n return this.client.get(\"/api/v1/documents/search\", { query, ...options });\n }\n\n /** Get latest document metrics from a source type. */\n async getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<Document[]> {\n return this.client.get(\n `/api/v1/documents/source/${encodeURIComponent(source)}`,\n options,\n );\n }\n\n /** Get AI-curated news story clusters. */\n async getStories(options?: GetStoriesOptions): Promise<Story[]> {\n return this.client.get(\"/api/v1/documents/stories\", options);\n }\n\n /** Get 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 {\n InsiderActivityResponse,\n InsiderTrade,\n ClusterBuy,\n GetInsiderOptions,\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<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<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<ClusterBuy[]> {\n return this.client.get(\"/api/v1/insider/cluster-buys\", options);\n }\n}\n","import type { APIClient } from \"../client.js\";\nimport type {\n Insight,\n InsightPreviewResponse,\n GetInsightsOptions,\n} from \"../types.js\";\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-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 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","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 FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n MarketStatus,\n MetricsBreakdown,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n} from \"../types.js\";\n\nexport class Stocks {\n constructor(private client: APIClient) {}\n\n /** List all available ticker symbols. */\n async list(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks\");\n }\n\n /** List all stocks with name, kbEntityId, urlSlug. */\n async listDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/detailed\");\n }\n\n /** Get popular ticker symbols. */\n async listPopular(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks/popular\");\n }\n\n /** Get popular stocks with details. */\n async listPopularDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/popular/detailed\");\n }\n\n /** Get real-time price for a single ticker. */\n async getPrice(ticker: string): Promise<StockPrice> {\n return this.client.get(\"/api/v1/stocks/price\", { ticker });\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<Record<string, StockPrice>> {\n return this.client.get(\"/api/v1/stocks/prices\", {\n tickers: tickers.join(\",\"),\n });\n }\n\n /** Get batch company logo URLs. */\n async getImages(\n tickers: string[],\n options?: GetImagesOptions,\n ): Promise<Record<string, StockImage>> {\n return this.client.get(\"/api/v1/stocks/images\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get company profiles with branding, market cap, sector. */\n async getDescriptions(\n tickers: string[],\n options?: GetDescriptionsOptions,\n ): Promise<Record<string, StockProfile>> {\n return this.client.get(\"/api/v1/stocks/descriptions\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get peer/similar stocks. */\n async getSimilar(ticker: string, options?: GetSimilarOptions): Promise<StockDetail[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/similar`, options);\n }\n\n /** Get company profile (CEO, sector, industry, market data). */\n async getProfile(ticker: string, options?: GetProfileOptions): Promise<StockProfile> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/profile`, options);\n }\n\n /** Get related KB entities (people, products, partners). */\n async getEntities(ticker: string): Promise<StockEntity[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/entities`);\n }\n\n /** Get AI-generated stock analysis report. Requires PRO tier. */\n async getAISummary(ticker: string, options?: GetAISummaryOptions): Promise<AISummary> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/ai-summary`, options);\n }\n\n /** Get sentiment/mention metrics breakdown by entity. */\n async getMetricsBreakdown(\n ticker: string,\n metricType: string,\n options?: GetMetricsBreakdownOptions,\n ): Promise<MetricsBreakdown> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker)}/metrics/${encodeURIComponent(metricType)}/breakdown`,\n options,\n );\n }\n\n /** Get historical OHLCV chart data. */\n async getChart(ticker: string, options?: GetChartOptions): Promise<ChartData> {\n return this.client.get(\"/api/v1/stocks/chart\", { ticker, ...options });\n }\n\n /** Get current market open/closed/pre-market/after-hours status. */\n async getMarketStatus(): Promise<MarketStatus> {\n return this.client.get(\"/api/v1/stocks/market-status\");\n }\n\n /** Get financial statement data. */\n async getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals\", { ticker, ...options });\n }\n\n /** Get available fiscal periods. */\n async getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]> {\n return this.client.get(\"/api/v1/stocks/fundamentals/periods\", { ticker });\n }\n\n /** Get most recent fundamentals snapshot. */\n async getCurrentFundamentals(ticker: string): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals/current\", { ticker });\n }\n\n /** Get historical P/E, P/B, P/S ratios. */\n async getHistoricalRatios(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/ratios\", { ticker });\n }\n\n /** Get historical revenue data. */\n async getHistoricalRevenue(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/revenue\", { ticker });\n }\n\n /** Get short interest metrics (FINRA). */\n async getShortInterest(ticker: string): Promise<ShortInterest> {\n return this.client.get(\"/api/v1/stocks/short-interest\", { ticker });\n }\n\n /** Get float information. */\n async getFloat(ticker: string): Promise<FloatInfo> {\n return this.client.get(\"/api/v1/stocks/float\", { ticker });\n }\n\n /** Get short volume trading data. */\n async getShortVolume(ticker: string): Promise<ShortVolume> {\n return this.client.get(\"/api/v1/stocks/short-volume\", { ticker });\n }\n}\n","export const VERSION = \"0.7.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { Insider } from \"./resources/insider.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;\n\n/** @internal HTTP interface exposed to resource classes. */\nexport interface APIClient {\n get<T = unknown>(path: string, params?: object): Promise<T>;\n}\n\nexport class SentiSense implements APIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeout: number;\n\n readonly stocks: Stocks;\n readonly documents: Documents;\n readonly institutional: Institutional;\n readonly insider: Insider;\n readonly insights: Insights;\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\n this.stocks = new Stocks(this);\n this.documents = new Documents(this);\n this.institutional = new Institutional(this);\n this.insider = new Insider(this);\n this.insights = new Insights(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 const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n const response = await fetch(url, {\n method: \"GET\",\n headers,\n signal: controller.signal,\n });\n\n if (!response.ok) {\n await this.handleErrorResponse(response);\n }\n\n return (await response.json()) as T;\n } catch (error) {\n if (error instanceof SentiSenseError) throw error;\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new SentiSenseError(`Request timed out after ${this.timeout}ms`);\n }\n throw new SentiSenseError(\n error instanceof Error ? error.message : \"Unknown error\",\n );\n } finally {\n clearTimeout(timer);\n }\n }\n\n private buildUrl(path: string, params?: object): string {\n const url = new URL(path, this.baseUrl);\n if (params) {\n for (const [key, value] of Object.entries(params as Record<string, unknown>)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n return url.toString();\n }\n\n private async handleErrorResponse(response: Response): Promise<never> {\n let body: { error?: string; message?: string } = {};\n try {\n body = await response.json();\n } catch {\n // Response may not be JSON\n }\n\n const message = body.message ?? response.statusText ?? \"API request failed\";\n const code = body.error;\n\n switch (response.status) {\n case 401:\n case 403:\n throw new AuthenticationError(message, response.status, code);\n case 404:\n throw new NotFoundError(message, code);\n case 429:\n throw new RateLimitError(message, code);\n default:\n throw new APIError(message, response.status, code);\n }\n }\n}\n"],"mappings":";AAAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EAIzC,YAAY,SAAiB,QAAiB,MAAe;AAC3D,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,sBAAN,cAAkC,gBAAgB;AAAA,EACvD,YAAY,SAAiB,QAAgB,MAAe;AAC1D,UAAM,SAAS,QAAQ,IAAI;AAC3B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAAN,cAA4B,gBAAgB;AAAA,EACjD,YAAY,SAAiB,MAAe;AAC1C,UAAM,SAAS,KAAK,IAAI;AACxB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,iBAAN,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AO,QAAQ,MAAiC,GAAG;AAC5E,YAAI,UAAU,UAAa,UAAU,MAAM;AACzC,cAAI,aAAa,IAAI,KAAK,OAAO,KAAK,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AACA,WAAO,IAAI,SAAS;AAAA,EACtB;AAAA,EAEA,MAAc,oBAAoB,UAAoC;AACpE,QAAI,OAA6C,CAAC;AAClD,QAAI;AACF,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B,QAAQ;AAAA,IAER;AAEA,UAAM,UAAU,KAAK,WAAW,SAAS,cAAc;AACvD,UAAM,OAAO,KAAK;AAElB,YAAQ,SAAS,QAAQ;AAAA,MACvB,KAAK;AAAA,MACL,KAAK;AACH,cAAM,IAAI,oBAAoB,SAAS,SAAS,QAAQ,IAAI;AAAA,MAC9D,KAAK;AACH,cAAM,IAAI,cAAc,SAAS,IAAI;AAAA,MACvC,KAAK;AACH,cAAM,IAAI,eAAe,SAAS,IAAI;AAAA,MACxC;AACE,cAAM,IAAI,SAAS,SAAS,SAAS,QAAQ,IAAI;AAAA,IACrD;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/resources/documents.ts","../src/resources/entityMetrics.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 {\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 {\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 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-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 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","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 FloatInfo,\n Fundamentals,\n FundamentalsPeriod,\n GetAISummaryOptions,\n GetChartOptions,\n GetDescriptionsOptions,\n GetFundamentalsOptions,\n GetImagesOptions,\n GetMetricsBreakdownOptions,\n GetProfileOptions,\n GetSimilarOptions,\n MarketStatus,\n MetricsBreakdown,\n ShortInterest,\n ShortVolume,\n StockDetail,\n StockEntity,\n StockImage,\n StockPrice,\n StockProfile,\n} from \"../types.js\";\n\nexport class Stocks {\n constructor(private client: APIClient) {}\n\n /** List all available ticker symbols. */\n async list(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks\");\n }\n\n /** List all stocks with name, kbEntityId, urlSlug. */\n async listDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/detailed\");\n }\n\n /** Get popular ticker symbols. */\n async listPopular(): Promise<string[]> {\n return this.client.get(\"/api/v1/stocks/popular\");\n }\n\n /** Get popular stocks with details. */\n async listPopularDetailed(): Promise<StockDetail[]> {\n return this.client.get(\"/api/v1/stocks/popular/detailed\");\n }\n\n /** Get real-time price for a single ticker. */\n async getPrice(ticker: string): Promise<StockPrice> {\n return this.client.get(\"/api/v1/stocks/price\", { ticker });\n }\n\n /** Get real-time prices for multiple tickers. */\n async getPrices(tickers: string[]): Promise<StockPrice[]> {\n return this.client.get(\"/api/v1/stocks/prices\", {\n tickers: tickers.join(\",\"),\n });\n }\n\n /** Get batch company logo URLs. */\n async getImages(\n tickers: string[],\n options?: GetImagesOptions,\n ): Promise<Record<string, StockImage>> {\n return this.client.get(\"/api/v1/stocks/images\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get company profiles with branding, market cap, sector. */\n async getDescriptions(\n tickers: string[],\n options?: GetDescriptionsOptions,\n ): Promise<Record<string, StockProfile>> {\n return this.client.get(\"/api/v1/stocks/descriptions\", {\n tickers: tickers.join(\",\"),\n ...options,\n });\n }\n\n /** Get peer/similar stocks. */\n async getSimilar(ticker: string, options?: GetSimilarOptions): Promise<StockDetail[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/similar`, options);\n }\n\n /** Get company profile (CEO, sector, industry, market data). */\n async getProfile(ticker: string, options?: GetProfileOptions): Promise<StockProfile> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/profile`, options);\n }\n\n /** Get related KB entities (people, products, partners). */\n async getEntities(ticker: string): Promise<StockEntity[]> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/entities`);\n }\n\n /** Get AI-generated stock analysis report. Requires PRO tier. */\n async getAISummary(ticker: string, options?: GetAISummaryOptions): Promise<AISummary> {\n return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/ai-summary`, options);\n }\n\n /** Get sentiment/mention metrics breakdown by entity. */\n async getMetricsBreakdown(\n ticker: string,\n metricType: string,\n options?: GetMetricsBreakdownOptions,\n ): Promise<MetricsBreakdown> {\n return this.client.get(\n `/api/v1/stocks/${encodeURIComponent(ticker)}/metrics/${encodeURIComponent(metricType)}/breakdown`,\n options,\n );\n }\n\n /** Get historical OHLCV chart data. */\n async getChart(ticker: string, options?: GetChartOptions): Promise<ChartData> {\n return this.client.get(\"/api/v1/stocks/chart\", { ticker, ...options });\n }\n\n /** Get current market open/closed/pre-market/after-hours status. */\n async getMarketStatus(): Promise<MarketStatus> {\n return this.client.get(\"/api/v1/stocks/market-status\");\n }\n\n /** Get financial statement data. */\n async getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals\", { ticker, ...options });\n }\n\n /** Get available fiscal periods. */\n async getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]> {\n return this.client.get(\"/api/v1/stocks/fundamentals/periods\", { ticker });\n }\n\n /** Get most recent fundamentals snapshot. */\n async getCurrentFundamentals(ticker: string): Promise<Fundamentals> {\n return this.client.get(\"/api/v1/stocks/fundamentals/current\", { ticker });\n }\n\n /** Get historical P/E, P/B, P/S ratios. */\n async getHistoricalRatios(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/ratios\", { ticker });\n }\n\n /** Get historical revenue data. */\n async getHistoricalRevenue(ticker: string): Promise<unknown> {\n return this.client.get(\"/api/v1/stocks/fundamentals/historical/revenue\", { ticker });\n }\n\n /** Get short interest metrics (FINRA). */\n async getShortInterest(ticker: string): Promise<ShortInterest> {\n return this.client.get(\"/api/v1/stocks/short-interest\", { ticker });\n }\n\n /** Get float information. */\n async getFloat(ticker: string): Promise<FloatInfo> {\n return this.client.get(\"/api/v1/stocks/float\", { ticker });\n }\n\n /** Get short volume trading data. */\n async getShortVolume(ticker: string): Promise<ShortVolume> {\n return this.client.get(\"/api/v1/stocks/short-volume\", { ticker });\n }\n}\n","export const VERSION = \"0.8.0\";\n","import {\n APIError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n SentiSenseError,\n} from \"./errors.js\";\nimport { Documents } from \"./resources/documents.js\";\nimport { EntityMetrics } from \"./resources/entityMetrics.js\";\nimport { 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}\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 institutional: Institutional;\n readonly insider: Insider;\n readonly politicians: Politicians;\n readonly insights: Insights;\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.institutional = new Institutional(this);\n this.insider = new Insider(this);\n this.politicians = new Politicians(this);\n this.insights = new Insights(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 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;AA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