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:
@@ -1,5 +1,4 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import * as paths from './paths.js';
|
||||
import type { OpenData } from './classes.main.opendata.js';
|
||||
|
||||
export type SeedEntryType = {
|
||||
@@ -41,8 +40,11 @@ export type SeedEntryType = {
|
||||
};
|
||||
|
||||
export class JsonlDataProcessor<T> {
|
||||
private germanBusinessDataDir: string;
|
||||
public forEachFunction: (entryArg: T) => Promise<void>;
|
||||
constructor(forEachFunctionArg: typeof this.forEachFunction) {
|
||||
|
||||
constructor(germanBusinessDataDirArg: string, forEachFunctionArg: typeof this.forEachFunction) {
|
||||
this.germanBusinessDataDir = germanBusinessDataDirArg;
|
||||
this.forEachFunction = forEachFunctionArg;
|
||||
}
|
||||
|
||||
@@ -51,9 +53,9 @@ export class JsonlDataProcessor<T> {
|
||||
dataUrlArg = 'https://daten.offeneregister.de/de_companies_ocdata.jsonl.bz2'
|
||||
) {
|
||||
const done = plugins.smartpromise.defer();
|
||||
const dataExists = await plugins.smartfile.fs.isDirectory(paths.germanBusinessDataDir);
|
||||
const dataExists = await plugins.smartfile.fs.isDirectory(this.germanBusinessDataDir);
|
||||
if (!dataExists) {
|
||||
await plugins.smartfile.fs.ensureDir(paths.germanBusinessDataDir);
|
||||
await plugins.smartfile.fs.ensureDir(this.germanBusinessDataDir);
|
||||
} else {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user