Skip to content

Commit

Permalink
👷 Hopefully fix npm build
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwoerpel committed Apr 11, 2024
1 parent 5ef969f commit 29e6b9b
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 152 deletions.
2 changes: 1 addition & 1 deletion js/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import queryString from "query-string";

import type { IEntityDatum, ICatalog, IDataset } from "../types";
import type { IEntityDatum, ICatalog, IDataset } from "../model";
import type { IAggregationResult, IApiQuery, IEntitiesResult } from "./types";

type ApiError = {
Expand Down
6 changes: 3 additions & 3 deletions js/api/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IEntityDatum, IDatasetStats } from "../types";
import type { IEntityDatum, ICoverage } from "../model";

export interface IPublicQuery {
// visible api params in the browser
Expand Down Expand Up @@ -29,7 +29,7 @@ export interface IEntitiesResult {
readonly url: string;
readonly next_url: string | null;
readonly prev_url: string | null;
readonly coverage: IDatasetStats;
readonly coverage: ICoverage;
readonly entities: IEntityDatum[];
}

Expand Down Expand Up @@ -65,6 +65,6 @@ export interface IAggregationResult {
readonly total: number;
readonly query: IApiQuery;
readonly url: string;
readonly coverage: IDatasetStats;
readonly coverage: ICoverage;
readonly aggregations: Aggregations;
}
2 changes: 0 additions & 2 deletions js/index.d.ts

This file was deleted.

128 changes: 0 additions & 128 deletions js/model.d.ts

This file was deleted.

130 changes: 130 additions & 0 deletions js/model/dataset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
export type TDatasetCategory =
| (
| "news"
| "leak"
| "land"
| "gazette"
| "court"
| "company"
| "sanctions"
| "procurement"
| "finance"
| "grey"
| "library"
| "license"
| "regulatory"
| "poi"
| "customs"
| "census"
| "transport"
| "casefile"
| "other"
)
| null;

export type TDatasetFrequency =
| (
| "unknown"
| "never"
| "hourly"
| "daily"
| "weekly"
| "monthly"
| "annually"
)
| null;

export interface IPublisher {
readonly name: string;
readonly url?: string | null;
readonly description?: string | null;
readonly country?: string | null;
readonly country_label?: string | null;
readonly official?: boolean | null;
readonly logo_url?: string | null;
}

export interface ICoverage {
readonly start?: string | null;
readonly end?: string | null;
readonly frequency?: TDatasetFrequency;
readonly countries?: string[] | null;
readonly schedule?: string[] | null;
}

export interface ISchemataStats {
readonly total?: number | null;
readonly countries?: ICountry[] | null;
readonly schemata?: ISchema[] | null;
}

export interface ICountry {
readonly code: string;
readonly count: number;
readonly label?: string | null;
}

export interface ISchema {
readonly name: string;
readonly count: number;
readonly label: string | null;
readonly plural: string | null;
}

export interface IResource {
readonly name: string;
readonly url: string;
readonly title?: string | null;
readonly checksum?: string | null;
readonly timestamp?: string | null;
readonly mime_type?: string | null;
readonly mime_type_label?: string | null;
readonly size?: number | null;
}

export interface IMaintainer {
readonly name: string;
readonly description?: string | null;
readonly url?: string | null;
readonly logo_url?: string | null;
}

export interface IDataset {
readonly name: string;
readonly prefix?: string | null;
readonly title?: string | null;
readonly license?: string | null;
readonly summary?: string | null;
readonly description?: string | null;
readonly url?: string | null;
readonly updated_at?: string | null;
readonly version?: string | null;
readonly category?: TDatasetCategory;
readonly publisher?: IPublisher | null;
readonly coverage?: ICoverage | null;
readonly things?: ISchema[] | null;
readonly intervals?: ISchema[] | null;
readonly entity_count?: number | null;
readonly resources?: IResource[] | null;
readonly index_url?: string | null;
readonly catalog?: string | null;
readonly countries?: string[] | null;
readonly info_url?: string | null;
readonly data_url?: string | null;
readonly git_repo?: string | null;
readonly uri?: string | null;
readonly maintainer?: IMaintainer | null;
}

export interface ICatalog {
readonly name: string;
readonly title?: string | null;
readonly datasets: IDataset[] | null;
readonly description?: string | null;
readonly url?: string | null;
readonly updated_at?: string | null;
readonly publisher?: IPublisher | null;
readonly maintainer?: IMaintainer | null;
readonly git_repo?: string | null;
readonly uri?: string | null;
}
8 changes: 8 additions & 0 deletions js/model/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,11 @@ export class Entity {
return new Entity(model, data);
}
}

// entity type is mostly used as a union type of the class instance or the data object
export type TEntity = Entity | IEntityDatum;

// base props interface for components
export interface IEntityComponent {
entity: TEntity;
}
3 changes: 3 additions & 0 deletions js/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ export * from "./model";
export * from "./property";
export * from "./schema";
export * from "./propertyType";

// dataset model types
export * from "./dataset"
7 changes: 0 additions & 7 deletions js/types/index.d.ts

This file was deleted.

8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@investigativedata/ftmq",
"version": "0.1.0",
"version": "0.1.1",
"description": "javascript interface for ftmq",
"main": "js/index.ts",
"types": "js/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"directories": {
"test": "tests"
},
"scripts": {
"build": "rollup -c rollup.config.mjs",
"build": "rm -rf dist ; tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand All @@ -28,8 +28,6 @@
"devDependencies": {
"babel-core": "^6.26.3",
"babel-runtime": "^6.26.0",
"rollup": "^4.14.0",
"rollup-plugin-typescript2": "^0.36.0",
"typescript": "^5.4.4"
"typescript": "^5.4.5"
}
}

0 comments on commit 29e6b9b

Please sign in to comment.