@hestia-earth/data-api 0.0.2-1 → 0.0.2-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitlab-ci.yml CHANGED
@@ -9,7 +9,7 @@ default:
9
9
  paths:
10
10
  - node_modules/
11
11
  before_script:
12
- - npm install
12
+ - npm ci --include=dev
13
13
 
14
14
  variables:
15
15
  CONTAINER_IMAGE: hestia-data-api
package/.mocharc.js CHANGED
@@ -4,5 +4,5 @@ module.exports = {
4
4
  require: ['ts-node/register', 'source-map-support/register', 'test/prepare.ts'],
5
5
  'full-trace': true,
6
6
  'watch-files': 'src',
7
- timeout: 5000
7
+ timeout: 10000
8
8
  };
package/Dockerfile CHANGED
@@ -4,7 +4,7 @@ WORKDIR /app
4
4
 
5
5
  COPY package.json .
6
6
  COPY package-lock.json .
7
- RUN npm ci
7
+ RUN npm ci --include=dev
8
8
 
9
9
  # copy source from context
10
10
  ADD . .
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/data-api",
3
- "version": "0.0.2-1",
3
+ "version": "0.0.2-2",
4
4
  "description": "Hestia Data API definitions",
5
5
  "main": "dist/models.js",
6
6
  "typings": "dist/models.d.ts",
@@ -10,7 +10,7 @@
10
10
  "build:lambdas": "rm -rf build-lambdas && tsc -p tsconfig.lambdas.json",
11
11
  "start": "node index.js",
12
12
  "dev": "ts-node-dev --respawn --rs dev.ts --files --ignore-watch node_modules",
13
- "lint": "eslint .",
13
+ "lint": "tsc --noEmit && eslint .",
14
14
  "lint:fix": "npm run lint -- --fix",
15
15
  "test": "nyc mocha \"./**/*.spec.ts\"",
16
16
  "migrate": "ts-node scripts/run-migrations.ts",
@@ -39,31 +39,14 @@
39
39
  "@hestia-earth/schema": "^22.1.0"
40
40
  },
41
41
  "devDependencies": {
42
+ "@commitlint/cli": "^17.6.5",
43
+ "@commitlint/config-conventional": "^17.6.5",
44
+ "@hestia-earth/eslint-config": "^0.0.5",
42
45
  "@hestia-earth/pipeline-utils": "^0.10.4",
43
46
  "@sentry/node": "^7.51.2",
44
47
  "@sentry/serverless": "^7.55.2",
45
48
  "@sentry/tracing": "^7.51.2",
46
49
  "@slack/web-api": "^6.8.1",
47
- "compression": "^1.7.4",
48
- "cors": "^2.8.5",
49
- "csvtojson": "^2.0.10",
50
- "dotenv": "^16.0.3",
51
- "exit-hook": "^3.2.0",
52
- "express": "^4.17.3",
53
- "express-async-errors": "^3.1.1",
54
- "http2-express-bridge": "^1.0.7",
55
- "lodash.chunk": "^4.2.0",
56
- "lodash.uniqby": "^4.7.0",
57
- "map-obj": "^5.0.2",
58
- "morgan": "^1.10.0",
59
- "pg": "^8.11.0",
60
- "rxjs": "^7.8.1",
61
- "swagger-jsdoc": "^6.2.8",
62
- "swagger-ui-express": "^4.6.3",
63
- "winston": "^3.8.2",
64
- "@commitlint/cli": "^17.6.5",
65
- "@commitlint/config-conventional": "^17.6.5",
66
- "@hestia-earth/eslint-config": "^0.0.5",
67
50
  "@types/chai": "^4.3.5",
68
51
  "@types/chai-as-promised": "^7.1.5",
69
52
  "@types/compression": "^1.7.2",
@@ -82,20 +65,37 @@
82
65
  "@types/swagger-ui-express": "^4.1.3",
83
66
  "chai": "^4.3.7",
84
67
  "chai-as-promised": "^7.1.1",
68
+ "compression": "^1.7.4",
69
+ "cors": "^2.8.5",
70
+ "csvtojson": "^2.0.10",
71
+ "dotenv": "^16.0.3",
85
72
  "eslint": "^7.32.0",
73
+ "exit-hook": "^3.2.0",
74
+ "express": "^4.17.3",
75
+ "express-async-errors": "^3.1.1",
76
+ "http2-express-bridge": "^1.0.7",
86
77
  "husky": "^4.3.8",
87
- "mocha-prepare": "^0.1.0",
78
+ "lodash.chunk": "^4.2.0",
79
+ "lodash.uniqby": "^4.7.0",
80
+ "map-obj": "^5.0.2",
81
+ "mocha": "^10.2.0",
82
+ "morgan": "^1.10.0",
88
83
  "nyc": "^15.1.0",
84
+ "pg": "^8.11.0",
89
85
  "postgrator": "^7.1.1",
86
+ "rxjs": "^7.8.1",
90
87
  "serverless": "^3.32.2",
91
88
  "serverless-deployment-bucket": "^1.6.0",
92
89
  "serverless-offline": "^12.0.4",
93
90
  "sinon": "^15.1.0",
94
91
  "standard-version": "^9.5.0",
95
92
  "supertest": "^6.3.3",
93
+ "swagger-jsdoc": "^6.2.8",
94
+ "swagger-ui-express": "^4.6.3",
96
95
  "ts-node": "^10.9.1",
97
96
  "ts-node-dev": "^2.0.0",
98
- "typescript": "^5.0.0"
97
+ "typescript": "^5.0.0",
98
+ "winston": "^3.8.2"
99
99
  },
100
100
  "husky": {
101
101
  "hooks": {
package/src/routes.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import { Express } from 'express';
2
+ import aggregatedNodes from './aggregated-nodes/routes';
2
3
 
3
4
  const routes = (app: Express) => {
4
- app.use('/', (req, res) => {
5
- res.send('Hello World!');
6
- });
5
+ app.use('/aggregated-nodes', aggregatedNodes());
7
6
  };
8
7
 
9
8
  export default routes;
package/test/prepare.ts CHANGED
@@ -1,15 +1,13 @@
1
- import prepare from 'mocha-prepare';
2
1
  import * as dotenv from 'dotenv';
3
2
  dotenv.config({ path: '.env.test' });
4
3
 
5
4
  let endPool: () => Promise<void>;
6
5
 
7
- prepare(
8
- (done) => {
6
+ export const mochaHooks = {
7
+ beforeAll() {
9
8
  ({ endPool } = require('../database/'));
10
- done();
11
9
  },
12
- (done) => {
10
+ afterAll(done) {
13
11
  endPool().finally(() => done());
14
12
  }
15
- );
13
+ };
package/tsconfig.json CHANGED
@@ -1,4 +1,9 @@
1
1
  {
2
+ "ts-node": {
3
+ "files": true,
4
+ "typeCheck": false,
5
+ "transpileOnly": true
6
+ },
2
7
  "compilerOptions": {
3
8
  "target": "es2017",
4
9
  "module": "node16",
@@ -1,33 +0,0 @@
1
- import { expect } from 'chai';
2
- import * as sinon from 'sinon';
3
- import 'mocha';
4
- import express from 'express';
5
- import supertest from 'supertest';
6
- import bodyParser from 'body-parser';
7
-
8
- import routes from './routes';
9
- import { errorHandler } from './errors';
10
-
11
- let stubs: sinon.SinonStub[] = [];
12
-
13
- const app = express();
14
- app.use(bodyParser.json());
15
- routes(app);
16
- app.use(errorHandler);
17
-
18
- describe('routes', () => {
19
- beforeEach(() => {
20
- stubs = [];
21
- });
22
-
23
- afterEach(() => {
24
- stubs.forEach((stub) => stub.restore());
25
- });
26
-
27
- describe('GET /', () => {
28
- it('returns hello world', async () => {
29
- const result = await supertest(app).get('/');
30
- expect(result.text).to.equal('Hello World!');
31
- });
32
- });
33
- });