@fonoster/common 0.8.21 → 0.8.22

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.
@@ -10,3 +10,4 @@ export * from "./withErrorHandling";
10
10
  export * from "./withErrorHandlingAndValidation";
11
11
  export * from "./withValidation";
12
12
  export * from "./types";
13
+ export * from "./makeFetchSingleCallByCallId";
@@ -44,3 +44,4 @@ __exportStar(require("./withErrorHandling"), exports);
44
44
  __exportStar(require("./withErrorHandlingAndValidation"), exports);
45
45
  __exportStar(require("./withValidation"), exports);
46
46
  __exportStar(require("./types"), exports);
47
+ __exportStar(require("./makeFetchSingleCallByCallId"), exports);
@@ -0,0 +1,4 @@
1
+ import { CallDetailRecord } from "@fonoster/types";
2
+ import { InfluxDBClient } from "./types";
3
+ declare function makeFetchSingleCallByCallId(influxdb: InfluxDBClient): (callId: string) => Promise<CallDetailRecord>;
4
+ export { makeFetchSingleCallByCallId };
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createFetchSingleCall = createFetchSingleCall;
12
+ exports.makeFetchSingleCallByCallId = makeFetchSingleCallByCallId;
13
13
  /*
14
14
  * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
15
15
  * http://github.com/fonoster/fonoster
@@ -30,17 +30,17 @@ exports.createFetchSingleCall = createFetchSingleCall;
30
30
  */
31
31
  const influxdb_client_1 = require("@influxdata/influxdb-client");
32
32
  const constants_1 = require("../constants");
33
- function createFetchSingleCall(influxdb) {
34
- return (accessKeyId, callId) => __awaiter(this, void 0, void 0, function* () {
33
+ function makeFetchSingleCallByCallId(influxdb) {
34
+ return (callId) => __awaiter(this, void 0, void 0, function* () {
35
35
  const query = (0, influxdb_client_1.flux) `from(bucket: "${constants_1.INFLUXDB_CALLS_BUCKET}")
36
- |> range(start: -5m)
36
+ |> range(start: -365d)
37
37
  |> pivot(rowKey: ["callId"], columnKey: ["_field"], valueColumn: "_value")
38
38
  |> map(fn: (r) => ({
39
39
  r with
40
40
  duration: int(v: r.endedAt) - int(v: r.startedAt)
41
41
  }))
42
42
  |> filter(fn: (r) => r._measurement == "${constants_1.CALL_DETAIL_RECORD_MEASUREMENT}")
43
- |> filter(fn: (r) => r.callId == ${callId} and r.accessKeyId == "${accessKeyId}")
43
+ |> filter(fn: (r) => r.callId == ${callId})
44
44
  |> sort(columns: ["_time"], desc: true)
45
45
  |> limit(n: 1)`;
46
46
  const items = (yield influxdb.collectRows(query));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/common",
3
- "version": "0.8.21",
3
+ "version": "0.8.22",
4
4
  "description": "Common library for Fonoster projects",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -18,7 +18,7 @@
18
18
  "clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
19
19
  },
20
20
  "dependencies": {
21
- "@fonoster/logger": "^0.8.20",
21
+ "@fonoster/logger": "^0.8.22",
22
22
  "@grpc/grpc-js": "~1.10.6",
23
23
  "@grpc/proto-loader": "^0.7.12",
24
24
  "@influxdata/influxdb-client": "^1.35.0",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "@types/nodemailer": "^6.4.14"
48
48
  },
49
- "gitHead": "2590a20d7309494faca50831ac0c0abdb14c2308"
49
+ "gitHead": "d91a20ab24877c0c854f21395473b8332d4a6f02"
50
50
  }
@@ -1,4 +0,0 @@
1
- import { CallDetailRecord } from "@fonoster/types";
2
- import { InfluxDBClient } from "./types";
3
- declare function createFetchSingleCall(influxdb: InfluxDBClient): (accessKeyId: string, callId: string) => Promise<CallDetailRecord>;
4
- export { createFetchSingleCall };