@hestia-earth/data-api 0.0.2-3 → 0.0.2-5

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.
Files changed (103) hide show
  1. package/dist/aggregated-nodes/model/index.d.ts +42 -5
  2. package/package.json +2 -2
  3. package/.dockerignore +0 -25
  4. package/.env.test +0 -7
  5. package/.eslintignore +0 -7
  6. package/.eslintrc.js +0 -11
  7. package/.gitlab-ci.yml +0 -128
  8. package/.mocharc.js +0 -8
  9. package/.nvmrc +0 -1
  10. package/.nycrc +0 -15
  11. package/Dockerfile +0 -17
  12. package/cleanup-docker.sh +0 -4
  13. package/commitlint.config.js +0 -1
  14. package/database/index.ts +0 -76
  15. package/database/migrations/001.do.init.sql +0 -53
  16. package/database/migrations/002.do.add-aggregated-sites.sql +0 -16
  17. package/database/migrations/003.do.add-generated-period-cols.sql +0 -7
  18. package/database/migrations/index.ts +0 -36
  19. package/database/seed/common.ts +0 -7
  20. package/database/seed/index.ts +0 -60
  21. package/database/seed/local/index.ts +0 -28
  22. package/database/seed/production/index.ts +0 -3
  23. package/database/seed/staging/index.ts +0 -5
  24. package/dev.ts +0 -3
  25. package/dist/aggregated-nodes/model/index.js +0 -11
  26. package/docker-compose.yml +0 -42
  27. package/envs/.master.env +0 -7
  28. package/envs/.staging.env +0 -7
  29. package/index.js +0 -3
  30. package/package.serverless.json +0 -21
  31. package/run-docker.sh +0 -14
  32. package/run-test.sh +0 -5
  33. package/scripts/run-lambda.ts +0 -10
  34. package/scripts/run-migrations.ts +0 -18
  35. package/scripts/run-resetdb.ts +0 -18
  36. package/scripts/run-seed.ts +0 -18
  37. package/serverless.yml +0 -101
  38. package/src/aggregated-nodes/model/index.ts +0 -37
  39. package/src/aggregated-nodes/routes/pg-get-filters.ts +0 -54
  40. package/src/aggregated-nodes/routes/pg-get.ts +0 -61
  41. package/src/aggregated-nodes/routes.spec.ts +0 -274
  42. package/src/aggregated-nodes/routes.ts +0 -56
  43. package/src/aggregated-nodes/services/pg-get-filters.ts +0 -62
  44. package/src/aggregated-nodes/services/pg-get.ts +0 -77
  45. package/src/app.spec.ts +0 -34
  46. package/src/app.ts +0 -59
  47. package/src/config.ts +0 -21
  48. package/src/cors.spec.ts +0 -32
  49. package/src/cors.ts +0 -7
  50. package/src/errors.spec.ts +0 -114
  51. package/src/errors.ts +0 -121
  52. package/src/index.spec.ts +0 -94
  53. package/src/index.ts +0 -14
  54. package/src/lambdas/sentry.ts +0 -12
  55. package/src/lambdas/update-aggregated-nodes/handler.spec.ts +0 -77
  56. package/src/lambdas/update-aggregated-nodes/handler.ts +0 -129
  57. package/src/logger.spec.ts +0 -20
  58. package/src/logger.ts +0 -45
  59. package/src/maintenance.spec.ts +0 -76
  60. package/src/maintenance.ts +0 -19
  61. package/src/models.ts +0 -1
  62. package/src/routes.ts +0 -8
  63. package/src/settings/model/index.ts +0 -21
  64. package/src/settings/routes/get.spec.ts +0 -33
  65. package/src/settings/routes/get.ts +0 -3
  66. package/src/settings/routes/update.spec.ts +0 -33
  67. package/src/settings/routes/update.ts +0 -5
  68. package/src/settings/routes.spec.ts +0 -75
  69. package/src/settings/routes.ts +0 -21
  70. package/src/settings/services/get.spec.ts +0 -62
  71. package/src/settings/services/get.ts +0 -18
  72. package/src/settings/services/update.spec.ts +0 -118
  73. package/src/settings/services/update.ts +0 -47
  74. package/src/slack.spec.ts +0 -42
  75. package/src/slack.ts +0 -17
  76. package/src/swagger/routes.ts +0 -57
  77. package/src/types/async-express-errors/index.d.ts +0 -1
  78. package/src/types/express/index.d.ts +0 -10
  79. package/src/utils/endpoint-wrapper.spec.ts +0 -80
  80. package/src/utils/endpoint-wrapper.ts +0 -16
  81. package/src/utils/middleware.spec.ts +0 -154
  82. package/src/utils/middleware.ts +0 -33
  83. package/test/Dockerfile +0 -13
  84. package/test/docker-compose.yml +0 -40
  85. package/test/fixtures/aggregated-nodes/get.ts +0 -196
  86. package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-cycle_pivoted.csv +0 -5
  87. package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-cycle_pivoted.csv.cycle.json +0 -458
  88. package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-cycle_pivoted.csv.site.json +0 -182
  89. package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-impactassessment_pivoted.csv +0 -3
  90. package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-impactassessment_pivoted.csv.impactAssessment.json +0 -988
  91. package/test/fixtures/update-aggregated-nodes/abyssinianKaleStraw-impactassessment_pivoted.csv +0 -3
  92. package/test/fixtures/update-aggregated-nodes/cycle-missing-impactassessment_pivoted.csv +0 -3
  93. package/test/fixtures/update-aggregated-nodes/tomatoFruit-cycle_pivoted.csv +0 -5
  94. package/test/fixtures/update-aggregated-nodes/tomatoFruit-cycle_pivoted.csv.cycle.json +0 -584
  95. package/test/fixtures/update-aggregated-nodes/tomatoFruit-cycle_pivoted.csv.site.json +0 -212
  96. package/test/fixtures/update-aggregated-nodes/tomatoFruit-impactassessment_pivoted.csv +0 -3
  97. package/test/fixtures/update-aggregated-nodes/tomatoFruit-impactassessment_pivoted.csv.impactAssessment.json +0 -1002
  98. package/test/prepare.ts +0 -13
  99. package/test/utils.ts +0 -32
  100. package/tsconfig.build.json +0 -13
  101. package/tsconfig.dist.json +0 -14
  102. package/tsconfig.json +0 -42
  103. 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,32 +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 commonSeeds from '../database/seed/common';
6
- import { runMigrations } from '../database/migrations';
7
-
8
- export const fixtures = Object.freeze({ ...commonSeeds });
9
-
10
- export const FIXTURES_DIR = resolve(join(__dirname, 'fixtures'));
11
-
12
- export const loadFixture = (path: string) => readFileSync(join(FIXTURES_DIR, path), 'utf-8');
13
-
14
- const dbResetQuery = `
15
- DROP SCHEMA public CASCADE;
16
- CREATE SCHEMA public;
17
- GRANT ALL ON SCHEMA public TO postgres;
18
- GRANT ALL ON SCHEMA public TO public;
19
- `;
20
-
21
- export const resetDb = async () => {
22
- if (!['localhost', 'hestia-data-api-test-db', 'postgres'].includes(process.env.PGHOST || '')) {
23
- throw new Error(`PGHOST=${process.env.PGHOST}: don't destroy remote DB!`);
24
- }
25
- await query(dbResetQuery);
26
- };
27
-
28
- export const initDb = async () => {
29
- await resetDb();
30
- await runMigrations();
31
- await seed({ ...commonSeeds });
32
- };
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "target": "es2019",
5
- "rootDir": ".",
6
- "outDir": "build",
7
- "sourceMap": true,
8
- "allowJs": true
9
- },
10
- "include": [
11
- "src/index.ts"
12
- ]
13
- }
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "rootDir": "./src",
5
- "outDir": "dist",
6
- "sourceMap": false,
7
- "declaration": true,
8
- "removeComments": true
9
- },
10
- "include": [
11
- "src/models.ts"
12
- ]
13
- }
14
-
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
- }
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "target": "es2019",
5
- "rootDir": ".",
6
- "outDir": "build",
7
- "sourceMap": true,
8
- "allowJs": true
9
- },
10
- "include": [
11
- "src/lambdas/**/handler.ts"
12
- ]
13
- }