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

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.
@@ -54,7 +54,7 @@ exports.create = void 0;
54
54
  /* eslint-disable require-jsdoc */
55
55
  const grpc = __importStar(require("@grpc/grpc-js"));
56
56
  const pb_util_1 = require("pb-util");
57
- const errors_1 = require("@routr/common/src/errors");
57
+ const common_1 = require("@routr/common");
58
58
  const utils_1 = require("../mappers/utils");
59
59
  const runtime_1 = require("@prisma/client/runtime");
60
60
  function create(operation, kind) {
@@ -85,10 +85,10 @@ function create(operation, kind) {
85
85
  return;
86
86
  }
87
87
  else if (e.code === "P2002") {
88
- callback(new errors_1.BadRequestError("entity already exist for field: " + e.meta.target[0]), null);
88
+ callback(new common_1.CommonErrors.BadRequestError("entity already exist for field: " + e.meta.target[0]), null);
89
89
  }
90
90
  else if (e.code === "P2003") {
91
- callback(new errors_1.BadRequestError("dependent entity doesn't exist for: " + e.meta.field_name), null);
91
+ callback(new common_1.CommonErrors.BadRequestError("dependent entity doesn't exist for: " + e.meta.field_name), null);
92
92
  }
93
93
  else {
94
94
  callback(e, null);
@@ -54,12 +54,12 @@ exports.del = void 0;
54
54
  /* eslint-disable require-jsdoc */
55
55
  const grpc = __importStar(require("@grpc/grpc-js"));
56
56
  const runtime_1 = require("@prisma/client/runtime");
57
- const errors_1 = require("@routr/common/src/errors");
57
+ const common_1 = require("@routr/common");
58
58
  // TODO: Fix the error handling. We should return the error
59
59
  function del(operation) {
60
60
  return (call, callback) => __awaiter(this, void 0, void 0, function* () {
61
61
  if (!call.request.ref) {
62
- return callback(new errors_1.BadRequestError("parameter ref is required"), null);
62
+ return callback(new common_1.CommonErrors.BadRequestError("parameter ref is required"), null);
63
63
  }
64
64
  try {
65
65
  yield operation({
@@ -30,9 +30,8 @@ exports.update = void 0;
30
30
  */
31
31
  /* eslint-disable require-jsdoc */
32
32
  const pb_util_1 = require("pb-util");
33
- const errors_1 = require("@routr/common/src/errors");
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 === connect_1.Kind.DOMAIN) {
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 === connect_1.Kind.TRUNK) {
56
+ if (kind === common_1.CommonConnect.Kind.TRUNK) {
58
57
  yield prisma.trunkURI.deleteMany({
59
58
  where: {
60
59
  trunkRef: request.ref
@@ -75,10 +74,10 @@ function update(operation, kind) {
75
74
  }
76
75
  catch (e) {
77
76
  if (e.code === "P2025") {
78
- callback(new errors_1.ResourceNotFoundError(call.request.ref), null);
77
+ callback(new common_1.CommonErrors.ResourceNotFoundError(call.request.ref), null);
79
78
  }
80
79
  else if (e.code === "P2003") {
81
- callback(new errors_1.BadRequestError("dependent entity doesn't exist for: " + e.meta.field_name), null);
80
+ callback(new common_1.CommonErrors.BadRequestError("dependent entity doesn't exist for: " + e.meta.field_name), null);
82
81
  }
83
82
  else {
84
83
  callback(e, null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/pgdata",
3
- "version": "2.0.8-alpha.28",
3
+ "version": "2.0.8-alpha.30",
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",
@@ -30,8 +30,8 @@
30
30
  "@opentelemetry/sdk-trace-node": "^1.0.4",
31
31
  "@opentelemetry/semantic-conventions": "^1.0.4",
32
32
  "@prisma/client": "^4.8.0",
33
- "@routr/common": "^2.0.8-alpha.28",
34
- "@routr/processor": "^2.0.8-alpha.28",
33
+ "@routr/common": "^2.0.8-alpha.30",
34
+ "@routr/processor": "^2.0.8-alpha.30",
35
35
  "google-protobuf": "^3.9.2",
36
36
  "pb-util": "^1.0.3",
37
37
  "phone": "^3.1.32",
@@ -55,5 +55,5 @@
55
55
  "@types/validator": "^13.7.10",
56
56
  "prisma": "^4.8.0"
57
57
  },
58
- "gitHead": "d28aabb2fce0600aaae94aa37709e89ed7112c99"
58
+ "gitHead": "6466c3e5262850c85dc6d15eec3e25f915a37667"
59
59
  }