@hestia-earth/data-api 0.0.2-2 → 0.0.2-4
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/package.json +3 -2
- package/.dockerignore +0 -25
- package/.env.test +0 -7
- package/.eslintignore +0 -7
- package/.eslintrc.js +0 -11
- package/.gitlab-ci.yml +0 -125
- package/.mocharc.js +0 -8
- package/.nvrm +0 -1
- package/.nycrc +0 -15
- package/Dockerfile +0 -17
- package/cleanup-docker.sh +0 -4
- package/commitlint.config.js +0 -1
- package/database/index.ts +0 -76
- package/database/migrations/001.do.init.sql +0 -53
- package/database/migrations/002.do.add-aggregated-sites.sql +0 -16
- package/database/migrations/003.do.add-generated-period-cols.sql +0 -7
- package/database/migrations/index.ts +0 -36
- package/database/seed/common.ts +0 -7
- package/database/seed/index.ts +0 -55
- package/database/seed/local/index.ts +0 -28
- package/database/seed/production/index.ts +0 -3
- package/database/seed/staging/index.ts +0 -5
- package/database/seed/test/index.ts +0 -28
- package/dev.ts +0 -3
- package/dist/aggregated-nodes/model/index.js +0 -11
- package/docker-compose.yml +0 -42
- package/envs/.master.env +0 -7
- package/envs/.staging.env +0 -7
- package/index.js +0 -3
- package/run-docker.sh +0 -14
- package/run-test.sh +0 -5
- package/scripts/run-lambda.ts +0 -10
- package/scripts/run-migrations.ts +0 -18
- package/scripts/run-resetdb.ts +0 -18
- package/scripts/run-seed.ts +0 -18
- package/serverless.yml +0 -76
- package/src/aggregated-nodes/model/index.ts +0 -37
- package/src/aggregated-nodes/routes/pg-get-filters.ts +0 -44
- package/src/aggregated-nodes/routes/pg-get.ts +0 -50
- package/src/aggregated-nodes/routes.spec.ts +0 -242
- package/src/aggregated-nodes/routes.ts +0 -56
- package/src/aggregated-nodes/services/pg-get-filters.ts +0 -52
- package/src/aggregated-nodes/services/pg-get.ts +0 -77
- package/src/app.spec.ts +0 -34
- package/src/app.ts +0 -59
- package/src/config.ts +0 -21
- package/src/cors.spec.ts +0 -32
- package/src/cors.ts +0 -7
- package/src/errors.spec.ts +0 -114
- package/src/errors.ts +0 -121
- package/src/index.spec.ts +0 -94
- package/src/index.ts +0 -14
- package/src/lambdas/sentry.ts +0 -12
- package/src/lambdas/update-aggregated-nodes/handler.spec.ts +0 -86
- package/src/lambdas/update-aggregated-nodes/handler.ts +0 -141
- package/src/logger.spec.ts +0 -20
- package/src/logger.ts +0 -45
- package/src/maintenance.spec.ts +0 -76
- package/src/maintenance.ts +0 -19
- package/src/models.ts +0 -1
- package/src/routes.ts +0 -8
- package/src/settings/model/index.ts +0 -21
- package/src/settings/routes/get.spec.ts +0 -33
- package/src/settings/routes/get.ts +0 -3
- package/src/settings/routes/update.spec.ts +0 -33
- package/src/settings/routes/update.ts +0 -5
- package/src/settings/routes.spec.ts +0 -75
- package/src/settings/routes.ts +0 -21
- package/src/settings/services/get.spec.ts +0 -62
- package/src/settings/services/get.ts +0 -18
- package/src/settings/services/update.spec.ts +0 -118
- package/src/settings/services/update.ts +0 -47
- package/src/slack.spec.ts +0 -42
- package/src/slack.ts +0 -17
- package/src/swagger/routes.ts +0 -57
- package/src/types/async-express-errors/index.d.ts +0 -1
- package/src/types/express/index.d.ts +0 -10
- package/src/utils/endpoint-wrapper.spec.ts +0 -80
- package/src/utils/endpoint-wrapper.ts +0 -16
- package/src/utils/middleware.spec.ts +0 -154
- package/src/utils/middleware.ts +0 -33
- package/test/Dockerfile +0 -13
- package/test/docker-compose.yml +0 -40
- package/test/fixtures/aggregated-nodes/get.ts +0 -184
- package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-cycle_pivoted.csv +0 -5
- package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-cycle_pivoted.csv.cycle.json +0 -458
- package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-cycle_pivoted.csv.site.json +0 -182
- package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-impactassessment_pivoted.csv +0 -3
- package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-impactassessment_pivoted.csv.impactAssessment.json +0 -988
- package/test/fixtures/update-aggregated-nodes/abyssinianKaleStraw-impactassessment_pivoted.csv +0 -3
- package/test/fixtures/update-aggregated-nodes/cycle-missing-impactassessment_pivoted.csv +0 -3
- package/test/fixtures/update-aggregated-nodes/tomatoFruit-cycle_pivoted.csv +0 -5
- package/test/fixtures/update-aggregated-nodes/tomatoFruit-cycle_pivoted.csv.cycle.json +0 -584
- package/test/fixtures/update-aggregated-nodes/tomatoFruit-cycle_pivoted.csv.site.json +0 -212
- package/test/fixtures/update-aggregated-nodes/tomatoFruit-impactassessment_pivoted.csv +0 -3
- package/test/fixtures/update-aggregated-nodes/tomatoFruit-impactassessment_pivoted.csv.impactAssessment.json +0 -1002
- package/test/prepare.ts +0 -13
- package/test/utils.ts +0 -33
- package/tsconfig.build.json +0 -13
- package/tsconfig.dist.json +0 -14
- package/tsconfig.json +0 -42
- package/tsconfig.lambdas.json +0 -13
package/test/prepare.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as dotenv from 'dotenv';
|
|
2
|
-
dotenv.config({ path: '.env.test' });
|
|
3
|
-
|
|
4
|
-
let endPool: () => Promise<void>;
|
|
5
|
-
|
|
6
|
-
export const mochaHooks = {
|
|
7
|
-
beforeAll() {
|
|
8
|
-
({ endPool } = require('../database/'));
|
|
9
|
-
},
|
|
10
|
-
afterAll(done) {
|
|
11
|
-
endPool().finally(() => done());
|
|
12
|
-
}
|
|
13
|
-
};
|
package/test/utils.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { resolve, join } from 'path';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import { query } from '../database';
|
|
4
|
-
import { seed } from '../database/seed';
|
|
5
|
-
import * as testSeeds from '../database/seed/test';
|
|
6
|
-
import * as commonSeeds from '../database/seed/common';
|
|
7
|
-
import { runMigrations } from '../database/migrations';
|
|
8
|
-
|
|
9
|
-
export const fixtures = Object.freeze({ ...commonSeeds, ...testSeeds });
|
|
10
|
-
|
|
11
|
-
export const FIXTURES_DIR = resolve(join(__dirname, 'fixtures'));
|
|
12
|
-
|
|
13
|
-
export const loadFixture = (path: string) => readFileSync(join(FIXTURES_DIR, path), 'utf-8');
|
|
14
|
-
|
|
15
|
-
const dbResetQuery = `
|
|
16
|
-
DROP SCHEMA public CASCADE;
|
|
17
|
-
CREATE SCHEMA public;
|
|
18
|
-
GRANT ALL ON SCHEMA public TO postgres;
|
|
19
|
-
GRANT ALL ON SCHEMA public TO public;
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
export const resetDb = async () => {
|
|
23
|
-
if (!['localhost', 'hestia-data-api-test-db', 'postgres'].includes(process.env.PGHOST || '')) {
|
|
24
|
-
throw new Error(`PGHOST=${process.env.PGHOST}: don't destroy remote DB!`);
|
|
25
|
-
}
|
|
26
|
-
await query(dbResetQuery);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const initDb = async () => {
|
|
30
|
-
await resetDb();
|
|
31
|
-
await runMigrations();
|
|
32
|
-
await seed({ ...commonSeeds, ...testSeeds });
|
|
33
|
-
};
|
package/tsconfig.build.json
DELETED
package/tsconfig.dist.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"ts-node": {
|
|
3
|
-
"files": true,
|
|
4
|
-
"typeCheck": false,
|
|
5
|
-
"transpileOnly": true
|
|
6
|
-
},
|
|
7
|
-
"compilerOptions": {
|
|
8
|
-
"target": "es2017",
|
|
9
|
-
"module": "node16",
|
|
10
|
-
"moduleResolution": "node16",
|
|
11
|
-
"stripInternal": true,
|
|
12
|
-
"emitDecoratorMetadata": true,
|
|
13
|
-
"experimentalDecorators": true,
|
|
14
|
-
"allowSyntheticDefaultImports": true,
|
|
15
|
-
"removeComments": false,
|
|
16
|
-
"noImplicitAny": false,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"lib": [
|
|
20
|
-
"es2019"
|
|
21
|
-
],
|
|
22
|
-
"baseUrl": ".",
|
|
23
|
-
"typeRoots": [
|
|
24
|
-
"./src/types",
|
|
25
|
-
"./node_modules/@types"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"include": [
|
|
29
|
-
"dev.ts",
|
|
30
|
-
"index.js",
|
|
31
|
-
"scripts/**/*.ts",
|
|
32
|
-
"database/**/*.ts",
|
|
33
|
-
"test/**/*.ts",
|
|
34
|
-
"src/**/*.ts"
|
|
35
|
-
],
|
|
36
|
-
"exclude": [
|
|
37
|
-
"node_modules"
|
|
38
|
-
],
|
|
39
|
-
"atom": {
|
|
40
|
-
"rewriteTsconfig": false
|
|
41
|
-
}
|
|
42
|
-
}
|
package/tsconfig.lambdas.json
DELETED