@routr/pgdata 2.0.8-alpha.30 → 2.0.8-alpha.32

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.
@@ -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) 2022 by Fonoster Inc (https://fonoster.com)
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
@@ -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) 2022 by Fonoster Inc (https://fonoster.com)
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) 2022 by Fonoster Inc (https://fonoster.com)
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) 2022 by Fonoster Inc (https://fonoster.com)
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) 2022 by Fonoster Inc (https://fonoster.com)
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
@@ -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) 2022 by Fonoster Inc (https://fonoster.com)
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
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,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /*
5
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster
7
+ *
8
+ * This file is part of Routr.
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const common_1 = require("@routr/common");
23
+ const envs_1 = require("./envs");
24
+ 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) 2022 by Fonoster Inc (https://fonoster.com)
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) 2022 by Fonoster Inc (https://fonoster.com)
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
- server.bindAsync(config.bindAddr, grpc.ServerCredentials.createInsecure(), () => {
87
- server.start();
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) 2022 by Fonoster Inc (https://fonoster.com)
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.30",
3
+ "version": "2.0.8-alpha.32",
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/logger": "0.3.18",
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.30",
34
- "@routr/processor": "^2.0.8-alpha.30",
35
+ "@routr/common": "^2.0.8-alpha.32",
36
+ "@routr/processor": "^2.0.8-alpha.32",
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": "6466c3e5262850c85dc6d15eec3e25f915a37667"
61
+ "gitHead": "cc7a72209d40052647c76a4e47517a0ea82ae9f7"
59
62
  }