@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.
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -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);
|
|
@@ -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.
|
|
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
|
|
34
|
-
return (
|
|
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: -
|
|
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}
|
|
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.
|
|
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.
|
|
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": "
|
|
49
|
+
"gitHead": "d91a20ab24877c0c854f21395473b8332d4a6f02"
|
|
50
50
|
}
|