4 Commits

Author SHA1 Message Date
fdea1bb149 3.2.2
Some checks failed
Default (tags) / security (push) Failing after 21s
Default (tags) / test (push) Failing after 13s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-11-01 15:20:20 +00:00
8286c30edf fix(handelsregister): Correct screenshot path handling in HandelsRegister and add local tool permissions 2025-11-01 15:20:20 +00:00
ea76776ee1 3.2.1
Some checks failed
Default (tags) / security (push) Failing after 21s
Default (tags) / test (push) Failing after 12s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-11-01 14:54:04 +00:00
54818293a1 fix(stocks/providers/provider.secedgar): Improve SEC EDGAR provider networking and error handling, update plugin path import, bump dev deps and add/refresh tests and lockfile 2025-11-01 14:54:04 +00:00
12 changed files with 7820 additions and 589 deletions

View File

@@ -1,5 +1,21 @@
# Changelog
## 2025-11-01 - 3.2.2 - fix(handelsregister)
Correct screenshot path handling in HandelsRegister and add local tool permissions
- ts/classes.handelsregister.ts: Replace string concatenation for screenshot path with a template literal and explicit string assertion to ensure the path is formed correctly for page.screenshot() and avoid type issues.
- Add .claude/settings.local.json: Introduce local Claude settings that grant specific tool permissions used during development and testing (bash commands, web fetches, pnpm build, tstest, etc.).
## 2025-11-01 - 3.2.1 - fix(stocks/providers/provider.secedgar)
Improve SEC EDGAR provider networking and error handling, update plugin path import, bump dev deps and add/refresh tests and lockfile
- SEC EDGAR provider: switch from SmartRequest to native fetch for ticker list and company facts, add AbortController-based timeouts, handle gzip automatically, improve response validation and error messages, and keep CIK/ticker-list caching
- Improve timeout and rate-limit handling in SecEdgarProvider (uses native fetch + explicit timeout clear), plus clearer logging on failures
- Update ts/plugins import to use node:path for Node compatibility
- Bump devDependencies: @git.zone/tsrun to ^1.6.2 and @git.zone/tstest to ^2.7.0; bump @push.rocks/smartrequest to ^4.3.4
- Add and refresh comprehensive test files (node/bun/deno variants) for fundamentals, marketstack, secedgar and stockdata services
- Add deno.lock (dependency lock) and a local .claude/settings.local.json for CI/permissions
## 2025-11-01 - 3.2.0 - feat(StockDataService)
Add unified StockDataService and BaseProviderService with new stockdata interfaces, provider integrations, tests and README updates

7209
deno.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@fin.cx/opendata",
"version": "3.2.0",
"version": "3.2.2",
"private": false,
"description": "A comprehensive TypeScript library for accessing business data and real-time financial information. Features include German company data management with MongoDB integration, JSONL bulk processing, automated Handelsregister interactions, and real-time stock market data from multiple providers.",
"main": "dist_ts/index.js",
@@ -16,8 +16,8 @@
"devDependencies": {
"@git.zone/tsbuild": "^2.6.8",
"@git.zone/tsbundle": "^2.5.1",
"@git.zone/tsrun": "^1.3.3",
"@git.zone/tstest": "^2.4.2",
"@git.zone/tsrun": "^1.6.2",
"@git.zone/tstest": "^2.7.0",
"@types/node": "^22.14.0"
},
"dependencies": {
@@ -32,7 +32,7 @@
"@push.rocks/smartlog": "^3.1.10",
"@push.rocks/smartpath": "^6.0.0",
"@push.rocks/smartpromise": "^4.2.3",
"@push.rocks/smartrequest": "^4.3.1",
"@push.rocks/smartrequest": "^4.3.4",
"@push.rocks/smartstream": "^3.2.5",
"@push.rocks/smartunique": "^3.0.9",
"@push.rocks/smartxml": "^1.1.1",

1054
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@fin.cx/opendata',
version: '3.2.0',
version: '3.2.2',
description: 'A comprehensive TypeScript library for accessing business data and real-time financial information. Features include German company data management with MongoDB integration, JSONL bulk processing, automated Handelsregister interactions, and real-time stock market data from multiple providers.'
}

View File

@@ -78,7 +78,7 @@ export class HandelsRegister {
timeout: 30000,
})
.catch(async (err) => {
await pageArg.screenshot({ path: this.downloadDir + '/error.png' });
await pageArg.screenshot({ path: `${this.downloadDir}/error.png` as `${string}.png` });
throw err;
});

View File

@@ -1,5 +1,5 @@
// node native scope
import * as path from 'path';
import * as path from 'node:path';
export {
path,

View File

@@ -217,6 +217,7 @@ export class SecEdgarProvider implements IFundamentalsProvider {
/**
* Fetch the SEC ticker-to-CIK mapping list
* Cached for 24 hours (list updates daily)
* Uses native fetch for automatic gzip decompression
*/
private async fetchTickerList(): Promise<any> {
// Check cache
@@ -230,15 +231,25 @@ export class SecEdgarProvider implements IFundamentalsProvider {
// Wait for rate limit slot
await this.rateLimiter.waitForSlot();
// Fetch from SEC
const response = await plugins.smartrequest.SmartRequest.create()
.url(this.tickersUrl)
.headers({
// Fetch from SEC using native fetch (handles gzip automatically)
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
try {
const response = await fetch(this.tickersUrl, {
headers: {
'User-Agent': this.userAgent,
'Accept': 'application/json'
})
.timeout(this.config.timeout)
.get();
// Note: Accept-Encoding is set automatically by fetch
},
signal: controller.signal
});
clearTimeout(timeoutId);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const data = await response.json();
@@ -249,10 +260,15 @@ export class SecEdgarProvider implements IFundamentalsProvider {
};
return data;
} catch (error) {
clearTimeout(timeoutId);
throw error;
}
}
/**
* Fetch company facts from SEC EDGAR
* Uses native fetch for automatic gzip decompression
*/
private async fetchCompanyFacts(cik: string): Promise<any> {
// Pad CIK to 10 digits
@@ -262,17 +278,26 @@ export class SecEdgarProvider implements IFundamentalsProvider {
// Wait for rate limit slot
await this.rateLimiter.waitForSlot();
// Fetch from SEC
const response = await plugins.smartrequest.SmartRequest.create()
.url(url)
.headers({
// Fetch from SEC using native fetch (handles gzip automatically)
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
try {
const response = await fetch(url, {
headers: {
'User-Agent': this.userAgent,
'Accept': 'application/json',
'Accept-Encoding': 'gzip, deflate',
'Host': 'data.sec.gov'
})
.timeout(this.config.timeout)
.get();
// Note: Accept-Encoding is set automatically by fetch and gzip is handled transparently
},
signal: controller.signal
});
clearTimeout(timeoutId);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const data = await response.json();
@@ -282,6 +307,10 @@ export class SecEdgarProvider implements IFundamentalsProvider {
}
return data;
} catch (error) {
clearTimeout(timeoutId);
throw error;
}
}
/**
@@ -382,20 +411,29 @@ export class SecEdgarProvider implements IFundamentalsProvider {
/**
* Check if SEC EDGAR API is available
* Uses native fetch for automatic gzip decompression
*/
public async isAvailable(): Promise<boolean> {
try {
// Test with Apple's well-known CIK
const url = `${this.baseUrl}/companyfacts/CIK0000320193.json`;
const response = await plugins.smartrequest.SmartRequest.create()
.url(url)
.headers({
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 5000);
const response = await fetch(url, {
headers: {
'User-Agent': this.userAgent,
'Accept': 'application/json'
})
.timeout(5000)
.get();
},
signal: controller.signal
});
clearTimeout(timeoutId);
if (!response.ok) {
return false;
}
const data = await response.json();
return data && data.facts !== undefined;