@furystack/rest-service 4.1.6 → 4.1.12
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/CHANGELOG.md +177 -0
- package/dist/authenticate.spec.js +3 -3
- package/dist/authenticate.spec.js.map +1 -1
- package/dist/authorize.spec.js +3 -3
- package/dist/authorize.spec.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +6 -0
- package/dist/models/index.js.map +1 -0
- package/dist/server-response-extensions.spec.js +4 -4
- package/dist/server-response-extensions.spec.js.map +1 -1
- package/dist/validate.integration.spec.d.ts +0 -11
- package/dist/validate.integration.spec.d.ts.map +1 -1
- package/dist/validate.integration.spec.js +8 -10
- package/dist/validate.integration.spec.js.map +1 -1
- package/package.json +14 -16
- package/src/authenticate.spec.ts +3 -3
- package/src/authorize.spec.ts +3 -3
- package/src/index.ts +1 -1
- package/src/models/index.ts +2 -0
- package/src/server-response-extensions.spec.ts +4 -4
- package/src/validate.integration.spec.ts +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
### [4.1.10](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.1.9...@furystack/rest-service@4.1.10) (2022-02-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### [4.1.9](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.1.8...@furystack/rest-service@4.1.9) (2022-02-02)
|
|
16
|
+
|
|
17
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### [4.1.8](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.1.6...@furystack/rest-service@4.1.8) (2022-01-10)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### [4.1.7](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.1.6...@furystack/rest-service@4.1.7) (2022-01-10)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### [4.1.6](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.1.5...@furystack/rest-service@4.1.6) (2021-12-20)
|
|
43
|
+
|
|
44
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### [4.1.5](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.1.4...@furystack/rest-service@4.1.5) (2021-12-08)
|
|
52
|
+
|
|
53
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### [4.1.4](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.1.3...@furystack/rest-service@4.1.4) (2021-11-30)
|
|
61
|
+
|
|
62
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### [4.1.3](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.1.2...@furystack/rest-service@4.1.3) (2021-11-29)
|
|
70
|
+
|
|
71
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### [4.1.2](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.1.1...@furystack/rest-service@4.1.2) (2021-11-19)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
### [4.1.1](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.1.0...@furystack/rest-service@4.1.1) (2021-11-17)
|
|
88
|
+
|
|
89
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## [4.1.0](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.0.21...@furystack/rest-service@4.1.0) (2021-11-09)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### 🚀 What's new
|
|
100
|
+
|
|
101
|
+
* **@furystack/rest-service:** disabled strict mode for schema validation ([20a9bad](https://github.com/furystack/furystack/commit/20a9bad9368b06b6b3186273b767dbb690e6473a))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### [4.0.21](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.0.20...@furystack/rest-service@4.0.21) (2021-10-15)
|
|
107
|
+
|
|
108
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
### [4.0.20](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.0.19...@furystack/rest-service@4.0.20) (2021-10-05)
|
|
116
|
+
|
|
117
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### [4.0.19](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.0.18...@furystack/rest-service@4.0.19) (2021-09-16)
|
|
125
|
+
|
|
126
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### [4.0.18](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.0.17...@furystack/rest-service@4.0.18) (2021-08-27)
|
|
134
|
+
|
|
135
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
### [4.0.17](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.0.16...@furystack/rest-service@4.0.17) (2021-08-25)
|
|
143
|
+
|
|
144
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
### [4.0.16](https://github.com/furystack/furystack/compare/@furystack/rest-service@4.0.15...@furystack/rest-service@4.0.16) (2021-08-19)
|
|
152
|
+
|
|
153
|
+
**Note:** Version bump only for package @furystack/rest-service
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### [4.0.15](https://github.com/furystack/furystack/compare/@furystack/rest-service@2.3.2...@furystack/rest-service@4.0.15) (2021-08-19)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
### 🐛 Bug Fixes
|
|
164
|
+
|
|
165
|
+
* **rest-service:** cookie logout ([d1b04c6](https://github.com/furystack/furystack/commit/d1b04c6d976951b74c7880ab57e5676618dd5bb2))
|
|
166
|
+
* **rest-service:** remove session by its id ([14d9729](https://github.com/furystack/furystack/commit/14d9729c1e9581bb86ef0d87b93b3ec65056bc29))
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
### [4.0.14](https://github.com/furystack/furystack/compare/@furystack/rest-service@2.3.2...@furystack/rest-service@4.0.14) (2021-07-30)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
### 🐛 Bug Fixes
|
|
175
|
+
|
|
176
|
+
* **rest-service:** cookie logout ([d1b04c6](https://github.com/furystack/furystack/commit/d1b04c6d976951b74c7880ab57e5676618dd5bb2))
|
|
177
|
+
* **rest-service:** remove session by its id ([14d9729](https://github.com/furystack/furystack/commit/14d9729c1e9581bb86ef0d87b93b3ec65056bc29))
|
|
@@ -16,7 +16,7 @@ describe('Authenticate', () => {
|
|
|
16
16
|
i.setExplicitInstance({
|
|
17
17
|
authentication: { enableBasicAuth: false },
|
|
18
18
|
}, http_user_context_1.HttpUserContext);
|
|
19
|
-
const exampleAuthenticatedAction = jest.fn(async (
|
|
19
|
+
const exampleAuthenticatedAction = jest.fn(async () => (0, request_action_implementation_1.EmptyResult)());
|
|
20
20
|
const authorized = (0, authenticate_1.Authenticate)()(exampleAuthenticatedAction);
|
|
21
21
|
const result = await authorized({ injector: i, request, response });
|
|
22
22
|
expect(result.statusCode).toBe(401);
|
|
@@ -33,7 +33,7 @@ describe('Authenticate', () => {
|
|
|
33
33
|
getCurrentUser: async () => Promise.reject(':('),
|
|
34
34
|
authentication: { enableBasicAuth: true },
|
|
35
35
|
}, http_user_context_1.HttpUserContext);
|
|
36
|
-
const exampleAuthenticatedAction = jest.fn(async (
|
|
36
|
+
const exampleAuthenticatedAction = jest.fn(async () => (0, request_action_implementation_1.EmptyResult)());
|
|
37
37
|
const authorized = (0, authenticate_1.Authenticate)()(exampleAuthenticatedAction);
|
|
38
38
|
const result = await authorized({ injector: i, request, response });
|
|
39
39
|
expect(result.statusCode).toBe(401);
|
|
@@ -46,7 +46,7 @@ describe('Authenticate', () => {
|
|
|
46
46
|
await (0, utils_1.usingAsync)(new inject_1.Injector(), async (i) => {
|
|
47
47
|
const isAuthenticatedAction = jest.fn(async () => true);
|
|
48
48
|
i.setExplicitInstance({ isAuthenticated: isAuthenticatedAction, getCurrentUser: async () => Promise.reject(':(') }, core_1.IdentityContext);
|
|
49
|
-
const exampleAuthenticatedAction = jest.fn(async (
|
|
49
|
+
const exampleAuthenticatedAction = jest.fn(async () => (0, request_action_implementation_1.EmptyResult)());
|
|
50
50
|
const authorized = (0, authenticate_1.Authenticate)()(exampleAuthenticatedAction);
|
|
51
51
|
const params = { injector: i, body: undefined, query: undefined, request, response };
|
|
52
52
|
const result = await authorized(params);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.spec.js","sourceRoot":"","sources":["../src/authenticate.spec.ts"],"names":[],"mappings":";;AACA,8CAA4C;AAC5C,4CAA6C;AAC7C,2DAAqD;AACrD,iDAA6C;AAE7C,0CAAiD;AACjD,mFAA6D;AAE7D,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,MAAM,QAAQ,GAAG,EAA2B,CAAA;IAC5C,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,mBAAmB,EAAqB,CAAA;IAE/D,EAAE,CAAC,uFAAuF,EAAE,KAAK,IAAI,EAAE;QACrG,MAAM,IAAA,kBAAU,EAAC,IAAI,iBAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;YAC3C,MAAM,qBAAqB,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAA;YAExD,CAAC,CAAC,mBAAmB,CACnB,EAAE,eAAe,EAAE,qBAAqB,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAC5F,sBAAe,CAChB,CAAA;YAED,CAAC,CAAC,mBAAmB,CACnB;gBACE,cAAc,EAAE,EAAE,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CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACpC,MAAM,CAAC,0BAA0B,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QAC3D,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/authorize.spec.js
CHANGED
|
@@ -12,7 +12,7 @@ describe('Authorize', () => {
|
|
|
12
12
|
await (0, utils_1.usingAsync)(new inject_1.Injector(), async (i) => {
|
|
13
13
|
const isAuthorizedAction = jest.fn(async () => false);
|
|
14
14
|
i.setExplicitInstance({ isAuthorized: isAuthorizedAction, getCurrentUser: () => Promise.reject(':(') }, core_1.IdentityContext);
|
|
15
|
-
const exampleAuthorizedAction = jest.fn(async (
|
|
15
|
+
const exampleAuthorizedAction = jest.fn(async () => (0, request_action_implementation_1.EmptyResult)());
|
|
16
16
|
const authorized = (0, authorize_1.Authorize)('Role1')(exampleAuthorizedAction);
|
|
17
17
|
const result = await authorized({ injector: i, request, response });
|
|
18
18
|
expect(result.statusCode).toBe(403);
|
|
@@ -27,7 +27,7 @@ describe('Authorize', () => {
|
|
|
27
27
|
isAuthorized: isAuthorizedAction,
|
|
28
28
|
getCurrentUser: async () => Promise.resolve({ username: 'a', roles: ['Role1'] }),
|
|
29
29
|
}, core_1.IdentityContext);
|
|
30
|
-
const exampleAuthorizedAction = jest.fn(async (
|
|
30
|
+
const exampleAuthorizedAction = jest.fn(async () => (0, request_action_implementation_1.EmptyResult)());
|
|
31
31
|
const authorized = (0, authorize_1.Authorize)('Role2')(exampleAuthorizedAction);
|
|
32
32
|
const result = await authorized({ injector: i, request, response });
|
|
33
33
|
expect(result.statusCode).toBe(403);
|
|
@@ -42,7 +42,7 @@ describe('Authorize', () => {
|
|
|
42
42
|
isAuthorized: isAuthorizedAction,
|
|
43
43
|
getCurrentUser: async () => Promise.resolve({ username: 'a', roles: ['Role1'] }),
|
|
44
44
|
}, core_1.IdentityContext);
|
|
45
|
-
const exampleAuthorizedAction = jest.fn(async (
|
|
45
|
+
const exampleAuthorizedAction = jest.fn(async () => (0, request_action_implementation_1.EmptyResult)());
|
|
46
46
|
const authorized = (0, authorize_1.Authorize)('Role1')(exampleAuthorizedAction);
|
|
47
47
|
const params = { injector: i, body: undefined, query: undefined, request, response };
|
|
48
48
|
const result = await authorized(params);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.spec.js","sourceRoot":"","sources":["../src/authorize.spec.ts"],"names":[],"mappings":";;AACA,8CAA4C;AAC5C,4CAA6C;AAC7C,0CAAuD;AACvD,2CAAuC;AAEvC,mFAA6D;AAE7D,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,QAAQ,GAAG,EAA2B,CAAA;IAC5C,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,mBAAmB,EAAqB,CAAA;IAE/D,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;QACjE,MAAM,IAAA,kBAAU,EAAC,IAAI,iBAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;YAC3C,MAAM,kBAAkB,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAA;YACrD,CAAC,CAAC,mBAAmB,CACnB,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAChF,sBAAe,CAChB,CAAA;YACD,MAAM,uBAAuB,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"authorize.spec.js","sourceRoot":"","sources":["../src/authorize.spec.ts"],"names":[],"mappings":";;AACA,8CAA4C;AAC5C,4CAA6C;AAC7C,0CAAuD;AACvD,2CAAuC;AAEvC,mFAA6D;AAE7D,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,QAAQ,GAAG,EAA2B,CAAA;IAC5C,M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O,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;aACvF,EACD,sBAAe,CAChB,CAAA;YACD,MAAM,uBAAuB,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,IAAA,2CAAW,GAAE,CAAC,CAAA;YAClE,MAAM,UAAU,GAAG,IAAA,qBAAS,EAAC,OAAO,CAAC,CAAC,uBAAuB,CAAC,CAAA;YAC9D,MAAM,MAAM,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;YACpF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,CAAA;YACvC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACnC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACpC,MAAM,CAAC,uBAAuB,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QACxD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export * from './incoming-message-extensions';
|
|
|
9
9
|
export * from './server-manager';
|
|
10
10
|
export * from './server-response-extensions';
|
|
11
11
|
export * from './utils';
|
|
12
|
-
export * from './models
|
|
12
|
+
export * from './models';
|
|
13
13
|
export * from './endpoint-generators';
|
|
14
14
|
export * from './schema-validator';
|
|
15
15
|
export * from './request-action-implementation';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,SAAS,CAAA;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ require("./injector-extensions");
|
|
|
12
12
|
(0, tslib_1.__exportStar)(require("./server-manager"), exports);
|
|
13
13
|
(0, tslib_1.__exportStar)(require("./server-response-extensions"), exports);
|
|
14
14
|
(0, tslib_1.__exportStar)(require("./utils"), exports);
|
|
15
|
-
(0, tslib_1.__exportStar)(require("./models
|
|
15
|
+
(0, tslib_1.__exportStar)(require("./models"), exports);
|
|
16
16
|
(0, tslib_1.__exportStar)(require("./endpoint-generators"), exports);
|
|
17
17
|
(0, tslib_1.__exportStar)(require("./schema-validator"), exports);
|
|
18
18
|
(0, tslib_1.__exportStar)(require("./request-action-implementation"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,6DAA6B;AAC7B,yDAAyB;AACzB,8DAA8B;AAC9B,2DAA2B;AAC3B,8EAA8C;AAC9C,mEAAmC;AACnC,6EAA6C;AAC7C,gEAAgC;AAChC,4EAA4C;AAC5C,uDAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,6DAA6B;AAC7B,yDAAyB;AACzB,8DAA8B;AAC9B,2DAA2B;AAC3B,8EAA8C;AAC9C,mEAAmC;AACnC,6EAA6C;AAC7C,gEAAgC;AAChC,4EAA4C;AAC5C,uDAAuB;AACvB,wDAAwB;AACxB,qEAAqC;AACrC,kEAAkC;AAClC,+EAA+C;AAC/C,0DAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./cors-options"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./default-session"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;AAAA,8DAA8B;AAC9B,iEAAiC"}
|
|
@@ -16,11 +16,11 @@ describe('ServerResponse extensions', () => {
|
|
|
16
16
|
const socket = new net_1.Socket();
|
|
17
17
|
const msg = new http_1.ServerResponse(new http_1.IncomingMessage(socket));
|
|
18
18
|
msg.writeHead = jest.fn();
|
|
19
|
-
msg.end = (chunk) => {
|
|
19
|
+
msg.end = ((chunk) => {
|
|
20
20
|
expect(chunk).toBe(JSON.stringify(jsonValue));
|
|
21
21
|
expect(msg.writeHead).toBeCalledWith(200, { 'Content-Type': 'application/json' });
|
|
22
22
|
done();
|
|
23
|
-
};
|
|
23
|
+
});
|
|
24
24
|
msg.sendActionResult((0, request_action_implementation_1.JsonResult)(jsonValue));
|
|
25
25
|
});
|
|
26
26
|
it('Should send the plain TEXT response with the correct Content Type header and default status', (done) => {
|
|
@@ -28,11 +28,11 @@ describe('ServerResponse extensions', () => {
|
|
|
28
28
|
const socket = new net_1.Socket();
|
|
29
29
|
const msg = new http_1.ServerResponse(new http_1.IncomingMessage(socket));
|
|
30
30
|
msg.writeHead = jest.fn();
|
|
31
|
-
msg.end = (chunk) => {
|
|
31
|
+
msg.end = ((chunk) => {
|
|
32
32
|
expect(chunk).toBe(textValue);
|
|
33
33
|
expect(msg.writeHead).toBeCalledWith(200, { 'Content-Type': 'plain/text' });
|
|
34
34
|
done();
|
|
35
|
-
};
|
|
35
|
+
});
|
|
36
36
|
msg.sendActionResult((0, request_action_implementation_1.PlainTextResult)(textValue));
|
|
37
37
|
});
|
|
38
38
|
it('Should skip sending on BypassResult', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-response-extensions.spec.js","sourceRoot":"","sources":["../src/server-response-extensions.spec.ts"],"names":[],"mappings":";;AAAA,6BAA4B;AAC5B,+BAAsD;AACtD,wCAAqC;AACrC,mFAA2F;AAE3F,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,YAAM,EAAE,CAAA;YAC3B,MAAM,GAAG,GAAG,IAAI,qBAAc,CAAC,IAAI,sBAAe,CAAC,MAAM,CAAC,CAAC,CAAA;YAC3D,MAAM,CAAC,OAA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AC,CAAA;QAEF,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;YAC7C,MAAM,MAAM,GAAG,IAAI,YAAM,EAAE,CAAA;YAC3B,MAAM,GAAG,GAAG,IAAI,qBAAc,CAAC,IAAI,sBAAe,CAAC,MAAM,CAAC,CAAC,CAAA;YAC3D,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;YACzB,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;YAEnB,GAAG,CAAC,gBAAgB,CAAC,IAAA,4CAAY,GAAE,CAAC,CAAA;YACpC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;YACtC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;QAClC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
1
|
import './injector-extensions';
|
|
2
|
-
import { ValidationApi } from 'validate.integration.schema';
|
|
3
|
-
export declare const createValidateApi: () => Promise<{
|
|
4
|
-
dispose: () => Promise<void>;
|
|
5
|
-
client: <TMethod extends keyof ValidationApi, TAction extends keyof ValidationApi[TMethod], TBodyType extends import("@furystack/rest-client-got").BodyParameter<ValidationApi[TMethod][TAction]>, TQuery extends import("@furystack/rest-client-got").QueryParameter<ValidationApi[TMethod][TAction]>, TUrlParams extends import("@furystack/rest-client-got").UrlParameter<ValidationApi[TMethod][TAction]>, TReturns extends import("@furystack/rest-client-got").ReturnType<ValidationApi[TMethod][TAction]>, THeaders extends import("@furystack/rest-client-got").HeaderParameter<ValidationApi[TMethod][TAction]>>(options: {
|
|
6
|
-
method: TMethod;
|
|
7
|
-
action: TAction;
|
|
8
|
-
} & TBodyType & TQuery & TUrlParams & THeaders) => Promise<{
|
|
9
|
-
response: import("got/dist/source").Response<TReturns>;
|
|
10
|
-
getJson: () => TReturns;
|
|
11
|
-
}>;
|
|
12
|
-
}>;
|
|
13
2
|
//# sourceMappingURL=validate.integration.spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.integration.spec.d.ts","sourceRoot":"","sources":["../src/validate.integration.spec.ts"],"names":[],"mappings":"AAMA,OAAO,uBAAuB,CAAA
|
|
1
|
+
{"version":3,"file":"validate.integration.spec.d.ts","sourceRoot":"","sources":["../src/validate.integration.spec.ts"],"names":[],"mappings":"AAMA,OAAO,uBAAuB,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createValidateApi = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
4
|
const inject_1 = require("@furystack/inject");
|
|
6
5
|
const rest_client_got_1 = require("@furystack/rest-client-got");
|
|
@@ -60,11 +59,10 @@ const createValidateApi = async () => {
|
|
|
60
59
|
client,
|
|
61
60
|
};
|
|
62
61
|
};
|
|
63
|
-
exports.createValidateApi = createValidateApi;
|
|
64
62
|
describe('Validation integration tests', () => {
|
|
65
63
|
describe('Validation errors', () => {
|
|
66
64
|
it('Should validate query', async () => {
|
|
67
|
-
await (0, utils_1.usingAsync)(await
|
|
65
|
+
await (0, utils_1.usingAsync)(await createValidateApi(), async ({ client }) => {
|
|
68
66
|
var _a, _b;
|
|
69
67
|
expect.assertions(5);
|
|
70
68
|
try {
|
|
@@ -87,7 +85,7 @@ describe('Validation integration tests', () => {
|
|
|
87
85
|
});
|
|
88
86
|
});
|
|
89
87
|
it('Should validate url', async () => {
|
|
90
|
-
await (0, utils_1.usingAsync)(await
|
|
88
|
+
await (0, utils_1.usingAsync)(await createValidateApi(), async ({ client }) => {
|
|
91
89
|
var _a, _b;
|
|
92
90
|
expect.assertions(4);
|
|
93
91
|
try {
|
|
@@ -109,7 +107,7 @@ describe('Validation integration tests', () => {
|
|
|
109
107
|
});
|
|
110
108
|
});
|
|
111
109
|
it('Should validate headers', async () => {
|
|
112
|
-
await (0, utils_1.usingAsync)(await
|
|
110
|
+
await (0, utils_1.usingAsync)(await createValidateApi(), async ({ client }) => {
|
|
113
111
|
var _a, _b;
|
|
114
112
|
expect.assertions(3);
|
|
115
113
|
try {
|
|
@@ -130,7 +128,7 @@ describe('Validation integration tests', () => {
|
|
|
130
128
|
});
|
|
131
129
|
});
|
|
132
130
|
it('Should validate body', async () => {
|
|
133
|
-
await (0, utils_1.usingAsync)(await
|
|
131
|
+
await (0, utils_1.usingAsync)(await createValidateApi(), async ({ client }) => {
|
|
134
132
|
var _a, _b;
|
|
135
133
|
expect.assertions(3);
|
|
136
134
|
try {
|
|
@@ -153,7 +151,7 @@ describe('Validation integration tests', () => {
|
|
|
153
151
|
});
|
|
154
152
|
describe('Validation Success', () => {
|
|
155
153
|
it('Should validate query', async () => {
|
|
156
|
-
await (0, utils_1.usingAsync)(await
|
|
154
|
+
await (0, utils_1.usingAsync)(await createValidateApi(), async ({ client }) => {
|
|
157
155
|
const result = await client({
|
|
158
156
|
method: 'GET',
|
|
159
157
|
action: '/validate-query',
|
|
@@ -171,7 +169,7 @@ describe('Validation integration tests', () => {
|
|
|
171
169
|
});
|
|
172
170
|
});
|
|
173
171
|
it('Should validate url', async () => {
|
|
174
|
-
await (0, utils_1.usingAsync)(await
|
|
172
|
+
await (0, utils_1.usingAsync)(await createValidateApi(), async ({ client }) => {
|
|
175
173
|
const result = await client({
|
|
176
174
|
method: 'GET',
|
|
177
175
|
action: '/validate-url/:id',
|
|
@@ -183,7 +181,7 @@ describe('Validation integration tests', () => {
|
|
|
183
181
|
});
|
|
184
182
|
});
|
|
185
183
|
it('Should validate headers', async () => {
|
|
186
|
-
await (0, utils_1.usingAsync)(await
|
|
184
|
+
await (0, utils_1.usingAsync)(await createValidateApi(), async ({ client }) => {
|
|
187
185
|
const result = await client({
|
|
188
186
|
method: 'GET',
|
|
189
187
|
action: '/validate-headers',
|
|
@@ -201,7 +199,7 @@ describe('Validation integration tests', () => {
|
|
|
201
199
|
});
|
|
202
200
|
});
|
|
203
201
|
it('Should validate body', async () => {
|
|
204
|
-
await (0, utils_1.usingAsync)(await
|
|
202
|
+
await (0, utils_1.usingAsync)(await createValidateApi(), async ({ client }) => {
|
|
205
203
|
const result = await client({
|
|
206
204
|
method: 'POST',
|
|
207
205
|
action: '/validate-body',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.integration.spec.js","sourceRoot":"","sources":["../src/validate.integration.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.integration.spec.js","sourceRoot":"","sources":["../src/validate.integration.spec.ts"],"names":[],"mappings":";;;AAAA,8CAA4C;AAC5C,gEAAyD;AACzD,4CAA6C;AAC7C,4CAA8C;AAC9C,mFAA4D;AAC5D,yCAAqC;AACrC,iCAA8B;AAE9B,iIAA4D;AAG5D,6MAA6M;AAE7M,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;IACnC,MAAM,QAAQ,GAAG,IAAI,iBAAQ,EAAE,CAAA;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAA;IACrD,QAAQ,CAAC,cAAc,CAAgB;QACrC,GAAG,EAAE;YACH,GAAG,EAAE;gBACH,iBAAiB,EAAE,IAAA,mBAAQ,EAAC;oBAC1B,MAAM,EAAN,+CAAM;oBACN,UAAU,EAAE,eAAe;iBAC5B,CAAC,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,IAAA,0CAAU,EAAC,EAAE,GAAG,QAAQ,EAAE,EAAE,CAAC,CAAC;gBACzD,mBAAmB,EAAE,IAAA,mBAAQ,EAAC;oBAC5B,MAAM,EAAN,+CAAM;oBACN,UAAU,EAAE,aAAa;iBAC1B,CAAC,CAAC,KAAK,EAAE,EAAE,YA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;QACJ,CAAC,CAAC,CAAA;QACF,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;YACpC,MAAM,IAAA,kBAAU,EAAC,MAAM,iBAAiB,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;gBAC/D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC;oBAC1B,MAAM,EAAE,MAAM;oBACd,MAAM,EAAE,gBAAgB;oBACxB,IAAI,EAAE;wBACJ,GAAG,EAAE,KAAK;wBACV,GAAG,EAAE,EAAE;wBACP,GAAG,EAAE,IAAI;qBACV;iBACF,CAAC,CAAA;gBAEF,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBAC5C,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,EAAE,CAAA;gBACrC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACpC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBACjC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACrC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@furystack/rest-service",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.12",
|
|
4
4
|
"description": "Repository implementation for FuryStack",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"start:mock": "yarn node ./dist/mock.js"
|
|
8
|
-
},
|
|
9
6
|
"files": [
|
|
10
7
|
"dist",
|
|
11
8
|
"src"
|
|
@@ -31,13 +28,13 @@
|
|
|
31
28
|
},
|
|
32
29
|
"homepage": "https://github.com/furystack/furystack",
|
|
33
30
|
"dependencies": {
|
|
34
|
-
"@furystack/core": "^10.4.
|
|
35
|
-
"@furystack/inject": "^5.0.
|
|
36
|
-
"@furystack/logging": "^2.0.
|
|
37
|
-
"@furystack/repository": "^5.0.
|
|
38
|
-
"@furystack/rest": "^3.1.
|
|
39
|
-
"@furystack/utils": "^2.0.
|
|
40
|
-
"ajv": "^8.
|
|
31
|
+
"@furystack/core": "^10.4.8",
|
|
32
|
+
"@furystack/inject": "^5.0.5",
|
|
33
|
+
"@furystack/logging": "^2.0.89",
|
|
34
|
+
"@furystack/repository": "^5.0.32",
|
|
35
|
+
"@furystack/rest": "^3.1.10",
|
|
36
|
+
"@furystack/utils": "^2.0.4",
|
|
37
|
+
"ajv": "^8.10.0",
|
|
41
38
|
"ajv-formats": "^2.1.1",
|
|
42
39
|
"hash.js": "^1.1.7",
|
|
43
40
|
"path-to-regexp": "^6.2.0",
|
|
@@ -46,11 +43,12 @@
|
|
|
46
43
|
"uuid": "^8.3.2"
|
|
47
44
|
},
|
|
48
45
|
"devDependencies": {
|
|
49
|
-
"@
|
|
50
|
-
"@types/
|
|
51
|
-
"@types/
|
|
46
|
+
"@furystack/rest-client-got": "^1.0.41",
|
|
47
|
+
"@types/jest": "^27.4.0",
|
|
48
|
+
"@types/node": "^17.0.19",
|
|
49
|
+
"@types/uuid": "^8.3.4",
|
|
52
50
|
"got": "^11.8.3"
|
|
53
51
|
},
|
|
54
52
|
"typings": "./dist/index.d.ts",
|
|
55
|
-
"gitHead": "
|
|
56
|
-
}
|
|
53
|
+
"gitHead": "1045d854bfd8c475b7035471d130d401417a2321"
|
|
54
|
+
}
|
package/src/authenticate.spec.ts
CHANGED
|
@@ -26,7 +26,7 @@ describe('Authenticate', () => {
|
|
|
26
26
|
},
|
|
27
27
|
HttpUserContext,
|
|
28
28
|
)
|
|
29
|
-
const exampleAuthenticatedAction = jest.fn(async (
|
|
29
|
+
const exampleAuthenticatedAction = jest.fn(async () => EmptyResult())
|
|
30
30
|
const authorized = Authenticate()(exampleAuthenticatedAction)
|
|
31
31
|
|
|
32
32
|
const result = await authorized({ injector: i, request, response })
|
|
@@ -48,7 +48,7 @@ describe('Authenticate', () => {
|
|
|
48
48
|
},
|
|
49
49
|
HttpUserContext,
|
|
50
50
|
)
|
|
51
|
-
const exampleAuthenticatedAction = jest.fn(async (
|
|
51
|
+
const exampleAuthenticatedAction = jest.fn(async () => EmptyResult())
|
|
52
52
|
const authorized = Authenticate()(exampleAuthenticatedAction)
|
|
53
53
|
|
|
54
54
|
const result = await authorized({ injector: i, request, response })
|
|
@@ -66,7 +66,7 @@ describe('Authenticate', () => {
|
|
|
66
66
|
{ isAuthenticated: isAuthenticatedAction, getCurrentUser: async () => Promise.reject(':(') },
|
|
67
67
|
IdentityContext,
|
|
68
68
|
)
|
|
69
|
-
const exampleAuthenticatedAction = jest.fn(async (
|
|
69
|
+
const exampleAuthenticatedAction = jest.fn(async () => EmptyResult())
|
|
70
70
|
const authorized = Authenticate()(exampleAuthenticatedAction)
|
|
71
71
|
const params = { injector: i, body: undefined, query: undefined, request, response }
|
|
72
72
|
const result = await authorized(params)
|
package/src/authorize.spec.ts
CHANGED
|
@@ -17,7 +17,7 @@ describe('Authorize', () => {
|
|
|
17
17
|
{ isAuthorized: isAuthorizedAction, getCurrentUser: () => Promise.reject(':(') },
|
|
18
18
|
IdentityContext,
|
|
19
19
|
)
|
|
20
|
-
const exampleAuthorizedAction = jest.fn(async (
|
|
20
|
+
const exampleAuthorizedAction = jest.fn(async () => EmptyResult())
|
|
21
21
|
const authorized = Authorize('Role1')(exampleAuthorizedAction)
|
|
22
22
|
|
|
23
23
|
const result = await authorized({ injector: i, request, response })
|
|
@@ -37,7 +37,7 @@ describe('Authorize', () => {
|
|
|
37
37
|
},
|
|
38
38
|
IdentityContext,
|
|
39
39
|
)
|
|
40
|
-
const exampleAuthorizedAction = jest.fn(async (
|
|
40
|
+
const exampleAuthorizedAction = jest.fn(async () => EmptyResult())
|
|
41
41
|
const authorized = Authorize('Role2')(exampleAuthorizedAction)
|
|
42
42
|
|
|
43
43
|
const result = await authorized({ injector: i, request, response })
|
|
@@ -57,7 +57,7 @@ describe('Authorize', () => {
|
|
|
57
57
|
},
|
|
58
58
|
IdentityContext,
|
|
59
59
|
)
|
|
60
|
-
const exampleAuthorizedAction = jest.fn(async (
|
|
60
|
+
const exampleAuthorizedAction = jest.fn(async () => EmptyResult())
|
|
61
61
|
const authorized = Authorize('Role1')(exampleAuthorizedAction)
|
|
62
62
|
const params = { injector: i, body: undefined, query: undefined, request, response }
|
|
63
63
|
const result = await authorized(params)
|
package/src/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export * from './incoming-message-extensions'
|
|
|
9
9
|
export * from './server-manager'
|
|
10
10
|
export * from './server-response-extensions'
|
|
11
11
|
export * from './utils'
|
|
12
|
-
export * from './models
|
|
12
|
+
export * from './models'
|
|
13
13
|
export * from './endpoint-generators'
|
|
14
14
|
export * from './schema-validator'
|
|
15
15
|
export * from './request-action-implementation'
|
|
@@ -16,11 +16,11 @@ describe('ServerResponse extensions', () => {
|
|
|
16
16
|
const socket = new Socket()
|
|
17
17
|
const msg = new ServerResponse(new IncomingMessage(socket))
|
|
18
18
|
msg.writeHead = jest.fn()
|
|
19
|
-
msg.end = (chunk
|
|
19
|
+
msg.end = ((chunk: any) => {
|
|
20
20
|
expect(chunk).toBe(JSON.stringify(jsonValue))
|
|
21
21
|
expect(msg.writeHead).toBeCalledWith(200, { 'Content-Type': 'application/json' })
|
|
22
22
|
done()
|
|
23
|
-
}
|
|
23
|
+
}) as typeof msg['end']
|
|
24
24
|
|
|
25
25
|
msg.sendActionResult(JsonResult(jsonValue))
|
|
26
26
|
})
|
|
@@ -30,11 +30,11 @@ describe('ServerResponse extensions', () => {
|
|
|
30
30
|
const socket = new Socket()
|
|
31
31
|
const msg = new ServerResponse(new IncomingMessage(socket))
|
|
32
32
|
msg.writeHead = jest.fn()
|
|
33
|
-
msg.end = (chunk
|
|
33
|
+
msg.end = ((chunk: any) => {
|
|
34
34
|
expect(chunk).toBe(textValue)
|
|
35
35
|
expect(msg.writeHead).toBeCalledWith(200, { 'Content-Type': 'plain/text' })
|
|
36
36
|
done()
|
|
37
|
-
}
|
|
37
|
+
}) as typeof msg['end']
|
|
38
38
|
|
|
39
39
|
msg.sendActionResult(PlainTextResult(textValue))
|
|
40
40
|
})
|
|
@@ -11,7 +11,7 @@ import { ValidationApi } from 'validate.integration.schema'
|
|
|
11
11
|
|
|
12
12
|
// To recreate: yarn ts-json-schema-generator -f tsconfig.json --no-type-check -p packages/rest-service/src/validate.integration.schema.ts -o packages/rest-service/src/validate.integration.spec.schema.json
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const createValidateApi = async () => {
|
|
15
15
|
const injector = new Injector()
|
|
16
16
|
const port = Math.round(Math.random() * 1000) + 10000
|
|
17
17
|
injector.useRestService<ValidationApi>({
|