@routr/processor 2.3.0 → 2.4.0

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.
@@ -19,6 +19,16 @@ export default class Response {
19
19
  name: string;
20
20
  value: string;
21
21
  }>): void;
22
+ /**
23
+ * Sends a register ok response.
24
+ *
25
+ * @param {MessageRequest} request - The request message.
26
+ * @param {object[]} extraHeaders - Optional extra headers to be sent.
27
+ */
28
+ sendRegisterOk(request: MessageRequest, extraHeaders?: Array<{
29
+ name: string;
30
+ value: string;
31
+ }>): void;
22
32
  /**
23
33
  * Sends a method not allowed response.
24
34
  */
@@ -27,6 +37,10 @@ export default class Response {
27
37
  * Sends a not found response.
28
38
  */
29
39
  sendNotFound(): void;
40
+ /**
41
+ * Sends a temporary unavailable response.
42
+ */
43
+ sendTemporaryUnavailable(): void;
30
44
  /**
31
45
  * Sends a not implemented response.
32
46
  */
package/dist/response.js CHANGED
@@ -48,6 +48,17 @@ class Response {
48
48
  sendOk(extraHeaders) {
49
49
  this.callback(null, buildResponse({ code: common_1.CommonTypes.ResponseType.OK, extraHeaders }));
50
50
  }
51
+ /**
52
+ * Sends a register ok response.
53
+ *
54
+ * @param {MessageRequest} request - The request message.
55
+ * @param {object[]} extraHeaders - Optional extra headers to be sent.
56
+ */
57
+ sendRegisterOk(request, extraHeaders) {
58
+ this.callback(null, {
59
+ message: Object.assign(Object.assign({}, buildResponse({ code: common_1.CommonTypes.ResponseType.OK, extraHeaders }).message), { contact: request.message.contact })
60
+ });
61
+ }
51
62
  /**
52
63
  * Sends a method not allowed response.
53
64
  */
@@ -66,6 +77,15 @@ class Response {
66
77
  reasonPhrase: "Not Found"
67
78
  }));
68
79
  }
80
+ /**
81
+ * Sends a temporary unavailable response.
82
+ */
83
+ sendTemporaryUnavailable() {
84
+ this.callback(null, buildResponse({
85
+ code: common_1.CommonTypes.ResponseType.TEMPORARILY_UNAVAILABLE,
86
+ reasonPhrase: "Temporarily Unavailable"
87
+ }));
88
+ }
69
89
  /**
70
90
  * Sends a not implemented response.
71
91
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/processor",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Processor server and API",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -23,7 +23,7 @@
23
23
  "@opentelemetry/sdk-trace-base": "^1.0.4",
24
24
  "@opentelemetry/sdk-trace-node": "^1.0.4",
25
25
  "@opentelemetry/semantic-conventions": "^1.0.4",
26
- "@routr/common": "^2.3.0",
26
+ "@routr/common": "^2.4.0",
27
27
  "fp-ts": "^2.11.8",
28
28
  "phone": "^3.1.32"
29
29
  },
@@ -44,5 +44,5 @@
44
44
  "bugs": {
45
45
  "url": "https://github.com/fonoster/routr/issues"
46
46
  },
47
- "gitHead": "a07009852c37cf04303a5adef42bdac75a747a32"
47
+ "gitHead": "704808be190e0fc8b07ceb3d98c15758c5c6c33c"
48
48
  }