@furystack/rest-service 7.0.12 → 7.0.14
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/esm/actions/error-action.js.map +1 -1
- package/esm/actions/error-action.spec.d.ts +2 -0
- package/esm/actions/error-action.spec.d.ts.map +1 -0
- package/esm/actions/error-action.spec.js +47 -0
- package/esm/actions/error-action.spec.js.map +1 -0
- package/esm/actions/get-current-user.spec.d.ts +2 -0
- package/esm/actions/get-current-user.spec.d.ts.map +1 -0
- package/esm/actions/get-current-user.spec.js +19 -0
- package/esm/actions/get-current-user.spec.js.map +1 -0
- package/esm/actions/is-authenticated.spec.d.ts +2 -0
- package/esm/actions/is-authenticated.spec.d.ts.map +1 -0
- package/esm/actions/is-authenticated.spec.js +18 -0
- package/esm/actions/is-authenticated.spec.js.map +1 -0
- package/esm/actions/login-action.spec.d.ts +2 -0
- package/esm/actions/login-action.spec.d.ts.map +1 -0
- package/esm/actions/login-action.spec.js +34 -0
- package/esm/actions/login-action.spec.js.map +1 -0
- package/esm/actions/login.js.map +1 -1
- package/esm/actions/logout-action.spec.d.ts +2 -0
- package/esm/actions/logout-action.spec.d.ts.map +1 -0
- package/esm/actions/logout-action.spec.js +22 -0
- package/esm/actions/logout-action.spec.js.map +1 -0
- package/esm/actions/not-found-action.spec.d.ts +2 -0
- package/esm/actions/not-found-action.spec.d.ts.map +1 -0
- package/esm/actions/not-found-action.spec.js +16 -0
- package/esm/actions/not-found-action.spec.js.map +1 -0
- package/esm/add-cors-header.spec.d.ts +2 -0
- package/esm/add-cors-header.spec.d.ts.map +1 -0
- package/esm/add-cors-header.spec.js +98 -0
- package/esm/add-cors-header.spec.js.map +1 -0
- package/esm/api-manager.js.map +1 -1
- package/esm/authenticate.js.map +1 -1
- package/esm/authenticate.spec.d.ts +2 -0
- package/esm/authenticate.spec.d.ts.map +1 -0
- package/esm/authenticate.spec.js +58 -0
- package/esm/authenticate.spec.js.map +1 -0
- package/esm/authorize.js.map +1 -1
- package/esm/authorize.spec.d.ts +2 -0
- package/esm/authorize.spec.d.ts.map +1 -0
- package/esm/authorize.spec.js +54 -0
- package/esm/authorize.spec.js.map +1 -0
- package/esm/endpoint-generators/create-delete-endpoint.spec.d.ts +2 -0
- package/esm/endpoint-generators/create-delete-endpoint.spec.d.ts.map +1 -0
- package/esm/endpoint-generators/create-delete-endpoint.spec.js +34 -0
- package/esm/endpoint-generators/create-delete-endpoint.spec.js.map +1 -0
- package/esm/endpoint-generators/create-get-collection-endpoint.spec.d.ts +2 -0
- package/esm/endpoint-generators/create-get-collection-endpoint.spec.d.ts.map +1 -0
- package/esm/endpoint-generators/create-get-collection-endpoint.spec.js +156 -0
- package/esm/endpoint-generators/create-get-collection-endpoint.spec.js.map +1 -0
- package/esm/endpoint-generators/create-get-entity-endpoint.js.map +1 -1
- package/esm/endpoint-generators/create-get-entity-endpoint.spec.d.ts +2 -0
- package/esm/endpoint-generators/create-get-entity-endpoint.spec.d.ts.map +1 -0
- package/esm/endpoint-generators/create-get-entity-endpoint.spec.js +74 -0
- package/esm/endpoint-generators/create-get-entity-endpoint.spec.js.map +1 -0
- package/esm/endpoint-generators/create-patch-endpoint.spec.d.ts +2 -0
- package/esm/endpoint-generators/create-patch-endpoint.spec.d.ts.map +1 -0
- package/esm/endpoint-generators/create-patch-endpoint.spec.js +37 -0
- package/esm/endpoint-generators/create-patch-endpoint.spec.js.map +1 -0
- package/esm/endpoint-generators/create-post-endpoint.js.map +1 -1
- package/esm/endpoint-generators/create-post-endpoint.spec.d.ts +2 -0
- package/esm/endpoint-generators/create-post-endpoint.spec.d.ts.map +1 -0
- package/esm/endpoint-generators/create-post-endpoint.spec.js +35 -0
- package/esm/endpoint-generators/create-post-endpoint.spec.js.map +1 -0
- package/esm/helpers.spec.d.ts +2 -0
- package/esm/helpers.spec.d.ts.map +1 -0
- package/esm/helpers.spec.js +34 -0
- package/esm/helpers.spec.js.map +1 -0
- package/esm/http-user-context.d.ts +3 -0
- package/esm/http-user-context.d.ts.map +1 -1
- package/esm/http-user-context.js.map +1 -1
- package/esm/http-user-context.spec.d.ts +3 -0
- package/esm/http-user-context.spec.d.ts.map +1 -0
- package/esm/http-user-context.spec.js +269 -0
- package/esm/http-user-context.spec.js.map +1 -0
- package/esm/incoming-message-extensions.spec.d.ts +2 -0
- package/esm/incoming-message-extensions.spec.d.ts.map +1 -0
- package/esm/incoming-message-extensions.spec.js +38 -0
- package/esm/incoming-message-extensions.spec.js.map +1 -0
- package/esm/mime-types.spec.d.ts +2 -0
- package/esm/mime-types.spec.d.ts.map +1 -0
- package/esm/mime-types.spec.js +14 -0
- package/esm/mime-types.spec.js.map +1 -0
- package/esm/request-action-implementation.d.ts +3 -0
- package/esm/request-action-implementation.d.ts.map +1 -1
- package/esm/rest-service.integration.spec.d.ts +2 -0
- package/esm/rest-service.integration.spec.d.ts.map +1 -0
- package/esm/rest-service.integration.spec.js +156 -0
- package/esm/rest-service.integration.spec.js.map +1 -0
- package/esm/rest.integration.test.d.ts +89 -0
- package/esm/rest.integration.test.d.ts.map +1 -0
- package/esm/rest.integration.test.js +154 -0
- package/esm/rest.integration.test.js.map +1 -0
- package/esm/schema-validator/schema-validator.js.map +1 -1
- package/esm/schema-validator/schema-validator.test.d.ts +2 -0
- package/esm/schema-validator/schema-validator.test.d.ts.map +1 -0
- package/esm/schema-validator/schema-validator.test.js +61 -0
- package/esm/schema-validator/schema-validator.test.js.map +1 -0
- package/esm/server-manager.d.ts +3 -0
- package/esm/server-manager.d.ts.map +1 -1
- package/esm/server-manager.js.map +1 -1
- package/esm/server-response-extensions.js.map +1 -1
- package/esm/server-response-extensions.spec.d.ts +2 -0
- package/esm/server-response-extensions.spec.d.ts.map +1 -0
- package/esm/server-response-extensions.spec.js +52 -0
- package/esm/server-response-extensions.spec.js.map +1 -0
- package/esm/static-server-manager.d.ts +3 -0
- package/esm/static-server-manager.d.ts.map +1 -1
- package/esm/static-server-manager.js.map +1 -1
- package/esm/static-server-manager.spec.d.ts +2 -0
- package/esm/static-server-manager.spec.d.ts.map +1 -0
- package/esm/static-server-manager.spec.js +216 -0
- package/esm/static-server-manager.spec.js.map +1 -0
- package/esm/utils.d.ts +3 -0
- package/esm/utils.d.ts.map +1 -1
- package/esm/utils.js.map +1 -1
- package/esm/validate.integration.spec.d.ts +2 -0
- package/esm/validate.integration.spec.d.ts.map +1 -0
- package/esm/validate.integration.spec.js +211 -0
- package/esm/validate.integration.spec.js.map +1 -0
- package/esm/validate.js.map +1 -1
- package/package.json +11 -11
- package/src/actions/error-action.spec.ts +1 -1
- package/src/actions/get-current-user.spec.ts +1 -1
- package/src/actions/is-authenticated.spec.ts +1 -1
- package/src/actions/login-action.spec.ts +2 -2
- package/src/actions/logout-action.spec.ts +2 -2
- package/src/actions/not-found-action.spec.ts +1 -1
- package/src/add-cors-header.spec.ts +1 -1
- package/src/authenticate.spec.ts +3 -3
- package/src/authorize.spec.ts +2 -2
- package/src/endpoint-generators/create-delete-endpoint.spec.ts +3 -3
- package/src/endpoint-generators/create-get-collection-endpoint.spec.ts +3 -3
- package/src/endpoint-generators/create-get-entity-endpoint.spec.ts +3 -3
- package/src/endpoint-generators/create-patch-endpoint.spec.ts +3 -3
- package/src/endpoint-generators/create-post-endpoint.spec.ts +3 -3
- package/src/helpers.spec.ts +4 -4
- package/src/http-user-context.spec.ts +3 -3
- package/src/mime-types.spec.ts +1 -1
- package/src/rest-service.integration.spec.ts +4 -4
- package/src/rest.integration.test.ts +2 -3
- package/src/schema-validator/schema-validator.test.ts +4 -4
- package/src/server-response-extensions.spec.ts +1 -1
- package/src/static-server-manager.spec.ts +2 -2
- package/src/validate.integration.spec.ts +4 -7
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { Injector } from '@furystack/inject';
|
|
2
|
+
import { sleepAsync, usingAsync } from '@furystack/utils';
|
|
3
|
+
import { ServerManager } from './server-manager.js';
|
|
4
|
+
import { StaticServerManager } from './static-server-manager.js';
|
|
5
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
6
|
+
/**
|
|
7
|
+
* Generator for an incremental port number
|
|
8
|
+
* @param initialPort The initial port number
|
|
9
|
+
* @yields a port for testing
|
|
10
|
+
* @returns The Port number
|
|
11
|
+
*/
|
|
12
|
+
function* portGenerator(initialPort = 1234) {
|
|
13
|
+
let port = initialPort;
|
|
14
|
+
while (true) {
|
|
15
|
+
yield port++;
|
|
16
|
+
}
|
|
17
|
+
return port;
|
|
18
|
+
}
|
|
19
|
+
const getPort = () => portGenerator().next().value;
|
|
20
|
+
describe('StaticServerManager', () => {
|
|
21
|
+
describe('Top level routing', () => {
|
|
22
|
+
it('Should return a 404 without fallback', async () => {
|
|
23
|
+
await usingAsync(new Injector(), async (injector) => {
|
|
24
|
+
const staticServerManager = injector.getInstance(StaticServerManager);
|
|
25
|
+
const port = getPort();
|
|
26
|
+
await staticServerManager.addStaticSite({
|
|
27
|
+
baseUrl: '/',
|
|
28
|
+
path: '.',
|
|
29
|
+
port,
|
|
30
|
+
});
|
|
31
|
+
const result = await fetch(`http://localhost:${port}/not-found.html`);
|
|
32
|
+
expect(result.ok).toBe(false);
|
|
33
|
+
expect(result.status).toBe(404);
|
|
34
|
+
expect(result?.headers.get('content-type')).toBe('text/plain');
|
|
35
|
+
const body = await result.text();
|
|
36
|
+
expect(body).toBe('Not found');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
it('Should return a fallback', async () => {
|
|
40
|
+
await usingAsync(new Injector(), async (injector) => {
|
|
41
|
+
const staticServerManager = injector.getInstance(StaticServerManager);
|
|
42
|
+
const port = getPort();
|
|
43
|
+
await staticServerManager.addStaticSite({
|
|
44
|
+
baseUrl: '/',
|
|
45
|
+
path: '.',
|
|
46
|
+
fallback: 'package.json',
|
|
47
|
+
port,
|
|
48
|
+
headers: {
|
|
49
|
+
'custom-header': 'custom-value',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const result = await fetch(`http://localhost:${port}/not-found.html`);
|
|
53
|
+
expect(result.headers.get('content-type')).toBe('application/json');
|
|
54
|
+
expect(result.headers.get('custom-header')).toBe('custom-value');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
it('Should return a fallback for root files', async () => {
|
|
58
|
+
await usingAsync(new Injector(), async (injector) => {
|
|
59
|
+
const staticServerManager = injector.getInstance(StaticServerManager);
|
|
60
|
+
const port = getPort();
|
|
61
|
+
await staticServerManager.addStaticSite({
|
|
62
|
+
baseUrl: '/',
|
|
63
|
+
path: '.',
|
|
64
|
+
fallback: 'package.json',
|
|
65
|
+
port,
|
|
66
|
+
headers: {
|
|
67
|
+
'custom-header': 'custom-value',
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
const result = await fetch(`http://localhost:${port}`);
|
|
71
|
+
expect(result.headers.get('content-type')).toBe('application/json');
|
|
72
|
+
expect(result.headers.get('custom-header')).toBe('custom-value');
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
it('Should return a defined file from a root directory', async () => {
|
|
76
|
+
await usingAsync(new Injector(), async (injector) => {
|
|
77
|
+
const staticServerManager = injector.getInstance(StaticServerManager);
|
|
78
|
+
const port = getPort();
|
|
79
|
+
await staticServerManager.addStaticSite({
|
|
80
|
+
baseUrl: '/',
|
|
81
|
+
path: '.',
|
|
82
|
+
port,
|
|
83
|
+
headers: {
|
|
84
|
+
'custom-header': 'custom-value',
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const result = await fetch(`http://localhost:${port}/README.md`);
|
|
88
|
+
expect(result.headers.get('content-type')).toBe('text/markdown');
|
|
89
|
+
expect(result.headers.get('custom-header')).toBe('custom-value');
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
it('Should return a defined file from a subdirectory', async () => {
|
|
93
|
+
await usingAsync(new Injector(), async (injector) => {
|
|
94
|
+
const staticServerManager = injector.getInstance(StaticServerManager);
|
|
95
|
+
const port = getPort();
|
|
96
|
+
await staticServerManager.addStaticSite({
|
|
97
|
+
baseUrl: '/',
|
|
98
|
+
path: '.',
|
|
99
|
+
port,
|
|
100
|
+
});
|
|
101
|
+
const result = await fetch(`http://localhost:${port}/packages/utils/README.md`);
|
|
102
|
+
expect(result.headers.get('content-type')).toBe('text/markdown');
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
describe('Non-top level routing', () => {
|
|
107
|
+
it('Should not handle a request when the path is not matching', async () => {
|
|
108
|
+
await usingAsync(new Injector(), async (injector) => {
|
|
109
|
+
const staticServerManager = injector.getInstance(StaticServerManager);
|
|
110
|
+
const port = getPort();
|
|
111
|
+
await staticServerManager.addStaticSite({
|
|
112
|
+
baseUrl: '/bundle',
|
|
113
|
+
path: '.',
|
|
114
|
+
port,
|
|
115
|
+
});
|
|
116
|
+
const server = [...injector.getInstance(ServerManager).servers.values()][0];
|
|
117
|
+
server.apis[0].onRequest = vi.fn();
|
|
118
|
+
fetch(`http://localhost:${port}/bundleToAnotherFolder/not-found.html`).catch(() => {
|
|
119
|
+
/** should fall, ignore */
|
|
120
|
+
});
|
|
121
|
+
await sleepAsync(100);
|
|
122
|
+
expect(server.apis[0].onRequest).not.toHaveBeenCalled();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
it('Should return a 404 without fallback', async () => {
|
|
126
|
+
await usingAsync(new Injector(), async (injector) => {
|
|
127
|
+
const staticServerManager = injector.getInstance(StaticServerManager);
|
|
128
|
+
const port = getPort();
|
|
129
|
+
await staticServerManager.addStaticSite({
|
|
130
|
+
baseUrl: '/bundle',
|
|
131
|
+
path: '.',
|
|
132
|
+
port,
|
|
133
|
+
});
|
|
134
|
+
const result = await fetch(`http://localhost:${port}/bundle/not-found.html`);
|
|
135
|
+
expect(result.ok).toBe(false);
|
|
136
|
+
expect(result.status).toBe(404);
|
|
137
|
+
expect(result.headers.get('content-type')).toBe('text/plain');
|
|
138
|
+
const body = await result.text();
|
|
139
|
+
expect(body).toBe('Not found');
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
it('Should return a fallback', async () => {
|
|
143
|
+
await usingAsync(new Injector(), async (injector) => {
|
|
144
|
+
const staticServerManager = injector.getInstance(StaticServerManager);
|
|
145
|
+
const port = getPort();
|
|
146
|
+
await staticServerManager.addStaticSite({
|
|
147
|
+
baseUrl: '/bundle',
|
|
148
|
+
path: '.',
|
|
149
|
+
fallback: 'package.json',
|
|
150
|
+
port,
|
|
151
|
+
});
|
|
152
|
+
const result = await fetch(`http://localhost:${port}/bundle/not-found.html`);
|
|
153
|
+
expect(result.headers.get('content-type')).toBe('application/json');
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
it('Should return a defined file from a root directory', async () => {
|
|
157
|
+
await usingAsync(new Injector(), async (injector) => {
|
|
158
|
+
const staticServerManager = injector.getInstance(StaticServerManager);
|
|
159
|
+
const port = getPort();
|
|
160
|
+
await staticServerManager.addStaticSite({
|
|
161
|
+
baseUrl: '/',
|
|
162
|
+
path: '.',
|
|
163
|
+
port,
|
|
164
|
+
});
|
|
165
|
+
const result = await fetch(`http://localhost:${port}/README.md`);
|
|
166
|
+
expect(result.headers.get('content-type')).toBe('text/markdown');
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
it('Should return a defined file from a subdirectory', async () => {
|
|
170
|
+
await usingAsync(new Injector(), async (injector) => {
|
|
171
|
+
const staticServerManager = injector.getInstance(StaticServerManager);
|
|
172
|
+
const port = getPort();
|
|
173
|
+
await staticServerManager.addStaticSite({
|
|
174
|
+
baseUrl: '/',
|
|
175
|
+
path: '.',
|
|
176
|
+
port,
|
|
177
|
+
});
|
|
178
|
+
const result = await fetch(`http://localhost:${port}/packages/utils/README.md`);
|
|
179
|
+
expect(result.headers.get('content-type')).toBe('text/markdown');
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
describe('shouldExec', () => {
|
|
184
|
+
it('Should NOT match for requests with not defined method', () => {
|
|
185
|
+
const staticServerManager = new StaticServerManager();
|
|
186
|
+
expect(staticServerManager.shouldExec('/')({ req: { url: '/' } })).toBe(false);
|
|
187
|
+
});
|
|
188
|
+
it('Should NOT match for non-GET requests', () => {
|
|
189
|
+
const staticServerManager = new StaticServerManager();
|
|
190
|
+
expect(staticServerManager.shouldExec('/')({ req: { method: 'POST', url: '/' } })).toBe(false);
|
|
191
|
+
});
|
|
192
|
+
[
|
|
193
|
+
['/', '/'],
|
|
194
|
+
['/', '/index.html'],
|
|
195
|
+
['/', '/subdir'],
|
|
196
|
+
['/', '/subdir/'],
|
|
197
|
+
['/', '/subdir/file.js'],
|
|
198
|
+
['/subdir', '/subdir'],
|
|
199
|
+
['/subdir', '/subdir/'],
|
|
200
|
+
['/subdir', '/subdir/file.js'],
|
|
201
|
+
['/subdir', '/subdir/s2/file.js'],
|
|
202
|
+
].forEach(([root, url]) => it(`Should match for '${root}' root and '${url}' url`, () => {
|
|
203
|
+
const staticServerManager = new StaticServerManager();
|
|
204
|
+
const shouldExec = staticServerManager.shouldExec(root)({ req: { method: 'GET', url } });
|
|
205
|
+
expect(shouldExec).toBe(true);
|
|
206
|
+
}));
|
|
207
|
+
it('Should not exec different paths for non-top level root directory', () => {
|
|
208
|
+
const staticServerManager = new StaticServerManager();
|
|
209
|
+
expect(staticServerManager.shouldExec('/subdir')({ req: { method: 'GET', url: '/' } })).toBe(false);
|
|
210
|
+
expect(staticServerManager.shouldExec('/subdir')({ req: { method: 'GET', url: '/other/index.html' } })).toBe(false);
|
|
211
|
+
expect(staticServerManager.shouldExec('/subdir')({ req: { method: 'GET', url: '/subdir2' } })).toBe(false);
|
|
212
|
+
expect(staticServerManager.shouldExec('/subdir')({ req: { method: 'GET', url: '/subdir2/index.html' } })).toBe(false);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
//# sourceMappingURL=static-server-manager.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static-server-manager.spec.js","sourceRoot":"","sources":["../src/static-server-manager.spec.ts"],"names":[],"mappings":"AAA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AU,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACnG,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAC1G,KAAK,CACN,CAAA;YACD,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAC1G,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAC5G,KAAK,CACN,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/esm/utils.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/// <reference path="server-response-extensions.d.ts" />
|
|
2
|
+
/// <reference path="incoming-message-extensions.d.ts" />
|
|
3
|
+
/// <reference types="node/http.js" />
|
|
1
4
|
import type { IncomingMessage, ServerResponse } from 'http';
|
|
2
5
|
import type { CorsOptions } from './models/cors-options.js';
|
|
3
6
|
/**
|
package/esm/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAE3D;;GAEG;AACH,qBACa,KAAK;IACH,eAAe,CAAC,eAAe,EAAE,eAAe;IAuB7D;;;;OAIG;IACU,YAAY,CAAC,CAAC,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC;IAM1E;;;;;OAKG;IACI,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc;CAkB7G"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAE3D;;GAEG;AACH,qBACa,KAAK;IACH,eAAe,CAAC,eAAe,EAAE,eAAe;IAuB7D;;;;OAIG;IACU,YAAY,CAAC,CAAC,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC;IAM1E;;;;;OAKG;IACI,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc;CAkB7G"}
|
package/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAG9C;;GAEG;AAEI,IAAM,KAAK,GAAX,MAAM,KAAK;IACT,KAAK,CAAC,eAAe,CAAC,eAAgC;QAC3D,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAA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AAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,EAC3E,CAAC;YACD,cAAc,CAAC,SAAS,CAAC,6BAA6B,EAAE,eAAe,CAAC,OAAO,CAAC,MAAgB,CAAC,CAAA;YACjG,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;gBACxB,cAAc,CAAC,SAAS,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAA;YACtE,CAAC;YACD,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBAC9C,cAAc,CAAC,SAAS,CAAC,8BAA8B,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;YACtF,CAAC;YACD,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBAC9C,cAAc,CAAC,SAAS,CAAC,8BAA8B,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;YACtF,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AA3DY,KAAK;IADjB,UAAU,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;GACzB,KAAK,CA2DjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.integration.spec.d.ts","sourceRoot":"","sources":["../src/validate.integration.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { Injector } from '@furystack/inject';
|
|
2
|
+
import { createClient, ResponseError } from '@furystack/rest-client-fetch';
|
|
3
|
+
import { usingAsync } from '@furystack/utils';
|
|
4
|
+
import { JsonResult } from './request-action-implementation.js';
|
|
5
|
+
import { Validate } from './validate.js';
|
|
6
|
+
import schema from './validate.integration.spec.schema.json' assert { type: 'json' };
|
|
7
|
+
import { useRestService } from './helpers.js';
|
|
8
|
+
import { describe, it, expect } from 'vitest';
|
|
9
|
+
// 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
|
|
10
|
+
const createValidateApi = async () => {
|
|
11
|
+
const injector = new Injector();
|
|
12
|
+
const port = Math.round(Math.random() * 1000) + 10000;
|
|
13
|
+
useRestService({
|
|
14
|
+
injector,
|
|
15
|
+
api: {
|
|
16
|
+
GET: {
|
|
17
|
+
'/validate-query': Validate({
|
|
18
|
+
schema,
|
|
19
|
+
schemaName: 'ValidateQuery',
|
|
20
|
+
})(async ({ getQuery }) => JsonResult({ ...getQuery() })),
|
|
21
|
+
'/validate-url/:id': Validate({
|
|
22
|
+
schema,
|
|
23
|
+
schemaName: 'ValidateUrl',
|
|
24
|
+
})(async ({ getUrlParams }) => JsonResult({ ...getUrlParams() })),
|
|
25
|
+
'/validate-headers': Validate({
|
|
26
|
+
schema,
|
|
27
|
+
schemaName: 'ValidateHeaders',
|
|
28
|
+
})(async ({ headers }) => JsonResult({ ...headers })),
|
|
29
|
+
'/mock': undefined, // ToDo: Generator and test
|
|
30
|
+
'/mock/:id': undefined, // ToDo: Generator and test
|
|
31
|
+
},
|
|
32
|
+
POST: {
|
|
33
|
+
'/validate-body': Validate({
|
|
34
|
+
schema,
|
|
35
|
+
schemaName: 'ValidateBody',
|
|
36
|
+
})(async ({ getBody }) => {
|
|
37
|
+
const body = await getBody();
|
|
38
|
+
return JsonResult({ ...body });
|
|
39
|
+
}),
|
|
40
|
+
'/mock': undefined, // ToDo: Generator and test
|
|
41
|
+
},
|
|
42
|
+
PATCH: {
|
|
43
|
+
'/mock/:id': undefined, // ToDo: Generator and test
|
|
44
|
+
},
|
|
45
|
+
DELETE: {
|
|
46
|
+
'/mock/:id': undefined, // ToDo: Generator and test
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
port,
|
|
50
|
+
root: '/api',
|
|
51
|
+
});
|
|
52
|
+
const client = createClient({
|
|
53
|
+
endpointUrl: `http://localhost:${port}/api`,
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
dispose: injector.dispose.bind(injector),
|
|
57
|
+
client,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
describe('Validation integration tests', () => {
|
|
61
|
+
describe('Validation errors', () => {
|
|
62
|
+
it('Should validate query', async () => {
|
|
63
|
+
await usingAsync(await createValidateApi(), async ({ client }) => {
|
|
64
|
+
expect.assertions(5);
|
|
65
|
+
try {
|
|
66
|
+
await client({
|
|
67
|
+
method: 'GET',
|
|
68
|
+
action: '/validate-query',
|
|
69
|
+
query: undefined,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (error instanceof ResponseError) {
|
|
74
|
+
expect(error.message).toBe('Bad Request');
|
|
75
|
+
expect(error.response?.status).toBe(400);
|
|
76
|
+
const responseJson = await error.response.json();
|
|
77
|
+
expect(responseJson.errors[0].params.missingProperty).toEqual('foo');
|
|
78
|
+
expect(responseJson.errors[1].params.missingProperty).toEqual('bar');
|
|
79
|
+
expect(responseJson.errors[2].params.missingProperty).toEqual('baz');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
it('Should validate url', async () => {
|
|
85
|
+
await usingAsync(await createValidateApi(), async ({ client }) => {
|
|
86
|
+
expect.assertions(4);
|
|
87
|
+
try {
|
|
88
|
+
await client({
|
|
89
|
+
method: 'GET',
|
|
90
|
+
action: '/validate-url/:id',
|
|
91
|
+
url: undefined,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
if (error instanceof ResponseError) {
|
|
96
|
+
expect(error.message).toBe('Bad Request');
|
|
97
|
+
expect(error.response?.status).toBe(400);
|
|
98
|
+
const responseJson = await error.response.json();
|
|
99
|
+
expect(responseJson.errors[0].params.type).toEqual('number');
|
|
100
|
+
expect(responseJson.errors[0].instancePath).toEqual('/url/id');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
it('Should validate headers', async () => {
|
|
106
|
+
await usingAsync(await createValidateApi(), async ({ client }) => {
|
|
107
|
+
expect.assertions(3);
|
|
108
|
+
try {
|
|
109
|
+
await client({
|
|
110
|
+
method: 'GET',
|
|
111
|
+
action: '/validate-headers',
|
|
112
|
+
headers: undefined,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
if (error instanceof ResponseError) {
|
|
117
|
+
expect(error.message).toBe('Bad Request');
|
|
118
|
+
expect(error.response?.status).toBe(400);
|
|
119
|
+
const responseJson = await error.response.json();
|
|
120
|
+
expect(responseJson.errors.find((e) => e.keyword === 'required' && e.message.includes('foo'))).toBeDefined();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
it('Should validate body', async () => {
|
|
126
|
+
await usingAsync(await createValidateApi(), async ({ client }) => {
|
|
127
|
+
expect.assertions(3);
|
|
128
|
+
try {
|
|
129
|
+
await client({
|
|
130
|
+
method: 'POST',
|
|
131
|
+
action: '/validate-body',
|
|
132
|
+
body: undefined,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
if (error instanceof ResponseError) {
|
|
137
|
+
expect(error.message).toBe('Bad Request');
|
|
138
|
+
expect(error.response?.status).toBe(400);
|
|
139
|
+
const responseJson = await error.response.json();
|
|
140
|
+
expect(responseJson.errors[0].params.missingProperty).toEqual('body');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
describe('Validation Success', () => {
|
|
147
|
+
it('Should validate query', async () => {
|
|
148
|
+
await usingAsync(await createValidateApi(), async ({ client }) => {
|
|
149
|
+
const result = await client({
|
|
150
|
+
method: 'GET',
|
|
151
|
+
action: '/validate-query',
|
|
152
|
+
query: {
|
|
153
|
+
foo: 'foo',
|
|
154
|
+
bar: 2,
|
|
155
|
+
baz: false,
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
expect(result.response.status).toBe(200);
|
|
159
|
+
expect(result.result.foo).toBe('foo');
|
|
160
|
+
expect(result.result.bar).toBe(2);
|
|
161
|
+
expect(result.result.baz).toBe(false);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
it('Should validate url', async () => {
|
|
165
|
+
await usingAsync(await createValidateApi(), async ({ client }) => {
|
|
166
|
+
const result = await client({
|
|
167
|
+
method: 'GET',
|
|
168
|
+
action: '/validate-url/:id',
|
|
169
|
+
url: { id: 3 },
|
|
170
|
+
});
|
|
171
|
+
expect(result.response.status).toBe(200);
|
|
172
|
+
expect(result.result.id).toBe(3);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
it('Should validate headers', async () => {
|
|
176
|
+
await usingAsync(await createValidateApi(), async ({ client }) => {
|
|
177
|
+
const result = await client({
|
|
178
|
+
method: 'GET',
|
|
179
|
+
action: '/validate-headers',
|
|
180
|
+
headers: {
|
|
181
|
+
foo: 'foo',
|
|
182
|
+
bar: 42,
|
|
183
|
+
baz: true,
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
expect(result.response.status).toBe(200);
|
|
187
|
+
expect(result.result.foo).toBe('foo');
|
|
188
|
+
expect(result.result.bar).toBe(42);
|
|
189
|
+
expect(result.result.baz).toBe(true);
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
it('Should validate body', async () => {
|
|
193
|
+
await usingAsync(await createValidateApi(), async ({ client }) => {
|
|
194
|
+
const result = await client({
|
|
195
|
+
method: 'POST',
|
|
196
|
+
action: '/validate-body',
|
|
197
|
+
body: {
|
|
198
|
+
foo: 'foo',
|
|
199
|
+
bar: 42,
|
|
200
|
+
baz: true,
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
expect(result.response.status).toBe(200);
|
|
204
|
+
expect(result.result.foo).toBe('foo');
|
|
205
|
+
expect(result.result.bar).toBe(42);
|
|
206
|
+
expect(result.result.baz).toBe(true);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
//# sourceMappingURL=validate.integration.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.integration.spec.js","sourceRoot":"","sources":["../src/validate.integration.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,MAAM,MAAM,yCAAyC,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,CAAA;AAEpF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE7C,6MAA6M;AAE7M,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;IACnC,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAA;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAA;IACrD,cAAc,CAAgB;QAC5B,QAAQ;QACR,GAAG,EAAE;YACH,GAAG,EAAE;gBACH,iBAAiB,EAAE,QAAQ,CAAC;oBAC1B,MAAM;oBACN,UAAU,EAAE,eAAe;iBAC5B,CAAC,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,G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,EAAE,CAAA;QAClC,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,EAAE,EAAE,CAAA;QACpC,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,EAAE,CAAA;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS;QACX,CAAC;QACD,SAAS,CAAC,OAAO,CACf;YACE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzB,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChC,EACD,EAAE,UAAU,EAAE,iBAAiB,CAAC,UAAU,EAAE,CAC7C,CAAA;QACD,OAAO,MAAM,MAAM,CAAC;YAClB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO;YACP,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK;YACrB,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG;YACvB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;SAC9B,CAAC,CAAA;IACX,CAAC,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@furystack/rest-service",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.14",
|
|
4
4
|
"description": "Repository implementation for FuryStack",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/furystack/furystack",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@furystack/core": "^12.0.
|
|
41
|
-
"@furystack/inject": "^8.1.
|
|
42
|
-
"@furystack/repository": "^7.0.
|
|
43
|
-
"@furystack/rest": "^5.0.
|
|
44
|
-
"@furystack/security": "^3.0.
|
|
45
|
-
"@furystack/utils": "^4.0.
|
|
40
|
+
"@furystack/core": "^12.0.12",
|
|
41
|
+
"@furystack/inject": "^8.1.2",
|
|
42
|
+
"@furystack/repository": "^7.0.12",
|
|
43
|
+
"@furystack/rest": "^5.0.13",
|
|
44
|
+
"@furystack/security": "^3.0.12",
|
|
45
|
+
"@furystack/utils": "^4.0.11",
|
|
46
46
|
"ajv": "^8.12.0",
|
|
47
47
|
"ajv-formats": "^2.1.1",
|
|
48
48
|
"path-to-regexp": "^6.2.1",
|
|
49
49
|
"semaphore-async-await": "^1.5.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@furystack/rest-client-fetch": "^5.0.
|
|
53
|
-
"@types/node": "^20.
|
|
54
|
-
"typescript": "^5.
|
|
55
|
-
"vitest": "^0.34.
|
|
52
|
+
"@furystack/rest-client-fetch": "^5.0.13",
|
|
53
|
+
"@types/node": "^20.10.0",
|
|
54
|
+
"typescript": "^5.3.2",
|
|
55
|
+
"vitest": "^0.34.6"
|
|
56
56
|
},
|
|
57
57
|
"gitHead": "1045d854bfd8c475b7035471d130d401417a2321"
|
|
58
58
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Injector } from '@furystack/inject'
|
|
2
2
|
import { usingAsync } from '@furystack/utils'
|
|
3
|
-
import { ErrorAction } from './error-action'
|
|
3
|
+
import { ErrorAction } from './error-action.js'
|
|
4
4
|
import type { IncomingMessage } from 'http'
|
|
5
5
|
import { RequestError } from '@furystack/rest'
|
|
6
6
|
import { AuthorizationError } from '@furystack/core'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Injector } from '@furystack/inject'
|
|
2
2
|
import { usingAsync } from '@furystack/utils'
|
|
3
|
-
import { GetCurrentUser } from './get-current-user'
|
|
3
|
+
import { GetCurrentUser } from './get-current-user.js'
|
|
4
4
|
import type { IncomingMessage, ServerResponse } from 'http'
|
|
5
5
|
import { IdentityContext } from '@furystack/core'
|
|
6
6
|
import { describe, it, expect } from 'vitest'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Injector } from '@furystack/inject'
|
|
2
2
|
import { usingAsync } from '@furystack/utils'
|
|
3
|
-
import { IsAuthenticated } from './is-authenticated'
|
|
3
|
+
import { IsAuthenticated } from './is-authenticated.js'
|
|
4
4
|
import type { IncomingMessage, ServerResponse } from 'http'
|
|
5
5
|
import { IdentityContext } from '@furystack/core'
|
|
6
6
|
import { describe, it, expect } from 'vitest'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'http'
|
|
2
2
|
import { Injector } from '@furystack/inject'
|
|
3
3
|
import { usingAsync } from '@furystack/utils'
|
|
4
|
-
import { LoginAction } from './login'
|
|
5
|
-
import { HttpUserContext } from '../http-user-context'
|
|
4
|
+
import { LoginAction } from './login.js'
|
|
5
|
+
import { HttpUserContext } from '../http-user-context.js'
|
|
6
6
|
import { describe, it, expect, vi } from 'vitest'
|
|
7
7
|
|
|
8
8
|
describe('LoginAction', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injector } from '@furystack/inject'
|
|
2
2
|
import { usingAsync } from '@furystack/utils'
|
|
3
|
-
import { HttpUserContext } from '../http-user-context'
|
|
4
|
-
import { LogoutAction } from './logout'
|
|
3
|
+
import { HttpUserContext } from '../http-user-context.js'
|
|
4
|
+
import { LogoutAction } from './logout.js'
|
|
5
5
|
import type { IncomingMessage, ServerResponse } from 'http'
|
|
6
6
|
import { describe, it, expect, vi } from 'vitest'
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Injector } from '@furystack/inject'
|
|
2
2
|
import { usingAsync } from '@furystack/utils'
|
|
3
|
-
import { NotFoundAction } from './not-found-action'
|
|
3
|
+
import { NotFoundAction } from './not-found-action.js'
|
|
4
4
|
import type { IncomingMessage, ServerResponse } from 'http'
|
|
5
5
|
import { describe, it, expect } from 'vitest'
|
|
6
6
|
|
package/src/authenticate.spec.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'http'
|
|
2
2
|
import { Injector } from '@furystack/inject'
|
|
3
3
|
import { usingAsync } from '@furystack/utils'
|
|
4
|
-
import { HttpUserContext } from './http-user-context'
|
|
5
|
-
import { Authenticate } from './authenticate'
|
|
4
|
+
import { HttpUserContext } from './http-user-context.js'
|
|
5
|
+
import { Authenticate } from './authenticate.js'
|
|
6
6
|
import type { ServerResponse } from 'http'
|
|
7
7
|
import { IdentityContext } from '@furystack/core'
|
|
8
|
-
import { EmptyResult } from './request-action-implementation'
|
|
8
|
+
import { EmptyResult } from './request-action-implementation.js'
|
|
9
9
|
import { describe, it, expect, vi } from 'vitest'
|
|
10
10
|
|
|
11
11
|
describe('Authenticate', () => {
|