Skip to content

Commit

Permalink
fix: no circular imports
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Sep 11, 2019
1 parent fe30727 commit 8f62c71
Show file tree
Hide file tree
Showing 23 changed files with 458 additions and 282 deletions.
2 changes: 1 addition & 1 deletion __tests__/component.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { namedNode } from "@rdfjs/data-model";
import {Dimension} from "../src/components";
import { Dimension } from "../src/components";

let d = null;

Expand Down
8 changes: 4 additions & 4 deletions __tests__/filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ const datacube: DataCube = new DataCube("https://ld.stadt-zuerich.ch/query", {
},
});

const a: any = new Dimension({
const a: Dimension = new Dimension({
labels: [{ value: "aaaa", language: "" }],
iri: "http://aaaa.aa"
});
const b: any = new Dimension({
const b: Dimension = new Dimension({
labels: [{ value: "bbbb", language: "" }],
iri: "http://bbbb.bb"
});
const c: any = new Dimension({
const c: Dimension = new Dimension({
labels: [{ value: "cccc", language: "" }],
iri: "http://cccc.cc"
});
const d: any = new Dimension({
const d: Dimension = new Dimension({
labels: [{ value: "dddd", language: "" }],
iri: "http://dddd.dd"
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/utils.test.ts → __tests__/operator.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { literal } from "@rdfjs/data-model";
import namespace from "@rdfjs/namespace";
import { toLiteral } from "../src/expressions";
import { toLiteral } from "../src/expressions/operator";

const xsd = namespace("http://www.w3.org/2001/XMLSchema#");
const rdf = namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
Expand Down
2 changes: 1 addition & 1 deletion examples/introspect-and-query.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { inspect } = require("util");
const { DataCubeEntryPoint } = require("..");
const { DataCubeEntryPoint, Dimension } = require("..");

function prettyPrint(obj) {
return inspect(obj, false, 10000, true);
Expand Down
170 changes: 164 additions & 6 deletions package-lock.json

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

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
"version": "0.0.8",
"description": "Query (or introspect) [RDF Data Cubes](https://www.w3.org/TR/vocab-data-cube/) with a JavaScript API, without writing SPARQL.",
"scripts": {
"build:cjs": "tsc --target es2017 --module commonjs --outDir dist/node",
"build:esm": "tsc --target esnext --module esnext --outDir dist/es",
"build": "rimraf dist; rollup -c",
"build:watch": "rollup -cw",
"test": "jest",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"docs:compile": "rimraf docs && npm run typedoc -- ./src/ && touch ./docs/.nojekyll",
"docs:publish": "gh-pages -t -d docs",
"typedoc": "typedoc",
"lint": "tslint --project tsconfig.json",
"build": "rimraf dist; npm run build:cjs; npm run build:esm",
"prepare": "npm run build",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
"postversion": "npm run docs:compile && npm run docs:publish"
Expand Down Expand Up @@ -41,6 +40,7 @@
},
"homepage": "https://github.com/zazuko/query-rdf-data-cube#readme",
"dependencies": {
"@rdfjs/data-model": "^1.1.2",
"@rdfjs/namespace": "^1.1.0",
"clone": "^2.1.2",
"node-fetch": "^2.6.0",
Expand All @@ -61,11 +61,13 @@
"lint-staged": "^9.2.5",
"prettier": "^1.18.2",
"rimraf": "^3.0.0",
"rollup": "^1.21.2",
"rollup-plugin-typescript2": "^0.24.1",
"ts-jest": "^24.0.2",
"ts-node": "^8.3.0",
"tslint": "^5.19.0",
"typedoc": "^0.15.0",
"typescript": "^3.6.2"
"typescript": "^3.6.3"
},
"jest": {
"automock": false,
Expand All @@ -86,7 +88,9 @@
},
"globals": {
"ts-jest": {
"diagnostics": true
"diagnostics": {
"warnOnly": true
}
}
}
},
Expand Down
25 changes: 25 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import typescript from 'rollup-plugin-typescript2';
import pkg from './package.json';

export default {
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
},
{
file: pkg.module,
format: 'es',
},
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
plugins: [
typescript({
typescript: require('typescript'),
}),
],
};
5 changes: 0 additions & 5 deletions src/components/attribute.ts

This file was deleted.

14 changes: 13 additions & 1 deletion src/components/component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// tslint:disable max-classes-per-file
import { namedNode } from "@rdfjs/data-model";
import clone from "clone";
import { Term } from "rdf-js";
import { Label } from "../datacube";
import { BaseExpr, Binding, IExpr } from "../expressions";
import { Attribute, Dimension, Measure } from "./index";

export type SerializedComponent = {
componentType: string,
Expand Down Expand Up @@ -92,3 +92,15 @@ export class Component extends BaseExpr {
return new Binding(mapping.get(this.iri.value));
}
}

export class Attribute extends Component {
public componentType = "attribute";
}

export class Dimension extends Component {
public componentType = "dimension";
}

export class Measure extends Component {
public componentType = "measure";
}
5 changes: 0 additions & 5 deletions src/components/dimension.ts

This file was deleted.

5 changes: 1 addition & 4 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export { Component } from "./component";
export { Attribute } from "./attribute";
export { Dimension } from "./dimension";
export { Measure } from "./measure";
export { Attribute, Component, Dimension, Measure } from "./component";
5 changes: 0 additions & 5 deletions src/components/measure.ts

This file was deleted.

0 comments on commit 8f62c71

Please sign in to comment.