@routr/common 2.0.8-alpha.41 → 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
@@ -24,9 +24,6 @@ export declare const createUnauthorizedResponse: (realm: string, params?: {
24
24
  qop: string;
25
25
  algorithm: string;
26
26
  }) => {
27
- metadata: {
28
- accessKeyId: string;
29
- };
30
27
  message: {
31
28
  responseType: ResponseType;
32
29
  reasonPhrase: string;
@@ -41,18 +38,24 @@ export declare const createUnauthorizedResponse: (realm: string, params?: {
41
38
  };
42
39
  };
43
40
  };
44
- export declare const createUnauthorizedResponseWithoutChallenge: () => {
41
+ export declare const createUnauthorizedResponseWithoutChallenge: (metadata?: Record<string, string>) => {
42
+ metadata: Record<string, string>;
45
43
  message: {
46
44
  responseType: ResponseType;
45
+ reasonPhrase: string;
47
46
  };
48
47
  };
49
- export declare const createServerInternalErrorResponse: () => {
48
+ export declare const createServerInternalErrorResponse: (metadata?: Record<string, string>) => {
49
+ metadata: Record<string, string>;
50
50
  message: {
51
51
  responseType: ResponseType;
52
+ reasonPhrase: string;
52
53
  };
53
54
  };
54
- export declare const createForbideenResponse: () => {
55
+ export declare const createForbideenResponse: (metadata?: Record<string, string>) => {
56
+ metadata: Record<string, string>;
55
57
  message: {
56
58
  responseType: ResponseType;
59
+ reasonPhrase: string;
57
60
  };
58
61
  };
package/dist/auth.js CHANGED
@@ -58,12 +58,9 @@ const getCredentials = (username, users) => users.find((user) => user.username =
58
58
  exports.getCredentials = getCredentials;
59
59
  const createUnauthorizedResponse = (realm, params = { qop: "auth", algorithm: DEFAULT_ALGORITHM }) => {
60
60
  return {
61
- metadata: {
62
- accessKeyId: "xxxxxxxxx"
63
- },
64
61
  message: {
65
62
  responseType: types_1.ResponseType.UNAUTHORIZED,
66
- reasonPhrase: "Bro fix your password",
63
+ reasonPhrase: "Unauthorized",
67
64
  wwwAuthenticate: {
68
65
  scheme: "Digest",
69
66
  realm: realm,
@@ -77,26 +74,32 @@ const createUnauthorizedResponse = (realm, params = { qop: "auth", algorithm: DE
77
74
  };
78
75
  };
79
76
  exports.createUnauthorizedResponse = createUnauthorizedResponse;
80
- const createUnauthorizedResponseWithoutChallenge = () => {
77
+ const createUnauthorizedResponseWithoutChallenge = (metadata) => {
81
78
  return {
79
+ metadata,
82
80
  message: {
83
- responseType: types_1.ResponseType.UNAUTHORIZED
81
+ responseType: types_1.ResponseType.UNAUTHORIZED,
82
+ reasonPhrase: "Unauthorized"
84
83
  }
85
84
  };
86
85
  };
87
86
  exports.createUnauthorizedResponseWithoutChallenge = createUnauthorizedResponseWithoutChallenge;
88
- const createServerInternalErrorResponse = () => {
87
+ const createServerInternalErrorResponse = (metadata) => {
89
88
  return {
89
+ metadata,
90
90
  message: {
91
- responseType: types_1.ResponseType.SERVER_INTERNAL_ERROR
91
+ responseType: types_1.ResponseType.SERVER_INTERNAL_ERROR,
92
+ reasonPhrase: "Server Internal Error"
92
93
  }
93
94
  };
94
95
  };
95
96
  exports.createServerInternalErrorResponse = createServerInternalErrorResponse;
96
- const createForbideenResponse = () => {
97
+ const createForbideenResponse = (metadata) => {
97
98
  return {
99
+ metadata,
98
100
  message: {
99
- responseType: types_1.ResponseType.FORBIDDEN
101
+ responseType: types_1.ResponseType.FORBIDDEN,
102
+ reasonPhrase: "Forbidden"
100
103
  }
101
104
  };
102
105
  };
package/dist/types.d.ts CHANGED
@@ -142,6 +142,7 @@ export interface Route {
142
142
  externalAddrs: string[];
143
143
  labels?: Map<string, string>;
144
144
  headers?: HeaderModifier[];
145
+ metadata?: Record<string, string>;
145
146
  }
146
147
  export declare enum ResponseType {
147
148
  UNKNOWN = "UNKNOWN",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/common",
3
- "version": "2.0.8-alpha.41",
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": "52f44320b57824dfea40f48b02b44b9a8e6bdda3"
58
+ "gitHead": "d52dbb834a74e0d0630521d5f9074ca25b0104c0"
59
59
  }