@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.
Files changed (102) hide show
  1. package/package.json +3 -2
  2. package/.dockerignore +0 -25
  3. package/.env.test +0 -7
  4. package/.eslintignore +0 -7
  5. package/.eslintrc.js +0 -11
  6. package/.gitlab-ci.yml +0 -125
  7. package/.mocharc.js +0 -8
  8. package/.nvrm +0 -1
  9. package/.nycrc +0 -15
  10. package/Dockerfile +0 -17
  11. package/cleanup-docker.sh +0 -4
  12. package/commitlint.config.js +0 -1
  13. package/database/index.ts +0 -76
  14. package/database/migrations/001.do.init.sql +0 -53
  15. package/database/migrations/002.do.add-aggregated-sites.sql +0 -16
  16. package/database/migrations/003.do.add-generated-period-cols.sql +0 -7
  17. package/database/migrations/index.ts +0 -36
  18. package/database/seed/common.ts +0 -7
  19. package/database/seed/index.ts +0 -55
  20. package/database/seed/local/index.ts +0 -28
  21. package/database/seed/production/index.ts +0 -3
  22. package/database/seed/staging/index.ts +0 -5
  23. package/database/seed/test/index.ts +0 -28
  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/run-docker.sh +0 -14
  31. package/run-test.sh +0 -5
  32. package/scripts/run-lambda.ts +0 -10
  33. package/scripts/run-migrations.ts +0 -18
  34. package/scripts/run-resetdb.ts +0 -18
  35. package/scripts/run-seed.ts +0 -18
  36. package/serverless.yml +0 -76
  37. package/src/aggregated-nodes/model/index.ts +0 -37
  38. package/src/aggregated-nodes/routes/pg-get-filters.ts +0 -44
  39. package/src/aggregated-nodes/routes/pg-get.ts +0 -50
  40. package/src/aggregated-nodes/routes.spec.ts +0 -242
  41. package/src/aggregated-nodes/routes.ts +0 -56
  42. package/src/aggregated-nodes/services/pg-get-filters.ts +0 -52
  43. package/src/aggregated-nodes/services/pg-get.ts +0 -77
  44. package/src/app.spec.ts +0 -34
  45. package/src/app.ts +0 -59
  46. package/src/config.ts +0 -21
  47. package/src/cors.spec.ts +0 -32
  48. package/src/cors.ts +0 -7
  49. package/src/errors.spec.ts +0 -114
  50. package/src/errors.ts +0 -121
  51. package/src/index.spec.ts +0 -94
  52. package/src/index.ts +0 -14
  53. package/src/lambdas/sentry.ts +0 -12
  54. package/src/lambdas/update-aggregated-nodes/handler.spec.ts +0 -86
  55. package/src/lambdas/update-aggregated-nodes/handler.ts +0 -141
  56. package/src/logger.spec.ts +0 -20
  57. package/src/logger.ts +0 -45
  58. package/src/maintenance.spec.ts +0 -76
  59. package/src/maintenance.ts +0 -19
  60. package/src/models.ts +0 -1
  61. package/src/routes.ts +0 -8
  62. package/src/settings/model/index.ts +0 -21
  63. package/src/settings/routes/get.spec.ts +0 -33
  64. package/src/settings/routes/get.ts +0 -3
  65. package/src/settings/routes/update.spec.ts +0 -33
  66. package/src/settings/routes/update.ts +0 -5
  67. package/src/settings/routes.spec.ts +0 -75
  68. package/src/settings/routes.ts +0 -21
  69. package/src/settings/services/get.spec.ts +0 -62
  70. package/src/settings/services/get.ts +0 -18
  71. package/src/settings/services/update.spec.ts +0 -118
  72. package/src/settings/services/update.ts +0 -47
  73. package/src/slack.spec.ts +0 -42
  74. package/src/slack.ts +0 -17
  75. package/src/swagger/routes.ts +0 -57
  76. package/src/types/async-express-errors/index.d.ts +0 -1
  77. package/src/types/express/index.d.ts +0 -10
  78. package/src/utils/endpoint-wrapper.spec.ts +0 -80
  79. package/src/utils/endpoint-wrapper.ts +0 -16
  80. package/src/utils/middleware.spec.ts +0 -154
  81. package/src/utils/middleware.ts +0 -33
  82. package/test/Dockerfile +0 -13
  83. package/test/docker-compose.yml +0 -40
  84. package/test/fixtures/aggregated-nodes/get.ts +0 -184
  85. package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-cycle_pivoted.csv +0 -5
  86. package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-cycle_pivoted.csv.cycle.json +0 -458
  87. package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-cycle_pivoted.csv.site.json +0 -182
  88. package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-impactassessment_pivoted.csv +0 -3
  89. package/test/fixtures/update-aggregated-nodes/abyssinianKaleSeedWhole-impactassessment_pivoted.csv.impactAssessment.json +0 -988
  90. package/test/fixtures/update-aggregated-nodes/abyssinianKaleStraw-impactassessment_pivoted.csv +0 -3
  91. package/test/fixtures/update-aggregated-nodes/cycle-missing-impactassessment_pivoted.csv +0 -3
  92. package/test/fixtures/update-aggregated-nodes/tomatoFruit-cycle_pivoted.csv +0 -5
  93. package/test/fixtures/update-aggregated-nodes/tomatoFruit-cycle_pivoted.csv.cycle.json +0 -584
  94. package/test/fixtures/update-aggregated-nodes/tomatoFruit-cycle_pivoted.csv.site.json +0 -212
  95. package/test/fixtures/update-aggregated-nodes/tomatoFruit-impactassessment_pivoted.csv +0 -3
  96. package/test/fixtures/update-aggregated-nodes/tomatoFruit-impactassessment_pivoted.csv.impactAssessment.json +0 -1002
  97. package/test/prepare.ts +0 -13
  98. package/test/utils.ts +0 -33
  99. package/tsconfig.build.json +0 -13
  100. package/tsconfig.dist.json +0 -14
  101. package/tsconfig.json +0 -42
  102. 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
- };
@@ -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
- }