@routr/pgdata 2.0.8-alpha.29 → 2.0.8-alpha.31
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/api/create.js +1 -1
- package/dist/api/delete.js +1 -1
- package/dist/api/find.js +1 -1
- package/dist/api/get.js +6 -1
- package/dist/api/list.js +1 -1
- package/dist/api/update.js +3 -4
- package/dist/envs.d.ts +1 -0
- package/dist/envs.js +23 -0
- package/dist/healthcheck.d.ts +1 -0
- package/dist/healthcheck.js +23 -0
- package/dist/runner.js +3 -5
- package/dist/service.js +8 -3
- package/dist/tracer.js +1 -1
- package/package.json +9 -6
package/dist/api/create.js
CHANGED
|
@@ -34,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.create = void 0;
|
|
36
36
|
/*
|
|
37
|
-
* Copyright (C)
|
|
37
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
38
38
|
* http://github.com/fonoster/routr
|
|
39
39
|
*
|
|
40
40
|
* This file is part of Routr
|
package/dist/api/delete.js
CHANGED
|
@@ -34,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.del = void 0;
|
|
36
36
|
/*
|
|
37
|
-
* Copyright (C)
|
|
37
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
38
38
|
* http://github.com/fonoster/routr
|
|
39
39
|
*
|
|
40
40
|
* This file is part of Routr
|
package/dist/api/find.js
CHANGED
|
@@ -34,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.findBy = void 0;
|
|
36
36
|
/*
|
|
37
|
-
* Copyright (C)
|
|
37
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
38
38
|
* http://github.com/fonoster/routr
|
|
39
39
|
*
|
|
40
40
|
* This file is part of Routr
|
package/dist/api/get.js
CHANGED
|
@@ -34,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.get = void 0;
|
|
36
36
|
/*
|
|
37
|
-
* Copyright (C)
|
|
37
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
38
38
|
* http://github.com/fonoster/routr
|
|
39
39
|
*
|
|
40
40
|
* This file is part of Routr
|
|
@@ -83,7 +83,12 @@ function get(operation, kind) {
|
|
|
83
83
|
code: grpc.status.UNAVAILABLE,
|
|
84
84
|
message: "database is not available"
|
|
85
85
|
}, null);
|
|
86
|
+
return;
|
|
86
87
|
}
|
|
88
|
+
callback({
|
|
89
|
+
code: grpc.status.UNKNOWN,
|
|
90
|
+
message: "unknown database error"
|
|
91
|
+
}, null);
|
|
87
92
|
}
|
|
88
93
|
});
|
|
89
94
|
}
|
package/dist/api/list.js
CHANGED
|
@@ -34,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.list = void 0;
|
|
36
36
|
/*
|
|
37
|
-
* Copyright (C)
|
|
37
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
38
38
|
* http://github.com/fonoster/routr
|
|
39
39
|
*
|
|
40
40
|
* This file is part of Routr
|
package/dist/api/update.js
CHANGED
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.update = void 0;
|
|
13
13
|
/*
|
|
14
|
-
* Copyright (C)
|
|
14
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
15
15
|
* http://github.com/fonoster/routr
|
|
16
16
|
*
|
|
17
17
|
* This file is part of Routr
|
|
@@ -32,7 +32,6 @@ exports.update = void 0;
|
|
|
32
32
|
const pb_util_1 = require("pb-util");
|
|
33
33
|
const common_1 = require("@routr/common");
|
|
34
34
|
const utils_1 = require("../mappers/utils");
|
|
35
|
-
const connect_1 = require("@routr/common/src/connect");
|
|
36
35
|
const client_1 = require("@prisma/client");
|
|
37
36
|
// TODO: The entire function should be wrapped in a transaction
|
|
38
37
|
// TODO: We should reuse the prisma client
|
|
@@ -47,14 +46,14 @@ function update(operation, kind) {
|
|
|
47
46
|
const Manager = (0, utils_1.getManager)(kind);
|
|
48
47
|
const manager = new Manager(request);
|
|
49
48
|
manager.validOrThrowUpdate();
|
|
50
|
-
if (kind ===
|
|
49
|
+
if (kind === common_1.CommonConnect.Kind.DOMAIN) {
|
|
51
50
|
yield prisma.egressPolicy.deleteMany({
|
|
52
51
|
where: {
|
|
53
52
|
domainRef: request.ref
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
55
|
}
|
|
57
|
-
if (kind ===
|
|
56
|
+
if (kind === common_1.CommonConnect.Kind.TRUNK) {
|
|
58
57
|
yield prisma.trunkURI.deleteMany({
|
|
59
58
|
where: {
|
|
60
59
|
trunkRef: request.ref
|
package/dist/envs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BIND_ADDR: string;
|
package/dist/envs.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.BIND_ADDR = void 0;
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
7
|
+
* http://github.com/fonoster
|
|
8
|
+
*
|
|
9
|
+
* This file is part of Routr.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the MIT License (the "License");
|
|
12
|
+
* you may not use this file except in compliance with
|
|
13
|
+
* the License. You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* https://opensource.org/licenses/MIT
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
exports.BIND_ADDR = (_a = process.env.BIND_ADDR) !== null && _a !== void 0 ? _a : "0.0.0.0:51907";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
5
|
+
* http://github.com/fonoster
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Routr.
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the MIT License (the "License");
|
|
10
|
+
* you may not use this file except in compliance with
|
|
11
|
+
* the License. You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* https://opensource.org/licenses/MIT
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
const common_1 = require("@routr/common");
|
|
22
|
+
const envs_1 = require("./envs");
|
|
23
|
+
common_1.HealthCheck.check(envs_1.BIND_ADDR);
|
package/dist/runner.js
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
|
-
var _a;
|
|
7
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
7
|
/*
|
|
9
|
-
* Copyright (C)
|
|
8
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
10
9
|
* http://github.com/fonoster/routr
|
|
11
10
|
*
|
|
12
11
|
* This file is part of Routr
|
|
@@ -27,11 +26,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
27
26
|
require("./tracer").init("simpleauth");
|
|
28
27
|
const service_1 = __importDefault(require("./service"));
|
|
29
28
|
const logger_1 = require("@fonoster/logger");
|
|
29
|
+
const envs_1 = require("./envs");
|
|
30
30
|
const logger = (0, logger_1.getLogger)({ service: "pgdata", filePath: __filename });
|
|
31
31
|
try {
|
|
32
|
-
(0, service_1.default)({
|
|
33
|
-
bindAddr: (_a = process.env.BIND_ADDR) !== null && _a !== void 0 ? _a : "0.0.0.0:51907"
|
|
34
|
-
});
|
|
32
|
+
(0, service_1.default)({ bindAddr: envs_1.BIND_ADDR });
|
|
35
33
|
}
|
|
36
34
|
catch (e) {
|
|
37
35
|
logger.error(e);
|
package/dist/service.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
/*
|
|
27
|
-
* Copyright (C)
|
|
27
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
28
28
|
* http://github.com/fonoster/routr
|
|
29
29
|
*
|
|
30
30
|
* This file is part of Routr
|
|
@@ -51,6 +51,9 @@ const get_1 = require("./api/get");
|
|
|
51
51
|
const delete_1 = require("./api/delete");
|
|
52
52
|
const find_1 = require("./api/find");
|
|
53
53
|
const list_1 = require("./api/list");
|
|
54
|
+
const grpc_health_check_1 = require("@fonoster/grpc-health-check");
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
56
|
+
const interceptor = require("grpc-interceptors");
|
|
54
57
|
const prisma = new client_1.PrismaClient();
|
|
55
58
|
const logger = (0, logger_1.getLogger)({ service: "pgdata", filePath: __filename });
|
|
56
59
|
/**
|
|
@@ -83,8 +86,10 @@ function pgDataService(config) {
|
|
|
83
86
|
list: (0, list_1.list)(delegate.findMany, k)
|
|
84
87
|
});
|
|
85
88
|
});
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
const credentials = grpc.ServerCredentials.createInsecure();
|
|
90
|
+
const withHealthChecks = interceptor.serverProxy((0, grpc_health_check_1.useHealth)(server));
|
|
91
|
+
withHealthChecks.bindAsync(config.bindAddr, credentials, () => {
|
|
92
|
+
withHealthChecks.start();
|
|
88
93
|
});
|
|
89
94
|
}
|
|
90
95
|
exports.default = pgDataService;
|
package/dist/tracer.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.init = void 0;
|
|
7
7
|
/*
|
|
8
|
-
* Copyright (C)
|
|
8
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/routr
|
|
10
10
|
*
|
|
11
11
|
* This file is part of Routr
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/pgdata",
|
|
3
|
-
"version": "2.0.8-alpha.
|
|
3
|
+
"version": "2.0.8-alpha.31",
|
|
4
4
|
"description": "Postgres API Server for Routr Connect",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
"build": "tsc -b tsconfig.json"
|
|
17
17
|
},
|
|
18
18
|
"bin": {
|
|
19
|
-
"run_pgdata": "dist/runner.js"
|
|
19
|
+
"run_pgdata": "dist/runner.js",
|
|
20
|
+
"healthcheck_pgdata": "dist/healthcheck.js"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@fonoster/
|
|
23
|
+
"@fonoster/grpc-health-check": "^3.1.2",
|
|
24
|
+
"@fonoster/logger": "0.3.20",
|
|
23
25
|
"@grpc/grpc-js": "^1.8.4",
|
|
24
26
|
"@opentelemetry/api": "^1.0.4",
|
|
25
27
|
"@opentelemetry/exporter-jaeger": "^1.0.4",
|
|
@@ -30,9 +32,10 @@
|
|
|
30
32
|
"@opentelemetry/sdk-trace-node": "^1.0.4",
|
|
31
33
|
"@opentelemetry/semantic-conventions": "^1.0.4",
|
|
32
34
|
"@prisma/client": "^4.8.0",
|
|
33
|
-
"@routr/common": "^2.0.8-alpha.
|
|
34
|
-
"@routr/processor": "^2.0.8-alpha.
|
|
35
|
+
"@routr/common": "^2.0.8-alpha.31",
|
|
36
|
+
"@routr/processor": "^2.0.8-alpha.31",
|
|
35
37
|
"google-protobuf": "^3.9.2",
|
|
38
|
+
"grpc-interceptors": "github:fonoster/node-grpc-interceptors",
|
|
36
39
|
"pb-util": "^1.0.3",
|
|
37
40
|
"phone": "^3.1.32",
|
|
38
41
|
"validator": "^13.7.0"
|
|
@@ -55,5 +58,5 @@
|
|
|
55
58
|
"@types/validator": "^13.7.10",
|
|
56
59
|
"prisma": "^4.8.0"
|
|
57
60
|
},
|
|
58
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "6bca271d5a0b7163353a16af6b5195d264b3530f"
|
|
59
62
|
}
|