@piaa/sdk 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -6
- package/dist/client.d.ts +10 -1
- package/dist/config.d.ts +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/http/transport.d.ts +0 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +72 -9
- package/dist/logger.d.ts +0 -1
- package/dist/realtime/events.d.ts +0 -1
- package/dist/realtime/socket.d.ts +0 -1
- package/dist/resources/economic.d.ts +17 -0
- package/dist/resources/fixed-income.d.ts +17 -0
- package/dist/resources/market.d.ts +8 -1
- package/dist/resources/news.d.ts +9 -2
- package/dist/resources/social.d.ts +4 -1
- package/dist/resources/ws.d.ts +0 -1
- package/dist/types.d.ts +37 -1
- package/package.json +5 -5
- package/dist/client.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/http/transport.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -20
- package/dist/logger.d.ts.map +0 -1
- package/dist/realtime/events.d.ts.map +0 -1
- package/dist/realtime/socket.d.ts.map +0 -1
- package/dist/resources/market.d.ts.map +0 -1
- package/dist/resources/news.d.ts.map +0 -1
- package/dist/resources/social.d.ts.map +0 -1
- package/dist/resources/ws.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -8,12 +8,11 @@ Designed for institutional algorithmic traders, fintech dashboards, and quantita
|
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- 📊 **Rate Limit Telemetry**: Real-time inspection of RFC 6585 and daily quota headers (`X-RateLimit-*`, `X-DailyQuota-*`).
|
|
11
|
+
- **Zero-Fuss Sensible Defaults**: Connect in 3 lines of code with pre-configured endpoints and sensible timeout/retry defaults.
|
|
12
|
+
- **Typed Error Hierarchy**: Clear, actionable, strongly-typed errors (`AuthenticationError`, `RateLimitError`, `TimeoutError`, `ValidationError`, `NetworkError`).
|
|
13
|
+
- **Zero Sensitive Data Leaks**: Automatic redaction of API keys, bearer tokens, and secrets from error logs and stack traces.
|
|
14
|
+
- **Cross-Platform Realtime Streaming**: Built-in resilient WebSocket client with **In-Band Message Authentication**, ping/pong keep-alives, and automatic re-subscription on reconnect.
|
|
15
|
+
- **Rate Limit Telemetry**: Real-time inspection of RFC 6585 and daily quota headers (`X-RateLimit-*`, `X-DailyQuota-*`).
|
|
17
16
|
|
|
18
17
|
---
|
|
19
18
|
|
package/dist/client.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ import { RealtimeClient } from "./realtime/socket";
|
|
|
6
6
|
import { MarketResource } from "./resources/market";
|
|
7
7
|
import { NewsResource } from "./resources/news";
|
|
8
8
|
import { SocialResource } from "./resources/social";
|
|
9
|
+
import { EconomicResource } from "./resources/economic";
|
|
10
|
+
import { FixedIncomeResource } from "./resources/fixed-income";
|
|
9
11
|
import { WsResource } from "./resources/ws";
|
|
10
12
|
import type { RateLimitInfo } from "./types";
|
|
11
13
|
export declare class PiaClient {
|
|
@@ -23,6 +25,14 @@ export declare class PiaClient {
|
|
|
23
25
|
* Financial news resource.
|
|
24
26
|
*/
|
|
25
27
|
readonly news: NewsResource;
|
|
28
|
+
/**
|
|
29
|
+
* Macroeconomic calendar and indicators resource.
|
|
30
|
+
*/
|
|
31
|
+
readonly economic: EconomicResource;
|
|
32
|
+
/**
|
|
33
|
+
* Sovereign bond yields and fixed income rates resource.
|
|
34
|
+
*/
|
|
35
|
+
readonly fixedIncome: FixedIncomeResource;
|
|
26
36
|
/**
|
|
27
37
|
* WebSocket ticket issuance resource.
|
|
28
38
|
*/
|
|
@@ -48,4 +58,3 @@ export declare class PiaClient {
|
|
|
48
58
|
*/
|
|
49
59
|
getRateLimitInfo(): RateLimitInfo;
|
|
50
60
|
}
|
|
51
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/config.d.ts
CHANGED
package/dist/errors.d.ts
CHANGED
package/dist/http/transport.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export { PiaClient } from "./client";
|
|
|
6
6
|
export { type PiaClientOptions, type ResolvedPiaConfig, resolveConfig, DEFAULT_BASE_URL, DEFAULT_WS_URL, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_RETRIES, } from "./config";
|
|
7
7
|
export { PiaError, type PiaErrorDetails, ConfigurationError, ValidationError, AuthenticationError, PermissionError, RateLimitError, TimeoutError, NetworkError, ParseError, ApiError, } from "./errors";
|
|
8
8
|
export { type PiaLogger, type LogLevel, DefaultLogger, redactSensitive, } from "./logger";
|
|
9
|
-
export { type Timeframe, type RateLimitInfo, type RequestOptions, type MarketPrice, type MarketPricesResponse, type Candle, type CandleResponse, type GetCandlesOptions, type OrderBook, type OrderBookLevel, type SocialPost, type SocialFeedResponse, type GetSocialOptions, type NewsArticle, type NewsFeedResponse, type GetNewsOptions, type WsTicketResponse, } from "./types";
|
|
9
|
+
export { type Timeframe, type RateLimitInfo, type RequestOptions, type MarketPrice, type MarketPricesResponse, type Candle, type CandleResponse, type GetCandlesOptions, type OrderBook, type OrderBookLevel, type SocialPost, type SocialFeedResponse, type GetSocialOptions, type NewsArticle, type NewsFeedResponse, type GetNewsOptions, type EconomicEvent, type EconomicCalendarResponse, type GetCalendarOptions, type YieldCurvePoint, type YieldCurveResponse, type MarketInsight, type WsTicketResponse, } from "./types";
|
|
10
10
|
export { RealtimeClient, type SocketState } from "./realtime/socket";
|
|
11
11
|
export { type RealtimeEvents } from "./realtime/events";
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -253,7 +253,7 @@ function resolveConfig(options = {}) {
|
|
|
253
253
|
|
|
254
254
|
// src/http/transport.ts
|
|
255
255
|
var RETRYABLE_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504]);
|
|
256
|
-
var SDK_VERSION = "1.0.
|
|
256
|
+
var SDK_VERSION = "1.0.2";
|
|
257
257
|
|
|
258
258
|
class HttpTransport {
|
|
259
259
|
config;
|
|
@@ -707,15 +707,22 @@ class MarketResource {
|
|
|
707
707
|
const cleanSymbol = symbol.trim().toUpperCase();
|
|
708
708
|
const params = new URLSearchParams;
|
|
709
709
|
if (options?.timeframe)
|
|
710
|
-
params.set("
|
|
710
|
+
params.set("resolution", options.timeframe);
|
|
711
711
|
if (options?.limit)
|
|
712
712
|
params.set("limit", String(options.limit));
|
|
713
713
|
if (options?.since)
|
|
714
714
|
params.set("since", String(options.since));
|
|
715
715
|
if (options?.until)
|
|
716
|
-
params.set("
|
|
716
|
+
params.set("before", String(options.until));
|
|
717
717
|
const query = params.toString() ? `?${params.toString()}` : "";
|
|
718
|
-
|
|
718
|
+
const raw = await this.transport.request(`/api/v1/market/history/${encodeURIComponent(cleanSymbol)}${query}`, "GET", undefined, options);
|
|
719
|
+
const candleList = raw?.candles || raw?.items || [];
|
|
720
|
+
return {
|
|
721
|
+
symbol: cleanSymbol,
|
|
722
|
+
timeframe: options?.timeframe || "1m",
|
|
723
|
+
count: candleList.length,
|
|
724
|
+
candles: candleList
|
|
725
|
+
};
|
|
719
726
|
}
|
|
720
727
|
async getOrderBook(symbol, options) {
|
|
721
728
|
if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
|
|
@@ -724,6 +731,16 @@ class MarketResource {
|
|
|
724
731
|
const cleanSymbol = symbol.trim().toUpperCase();
|
|
725
732
|
return this.transport.request(`/api/v1/market/orderbook/${encodeURIComponent(cleanSymbol)}`, "GET", undefined, options);
|
|
726
733
|
}
|
|
734
|
+
async getInsights(symbol, options) {
|
|
735
|
+
if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
|
|
736
|
+
throw new ValidationError("Symbol must be a non-empty string.", "symbol");
|
|
737
|
+
}
|
|
738
|
+
const cleanSymbol = symbol.trim().toUpperCase();
|
|
739
|
+
return this.transport.request(`/api/v1/market/insights/${encodeURIComponent(cleanSymbol)}`, "GET", undefined, options);
|
|
740
|
+
}
|
|
741
|
+
async getWhy(symbol, options) {
|
|
742
|
+
return this.getInsights(symbol, options);
|
|
743
|
+
}
|
|
727
744
|
}
|
|
728
745
|
|
|
729
746
|
// src/resources/news.ts
|
|
@@ -737,11 +754,19 @@ class NewsResource {
|
|
|
737
754
|
if (options?.symbols && options.symbols.length > 0) {
|
|
738
755
|
params.set("symbols", options.symbols.map((s) => s.trim().toUpperCase()).join(","));
|
|
739
756
|
}
|
|
757
|
+
if (options?.category)
|
|
758
|
+
params.set("category", options.category);
|
|
740
759
|
if (options?.limit)
|
|
741
760
|
params.set("limit", String(options.limit));
|
|
742
761
|
const query = params.toString() ? `?${params.toString()}` : "";
|
|
743
762
|
return this.transport.request(`/api/v1/news${query}`, "GET", undefined, options);
|
|
744
763
|
}
|
|
764
|
+
async getLatest(options) {
|
|
765
|
+
return this.transport.request("/api/v1/news/latest", "GET", undefined, options);
|
|
766
|
+
}
|
|
767
|
+
async getById(id, options) {
|
|
768
|
+
return this.transport.request(`/api/v1/news/${encodeURIComponent(id)}`, "GET", undefined, options);
|
|
769
|
+
}
|
|
745
770
|
}
|
|
746
771
|
|
|
747
772
|
// src/resources/social.ts
|
|
@@ -750,7 +775,7 @@ class SocialResource {
|
|
|
750
775
|
constructor(transport) {
|
|
751
776
|
this.transport = transport;
|
|
752
777
|
}
|
|
753
|
-
async
|
|
778
|
+
async getFeed(options) {
|
|
754
779
|
const params = new URLSearchParams;
|
|
755
780
|
if (options?.symbol)
|
|
756
781
|
params.set("symbol", options.symbol.trim().toUpperCase());
|
|
@@ -759,7 +784,44 @@ class SocialResource {
|
|
|
759
784
|
if (options?.cursor)
|
|
760
785
|
params.set("cursor", options.cursor);
|
|
761
786
|
const query = params.toString() ? `?${params.toString()}` : "";
|
|
762
|
-
return this.transport.request(`/api/v1/social/
|
|
787
|
+
return this.transport.request(`/api/v1/social/feed${query}`, "GET", undefined, options);
|
|
788
|
+
}
|
|
789
|
+
async getPosts(options) {
|
|
790
|
+
return this.getFeed(options);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
// src/resources/economic.ts
|
|
795
|
+
class EconomicResource {
|
|
796
|
+
transport;
|
|
797
|
+
constructor(transport) {
|
|
798
|
+
this.transport = transport;
|
|
799
|
+
}
|
|
800
|
+
async getCalendar(options) {
|
|
801
|
+
const params = new URLSearchParams;
|
|
802
|
+
if (options?.impact)
|
|
803
|
+
params.set("impact", options.impact);
|
|
804
|
+
if (options?.limit)
|
|
805
|
+
params.set("limit", String(options.limit));
|
|
806
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
807
|
+
return this.transport.request(`/api/v1/economic/calendar${query}`, "GET", undefined, options);
|
|
808
|
+
}
|
|
809
|
+
async getIndicators(options) {
|
|
810
|
+
return this.transport.request("/api/v1/economic/indicators", "GET", undefined, options);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// src/resources/fixed-income.ts
|
|
815
|
+
class FixedIncomeResource {
|
|
816
|
+
transport;
|
|
817
|
+
constructor(transport) {
|
|
818
|
+
this.transport = transport;
|
|
819
|
+
}
|
|
820
|
+
async getYieldCurve(options) {
|
|
821
|
+
return this.transport.request("/api/v1/fixed-income/yield-curve", "GET", undefined, options);
|
|
822
|
+
}
|
|
823
|
+
async getSpreads(options) {
|
|
824
|
+
return this.transport.request("/api/v1/fixed-income/spreads", "GET", undefined, options);
|
|
763
825
|
}
|
|
764
826
|
}
|
|
765
827
|
|
|
@@ -781,6 +843,8 @@ class PiaClient {
|
|
|
781
843
|
market;
|
|
782
844
|
social;
|
|
783
845
|
news;
|
|
846
|
+
economic;
|
|
847
|
+
fixedIncome;
|
|
784
848
|
ws;
|
|
785
849
|
realtime;
|
|
786
850
|
constructor(options = {}) {
|
|
@@ -789,6 +853,8 @@ class PiaClient {
|
|
|
789
853
|
this.market = new MarketResource(this.transport);
|
|
790
854
|
this.social = new SocialResource(this.transport);
|
|
791
855
|
this.news = new NewsResource(this.transport);
|
|
856
|
+
this.economic = new EconomicResource(this.transport);
|
|
857
|
+
this.fixedIncome = new FixedIncomeResource(this.transport);
|
|
792
858
|
this.ws = new WsResource(this.transport);
|
|
793
859
|
this.realtime = new RealtimeClient(this.config);
|
|
794
860
|
}
|
|
@@ -817,6 +883,3 @@ export {
|
|
|
817
883
|
redactSensitive,
|
|
818
884
|
resolveConfig
|
|
819
885
|
};
|
|
820
|
-
|
|
821
|
-
//# debugId=9179749A09C27B0264756E2164756E21
|
|
822
|
-
//# sourceMappingURL=index.js.map
|
package/dist/logger.d.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official PIA SDK - Economic Intelligence API Resource
|
|
3
|
+
*/
|
|
4
|
+
import type { HttpTransport } from "../http/transport";
|
|
5
|
+
import type { EconomicCalendarResponse, GetCalendarOptions, RequestOptions } from "../types";
|
|
6
|
+
export declare class EconomicResource {
|
|
7
|
+
private readonly transport;
|
|
8
|
+
constructor(transport: HttpTransport);
|
|
9
|
+
/**
|
|
10
|
+
* Fetches global macroeconomic calendar events (NFP, CPI, interest rates, GDP).
|
|
11
|
+
*/
|
|
12
|
+
getCalendar(options?: GetCalendarOptions): Promise<EconomicCalendarResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves macroeconomic indicators and series metadata.
|
|
15
|
+
*/
|
|
16
|
+
getIndicators(options?: RequestOptions): Promise<any>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official PIA SDK - Fixed Income & Sovereign Rates API Resource
|
|
3
|
+
*/
|
|
4
|
+
import type { HttpTransport } from "../http/transport";
|
|
5
|
+
import type { RequestOptions, YieldCurveResponse } from "../types";
|
|
6
|
+
export declare class FixedIncomeResource {
|
|
7
|
+
private readonly transport;
|
|
8
|
+
constructor(transport: HttpTransport);
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves US Treasury sovereign bond yield curve structure across all standard tenors.
|
|
11
|
+
*/
|
|
12
|
+
getYieldCurve(options?: RequestOptions): Promise<YieldCurveResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves sovereign yield spreads (2Y-10Y, 3M-10Y curve steepness indicators).
|
|
15
|
+
*/
|
|
16
|
+
getSpreads(options?: RequestOptions): Promise<any>;
|
|
17
|
+
}
|
|
@@ -21,5 +21,12 @@ export declare class MarketResource {
|
|
|
21
21
|
* Retrieves Level 2 DOM (Depth of Market) order book for a symbol.
|
|
22
22
|
*/
|
|
23
23
|
getOrderBook(symbol: string, options?: RequestOptions): Promise<OrderBook>;
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves AI/Quant market insights and price movement narrative for a given instrument.
|
|
26
|
+
*/
|
|
27
|
+
getInsights(symbol: string, options?: RequestOptions): Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use `getInsights(symbol)` instead.
|
|
30
|
+
*/
|
|
31
|
+
getWhy(symbol: string, options?: RequestOptions): Promise<any>;
|
|
24
32
|
}
|
|
25
|
-
//# sourceMappingURL=market.d.ts.map
|
package/dist/resources/news.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Official PIA SDK - News Intelligence API Resource
|
|
3
3
|
*/
|
|
4
4
|
import type { HttpTransport } from "../http/transport";
|
|
5
|
-
import type { GetNewsOptions, NewsFeedResponse } from "../types";
|
|
5
|
+
import type { GetNewsOptions, NewsFeedResponse, RequestOptions } from "../types";
|
|
6
6
|
export declare class NewsResource {
|
|
7
7
|
private readonly transport;
|
|
8
8
|
constructor(transport: HttpTransport);
|
|
@@ -10,5 +10,12 @@ export declare class NewsResource {
|
|
|
10
10
|
* Fetches curated financial and macro news articles.
|
|
11
11
|
*/
|
|
12
12
|
getNews(options?: GetNewsOptions): Promise<NewsFeedResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Fetches the latest breaking financial news bulletin.
|
|
15
|
+
*/
|
|
16
|
+
getLatest(options?: RequestOptions): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Fetches detailed intelligence for a specific news article ID.
|
|
19
|
+
*/
|
|
20
|
+
getById(id: string, options?: RequestOptions): Promise<any>;
|
|
13
21
|
}
|
|
14
|
-
//# sourceMappingURL=news.d.ts.map
|
|
@@ -9,6 +9,9 @@ export declare class SocialResource {
|
|
|
9
9
|
/**
|
|
10
10
|
* Fetches the latest social sentiment posts and discussions.
|
|
11
11
|
*/
|
|
12
|
+
getFeed(options?: GetSocialOptions): Promise<SocialFeedResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use `getFeed(options)` instead.
|
|
15
|
+
*/
|
|
12
16
|
getPosts(options?: GetSocialOptions): Promise<SocialFeedResponse>;
|
|
13
17
|
}
|
|
14
|
-
//# sourceMappingURL=social.d.ts.map
|
package/dist/resources/ws.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -98,11 +98,47 @@ export interface NewsFeedResponse {
|
|
|
98
98
|
}
|
|
99
99
|
export interface GetNewsOptions extends RequestOptions {
|
|
100
100
|
symbols?: string[];
|
|
101
|
+
category?: "forex" | "stock" | "all" | string;
|
|
101
102
|
limit?: number;
|
|
102
103
|
}
|
|
104
|
+
export interface EconomicEvent {
|
|
105
|
+
id?: string;
|
|
106
|
+
event: string;
|
|
107
|
+
country: string;
|
|
108
|
+
currency?: string;
|
|
109
|
+
date: string;
|
|
110
|
+
time?: string;
|
|
111
|
+
actual?: number | null;
|
|
112
|
+
forecast?: number | null;
|
|
113
|
+
previous?: number | null;
|
|
114
|
+
impact?: "high" | "medium" | "low" | string;
|
|
115
|
+
}
|
|
116
|
+
export interface EconomicCalendarResponse {
|
|
117
|
+
total: number;
|
|
118
|
+
items: EconomicEvent[];
|
|
119
|
+
}
|
|
120
|
+
export interface GetCalendarOptions extends RequestOptions {
|
|
121
|
+
impact?: string;
|
|
122
|
+
limit?: number;
|
|
123
|
+
}
|
|
124
|
+
export interface YieldCurvePoint {
|
|
125
|
+
tenor: string;
|
|
126
|
+
yield: number;
|
|
127
|
+
date?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface YieldCurveResponse {
|
|
130
|
+
date: string;
|
|
131
|
+
points: YieldCurvePoint[];
|
|
132
|
+
}
|
|
133
|
+
export interface MarketInsight {
|
|
134
|
+
symbol: string;
|
|
135
|
+
title: string;
|
|
136
|
+
summary: string;
|
|
137
|
+
sentiment?: string;
|
|
138
|
+
confidence?: number;
|
|
139
|
+
}
|
|
103
140
|
export interface WsTicketResponse {
|
|
104
141
|
ticket: string;
|
|
105
142
|
expires_in?: number;
|
|
106
143
|
ws_url?: string;
|
|
107
144
|
}
|
|
108
|
-
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piaa/sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Official TypeScript/JavaScript SDK for PIA Market Intelligence Platform",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/wignn/
|
|
26
|
-
"directory": "
|
|
25
|
+
"url": "https://github.com/wignn/pia-sdk.git",
|
|
26
|
+
"directory": "typescript"
|
|
27
27
|
},
|
|
28
28
|
"bugs": {
|
|
29
|
-
"url": "https://github.com/wignn/
|
|
29
|
+
"url": "https://github.com/wignn/pia-sdk/issues"
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://pia.wign.dev/portal/docs",
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "bun build src/index.ts --outdir ./dist --format esm
|
|
33
|
+
"build": "bun build src/index.ts --outdir ./dist --format esm && bun x tsc -p tsconfig.json --emitDeclarationOnly",
|
|
34
34
|
"test": "bun test",
|
|
35
35
|
"prepublishOnly": "bun run build && bun test"
|
|
36
36
|
},
|
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAiB,MAAM,UAAU,CAAC;AAExF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,qBAAa,SAAS;IACpB,SAAgB,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACpD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAE1C;;OAEG;IACH,SAAgB,MAAM,EAAE,cAAc,CAAC;IAEvC;;OAEG;IACH,SAAgB,MAAM,EAAE,cAAc,CAAC;IAEvC;;OAEG;IACH,SAAgB,IAAI,EAAE,YAAY,CAAC;IAEnC;;OAEG;IACH,SAAgB,EAAE,EAAE,UAAU,CAAC;IAE/B;;OAEG;IACH,SAAgB,QAAQ,EAAE,cAAc,CAAC;IAEzC;;;;;;;;;;OAUG;IACH,YAAY,OAAO,GAAE,gBAAqB,EASzC;IAED;;OAEG;IACI,gBAAgB,IAAI,aAAa,CAEvC;CACF"}
|
package/dist/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAi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AAO,CAAC,KAAK;CAGd"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,QAAQ,EACR,KAAK,eAAe,EACpB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,QAAQ,GACT,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,aAAa,EACb,eAAe,GAChB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js.map
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/errors.ts", "../src/logger.ts", "../src/config.ts", "../src/http/transport.ts", "../src/realtime/events.ts", "../src/realtime/socket.ts", "../src/resources/market.ts", "../src/resources/news.ts", "../src/resources/social.ts", "../src/resources/ws.ts", "../src/client.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Official PIA SDK - Strongly Typed Error Hierarchy\n */\n\nexport interface PiaErrorDetails {\n statusCode?: number;\n endpoint?: string;\n method?: string;\n requestId?: string | null;\n headers?: Record<string, string>;\n rawResponse?: unknown;\n}\n\n/**\n * Base class for all errors thrown by the PIA SDK.\n */\nexport class PiaError extends Error {\n public readonly isPiaError = true;\n public readonly statusCode?: number;\n public readonly endpoint?: string;\n public readonly method?: string;\n public readonly requestId?: string | null;\n\n constructor(message: string, details?: PiaErrorDetails) {\n super(message);\n this.name = \"PiaError\";\n this.statusCode = details?.statusCode;\n this.endpoint = details?.endpoint;\n this.method = details?.method;\n this.requestId = details?.requestId;\n\n // Restore prototype chain for instanceof checks\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * Thrown when client configuration is invalid (e.g. missing API key, invalid URL).\n */\nexport class ConfigurationError extends PiaError {\n constructor(message: string) {\n super(message);\n this.name = \"ConfigurationError\";\n }\n}\n\n/**\n * Thrown when caller passes invalid arguments (e.g. empty symbol, negative limit).\n */\nexport class ValidationError extends PiaError {\n public readonly paramName?: string;\n\n constructor(message: string, paramName?: string) {\n super(message);\n this.name = \"ValidationError\";\n this.paramName = paramName;\n }\n}\n\n/**\n * Thrown on HTTP 401 Unauthorized (invalid or revoked API key).\n * Redacts any sensitive data.\n */\nexport class AuthenticationError extends PiaError {\n constructor(message = \"Authentication failed. Verify that your API key is valid and active.\", details?: PiaErrorDetails) {\n super(message, details);\n this.name = \"AuthenticationError\";\n }\n}\n\n/**\n * Thrown on HTTP 403 Forbidden (missing required scope/permissions, e.g. 'realtime:ws').\n */\nexport class PermissionError extends PiaError {\n public readonly requiredScope?: string;\n\n constructor(message: string, requiredScope?: string, details?: PiaErrorDetails) {\n super(message, details);\n this.name = \"PermissionError\";\n this.requiredScope = requiredScope;\n }\n}\n\n/**\n * Thrown on HTTP 429 Too Many Requests (rate limit or daily quota exceeded).\n */\nexport class RateLimitError extends PiaError {\n public readonly retryAfterSeconds?: number;\n public readonly dailyLimit?: number;\n public readonly dailyRemaining?: number;\n public readonly minuteLimit?: number;\n public readonly minuteRemaining?: number;\n\n constructor(\n message: string,\n options?: {\n retryAfterSeconds?: number;\n dailyLimit?: number;\n dailyRemaining?: number;\n minuteLimit?: number;\n minuteRemaining?: number;\n details?: PiaErrorDetails;\n }\n ) {\n super(message, options?.details);\n this.name = \"RateLimitError\";\n this.retryAfterSeconds = options?.retryAfterSeconds;\n this.dailyLimit = options?.dailyLimit;\n this.dailyRemaining = options?.dailyRemaining;\n this.minuteLimit = options?.minuteLimit;\n this.minuteRemaining = options?.minuteRemaining;\n }\n}\n\n/**\n * Thrown when a request or operation exceeds the configured timeout threshold.\n */\nexport class TimeoutError extends PiaError {\n public readonly timeoutMs: number;\n\n constructor(message: string, timeoutMs: number, details?: PiaErrorDetails) {\n super(message, details);\n this.name = \"TimeoutError\";\n this.timeoutMs = timeoutMs;\n }\n}\n\n/**\n * Thrown when network transport fails (DNS resolution, connection refused, connection reset).\n */\nexport class NetworkError extends PiaError {\n public readonly causeError?: unknown;\n\n constructor(message: string, cause?: unknown, details?: PiaErrorDetails) {\n super(message, details);\n this.name = \"NetworkError\";\n this.causeError = cause;\n }\n}\n\n/**\n * Thrown when response parsing fails (malformed JSON or unexpected response body).\n */\nexport class ParseError extends PiaError {\n public readonly rawText?: string;\n\n constructor(message: string, rawText?: string, details?: PiaErrorDetails) {\n super(message, details);\n this.name = \"ParseError\";\n this.rawText = rawText;\n }\n}\n\n/**\n * Thrown on generic unexpected API responses (4xx, 5xx).\n */\nexport class ApiError extends PiaError {\n public readonly rawBody?: unknown;\n\n constructor(message: string, statusCode: number, rawBody?: unknown, details?: PiaErrorDetails) {\n super(message, { ...details, statusCode });\n this.name = \"ApiError\";\n this.rawBody = rawBody;\n }\n}\n",
|
|
6
|
-
"/**\n * Official PIA SDK - Secure Logger & Sensitive Data Redaction\n */\n\nexport type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\" | \"silent\";\n\nexport interface PiaLogger {\n debug(message: string, ...args: unknown[]): void;\n info(message: string, ...args: unknown[]): void;\n warn(message: string, ...args: unknown[]): void;\n error(message: string, ...args: unknown[]): void;\n}\n\nconst SENSITIVE_KEY_PATTERNS = [\n /wi_live_[a-zA-Z0-9_-]{10,}/g,\n /Bearer\\s+[a-zA-Z0-9._-]+/gi,\n /api[_-]?key[\"':\\s]+[\"']?([a-zA-Z0-9_-]+)[\"']?/gi,\n /password[\"':\\s]+[\"']?([^\"'\\s]+)[\"']?/gi,\n];\n\n/**\n * Redacts known sensitive patterns (API keys, bearer tokens) from strings.\n */\nexport function redactSensitive(input: string): string {\n let redacted = input;\n for (const pattern of SENSITIVE_KEY_PATTERNS) {\n redacted = redacted.replace(pattern, (match) => {\n if (match.startsWith(\"wi_live_\")) {\n return `wi_live_***${match.slice(-4)}`;\n }\n if (match.toLowerCase().startsWith(\"bearer \")) {\n return \"Bearer [REDACTED]\";\n }\n return \"[REDACTED]\";\n });\n }\n return redacted;\n}\n\nconst LOG_LEVELS: Record<LogLevel, number> = {\n debug: 10,\n info: 20,\n warn: 30,\n error: 40,\n silent: 50,\n};\n\nexport class DefaultLogger implements PiaLogger {\n private readonly levelNum: number;\n private readonly prefix = \"[PIA-SDK]\";\n\n constructor(level: LogLevel = \"warn\") {\n this.levelNum = LOG_LEVELS[level] ?? LOG_LEVELS.warn;\n }\n\n private safeFormat(msg: string, args: unknown[]): [string, ...unknown[]] {\n const cleanMsg = `${this.prefix} ${redactSensitive(msg)}`;\n const cleanArgs = args.map((arg) => {\n if (typeof arg === \"string\") return redactSensitive(arg);\n if (typeof arg === \"object\" && arg !== null) {\n try {\n return JSON.parse(redactSensitive(JSON.stringify(arg)));\n } catch {\n return \"[Unserializable Object]\";\n }\n }\n return arg;\n });\n return [cleanMsg, ...cleanArgs];\n }\n\n debug(message: string, ...args: unknown[]): void {\n if (this.levelNum <= LOG_LEVELS.debug) {\n const [msg, ...cleanArgs] = this.safeFormat(message, args);\n console.debug(msg, ...cleanArgs);\n }\n }\n\n info(message: string, ...args: unknown[]): void {\n if (this.levelNum <= LOG_LEVELS.info) {\n const [msg, ...cleanArgs] = this.safeFormat(message, args);\n console.info(msg, ...cleanArgs);\n }\n }\n\n warn(message: string, ...args: unknown[]): void {\n if (this.levelNum <= LOG_LEVELS.warn) {\n const [msg, ...cleanArgs] = this.safeFormat(message, args);\n console.warn(msg, ...cleanArgs);\n }\n }\n\n error(message: string, ...args: unknown[]): void {\n if (this.levelNum <= LOG_LEVELS.error) {\n const [msg, ...cleanArgs] = this.safeFormat(message, args);\n console.error(msg, ...cleanArgs);\n }\n }\n}\n",
|
|
7
|
-
"/**\n * Official PIA SDK - Configuration & Validation\n */\n\nimport { ConfigurationError } from \"./errors\";\nimport { DefaultLogger, type LogLevel, type PiaLogger } from \"./logger\";\n\nexport interface PiaClientOptions {\n /**\n * Secret or live API Key (e.g. \"wi_live_...\").\n * If omitted, the SDK attempts to read from process.env.PIA_API_KEY or ATSLD_API_KEY.\n */\n apiKey?: string;\n\n /**\n * Base URL for the unified REST gateway.\n * Default: \"https://api-engine.wign.dev\"\n */\n baseUrl?: string;\n\n /**\n * WebSocket URL for realtime streaming.\n * Default: \"wss://api-engine.wign.dev/api/v1/ws\"\n */\n wsUrl?: string;\n\n /**\n * Global HTTP request timeout in milliseconds.\n * Default: 15_000 (15s)\n */\n timeoutMs?: number;\n\n /**\n * Maximum number of retry attempts for transient failures (408, 429, 5xx).\n * Default: 3\n */\n maxRetries?: number;\n\n /**\n * Base initial delay for exponential backoff in milliseconds.\n * Default: 500\n */\n retryDelayMs?: number;\n\n /**\n * Maximum cap on retry backoff delay in milliseconds.\n * Default: 10_000 (10s)\n */\n maxRetryDelayMs?: number;\n\n /**\n * Custom HTTP headers injected into all requests.\n */\n headers?: Record<string, string>;\n\n /**\n * Custom fetch implementation (useful for tests or runtime environments).\n */\n fetch?: typeof fetch;\n\n /**\n * Custom WebSocket implementation (e.g. 'ws' in Node.js).\n */\n WebSocket?: unknown;\n\n /**\n * Custom logger instance.\n */\n logger?: PiaLogger;\n\n /**\n * Logging level when using the default logger.\n * Default: \"warn\" (or \"debug\" if debug: true)\n */\n logLevel?: LogLevel;\n\n /**\n * Enable verbose debug logs.\n * Default: false\n */\n debug?: boolean;\n}\n\nexport interface ResolvedPiaConfig {\n apiKey: string;\n baseUrl: string;\n wsUrl: string;\n timeoutMs: number;\n maxRetries: number;\n retryDelayMs: number;\n maxRetryDelayMs: number;\n headers: Record<string, string>;\n fetch: typeof fetch;\n WebSocket?: unknown;\n logger: PiaLogger;\n debug: boolean;\n}\n\nexport const DEFAULT_BASE_URL = \"https://api-engine.wign.dev\";\nexport const DEFAULT_WS_URL = \"wss://api-engine.wign.dev/api/v1/ws\";\nexport const DEFAULT_TIMEOUT_MS = 15_000;\nexport const DEFAULT_MAX_RETRIES = 3;\nexport const DEFAULT_RETRY_DELAY_MS = 500;\nexport const DEFAULT_MAX_RETRY_DELAY_MS = 10_000;\n\nfunction resolveEnvApiKey(): string | undefined {\n if (typeof process !== \"undefined\" && process?.env) {\n return (\n process.env.PIA_API_KEY ||\n process.env.ATSLD_API_KEY ||\n process.env.CORE_API_KEY ||\n process.env.NEXT_PUBLIC_API_KEY\n );\n }\n return undefined;\n}\n\n/**\n * Validates and resolves full client configuration with sensible defaults.\n */\nexport function resolveConfig(options: PiaClientOptions = {}): ResolvedPiaConfig {\n const apiKey = options.apiKey?.trim() || resolveEnvApiKey()?.trim();\n\n if (!apiKey) {\n throw new ConfigurationError(\n \"API key is required. Pass { apiKey: '...' } to PiaClient or set the PIA_API_KEY environment variable.\"\n );\n }\n\n const rawBaseUrl = options.baseUrl?.trim() || DEFAULT_BASE_URL;\n const baseUrl = rawBaseUrl.replace(/\\/+$/, \"\");\n\n try {\n const parsed = new URL(baseUrl);\n if (![\"http:\", \"https:\"].includes(parsed.protocol)) {\n throw new Error(\"Protocol must be http or https\");\n }\n } catch (err) {\n throw new ConfigurationError(\n `Invalid baseUrl '${baseUrl}': ${err instanceof Error ? err.message : String(err)}`\n );\n }\n\n const rawWsUrl = options.wsUrl?.trim() || DEFAULT_WS_URL;\n const wsUrl = rawWsUrl.replace(/\\/+$/, \"\");\n\n try {\n const parsedWs = new URL(wsUrl);\n if (![\"ws:\", \"wss:\"].includes(parsedWs.protocol)) {\n throw new Error(\"Protocol must be ws or wss\");\n }\n } catch (err) {\n throw new ConfigurationError(\n `Invalid wsUrl '${wsUrl}': ${err instanceof Error ? err.message : String(err)}`\n );\n }\n\n const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n if (timeoutMs < 100) {\n throw new ConfigurationError(\"timeoutMs must be at least 100 milliseconds.\");\n }\n\n const maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;\n if (maxRetries < 0) {\n throw new ConfigurationError(\"maxRetries cannot be negative.\");\n }\n\n const retryDelayMs = options.retryDelayMs ?? DEFAULT_RETRY_DELAY_MS;\n const maxRetryDelayMs = options.maxRetryDelayMs ?? DEFAULT_MAX_RETRY_DELAY_MS;\n\n const debug = options.debug ?? false;\n const logLevel: LogLevel = options.logLevel ?? (debug ? \"debug\" : \"warn\");\n const logger = options.logger ?? new DefaultLogger(logLevel);\n\n const resolvedFetch =\n options.fetch ||\n (typeof globalThis !== \"undefined\" && typeof globalThis.fetch === \"function\"\n ? globalThis.fetch.bind(globalThis)\n : undefined);\n\n if (!resolvedFetch) {\n throw new ConfigurationError(\n \"A valid fetch implementation was not found in the runtime. Pass a custom fetch to PiaClientOptions.\"\n );\n }\n\n // Resolve native or custom WebSocket\n const resolvedWebSocket =\n options.WebSocket ||\n (typeof globalThis !== \"undefined\" && (globalThis as any).WebSocket\n ? (globalThis as any).WebSocket\n : undefined);\n\n return {\n apiKey,\n baseUrl,\n wsUrl,\n timeoutMs,\n maxRetries,\n retryDelayMs,\n maxRetryDelayMs,\n headers: { ...(options.headers || {}) },\n fetch: resolvedFetch,\n WebSocket: resolvedWebSocket,\n logger,\n debug,\n };\n}\n",
|
|
8
|
-
"/**\n * Official PIA SDK - Resilient HTTP Transport with Exponential Backoff & Telemetry\n */\n\nimport type { ResolvedPiaConfig } from \"../config\";\nimport {\n ApiError,\n AuthenticationError,\n NetworkError,\n ParseError,\n PermissionError,\n RateLimitError,\n TimeoutError,\n} from \"../errors\";\nimport type { RateLimitInfo, RequestOptions } from \"../types\";\n\nconst RETRYABLE_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504]);\nconst SDK_VERSION = \"1.0.1\";\n\nexport class HttpTransport {\n private lastRateLimitInfo: RateLimitInfo = {};\n\n constructor(private readonly config: ResolvedPiaConfig) {}\n\n /**\n * Returns the most recent rate limit headers telemetry recorded by the SDK.\n */\n public getRateLimitInfo(): RateLimitInfo {\n return { ...this.lastRateLimitInfo };\n }\n\n /**\n * Executes an HTTP request with automatic retry, jittered backoff, and timeout.\n */\n public async request<T>(\n endpoint: string,\n method: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" = \"GET\",\n body?: unknown,\n options?: RequestOptions\n ): Promise<T> {\n const url = `${this.config.baseUrl}${endpoint.startsWith(\"/\") ? \"\" : \"/\"}${endpoint}`;\n const maxRetries = options?.maxRetries ?? this.config.maxRetries;\n const timeoutMs = options?.timeoutMs ?? this.config.timeoutMs;\n\n let attempt = 0;\n\n while (true) {\n attempt++;\n this.config.logger.debug(\n `HTTP ${method} ${endpoint} (Attempt ${attempt}/${maxRetries + 1})`\n );\n\n const controller = new AbortController();\n let isTimedOut = false;\n\n const timer = setTimeout(() => {\n isTimedOut = true;\n controller.abort();\n }, timeoutMs);\n\n // Chain caller's abort signal if provided\n if (options?.signal) {\n if (options.signal.aborted) {\n clearTimeout(timer);\n throw options.signal.reason;\n }\n options.signal.addEventListener(\n \"abort\",\n () => {\n clearTimeout(timer);\n controller.abort(options.signal?.reason);\n },\n { once: true }\n );\n }\n\n try {\n const headers: Record<string, string> = {\n \"x-api-key\": this.config.apiKey,\n Accept: \"application/json\",\n \"User-Agent\": `pia-sdk-ts/${SDK_VERSION}`,\n ...this.config.headers,\n ...(options?.headers || {}),\n };\n\n let serializedBody: string | undefined;\n if (body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n serializedBody = JSON.stringify(body);\n }\n\n const response = await this.config.fetch(url, {\n method,\n headers,\n body: serializedBody,\n signal: controller.signal,\n });\n\n clearTimeout(timer);\n\n // Extract rate limit and quota headers\n this.parseTelemetryHeaders(response.headers);\n\n if (response.ok) {\n return await this.parseResponseBody<T>(response, endpoint, method);\n }\n\n // Handle error responses\n const status = response.status;\n const errorText = await response.text().catch(() => \"\");\n let errorJson: any = null;\n try {\n if (errorText) errorJson = JSON.parse(errorText);\n } catch {\n // Ignored if not JSON\n }\n\n const errorMessage =\n errorJson?.message ||\n errorJson?.error ||\n (errorText ? errorText.slice(0, 200) : `HTTP ${status}`);\n\n const isRetryable = RETRYABLE_STATUS_CODES.has(status) && attempt <= maxRetries;\n\n if (isRetryable) {\n const delay = this.calculateBackoffDelay(attempt, response.headers);\n this.config.logger.warn(\n `Request to ${endpoint} failed with HTTP ${status}. Retrying in ${delay}ms...`\n );\n await this.sleep(delay);\n continue;\n }\n\n // Map non-retryable or exhausted errors\n this.handleHttpError(status, errorMessage, endpoint, method, response.headers, errorJson);\n } catch (err: unknown) {\n clearTimeout(timer);\n\n if (isTimedOut) {\n throw new TimeoutError(\n `Request to ${endpoint} exceeded timeout of ${timeoutMs}ms.`,\n timeoutMs,\n { endpoint, method }\n );\n }\n\n // If caller explicitly aborted\n if (options?.signal?.aborted) {\n throw options.signal.reason;\n }\n\n // If it's already a typed PiaError, rethrow\n if (err instanceof Error && \"isPiaError\" in err) {\n throw err;\n }\n\n // Check if transient network failure is retryable\n if (attempt <= maxRetries) {\n const delay = this.calculateBackoffDelay(attempt);\n this.config.logger.warn(\n `Network error calling ${endpoint}: ${err instanceof Error ? err.message : String(err)}. Retrying in ${delay}ms...`\n );\n await this.sleep(delay);\n continue;\n }\n\n throw new NetworkError(\n `Network transport failed connecting to ${endpoint}: ${err instanceof Error ? err.message : String(err)}`,\n err,\n { endpoint, method }\n );\n }\n }\n }\n\n private parseTelemetryHeaders(headers: Headers): void {\n const parseNum = (name: string): number | undefined => {\n const val = headers.get(name);\n if (!val) return undefined;\n const num = parseInt(val, 10);\n return Number.isFinite(num) ? num : undefined;\n };\n\n this.lastRateLimitInfo = {\n limit: parseNum(\"x-ratelimit-limit\"),\n remaining: parseNum(\"x-ratelimit-remaining\"),\n resetSeconds: parseNum(\"x-ratelimit-reset\"),\n dailyLimit: parseNum(\"x-dailyquota-limit\"),\n dailyRemaining: parseNum(\"x-dailyquota-remaining\"),\n };\n }\n\n private calculateBackoffDelay(attempt: number, headers?: Headers): number {\n // Respect Retry-After header if provided\n const retryAfter = headers?.get(\"retry-after\");\n if (retryAfter) {\n const parsedSeconds = parseInt(retryAfter, 10);\n if (Number.isFinite(parsedSeconds) && parsedSeconds > 0) {\n return Math.min(parsedSeconds * 1000, this.config.maxRetryDelayMs);\n }\n }\n\n // Exponential backoff with Full Jitter\n const base = this.config.retryDelayMs * Math.pow(2, attempt - 1);\n const capped = Math.min(base, this.config.maxRetryDelayMs);\n const jitter = 0.5 + Math.random() * 0.5;\n return Math.round(capped * jitter);\n }\n\n private async parseResponseBody<T>(\n response: Response,\n endpoint: string,\n method: string\n ): Promise<T> {\n const text = await response.text();\n if (!text || text.trim() === \"\") {\n return {} as T;\n }\n\n try {\n return JSON.parse(text) as T;\n } catch (err) {\n throw new ParseError(\n `Failed to parse JSON response from ${endpoint}: ${err instanceof Error ? err.message : String(err)}`,\n text.slice(0, 500),\n { statusCode: response.status, endpoint, method }\n );\n }\n }\n\n private handleHttpError(\n status: number,\n message: string,\n endpoint: string,\n method: string,\n headers: Headers,\n body: unknown\n ): never {\n const details = {\n statusCode: status,\n endpoint,\n method,\n requestId: headers.get(\"x-request-id\") || headers.get(\"cf-ray\"),\n rawResponse: body,\n };\n\n if (status === 401) {\n throw new AuthenticationError(message, details);\n }\n\n if (status === 403) {\n throw new PermissionError(message, undefined, details);\n }\n\n if (status === 429) {\n const retryAfter = headers.get(\"retry-after\");\n const retryAfterSeconds = retryAfter ? parseInt(retryAfter, 10) : undefined;\n throw new RateLimitError(message, {\n retryAfterSeconds: Number.isFinite(retryAfterSeconds) ? retryAfterSeconds : undefined,\n dailyLimit: this.lastRateLimitInfo.dailyLimit,\n dailyRemaining: this.lastRateLimitInfo.dailyRemaining,\n minuteLimit: this.lastRateLimitInfo.limit,\n minuteRemaining: this.lastRateLimitInfo.remaining,\n details,\n });\n }\n\n throw new ApiError(message, status, body, details);\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n",
|
|
9
|
-
"/**\n * Official PIA SDK - Typed Event Emitter for Realtime Streaming\n */\n\nimport type { MarketPrice } from \"../types\";\n\nexport interface RealtimeEvents {\n connect: () => void;\n authenticated: (data: { user_id?: string; plan?: string; ws_connections_max?: number }) => void;\n disconnect: (reason: { code: number; reason: string; wasClean: boolean }) => void;\n error: (error: Error) => void;\n tick: (tick: MarketPrice) => void;\n snapshot: (snapshot: { total: number; items: MarketPrice[] }) => void;\n raw: (data: unknown) => void;\n}\n\nexport type EventKey = keyof RealtimeEvents;\nexport type Listener<K extends EventKey> = RealtimeEvents[K];\n\nexport class TypedEventEmitter {\n private readonly listeners: Map<EventKey, Set<Function>> = new Map();\n\n public on<K extends EventKey>(event: K, listener: Listener<K>): this {\n if (!this.listeners.has(event)) {\n this.listeners.set(event, new Set());\n }\n this.listeners.get(event)!.add(listener);\n return this;\n }\n\n public off<K extends EventKey>(event: K, listener: Listener<K>): this {\n const set = this.listeners.get(event);\n if (set) {\n set.delete(listener);\n if (set.size === 0) {\n this.listeners.delete(event);\n }\n }\n return this;\n }\n\n public emit<K extends EventKey>(event: K, ...args: Parameters<RealtimeEvents[K]>): boolean {\n const set = this.listeners.get(event);\n if (!set || set.size === 0) return false;\n\n for (const listener of Array.from(set)) {\n try {\n (listener as any)(...args);\n } catch (err) {\n console.error(`[PIA-SDK] Unhandled error in '${event}' listener:`, err);\n }\n }\n return true;\n }\n\n public removeAllListeners(event?: EventKey): this {\n if (event) {\n this.listeners.delete(event);\n } else {\n this.listeners.clear();\n }\n return this;\n }\n}\n",
|
|
10
|
-
"/**\n * Official PIA SDK - Resilient Realtime WebSocket Client with In-Band Auth & Auto-Reconnect\n */\n\nimport type { ResolvedPiaConfig } from \"../config\";\nimport { AuthenticationError, ConfigurationError, NetworkError } from \"../errors\";\nimport { TypedEventEmitter } from \"./events\";\n\nexport type SocketState =\n | \"DISCONNECTED\"\n | \"CONNECTING\"\n | \"AUTHENTICATING\"\n | \"AUTHENTICATED\"\n | \"CLOSING\";\n\nexport class RealtimeClient extends TypedEventEmitter {\n private ws: any = null;\n private state: SocketState = \"DISCONNECTED\";\n private readonly subscribedSymbols: Set<string> = new Set();\n private reconnectAttempt = 0;\n private reconnectTimer: any = null;\n private isExplicitlyClosed = false;\n private pingIntervalTimer: any = null;\n\n constructor(private readonly config: ResolvedPiaConfig) {\n super();\n }\n\n /**\n * Returns current socket state.\n */\n public getState(): SocketState {\n return this.state;\n }\n\n /**\n * Connects to the Realtime WebSocket stream and performs In-Band Authentication.\n */\n public connect(): this {\n if (this.state === \"CONNECTING\" || this.state === \"AUTHENTICATING\" || this.state === \"AUTHENTICATED\") {\n this.config.logger.debug(\"Socket already active or connecting.\");\n return this;\n }\n\n this.isExplicitlyClosed = false;\n this.initiateConnection();\n return this;\n }\n\n private initiateConnection(): void {\n const WsConstructor: any =\n this.config.WebSocket ||\n (typeof globalThis !== \"undefined\" && (globalThis as any).WebSocket);\n\n if (!WsConstructor) {\n throw new ConfigurationError(\n \"WebSocket implementation not available. In Node.js environments, pass { WebSocket: require('ws') } in options.\"\n );\n }\n\n this.state = \"CONNECTING\";\n this.config.logger.info(`Connecting to Realtime WebSocket: ${this.config.wsUrl}`);\n\n try {\n this.ws = new WsConstructor(this.config.wsUrl);\n } catch (err) {\n this.handleSocketFailure(err);\n return;\n }\n\n this.ws.onopen = () => {\n this.config.logger.info(\"WebSocket TCP connection opened. Initiating In-Band Auth...\");\n this.state = \"AUTHENTICATING\";\n this.reconnectAttempt = 0;\n this.emit(\"connect\");\n\n // Send In-Band Auth frame immediately\n this.sendRaw({\n action: \"auth\",\n api_key: this.config.apiKey,\n });\n\n this.startHeartbeat();\n };\n\n this.ws.onmessage = (event: any) => {\n this.handleIncomingMessage(event.data);\n };\n\n this.ws.onerror = (event: any) => {\n const err = new NetworkError(\n \"WebSocket connection error\",\n event?.message || event?.error || event\n );\n this.config.logger.error(\"WebSocket error:\", err.message);\n this.emit(\"error\", err);\n };\n\n this.ws.onclose = (event: any) => {\n const code = event?.code ?? 1006;\n const reason = event?.reason ?? \"\";\n const wasClean = event?.wasClean ?? false;\n\n this.stopHeartbeat();\n this.state = \"DISCONNECTED\";\n this.ws = null;\n\n this.config.logger.warn(`WebSocket closed: code=${code}, reason=${reason}`);\n this.emit(\"disconnect\", { code, reason, wasClean });\n\n // Code 4001: Unauthorized (Bad API key or rejected) - do not reconnect loop\n if (code === 4001 || reason.toLowerCase().includes(\"unauthorized\")) {\n this.emit(\n \"error\",\n new AuthenticationError(\"WebSocket authentication rejected by server.\")\n );\n return;\n }\n\n if (!this.isExplicitlyClosed) {\n this.scheduleReconnect();\n }\n };\n }\n\n private handleIncomingMessage(rawPayload: any): void {\n let messageText: string;\n if (typeof rawPayload === \"string\") {\n messageText = rawPayload;\n } else if (rawPayload instanceof ArrayBuffer || (typeof Buffer !== \"undefined\" && Buffer && Buffer.isBuffer(rawPayload))) {\n messageText = new TextDecoder().decode(rawPayload);\n } else {\n messageText = String(rawPayload);\n }\n\n let payload: any;\n try {\n payload = JSON.parse(messageText);\n } catch {\n this.emit(\"raw\", messageText);\n return;\n }\n\n this.emit(\"raw\", payload);\n\n // 1. Auth confirmation\n if (payload.event === \"authenticated\") {\n this.state = \"AUTHENTICATED\";\n this.config.logger.info(\"WebSocket authenticated successfully.\");\n this.emit(\"authenticated\", payload.data || {});\n\n // Resubscribe to tracked symbols\n if (this.subscribedSymbols.size > 0) {\n this.flushSubscriptions();\n }\n return;\n }\n\n // 2. Market price tick\n if (payload.event === \"market.trade\" || payload.event === \"market.tick\") {\n const tick = payload.data?.tick || payload.data;\n if (tick) {\n this.emit(\"tick\", tick);\n }\n return;\n }\n\n // 3. Initial market snapshot\n if (payload.event === \"market.snapshot\" && payload.data) {\n this.emit(\"snapshot\", payload.data);\n return;\n }\n\n // 4. Server error frame\n if (payload.error) {\n if (payload.error === \"unauthorized\" || payload.error === 401) {\n this.emit(\n \"error\",\n new AuthenticationError(payload.message || \"Unauthorized WebSocket message.\")\n );\n } else {\n this.emit(\n \"error\",\n new NetworkError(payload.message || `Server reported error: ${payload.error}`)\n );\n }\n }\n }\n\n /**\n * Subscribes to realtime updates for one or more symbols.\n */\n public subscribe(symbols: string | string[]): this {\n const list = Array.isArray(symbols) ? symbols : [symbols];\n const newSymbols: string[] = [];\n\n for (const sym of list) {\n const clean = sym.trim().toUpperCase();\n if (clean && !this.subscribedSymbols.has(clean)) {\n this.subscribedSymbols.add(clean);\n newSymbols.push(clean);\n }\n }\n\n if (newSymbols.length > 0 && this.state === \"AUTHENTICATED\") {\n this.sendRaw({\n action: \"subscribe\",\n symbols: newSymbols,\n });\n }\n\n return this;\n }\n\n /**\n * Unsubscribes from realtime updates for one or more symbols.\n */\n public unsubscribe(symbols: string | string[]): this {\n const list = Array.isArray(symbols) ? symbols : [symbols];\n const removed: string[] = [];\n\n for (const sym of list) {\n const clean = sym.trim().toUpperCase();\n if (this.subscribedSymbols.delete(clean)) {\n removed.push(clean);\n }\n }\n\n if (removed.length > 0 && this.state === \"AUTHENTICATED\") {\n this.sendRaw({\n action: \"unsubscribe\",\n symbols: removed,\n });\n }\n\n return this;\n }\n\n private flushSubscriptions(): void {\n if (this.subscribedSymbols.size === 0) return;\n this.sendRaw({\n action: \"subscribe\",\n symbols: Array.from(this.subscribedSymbols),\n });\n }\n\n private sendRaw(data: unknown): boolean {\n if (!this.ws || this.ws.readyState !== 1 /* OPEN */) {\n return false;\n }\n try {\n this.ws.send(JSON.stringify(data));\n return true;\n } catch (err) {\n this.config.logger.error(\"Failed to send WebSocket message:\", err);\n return false;\n }\n }\n\n private scheduleReconnect(): void {\n this.reconnectAttempt++;\n // Exponential backoff: 1s, 2s, 4s, 8s, capped at 15s with jitter\n const delay = Math.min(1000 * Math.pow(1.5, this.reconnectAttempt - 1), 15000);\n const jitteredDelay = Math.round(delay * (0.8 + Math.random() * 0.4));\n\n this.config.logger.info(\n `Reconnecting in ${jitteredDelay}ms (Attempt ${this.reconnectAttempt})...`\n );\n\n clearTimeout(this.reconnectTimer);\n this.reconnectTimer = setTimeout(() => {\n if (!this.isExplicitlyClosed) {\n this.initiateConnection();\n }\n }, jitteredDelay);\n }\n\n private handleSocketFailure(err: unknown): void {\n this.state = \"DISCONNECTED\";\n this.ws = null;\n const netErr = new NetworkError(\"Failed to initiate WebSocket connection\", err);\n this.emit(\"error\", netErr);\n if (!this.isExplicitlyClosed) {\n this.scheduleReconnect();\n }\n }\n\n private startHeartbeat(): void {\n this.stopHeartbeat();\n // Ping every 30 seconds\n this.pingIntervalTimer = setInterval(() => {\n if (this.state === \"AUTHENTICATED\") {\n this.sendRaw({ action: \"ping\" });\n }\n }, 30_000);\n }\n\n private stopHeartbeat(): void {\n if (this.pingIntervalTimer) {\n clearInterval(this.pingIntervalTimer);\n this.pingIntervalTimer = null;\n }\n }\n\n /**\n * Explicitly closes the WebSocket connection and prevents auto-reconnection.\n */\n public disconnect(): void {\n this.isExplicitlyClosed = true;\n this.stopHeartbeat();\n clearTimeout(this.reconnectTimer);\n\n if (this.ws) {\n this.state = \"CLOSING\";\n try {\n this.ws.close(1000, \"Client disconnect\");\n } catch {\n // Ignored\n }\n this.ws = null;\n }\n\n this.state = \"DISCONNECTED\";\n }\n}\n",
|
|
11
|
-
"/**\n * Official PIA SDK - Market Intelligence API Resource\n */\n\nimport { ValidationError } from \"../errors\";\nimport type { HttpTransport } from \"../http/transport\";\nimport type {\n CandleResponse,\n GetCandlesOptions,\n MarketPricesResponse,\n OrderBook,\n RequestOptions,\n} from \"../types\";\n\nexport class MarketResource {\n constructor(private readonly transport: HttpTransport) {}\n\n /**\n * Retrieves current multi-asset price snapshot for all tracked global symbols.\n */\n public async getPrices(options?: RequestOptions): Promise<MarketPricesResponse> {\n return this.transport.request<MarketPricesResponse>(\n \"/api/v1/market/prices\",\n \"GET\",\n undefined,\n options\n );\n }\n\n /**\n * Fetches historical OHLCV candlestick bars for a given symbol and timeframe.\n *\n * @param symbol Alphanumeric instrument symbol (e.g. \"XAUUSD\", \"BTCUSDT\", \"BBCA\")\n * @param options Timeframe (\"1m\", \"5m\", \"15m\", \"1h\", \"4h\", \"1d\"), limit, timestamps\n */\n public async getCandles(\n symbol: string,\n options?: GetCandlesOptions\n ): Promise<CandleResponse> {\n if (!symbol || typeof symbol !== \"string\" || symbol.trim() === \"\") {\n throw new ValidationError(\"Symbol must be a non-empty string.\", \"symbol\");\n }\n\n const cleanSymbol = symbol.trim().toUpperCase();\n const params = new URLSearchParams();\n if (options?.timeframe) params.set(\"tf\", options.timeframe);\n if (options?.limit) params.set(\"limit\", String(options.limit));\n if (options?.since) params.set(\"since\", String(options.since));\n if (options?.until) params.set(\"until\", String(options.until));\n\n const query = params.toString() ? `?${params.toString()}` : \"\";\n return this.transport.request<CandleResponse>(\n `/api/v1/market/candles/${encodeURIComponent(cleanSymbol)}${query}`,\n \"GET\",\n undefined,\n options\n );\n }\n\n /**\n * Retrieves Level 2 DOM (Depth of Market) order book for a symbol.\n */\n public async getOrderBook(symbol: string, options?: RequestOptions): Promise<OrderBook> {\n if (!symbol || typeof symbol !== \"string\" || symbol.trim() === \"\") {\n throw new ValidationError(\"Symbol must be a non-empty string.\", \"symbol\");\n }\n\n const cleanSymbol = symbol.trim().toUpperCase();\n return this.transport.request<OrderBook>(\n `/api/v1/market/orderbook/${encodeURIComponent(cleanSymbol)}`,\n \"GET\",\n undefined,\n options\n );\n }\n}\n",
|
|
12
|
-
"/**\n * Official PIA SDK - News Intelligence API Resource\n */\n\nimport type { HttpTransport } from \"../http/transport\";\nimport type { GetNewsOptions, NewsFeedResponse } from \"../types\";\n\nexport class NewsResource {\n constructor(private readonly transport: HttpTransport) {}\n\n /**\n * Fetches curated financial and macro news articles.\n */\n public async getNews(options?: GetNewsOptions): Promise<NewsFeedResponse> {\n const params = new URLSearchParams();\n if (options?.symbols && options.symbols.length > 0) {\n params.set(\"symbols\", options.symbols.map((s) => s.trim().toUpperCase()).join(\",\"));\n }\n if (options?.limit) params.set(\"limit\", String(options.limit));\n\n const query = params.toString() ? `?${params.toString()}` : \"\";\n return this.transport.request<NewsFeedResponse>(\n `/api/v1/news${query}`,\n \"GET\",\n undefined,\n options\n );\n }\n}\n",
|
|
13
|
-
"/**\n * Official PIA SDK - Social Intelligence API Resource\n */\n\nimport type { HttpTransport } from \"../http/transport\";\nimport type { GetSocialOptions, SocialFeedResponse } from \"../types\";\n\nexport class SocialResource {\n constructor(private readonly transport: HttpTransport) {}\n\n /**\n * Fetches the latest social sentiment posts and discussions.\n */\n public async getPosts(options?: GetSocialOptions): Promise<SocialFeedResponse> {\n const params = new URLSearchParams();\n if (options?.symbol) params.set(\"symbol\", options.symbol.trim().toUpperCase());\n if (options?.limit) params.set(\"limit\", String(options.limit));\n if (options?.cursor) params.set(\"cursor\", options.cursor);\n\n const query = params.toString() ? `?${params.toString()}` : \"\";\n return this.transport.request<SocialFeedResponse>(\n `/api/v1/social/posts${query}`,\n \"GET\",\n undefined,\n options\n );\n }\n}\n",
|
|
14
|
-
"/**\n * Official PIA SDK - WebSocket Handshake Ticket Resource\n */\n\nimport type { HttpTransport } from \"../http/transport\";\nimport type { RequestOptions, WsTicketResponse } from \"../types\";\n\nexport class WsResource {\n constructor(private readonly transport: HttpTransport) {}\n\n /**\n * Generates an ephemeral single-use WebSocket ticket for browser authentication.\n */\n public async createTicket(options?: RequestOptions): Promise<WsTicketResponse> {\n return this.transport.request<WsTicketResponse>(\n \"/api/v1/ws/ticket\",\n \"POST\",\n {},\n options\n );\n }\n}\n",
|
|
15
|
-
"/**\n * Official PIA SDK - Main Client Facade\n */\n\nimport { type PiaClientOptions, type ResolvedPiaConfig, resolveConfig } from \"./config\";\nimport { HttpTransport } from \"./http/transport\";\nimport { RealtimeClient } from \"./realtime/socket\";\nimport { MarketResource } from \"./resources/market\";\nimport { NewsResource } from \"./resources/news\";\nimport { SocialResource } from \"./resources/social\";\nimport { WsResource } from \"./resources/ws\";\nimport type { RateLimitInfo } from \"./types\";\n\nexport class PiaClient {\n public readonly config: Readonly<ResolvedPiaConfig>;\n private readonly transport: HttpTransport;\n\n /**\n * Market data & prices API resource.\n */\n public readonly market: MarketResource;\n\n /**\n * Social sentiment and discussions resource.\n */\n public readonly social: SocialResource;\n\n /**\n * Financial news resource.\n */\n public readonly news: NewsResource;\n\n /**\n * WebSocket ticket issuance resource.\n */\n public readonly ws: WsResource;\n\n /**\n * Resilient realtime WebSocket streaming client with In-Band Auth.\n */\n public readonly realtime: RealtimeClient;\n\n /**\n * Initializes a new PIA API Client.\n *\n * @example\n * ```typescript\n * import { PiaClient } from \"@piaa/sdk\";\n *\n * const client = new PiaClient({ apiKey: \"wi_live_...\" });\n * const prices = await client.market.getPrices();\n * ```\n */\n constructor(options: PiaClientOptions = {}) {\n this.config = Object.freeze(resolveConfig(options));\n this.transport = new HttpTransport(this.config as ResolvedPiaConfig);\n\n this.market = new MarketResource(this.transport);\n this.social = new SocialResource(this.transport);\n this.news = new NewsResource(this.transport);\n this.ws = new WsResource(this.transport);\n this.realtime = new RealtimeClient(this.config as ResolvedPiaConfig);\n }\n\n /**\n * Returns telemetry on rate limit and daily quota usage from the latest request.\n */\n public getRateLimitInfo(): RateLimitIn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AAI,eAAe,KAAK,SAAS;AAAA,IAC/C,KAAK,OAAO,IAAI,aAAa,KAAK,SAAS;AAAA,IAC3C,KAAK,KAAK,IAAI,WAAW,KAAK,SAAS;AAAA,IACvC,KAAK,WAAW,IAAI,eAAe,KAAK,MAA2B;AAAA;AAAA,EAM9D,gBAAgB,GAAkB;AAAA,IACvC,OAAO,KAAK,UAAU,iBAAiB;AAAA;AAE3C;",
|
|
18
|
-
"debugId": "9179749A09C27B0264756E2164756E21",
|
|
19
|
-
"names": []
|
|
20
|
-
}
|
package/dist/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtE,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAClD;AASD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAcrD;AAUD,qBAAa,aAAc,YAAW,SAAS;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IAEtC,YAAY,KAAK,GAAE,QAAiB,EAEnC;IAED,OAAO,CAAC,UAAU;IAgBlB,KAAK,CAAC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Y,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,CAYtF;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"news.d.ts","sourceRoot":"","sources":["../../src/resources/news.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjE,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,aAAa,EAAI;IAEzD;;OAEG;IACU,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAcxE;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"social.d.ts","sourceRoot":"","sources":["../../src/resources/social.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAErE,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,aAAa,EAAI;IAEzD;;OAEG;IACU,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAa7E;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/resources/ws.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjE,qBA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