@routr/common 2.0.8-alpha.40 → 2.0.8-alpha.42

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/auth.d.ts CHANGED
@@ -26,6 +26,7 @@ export declare const createUnauthorizedResponse: (realm: string, params?: {
26
26
  }) => {
27
27
  message: {
28
28
  responseType: ResponseType;
29
+ reasonPhrase: string;
29
30
  wwwAuthenticate: {
30
31
  scheme: string;
31
32
  realm: string;
@@ -37,18 +38,24 @@ export declare const createUnauthorizedResponse: (realm: string, params?: {
37
38
  };
38
39
  };
39
40
  };
40
- export declare const createUnauthorizedResponseWithoutChallenge: () => {
41
+ export declare const createUnauthorizedResponseWithoutChallenge: (metadata?: Record<string, string>) => {
42
+ metadata: Record<string, string>;
41
43
  message: {
42
44
  responseType: ResponseType;
45
+ reasonPhrase: string;
43
46
  };
44
47
  };
45
- export declare const createServerInternalErrorResponse: () => {
48
+ export declare const createServerInternalErrorResponse: (metadata?: Record<string, string>) => {
49
+ metadata: Record<string, string>;
46
50
  message: {
47
51
  responseType: ResponseType;
52
+ reasonPhrase: string;
48
53
  };
49
54
  };
50
- export declare const createForbideenResponse: () => {
55
+ export declare const createForbideenResponse: (metadata?: Record<string, string>) => {
56
+ metadata: Record<string, string>;
51
57
  message: {
52
58
  responseType: ResponseType;
59
+ reasonPhrase: string;
53
60
  };
54
61
  };
package/dist/auth.js CHANGED
@@ -60,6 +60,7 @@ const createUnauthorizedResponse = (realm, params = { qop: "auth", algorithm: DE
60
60
  return {
61
61
  message: {
62
62
  responseType: types_1.ResponseType.UNAUTHORIZED,
63
+ reasonPhrase: "Unauthorized",
63
64
  wwwAuthenticate: {
64
65
  scheme: "Digest",
65
66
  realm: realm,
@@ -73,26 +74,32 @@ const createUnauthorizedResponse = (realm, params = { qop: "auth", algorithm: DE
73
74
  };
74
75
  };
75
76
  exports.createUnauthorizedResponse = createUnauthorizedResponse;
76
- const createUnauthorizedResponseWithoutChallenge = () => {
77
+ const createUnauthorizedResponseWithoutChallenge = (metadata) => {
77
78
  return {
79
+ metadata,
78
80
  message: {
79
- responseType: types_1.ResponseType.UNAUTHORIZED
81
+ responseType: types_1.ResponseType.UNAUTHORIZED,
82
+ reasonPhrase: "Unauthorized"
80
83
  }
81
84
  };
82
85
  };
83
86
  exports.createUnauthorizedResponseWithoutChallenge = createUnauthorizedResponseWithoutChallenge;
84
- const createServerInternalErrorResponse = () => {
87
+ const createServerInternalErrorResponse = (metadata) => {
85
88
  return {
89
+ metadata,
86
90
  message: {
87
- responseType: types_1.ResponseType.SERVER_INTERNAL_ERROR
91
+ responseType: types_1.ResponseType.SERVER_INTERNAL_ERROR,
92
+ reasonPhrase: "Server Internal Error"
88
93
  }
89
94
  };
90
95
  };
91
96
  exports.createServerInternalErrorResponse = createServerInternalErrorResponse;
92
- const createForbideenResponse = () => {
97
+ const createForbideenResponse = (metadata) => {
93
98
  return {
99
+ metadata,
94
100
  message: {
95
- responseType: types_1.ResponseType.FORBIDDEN
101
+ responseType: types_1.ResponseType.FORBIDDEN,
102
+ reasonPhrase: "Forbidden"
96
103
  }
97
104
  };
98
105
  };
@@ -82,10 +82,11 @@ message MessageRequest {
82
82
  repeated string external_addrs = 6;
83
83
  repeated string localnets = 7;
84
84
  fonoster.routr.sipmessage.v2draft1.SIPMessage message = 8;
85
- // .google.protobuf.Struct metadata = 9;
85
+ map<string, string> metadata = 9;
86
86
  }
87
87
 
88
88
  message MessageResponse {
89
89
  NetInterface sender = 1;
90
90
  fonoster.routr.sipmessage.v2draft1.SIPMessage message = 2;
91
+ map<string, string> metadata = 3;
91
92
  }
package/dist/types.d.ts CHANGED
@@ -59,6 +59,7 @@ export interface MessageRequest {
59
59
  externalAddrs: string[];
60
60
  localnets: string[];
61
61
  message: SIPMessage;
62
+ metadata?: Record<string, string>;
62
63
  }
63
64
  export interface MessageResponse {
64
65
  message: Record<string, unknown>;
@@ -141,6 +142,7 @@ export interface Route {
141
142
  externalAddrs: string[];
142
143
  labels?: Map<string, string>;
143
144
  headers?: HeaderModifier[];
145
+ metadata?: Record<string, string>;
144
146
  }
145
147
  export declare enum ResponseType {
146
148
  UNKNOWN = "UNKNOWN",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/common",
3
- "version": "2.0.8-alpha.40",
3
+ "version": "2.0.8-alpha.42",
4
4
  "description": "Common package",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -55,5 +55,5 @@
55
55
  "devDependencies": {
56
56
  "@types/js-yaml": "^4.0.5"
57
57
  },
58
- "gitHead": "3ac346a36a43ba06578accf48d7a4adac24a0911"
58
+ "gitHead": "d52dbb834a74e0d0630521d5f9074ca25b0104c0"
59
59
  }