fmp-node-api 0.1.0 → 0.1.1
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/chunk-RM7ETDL3.mjs +1 -0
- package/dist/common-COsxpVBY.d.mts +18 -0
- package/dist/common-COsxpVBY.d.ts +18 -0
- package/dist/index.d.mts +35 -1575
- package/dist/index.d.ts +35 -1575
- package/dist/index.js +2 -4182
- package/dist/index.mjs +2 -4137
- package/dist/types-only-DjnrpNZm.d.ts +1086 -0
- package/dist/types-only-v3B1TqXe.d.mts +1086 -0
- package/dist/types-only.d.mts +2 -0
- package/dist/types-only.d.ts +2 -0
- package/dist/types-only.js +1 -0
- package/dist/types-only.mjs +0 -0
- package/dist/utils/validation.d.mts +88 -0
- package/dist/utils/validation.d.ts +88 -0
- package/dist/utils/validation.js +1 -0
- package/dist/utils/validation.mjs +1 -0
- package/package.json +11 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { A as APIResponse, P as PeriodParams, S as SymbolParams } from './common-COsxpVBY.mjs';
|
|
2
|
+
export { B as BalanceSheet, C as CashFlowStatement, N as CompanyProfile, l as ETFHolder, k as ETFHolding, m as ETFProfile, z as EarningsCalendar, q as EconomicIndicator, F as FinancialRatios, a1 as Form13FResponse, a0 as HouseTradingResponse, I as IncomeStatement, a4 as InsiderTradingSearchResponse, a2 as InstitutionalHolderResponse, K as KeyMetrics, M as MarketCap, r as MarketHours, u as MarketIndex, X as Quote, ad as RSSFeedItem, _ as SenateTradingResponse, al as StockDividend, v as StockList, b as StockRealTimePrice, c as StockRealTimePriceFull, ak as StockSplit } from './types-only-v3B1TqXe.mjs';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { A as APIResponse, P as PeriodParams, S as SymbolParams } from './common-COsxpVBY.js';
|
|
2
|
+
export { B as BalanceSheet, C as CashFlowStatement, N as CompanyProfile, l as ETFHolder, k as ETFHolding, m as ETFProfile, z as EarningsCalendar, q as EconomicIndicator, F as FinancialRatios, a1 as Form13FResponse, a0 as HouseTradingResponse, I as IncomeStatement, a4 as InsiderTradingSearchResponse, a2 as InstitutionalHolderResponse, K as KeyMetrics, M as MarketCap, r as MarketHours, u as MarketIndex, X as Quote, ad as RSSFeedItem, _ as SenateTradingResponse, al as StockDividend, v as StockList, b as StockRealTimePrice, c as StockRealTimePriceFull, ak as StockSplit } from './types-only-DjnrpNZm.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
File without changes
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { A as APIResponse } from '../common-COsxpVBY.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Validation utilities for FMP API parameters and responses
|
|
5
|
+
*/
|
|
6
|
+
declare class FMPValidation {
|
|
7
|
+
/**
|
|
8
|
+
* Validate stock symbol format
|
|
9
|
+
* @param symbol - The symbol to validate
|
|
10
|
+
* @returns True if the symbol format is valid
|
|
11
|
+
*/
|
|
12
|
+
static isValidSymbol(symbol: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Validate crypto symbol format
|
|
15
|
+
* @param symbol - The crypto symbol to validate
|
|
16
|
+
* @returns True if the crypto symbol format is valid
|
|
17
|
+
*/
|
|
18
|
+
static isValidCryptoSymbol(symbol: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Validate forex pair format
|
|
21
|
+
* @param symbol - The forex pair to validate
|
|
22
|
+
* @returns True if the forex pair format is valid
|
|
23
|
+
*/
|
|
24
|
+
static isValidForexPair(symbol: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Validate date format (YYYY-MM-DD)
|
|
27
|
+
* @param date - The date string to validate
|
|
28
|
+
* @returns True if the date format is valid
|
|
29
|
+
*/
|
|
30
|
+
static isValidDate(date: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Validate date range
|
|
33
|
+
* @param from - Start date
|
|
34
|
+
* @param to - End date
|
|
35
|
+
* @returns True if the date range is valid
|
|
36
|
+
*/
|
|
37
|
+
static isValidDateRange(from: string, to: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Validate API response structure
|
|
40
|
+
* @param response - The response to validate
|
|
41
|
+
* @returns True if the response has the expected structure
|
|
42
|
+
*/
|
|
43
|
+
static isValidResponse(response: any): response is APIResponse<any>;
|
|
44
|
+
/**
|
|
45
|
+
* Validate API key format
|
|
46
|
+
* @param apiKey - The API key to validate
|
|
47
|
+
* @returns True if the API key format is valid
|
|
48
|
+
*/
|
|
49
|
+
static isValidApiKey(apiKey: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Validate period parameter
|
|
52
|
+
* @param period - The period to validate
|
|
53
|
+
* @returns True if the period is valid
|
|
54
|
+
*/
|
|
55
|
+
static isValidPeriod(period: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Validate limit parameter
|
|
58
|
+
* @param limit - The limit to validate
|
|
59
|
+
* @returns True if the limit is valid
|
|
60
|
+
*/
|
|
61
|
+
static isValidLimit(limit: number): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Get validation errors for quote parameters
|
|
64
|
+
* @param params - The parameters to validate
|
|
65
|
+
* @returns Array of validation error messages
|
|
66
|
+
*/
|
|
67
|
+
static validateQuoteParams(params: any): string[];
|
|
68
|
+
/**
|
|
69
|
+
* Get validation errors for financial statement parameters
|
|
70
|
+
* @param params - The parameters to validate
|
|
71
|
+
* @returns Array of validation error messages
|
|
72
|
+
*/
|
|
73
|
+
static validateFinancialParams(params: any): string[];
|
|
74
|
+
/**
|
|
75
|
+
* Get validation errors for date range parameters
|
|
76
|
+
* @param params - The parameters to validate
|
|
77
|
+
* @returns Array of validation error messages
|
|
78
|
+
*/
|
|
79
|
+
static validateDateRangeParams(params: any): string[];
|
|
80
|
+
/**
|
|
81
|
+
* Validate and throw error if validation fails
|
|
82
|
+
* @param errors - Array of validation errors
|
|
83
|
+
* @param context - Context for the error message
|
|
84
|
+
*/
|
|
85
|
+
static throwIfInvalid(errors: string[], context?: string): void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { FMPValidation };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { A as APIResponse } from '../common-COsxpVBY.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Validation utilities for FMP API parameters and responses
|
|
5
|
+
*/
|
|
6
|
+
declare class FMPValidation {
|
|
7
|
+
/**
|
|
8
|
+
* Validate stock symbol format
|
|
9
|
+
* @param symbol - The symbol to validate
|
|
10
|
+
* @returns True if the symbol format is valid
|
|
11
|
+
*/
|
|
12
|
+
static isValidSymbol(symbol: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Validate crypto symbol format
|
|
15
|
+
* @param symbol - The crypto symbol to validate
|
|
16
|
+
* @returns True if the crypto symbol format is valid
|
|
17
|
+
*/
|
|
18
|
+
static isValidCryptoSymbol(symbol: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Validate forex pair format
|
|
21
|
+
* @param symbol - The forex pair to validate
|
|
22
|
+
* @returns True if the forex pair format is valid
|
|
23
|
+
*/
|
|
24
|
+
static isValidForexPair(symbol: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Validate date format (YYYY-MM-DD)
|
|
27
|
+
* @param date - The date string to validate
|
|
28
|
+
* @returns True if the date format is valid
|
|
29
|
+
*/
|
|
30
|
+
static isValidDate(date: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Validate date range
|
|
33
|
+
* @param from - Start date
|
|
34
|
+
* @param to - End date
|
|
35
|
+
* @returns True if the date range is valid
|
|
36
|
+
*/
|
|
37
|
+
static isValidDateRange(from: string, to: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Validate API response structure
|
|
40
|
+
* @param response - The response to validate
|
|
41
|
+
* @returns True if the response has the expected structure
|
|
42
|
+
*/
|
|
43
|
+
static isValidResponse(response: any): response is APIResponse<any>;
|
|
44
|
+
/**
|
|
45
|
+
* Validate API key format
|
|
46
|
+
* @param apiKey - The API key to validate
|
|
47
|
+
* @returns True if the API key format is valid
|
|
48
|
+
*/
|
|
49
|
+
static isValidApiKey(apiKey: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Validate period parameter
|
|
52
|
+
* @param period - The period to validate
|
|
53
|
+
* @returns True if the period is valid
|
|
54
|
+
*/
|
|
55
|
+
static isValidPeriod(period: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Validate limit parameter
|
|
58
|
+
* @param limit - The limit to validate
|
|
59
|
+
* @returns True if the limit is valid
|
|
60
|
+
*/
|
|
61
|
+
static isValidLimit(limit: number): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Get validation errors for quote parameters
|
|
64
|
+
* @param params - The parameters to validate
|
|
65
|
+
* @returns Array of validation error messages
|
|
66
|
+
*/
|
|
67
|
+
static validateQuoteParams(params: any): string[];
|
|
68
|
+
/**
|
|
69
|
+
* Get validation errors for financial statement parameters
|
|
70
|
+
* @param params - The parameters to validate
|
|
71
|
+
* @returns Array of validation error messages
|
|
72
|
+
*/
|
|
73
|
+
static validateFinancialParams(params: any): string[];
|
|
74
|
+
/**
|
|
75
|
+
* Get validation errors for date range parameters
|
|
76
|
+
* @param params - The parameters to validate
|
|
77
|
+
* @returns Array of validation error messages
|
|
78
|
+
*/
|
|
79
|
+
static validateDateRangeParams(params: any): string[];
|
|
80
|
+
/**
|
|
81
|
+
* Validate and throw error if validation fails
|
|
82
|
+
* @param errors - Array of validation errors
|
|
83
|
+
* @param context - Context for the error message
|
|
84
|
+
*/
|
|
85
|
+
static throwIfInvalid(errors: string[], context?: string): void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { FMPValidation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var s=class{static isValidSymbol(t){return !t||typeof t!="string"?false:/^[A-Z]{1,5}$/.test(t)}static isValidCryptoSymbol(t){return !t||typeof t!="string"?false:/^[A-Z]{2,10}(USD|EUR|GBP|JPY|CAD|AUD|CHF|CNY)$/.test(t)}static isValidForexPair(t){return !t||typeof t!="string"?false:/^[A-Z]{3}[A-Z]{3}$/.test(t)}static isValidDate(t){if(!t||typeof t!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(t))return false;let i=new Date(t);return !isNaN(i.getTime())&&i.toISOString().split("T")[0]===t}static isValidDateRange(t,e){if(!this.isValidDate(t)||!this.isValidDate(e))return false;let i=new Date(t),r=new Date(e);return i<=r}static isValidResponse(t){return !!(t&&typeof t=="object"&&typeof t.success=="boolean")}static isValidApiKey(t){return !t||typeof t!="string"?false:/^[a-zA-Z0-9]{32,}$/.test(t)}static isValidPeriod(t){return !t||typeof t!="string"?false:["annual","quarter","fy"].includes(t.toLowerCase())}static isValidLimit(t){return typeof t=="number"&&Number.isInteger(t)&&t>0&&t<=1e3}static validateQuoteParams(t){let e=[];return t?(t.symbol?!this.isValidSymbol(t.symbol)&&!this.isValidCryptoSymbol(t.symbol)&&!this.isValidForexPair(t.symbol)&&e.push("Invalid symbol format"):e.push("Symbol is required"),t.from&&!this.isValidDate(t.from)&&e.push("Invalid from date format (expected YYYY-MM-DD)"),t.to&&!this.isValidDate(t.to)&&e.push("Invalid to date format (expected YYYY-MM-DD)"),t.from&&t.to&&!this.isValidDateRange(t.from,t.to)&&e.push("From date must be before or equal to to date"),e):(e.push("Parameters object is required"),e)}static validateFinancialParams(t){let e=[];return t?(t.symbol?this.isValidSymbol(t.symbol)||e.push("Invalid symbol format"):e.push("Symbol is required"),t.period&&!this.isValidPeriod(t.period)&&e.push('Invalid period (must be "annual", "quarter", or "FY")'),t.limit&&!this.isValidLimit(t.limit)&&e.push("Invalid limit (must be a positive integer <= 1000)"),e):(e.push("Parameters object is required"),e)}static validateDateRangeParams(t){let e=[];return t?(t.from&&!this.isValidDate(t.from)&&e.push("Invalid from date format (expected YYYY-MM-DD)"),t.to&&!this.isValidDate(t.to)&&e.push("Invalid to date format (expected YYYY-MM-DD)"),t.from&&t.to&&!this.isValidDateRange(t.from,t.to)&&e.push("From date must be before or equal to to date"),e):(e.push("Parameters object is required"),e)}static throwIfInvalid(t,e="Validation"){if(t.length>0)throw new Error(`${e} failed: ${t.join(", ")}`)}};exports.FMPValidation=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as FMPValidation}from'../chunk-RM7ETDL3.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fmp-node-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A comprehensive Node.js wrapper for Financial Modeling Prep API",
|
|
5
5
|
"disclaimer": "This package is not affiliated with, endorsed by, or sponsored by Financial Modeling Prep (FMP). This is an independent, community-developed wrapper.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.mjs",
|
|
13
13
|
"require": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./types": {
|
|
16
|
+
"types": "./dist/types-only.d.ts",
|
|
17
|
+
"import": "./dist/types-only.mjs",
|
|
18
|
+
"require": "./dist/types-only.js"
|
|
19
|
+
},
|
|
20
|
+
"./utils/validation": {
|
|
21
|
+
"types": "./dist/utils/validation.d.ts",
|
|
22
|
+
"import": "./dist/utils/validation.mjs",
|
|
23
|
+
"require": "./dist/utils/validation.js"
|
|
14
24
|
}
|
|
15
25
|
},
|
|
16
26
|
"files": [
|