@routr/pgdata 2.0.8-alpha.18 → 2.0.8-alpha.19

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.
@@ -79,7 +79,17 @@ class PeerManager extends manager_1.EntityManager {
79
79
  // TODO: We will need a better way to validate this so is a valid SIP URI
80
80
  if (!this.peer.aor.startsWith("backend:") &&
81
81
  !this.peer.aor.startsWith("sip:")) {
82
- throw new common_1.CommonErrors.BadRequestError("the aorLink must start with backend: or sip:");
82
+ throw new common_1.CommonErrors.BadRequestError("the aor schema must start with `backend:` or `sip:`");
83
+ }
84
+ if (this.peer.aor.startsWith("backend:")) {
85
+ if (!this.peer.balancingAlgorithm) {
86
+ throw new common_1.CommonErrors.BadRequestError("when the aor schema is `backend:`, the balancing algorithm is required");
87
+ }
88
+ }
89
+ if (this.peer.aor.startsWith("sip:")) {
90
+ if (this.peer.balancingAlgorithm) {
91
+ throw new common_1.CommonErrors.BadRequestError("when the aor schema is `sip:`, the balancing algorithm is not allowed");
92
+ }
83
93
  }
84
94
  }
85
95
  validOrThrowUpdate() {
@@ -96,7 +106,17 @@ class PeerManager extends manager_1.EntityManager {
96
106
  // TODO: We will need a better way to validate this so is a valid SIP URI
97
107
  if (!this.peer.aor.startsWith("backend:") &&
98
108
  !this.peer.aor.startsWith("sip:")) {
99
- throw new common_1.CommonErrors.BadRequestError("the aorLink must start with backend: or sip:");
109
+ throw new common_1.CommonErrors.BadRequestError("the aor schema must start with `backend:` or `sip:`");
110
+ }
111
+ }
112
+ if (this.peer.aor.startsWith("backend:")) {
113
+ if (!this.peer.balancingAlgorithm) {
114
+ throw new common_1.CommonErrors.BadRequestError("when the aor schema is `backend:`, the balancing algorithm is required");
115
+ }
116
+ }
117
+ if (this.peer.aor.startsWith("sip:")) {
118
+ if (this.peer.balancingAlgorithm) {
119
+ throw new common_1.CommonErrors.BadRequestError("when the aor schema is `sip:`, the balancing algorithm is not allowed");
100
120
  }
101
121
  }
102
122
  }
@@ -109,6 +129,9 @@ class PeerManager extends manager_1.EntityManager {
109
129
  username: this.peer.username,
110
130
  aor: this.peer.aor,
111
131
  contactAddr: this.peer.contactAddr,
132
+ balancingAlgorithm: this.peer
133
+ .balancingAlgorithm,
134
+ withSessionAffinity: this.peer.withSessionAffinity,
112
135
  enabled: this.peer.enabled,
113
136
  credentialsRef: this.peer.credentialsRef,
114
137
  accessControlListRef: this.peer.accessControlListRef,
@@ -125,6 +148,8 @@ class PeerManager extends manager_1.EntityManager {
125
148
  username: peer.username,
126
149
  aor: peer.aor,
127
150
  contactAddr: peer.contactAddr,
151
+ balancingAlgorithm: peer.balancingAlgorithm,
152
+ withSessionAffinity: peer.withSessionAffinity,
128
153
  enabled: peer.enabled,
129
154
  credentialsRef: peer.credentialsRef,
130
155
  credentials: credentials_1.CredentialsManager.mapToDto(peer.credentials),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/pgdata",
3
- "version": "2.0.8-alpha.18",
3
+ "version": "2.0.8-alpha.19",
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.18",
34
- "@routr/processor": "^2.0.8-alpha.18",
33
+ "@routr/common": "^2.0.8-alpha.19",
34
+ "@routr/processor": "^2.0.8-alpha.19",
35
35
  "google-protobuf": "^3.9.2",
36
36
  "pb-util": "^1.0.3",
37
37
  "validator": "^13.7.0"
@@ -54,5 +54,5 @@
54
54
  "@types/validator": "^13.7.10",
55
55
  "prisma": "^4.8.0"
56
56
  },
57
- "gitHead": "66ce6b3ed832bb8c549d344b3367aceed4b6da8f"
57
+ "gitHead": "ff62abb0ff7704a79f98a8e0b10c0036b949cc11"
58
58
  }