BREAKING CHANGE(OpenData): Require explicit directory paths for OpenData (nogit/download/germanBusinessData); remove automatic .nogit creation; update HandelsRegister, JsonlDataProcessor, tests and README.
This commit is contained in:
90
readme.md
90
readme.md
@@ -4,6 +4,20 @@
|
||||
|
||||
Access live stock prices, cryptocurrencies, forex, commodities AND comprehensive German company data - all through a single, unified API.
|
||||
|
||||
## ⚠️ Breaking Change in v2.0
|
||||
|
||||
**Directory paths are now MANDATORY when using German business data features.** The package no longer creates `.nogit/` directories automatically. You must explicitly configure all directory paths when instantiating `OpenData`:
|
||||
|
||||
```typescript
|
||||
const openData = new OpenData({
|
||||
nogitDir: '/path/to/your/data',
|
||||
downloadDir: '/path/to/your/data/downloads',
|
||||
germanBusinessDataDir: '/path/to/your/data/germanbusinessdata'
|
||||
});
|
||||
```
|
||||
|
||||
This change enables the package to work in read-only filesystems (like Deno compiled binaries) and gives you full control over where data is stored.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
@@ -54,8 +68,14 @@ Access comprehensive data on German companies:
|
||||
|
||||
```typescript
|
||||
import { OpenData } from '@fin.cx/opendata';
|
||||
import * as path from 'path';
|
||||
|
||||
const openData = new OpenData();
|
||||
// REQUIRED: Configure directory paths
|
||||
const openData = new OpenData({
|
||||
nogitDir: path.join(process.cwd(), '.nogit'),
|
||||
downloadDir: path.join(process.cwd(), '.nogit', 'downloads'),
|
||||
germanBusinessDataDir: path.join(process.cwd(), '.nogit', 'germanbusinessdata')
|
||||
});
|
||||
await openData.start();
|
||||
|
||||
// Create a business record
|
||||
@@ -159,6 +179,17 @@ console.log('Marketstack Stats:', {
|
||||
Automate German company data retrieval:
|
||||
|
||||
```typescript
|
||||
import { OpenData } from '@fin.cx/opendata';
|
||||
import * as path from 'path';
|
||||
|
||||
// Configure paths first
|
||||
const openData = new OpenData({
|
||||
nogitDir: path.join(process.cwd(), '.nogit'),
|
||||
downloadDir: path.join(process.cwd(), '.nogit', 'downloads'),
|
||||
germanBusinessDataDir: path.join(process.cwd(), '.nogit', 'germanbusinessdata')
|
||||
});
|
||||
await openData.start();
|
||||
|
||||
// Search for a company
|
||||
const results = await openData.handelsregister.searchCompany("Siemens AG");
|
||||
|
||||
@@ -182,6 +213,21 @@ for (const file of details.files) {
|
||||
Merge financial and business data:
|
||||
|
||||
```typescript
|
||||
import { OpenData, StockPriceService, MarketstackProvider } from '@fin.cx/opendata';
|
||||
import * as path from 'path';
|
||||
|
||||
// Configure OpenData with paths
|
||||
const openData = new OpenData({
|
||||
nogitDir: path.join(process.cwd(), '.nogit'),
|
||||
downloadDir: path.join(process.cwd(), '.nogit', 'downloads'),
|
||||
germanBusinessDataDir: path.join(process.cwd(), '.nogit', 'germanbusinessdata')
|
||||
});
|
||||
await openData.start();
|
||||
|
||||
// Setup stock service
|
||||
const stockService = new StockPriceService({ ttl: 60000, maxEntries: 1000 });
|
||||
stockService.register(new MarketstackProvider('YOUR_API_KEY'));
|
||||
|
||||
// Find all public German companies (AG)
|
||||
const publicCompanies = await openData.db
|
||||
.collection('businessrecords')
|
||||
@@ -212,6 +258,48 @@ for (const company of publicCompanies) {
|
||||
|
||||
## Configuration
|
||||
|
||||
### Directory Configuration (Required for German Business Data)
|
||||
|
||||
**All directory paths are mandatory when using `OpenData`.** Here are examples for different environments:
|
||||
|
||||
#### Development Environment
|
||||
```typescript
|
||||
import { OpenData } from '@fin.cx/opendata';
|
||||
import * as path from 'path';
|
||||
|
||||
const openData = new OpenData({
|
||||
nogitDir: path.join(process.cwd(), '.nogit'),
|
||||
downloadDir: path.join(process.cwd(), '.nogit', 'downloads'),
|
||||
germanBusinessDataDir: path.join(process.cwd(), '.nogit', 'germanbusinessdata')
|
||||
});
|
||||
```
|
||||
|
||||
#### Production Environment
|
||||
```typescript
|
||||
import { OpenData } from '@fin.cx/opendata';
|
||||
import * as path from 'path';
|
||||
|
||||
const openData = new OpenData({
|
||||
nogitDir: '/var/lib/myapp/data',
|
||||
downloadDir: '/var/lib/myapp/data/downloads',
|
||||
germanBusinessDataDir: '/var/lib/myapp/data/germanbusinessdata'
|
||||
});
|
||||
```
|
||||
|
||||
#### Deno Compiled Binaries (or other read-only filesystems)
|
||||
```typescript
|
||||
import { OpenData } from '@fin.cx/opendata';
|
||||
|
||||
// Use OS temp directory or user data directory
|
||||
const dataDir = Deno.env.get('HOME') + '/.myapp/data';
|
||||
|
||||
const openData = new OpenData({
|
||||
nogitDir: dataDir,
|
||||
downloadDir: dataDir + '/downloads',
|
||||
germanBusinessDataDir: dataDir + '/germanbusinessdata'
|
||||
});
|
||||
```
|
||||
|
||||
### Stock Service Options
|
||||
|
||||
```typescript
|
||||
|
||||
Reference in New Issue
Block a user