@golemio/air-quality-stations 1.1.12 → 1.2.0

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.
@@ -1,9 +1,11 @@
1
+ import { CacheHeaderMiddleware } from "@golemio/core/dist/output-gateway";
1
2
  import { BaseRouter } from "@golemio/core/dist/output-gateway/routes/BaseRouter";
2
3
  import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
3
4
  import { ValidationChain } from "@golemio/core/dist/shared/express-validator";
4
5
  import HistoryModel from "./models/AirQualityHistoryModel";
5
6
  export default class AirQualityHistoryRouter extends BaseRouter {
6
7
  protected historyModel: HistoryModel;
8
+ protected cacheHeaderMiddleware: CacheHeaderMiddleware;
7
9
  constructor();
8
10
  initRoutes: () => Promise<void>;
9
11
  GetAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
@@ -12,7 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ const Di_1 = require("./ioc/Di");
15
16
  const output_gateway_1 = require("@golemio/core/dist/output-gateway");
17
+ const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
16
18
  const BaseRouter_1 = require("@golemio/core/dist/output-gateway/routes/BaseRouter");
17
19
  const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
18
20
  const AirQualityHistoryModel_1 = __importDefault(require("./models/AirQualityHistoryModel"));
@@ -25,7 +27,7 @@ class AirQualityHistoryRouter extends BaseRouter_1.BaseRouter {
25
27
  (0, express_validator_1.query)("from").optional().isISO8601().not().isArray(),
26
28
  (0, express_validator_1.query)("to").optional().isISO8601().not().isArray(),
27
29
  sensorIdParam,
28
- ], output_gateway_1.pagination, output_gateway_1.checkErrors, (0, output_gateway_1.useCacheMiddleware)("3 minutes"), (0, output_gateway_1.paginationLimitMiddleware)("AirQualityHistoryRouter"), this.GetAll);
30
+ ], output_gateway_1.pagination, output_gateway_1.checkErrors, this.cacheHeaderMiddleware.getMiddleware(20 * 60, 5 * 60), (0, output_gateway_1.paginationLimitMiddleware)("AirQualityHistoryRouter"), this.GetAll);
29
31
  });
30
32
  this.GetAll = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
31
33
  const timestampFrom = new Date(req.query.from).toISOString();
@@ -48,6 +50,7 @@ class AirQualityHistoryRouter extends BaseRouter_1.BaseRouter {
48
50
  return (0, express_validator_1.query)("sensorId").optional().not().isEmpty({ ignore_whitespace: true }).not().isArray();
49
51
  });
50
52
  this.historyModel = new AirQualityHistoryModel_1.default();
53
+ this.cacheHeaderMiddleware = Di_1.AirQualityContainer.resolve(ioc_1.ContainerToken.CacheHeaderMiddleware);
51
54
  }
52
55
  }
53
56
  exports.default = AirQualityHistoryRouter;
@@ -1 +1 @@
1
- {"version":3,"file":"AirQualityHistoryRouter.js","sourceRoot":"","sources":["../../src/output-gateway/AirQualityHistoryRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sEAA2H;AAC3H,oFAAiF;AAEjF,mFAAqF;AACrF,6FAA2D;AAE3D,MAAqB,uBAAwB,SAAQ,uBAAU;IAE3D;QACI,KAAK,EAAE,CAAC;QAIL,eAAU,GAAG,GAAS,EAAE;YAC3B,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,8BAA8B,EAAE,CAAC;YAClE,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,GAAG,EACH;gBACI,IAAA,yBAAK,EAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;gBACpD,IAAA,yBAAK,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;gBAClD,aAAa;aAChB,EACD,2BAAU,EACV,4BAAW,EACX,IAAA,mCAAkB,EAAC,WAAW,CAAC,EAC/B,IAAA,0CAAyB,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AAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC;oBAC9B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;oBAChC,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,QAAkB;oBACtC,EAAE,EAAE,WAAW;iBAClB,CAAC,CAAC;gBAEH,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC9B;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,GAAG,CAAC,CAAC;aACb;QACL,CAAC,CAAA,CAAC;QAEQ,mCAA8B,GAAG,GAAmC,EAAE;YAC5E,OAAO,IAAA,yBAAK,EAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;QACnG,CAAC,CAAA,CAAC;QA1CE,IAAI,CAAC,YAAY,GAAG,IAAI,gCAAY,EAAE,CAAC;QACvC,IAAI,CAAC,qBAAqB,GAAG,wBAAmB,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;IAC1H,CAAC;CAyCJ;AAjDD,0CAiDC"}
@@ -19,6 +19,8 @@ const AirQualityHistoryRouter_1 = __importDefault(require("./AirQualityHistoryRo
19
19
  const AirQualityComponentTypes_1 = __importDefault(require("./models/AirQualityComponentTypes"));
20
20
  const AirQualityIndexesModel_1 = __importDefault(require("./models/AirQualityIndexesModel"));
21
21
  const AirQualityIndexTypesModel_1 = __importDefault(require("./models/AirQualityIndexTypesModel"));
22
+ const CACHE_MAX_AGE = 20 * 60;
23
+ const CACHE_STALE_WHILE_REVALIDATE = 5 * 60;
22
24
  class AirQualityRouter extends output_gateway_1.GeoJsonRouter {
23
25
  constructor() {
24
26
  super(new AirQualityIndexesModel_1.default());
@@ -41,9 +43,9 @@ class AirQualityRouter extends output_gateway_1.GeoJsonRouter {
41
43
  next(err);
42
44
  }
43
45
  });
44
- this.initRoutes();
45
- this.router.get("/indextypes", (0, output_gateway_1.useCacheMiddleware)(), this.GetIndexTypes);
46
- this.router.get("/componenttypes", (0, output_gateway_1.useCacheMiddleware)(), this.GetComponentTypes);
46
+ this.initRoutes({ maxAge: CACHE_MAX_AGE, staleWhileRevalidate: CACHE_STALE_WHILE_REVALIDATE });
47
+ this.router.get("/indextypes", this.cacheHeaderMiddleware.getMiddleware(CACHE_MAX_AGE, CACHE_STALE_WHILE_REVALIDATE), this.GetIndexTypes);
48
+ this.router.get("/componenttypes", this.cacheHeaderMiddleware.getMiddleware(CACHE_MAX_AGE, CACHE_STALE_WHILE_REVALIDATE), this.GetComponentTypes);
47
49
  this.airQualityComponentTypes = new AirQualityComponentTypes_1.default();
48
50
  this.airQualityIndexTypes = new AirQualityIndexTypesModel_1.default();
49
51
  const historyRouter = new AirQualityHistoryRouter_1.default();
@@ -1 +1 @@
1
- {"version":3,"file":"AirQualityRouter.js","sourceRoot":"","sources":["../../src/output-gateway/AirQualityRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sEAAsF;AACtF,+DAA4F;AAC5F,wFAAgE;AAChE,iGAA6E;AAC7E,6FAAqE;AACrE,mGAA2E;AAE3E,MAAqB,gBAAiB,SAAQ,8BAAa;IAKvD;QACI,KAAK,CAAC,IAAI,gCAAsB,EAAE,CAAC,CAAC;QALjC,WAAM,GAAW,IAAA,gBAAM,GAAE,CAAC;QAkB1B,kBAAa,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;YAC7E,IAAI;gBACA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC;gBACtD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC9B;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI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I,CAAC,qBAAqB,CAAC,aAAa,CAAC,aAAa,EAAE,4BAA4B,CAAC,EACrF,IAAI,CAAC,iBAAiB,CACzB,CAAC;QAEF,IAAI,CAAC,wBAAwB,GAAG,IAAI,kCAA4B,EAAE,CAAC;QACnE,IAAI,CAAC,oBAAoB,GAAG,IAAI,mCAAyB,EAAE,CAAC;QAE5D,MAAM,aAAa,GAAG,IAAI,iCAAuB,EAAE,CAAC;QACpD,aAAa,CAAC,UAAU,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;CAmBJ;AA5CD,mCA4CC;AAED,MAAM,gBAAgB,GAAW,IAAI,gBAAgB,EAAE,CAAC,MAAM,CAAC;AAEtD,4CAAgB"}
@@ -0,0 +1,3 @@
1
+ import { DependencyContainer } from "@golemio/core/dist/shared/tsyringe";
2
+ declare const airQualityContainer: DependencyContainer;
3
+ export { airQualityContainer as AirQualityContainer };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AirQualityContainer = void 0;
4
+ const Di_1 = require("@golemio/core/dist/output-gateway/ioc/Di");
5
+ //#region Initialization
6
+ const airQualityContainer = Di_1.OutputGatewayContainer.createChildContainer();
7
+ exports.AirQualityContainer = airQualityContainer;
8
+ //# sourceMappingURL=Di.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,iEAAkF;AAGlF,wBAAwB;AACxB,MAAM,mBAAmB,GAAwB,2BAAsB,CAAC,oBAAoB,EAAE,CAAC;AAM/D,kDAAmB"}
package/docs/openapi.yaml CHANGED
@@ -68,15 +68,15 @@ paths:
68
68
  schema:
69
69
  type: string
70
70
  example: "2019-05-18T07:38:37.000Z"
71
- - name: x-access-token
72
- in: header
73
- description: e.g. YOUR_ACCESS_TOKEN
74
- schema:
75
- type: string
76
- example: YOUR_ACCESS_TOKEN
77
71
  responses:
78
72
  200:
79
73
  description: OK
74
+ headers:
75
+ Cache-Control:
76
+ description: Cache control directive for caching proxies
77
+ schema:
78
+ type: string
79
+ example: public, s-maxage=1200, stale-while-revalidate=300
80
80
  content:
81
81
  application/json; charset=utf-8:
82
82
  schema:
@@ -111,6 +111,45 @@ paths:
111
111
  name: Praha 4-Chodov
112
112
  updated_at: "2019-05-18T07:38:37.000Z"
113
113
  type: Feature
114
+ 401:
115
+ $ref: "#/components/responses/UnauthorizedError"
116
+ 403:
117
+ description: Forbidden
118
+ content:
119
+ application/json; charset=utf-8:
120
+ schema:
121
+ $ref: "#/components/schemas/Error"
122
+ example:
123
+ error_message: Forbidden
124
+ error_status: 403
125
+ /v2/airqualitystations/componenttypes:
126
+ get:
127
+ tags:
128
+ - 🌦 Air Quality (v2)
129
+ summary: GET Air Quality Station Component Types
130
+ responses:
131
+ 200:
132
+ description: OK
133
+ headers:
134
+ Cache-Control:
135
+ description: Cache control directive for caching proxies
136
+ schema:
137
+ type: string
138
+ example: public, s-maxage=1200, stale-while-revalidate=300
139
+ content:
140
+ application/json; charset=utf-8:
141
+ schema:
142
+ type: array
143
+ items:
144
+ $ref: "#/components/schemas/AirQualityStationComponentType"
145
+ example:
146
+ - id: 1
147
+ component_code: SO2
148
+ unit: µg/m³
149
+ description_cs: oxid siřičitý
150
+ description_en: sulfur dioxide
151
+ 401:
152
+ $ref: "#/components/responses/UnauthorizedError"
114
153
  403:
115
154
  description: Forbidden
116
155
  content:
@@ -157,15 +196,15 @@ paths:
157
196
  schema:
158
197
  type: string
159
198
  example: "12345"
160
- - name: x-access-token
161
- in: header
162
- description: e.g. YOUR_ACCESS_TOKEN
163
- schema:
164
- type: string
165
- example: YOUR_ACCESS_TOKEN
166
199
  responses:
167
200
  200:
168
201
  description: OK
202
+ headers:
203
+ Cache-Control:
204
+ description: Cache control directive for caching proxies
205
+ schema:
206
+ type: string
207
+ example: public, s-maxage=1200, stale-while-revalidate=300
169
208
  content:
170
209
  application/json; charset=utf-8:
171
210
  schema:
@@ -182,6 +221,48 @@ paths:
182
221
  value: 10.7
183
222
  type: NO2
184
223
  updated_at: "2019-05-18T07:38:37.000Z"
224
+ 401:
225
+ $ref: "#/components/responses/UnauthorizedError"
226
+ 403:
227
+ description: Forbidden
228
+ content:
229
+ application/json; charset=utf-8:
230
+ schema:
231
+ $ref: "#/components/schemas/Error"
232
+ example:
233
+ error_message: Forbidden
234
+ error_status: 403
235
+ /v2/airqualitystations/indextypes:
236
+ get:
237
+ tags:
238
+ - 🌦 Air Quality (v2)
239
+ summary: GET Air Quality Station Index Types
240
+ responses:
241
+ 200:
242
+ description: OK
243
+ headers:
244
+ Cache-Control:
245
+ description: Cache control directive for caching proxies
246
+ schema:
247
+ type: string
248
+ example: public, s-maxage=1200, stale-while-revalidate=300
249
+ content:
250
+ application/json; charset=utf-8:
251
+ schema:
252
+ type: array
253
+ items:
254
+ $ref: "#/components/schemas/AirQualityStationIndexType"
255
+ example:
256
+ - id: 1
257
+ index_code: 1A
258
+ limit_gte: 0
259
+ limit_lt: 0.34
260
+ color: "009900"
261
+ color_text: "000000"
262
+ description_cs: velmi dobrá až dobrá
263
+ description_en: very good to good
264
+ 401:
265
+ $ref: "#/components/responses/UnauthorizedError"
185
266
  403:
186
267
  description: Forbidden
187
268
  content:
@@ -192,6 +273,13 @@ paths:
192
273
  error_message: Forbidden
193
274
  error_status: 403
194
275
  components:
276
+ responses:
277
+ UnauthorizedError:
278
+ description: API key is missing or invalid
279
+ headers:
280
+ x-access-token:
281
+ schema:
282
+ type: string
195
283
  schemas:
196
284
  Point:
197
285
  title: Point
@@ -283,6 +371,31 @@ components:
283
371
  type:
284
372
  type: string
285
373
  example: NO2
374
+ AirQualityStationComponentType:
375
+ title: Air Quality Station Component Type
376
+ type: object
377
+ required:
378
+ - id
379
+ properties:
380
+ id:
381
+ type: number
382
+ example: 1
383
+ component_code:
384
+ type: string
385
+ nullable: true
386
+ example: SO2
387
+ unit:
388
+ type: string
389
+ nullable: true
390
+ example: µg/m³
391
+ description_cs:
392
+ type: string
393
+ nullable: true
394
+ example: oxid siřičitý
395
+ description_en:
396
+ type: string
397
+ nullable: true
398
+ example: sulfur dioxide
286
399
  AirQualityStationHistory:
287
400
  title: Air Quality Station History
288
401
  required:
@@ -305,3 +418,40 @@ components:
305
418
  updated_at:
306
419
  type: string
307
420
  example: "2019-05-18T07:38:37.000Z"
421
+ AirQualityStationIndexType:
422
+ title: Air Quality Station Index Type
423
+ type: object
424
+ required:
425
+ - id
426
+ properties:
427
+ id:
428
+ type: number
429
+ example: 1
430
+ index_code:
431
+ type: string
432
+ nullable: true
433
+ example: 1A
434
+ limit_gte:
435
+ type: number
436
+ nullable: true
437
+ example: 0
438
+ limit_lt:
439
+ type: number
440
+ nullable: true
441
+ example: 0.34
442
+ color:
443
+ type: string
444
+ nullable: true
445
+ example: "009900"
446
+ color_text:
447
+ type: string
448
+ nullable: true
449
+ example: "000000"
450
+ description_cs:
451
+ type: string
452
+ nullable: true
453
+ example: velmi dobrá až dobrá
454
+ description_en:
455
+ type: string
456
+ nullable: true
457
+ example: very good to good
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/air-quality-stations",
3
- "version": "1.1.12",
3
+ "version": "1.2.0",
4
4
  "description": "Golemio Air Quality Stations Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  "@commitlint/config-conventional": "^11.0.0",
37
37
  "@golemio/city-districts": "1.2.10",
38
38
  "@golemio/cli": "1.5.0",
39
- "@golemio/core": "1.10.2",
39
+ "@golemio/core": "1.10.3",
40
40
  "@golemio/db-common": "1.1.4",
41
41
  "@golemio/eslint-config": "1.1.2",
42
42
  "@types/chai": "4.2.3",
@@ -44,6 +44,7 @@
44
44
  "@types/mocha": "^8.2.0",
45
45
  "@types/node": "^20.12.7",
46
46
  "@types/sinon": "^9.0.10",
47
+ "@types/supertest": "^6.0.2",
47
48
  "chai": "4.2.0",
48
49
  "chai-as-promised": "7.1.1",
49
50
  "cross-env": "^7.0.3",
@@ -57,6 +58,7 @@
57
58
  "rimraf": "^3.0.2",
58
59
  "sinon": "^9.2.3",
59
60
  "source-map-support": "0.5.21",
61
+ "supertest": "^7.0.0",
60
62
  "ts-node": "^10.9.1",
61
63
  "ts-patch": "3.0.0-beta3",
62
64
  "tsconfig-paths": "^4.2.0",