@furystack/rest-service 7.0.12 → 7.0.13
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.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/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/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.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.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.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.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/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.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-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.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/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/package.json +10 -10
- 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,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,
|
|
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,MA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ACJ,CAAC,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.13",
|
|
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.11",
|
|
41
|
+
"@furystack/inject": "^8.1.1",
|
|
42
|
+
"@furystack/repository": "^7.0.11",
|
|
43
|
+
"@furystack/rest": "^5.0.12",
|
|
44
|
+
"@furystack/security": "^3.0.11",
|
|
45
|
+
"@furystack/utils": "^4.0.10",
|
|
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.
|
|
52
|
+
"@furystack/rest-client-fetch": "^5.0.12",
|
|
53
|
+
"@types/node": "^20.8.10",
|
|
54
54
|
"typescript": "^5.2.2",
|
|
55
|
-
"vitest": "^0.34.
|
|
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', () => {
|
package/src/authorize.spec.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { Injector } from '@furystack/inject'
|
|
|
3
3
|
import { usingAsync } from '@furystack/utils'
|
|
4
4
|
import type { User } from '@furystack/core'
|
|
5
5
|
import { IdentityContext } from '@furystack/core'
|
|
6
|
-
import { Authorize } from './authorize'
|
|
6
|
+
import { Authorize } from './authorize.js'
|
|
7
7
|
import type { ServerResponse } from 'http'
|
|
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('Authorize', () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { usingAsync } from '@furystack/utils'
|
|
2
2
|
import { Injector } from '@furystack/inject'
|
|
3
3
|
import type { DeleteEndpoint } from '@furystack/rest'
|
|
4
|
-
import { createDeleteEndpoint } from './create-delete-endpoint'
|
|
5
|
-
import { MockClass, setupContext } from './utils'
|
|
6
|
-
import { useRestService } from '../helpers'
|
|
4
|
+
import { createDeleteEndpoint } from './create-delete-endpoint.js'
|
|
5
|
+
import { MockClass, setupContext } from './utils.js'
|
|
6
|
+
import { useRestService } from '../helpers.js'
|
|
7
7
|
import { getDataSetFor } from '@furystack/repository'
|
|
8
8
|
import { describe, it, expect } from 'vitest'
|
|
9
9
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { usingAsync } from '@furystack/utils'
|
|
2
2
|
import { Injector } from '@furystack/inject'
|
|
3
|
-
import { MockClass, setupContext } from './utils'
|
|
4
|
-
import { createGetCollectionEndpoint } from './create-get-collection-endpoint'
|
|
3
|
+
import { MockClass, setupContext } from './utils.js'
|
|
4
|
+
import { createGetCollectionEndpoint } from './create-get-collection-endpoint.js'
|
|
5
5
|
import type { GetCollectionEndpoint, GetCollectionResult } from '@furystack/rest'
|
|
6
6
|
import { serializeToQueryString } from '@furystack/rest'
|
|
7
7
|
import type { FindOptions } from '@furystack/core'
|
|
8
8
|
import { getDataSetFor, getRepository } from '@furystack/repository'
|
|
9
|
-
import { useRestService } from '../helpers'
|
|
9
|
+
import { useRestService } from '../helpers.js'
|
|
10
10
|
import { describe, it, expect } from 'vitest'
|
|
11
11
|
|
|
12
12
|
const addMockEntities = async (i: Injector) =>
|
|
@@ -2,10 +2,10 @@ import { usingAsync } from '@furystack/utils'
|
|
|
2
2
|
import { Injector } from '@furystack/inject'
|
|
3
3
|
import type { GetEntityEndpoint } from '@furystack/rest'
|
|
4
4
|
import { serializeToQueryString } from '@furystack/rest'
|
|
5
|
-
import { MockClass, setupContext } from './utils'
|
|
6
|
-
import { createGetEntityEndpoint } from './create-get-entity-endpoint'
|
|
5
|
+
import { MockClass, setupContext } from './utils.js'
|
|
6
|
+
import { createGetEntityEndpoint } from './create-get-entity-endpoint.js'
|
|
7
7
|
import { getDataSetFor } from '@furystack/repository'
|
|
8
|
-
import { useRestService } from '../helpers'
|
|
8
|
+
import { useRestService } from '../helpers.js'
|
|
9
9
|
import { describe, it, expect } from 'vitest'
|
|
10
10
|
|
|
11
11
|
describe('createGetEntityEndpoint', () => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { usingAsync } from '@furystack/utils'
|
|
2
2
|
import { Injector } from '@furystack/inject'
|
|
3
3
|
import type { PatchEndpoint } from '@furystack/rest'
|
|
4
|
-
import { createPatchEndpoint } from './create-patch-endpoint'
|
|
5
|
-
import { MockClass, setupContext } from './utils'
|
|
4
|
+
import { createPatchEndpoint } from './create-patch-endpoint.js'
|
|
5
|
+
import { MockClass, setupContext } from './utils.js'
|
|
6
6
|
import { getDataSetFor } from '@furystack/repository'
|
|
7
|
-
import { useRestService } from '../helpers'
|
|
7
|
+
import { useRestService } from '../helpers.js'
|
|
8
8
|
import { describe, it, expect } from 'vitest'
|
|
9
9
|
|
|
10
10
|
describe('createPatchEndpoint', () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { usingAsync } from '@furystack/utils'
|
|
2
2
|
import { Injector } from '@furystack/inject'
|
|
3
3
|
import type { PostEndpoint } from '@furystack/rest'
|
|
4
|
-
import { createPostEndpoint } from './create-post-endpoint'
|
|
5
|
-
import { MockClass, setupContext } from './utils'
|
|
6
|
-
import { useRestService } from '../helpers'
|
|
4
|
+
import { createPostEndpoint } from './create-post-endpoint.js'
|
|
5
|
+
import { MockClass, setupContext } from './utils.js'
|
|
6
|
+
import { useRestService } from '../helpers.js'
|
|
7
7
|
import { getDataSetFor } from '@furystack/repository'
|
|
8
8
|
import { describe, it, expect } from 'vitest'
|
|
9
9
|
|
package/src/helpers.spec.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Injector } from '@furystack/inject'
|
|
2
2
|
import { usingAsync } from '@furystack/utils'
|
|
3
|
-
import { ApiManager } from './api-manager'
|
|
4
|
-
import { HttpAuthenticationSettings } from './http-authentication-settings'
|
|
5
|
-
import { useHttpAuthentication, useRestService, useStaticFiles } from './helpers'
|
|
6
|
-
import { StaticServerManager } from './static-server-manager'
|
|
3
|
+
import { ApiManager } from './api-manager.js'
|
|
4
|
+
import { HttpAuthenticationSettings } from './http-authentication-settings.js'
|
|
5
|
+
import { useHttpAuthentication, useRestService, useStaticFiles } from './helpers.js'
|
|
6
|
+
import { StaticServerManager } from './static-server-manager.js'
|
|
7
7
|
import { describe, it, expect } from 'vitest'
|
|
8
8
|
|
|
9
9
|
describe('Injector extensions', () => {
|
|
@@ -2,10 +2,10 @@ import type { IncomingMessage, ServerResponse } from 'http'
|
|
|
2
2
|
import { usingAsync } from '@furystack/utils'
|
|
3
3
|
import { Injector } from '@furystack/inject'
|
|
4
4
|
import { User, StoreManager, InMemoryStore, addStore } from '@furystack/core'
|
|
5
|
-
import { DefaultSession } from './models/default-session'
|
|
6
|
-
import { HttpUserContext } from './http-user-context'
|
|
5
|
+
import { DefaultSession } from './models/default-session.js'
|
|
6
|
+
import { HttpUserContext } from './http-user-context.js'
|
|
7
7
|
import { PasswordAuthenticator, PasswordCredential, UnauthenticatedError } from '@furystack/security'
|
|
8
|
-
import { useHttpAuthentication } from './helpers'
|
|
8
|
+
import { useHttpAuthentication } from './helpers.js'
|
|
9
9
|
import { describe, it, expect, vi } from 'vitest'
|
|
10
10
|
|
|
11
11
|
export const prepareInjector = async (i: Injector) => {
|
package/src/mime-types.spec.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Injector } from '@furystack/inject'
|
|
2
2
|
import './helpers'
|
|
3
3
|
import { usingAsync, PathHelper } from '@furystack/utils'
|
|
4
|
-
import { GetCurrentUser, IsAuthenticated, LoginAction, LogoutAction } from './actions'
|
|
4
|
+
import { GetCurrentUser, IsAuthenticated, LoginAction, LogoutAction } from './actions/index.js'
|
|
5
5
|
import type { RestApi } from '@furystack/rest'
|
|
6
6
|
import { User, InMemoryStore, addStore } from '@furystack/core'
|
|
7
|
-
import { DefaultSession } from './models/default-session'
|
|
8
|
-
import { JsonResult } from './request-action-implementation'
|
|
9
|
-
import { useHttpAuthentication, useRestService } from './helpers'
|
|
7
|
+
import { DefaultSession } from './models/default-session.js'
|
|
8
|
+
import { JsonResult } from './request-action-implementation.js'
|
|
9
|
+
import { useHttpAuthentication, useRestService } from './helpers.js'
|
|
10
10
|
import { describe, it, expect } from 'vitest'
|
|
11
11
|
import { serializeValue } from '@furystack/rest'
|
|
12
12
|
|
|
@@ -2,9 +2,8 @@ import { Injector } from '@furystack/inject'
|
|
|
2
2
|
import type { RestApi } from '@furystack/rest'
|
|
3
3
|
import { createClient } from '@furystack/rest-client-fetch'
|
|
4
4
|
import { usingAsync } from '@furystack/utils'
|
|
5
|
-
import { JsonResult } from './request-action-implementation'
|
|
6
|
-
import './helpers'
|
|
7
|
-
import { useRestService } from './helpers'
|
|
5
|
+
import { JsonResult } from './request-action-implementation.js'
|
|
6
|
+
import { useRestService } from './helpers.js'
|
|
8
7
|
import { describe, it, expect } from 'vitest'
|
|
9
8
|
|
|
10
9
|
export interface EchoApi extends RestApi {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SchemaValidator } from './schema-validator'
|
|
2
|
-
import type { BodyParameters, Language } from './validate-examples'
|
|
3
|
-
import { exampleSchema } from './validate-examples'
|
|
4
|
-
import { SchemaValidationError } from './schema-validation-error'
|
|
1
|
+
import { SchemaValidator } from './schema-validator.js'
|
|
2
|
+
import type { BodyParameters, Language } from './validate-examples.js'
|
|
3
|
+
import { exampleSchema } from './validate-examples.js'
|
|
4
|
+
import { SchemaValidationError } from './schema-validation-error.js'
|
|
5
5
|
import { describe, it, expect } from 'vitest'
|
|
6
6
|
|
|
7
7
|
describe('ValidateSchema', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Socket } from 'net'
|
|
2
2
|
import { IncomingMessage, ServerResponse } from 'http'
|
|
3
3
|
import './server-response-extensions'
|
|
4
|
-
import { BypassResult, JsonResult, PlainTextResult } from './request-action-implementation'
|
|
4
|
+
import { BypassResult, JsonResult, PlainTextResult } from './request-action-implementation.js'
|
|
5
5
|
import { describe, it, expect, vi } from 'vitest'
|
|
6
6
|
|
|
7
7
|
describe('ServerResponse extensions', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injector } from '@furystack/inject'
|
|
2
2
|
import { sleepAsync, usingAsync } from '@furystack/utils'
|
|
3
|
-
import { ServerManager } from './server-manager'
|
|
4
|
-
import { StaticServerManager } from './static-server-manager'
|
|
3
|
+
import { ServerManager } from './server-manager.js'
|
|
4
|
+
import { StaticServerManager } from './static-server-manager.js'
|
|
5
5
|
import { describe, it, expect, vi } from 'vitest'
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { Injector } from '@furystack/inject'
|
|
2
2
|
import { createClient, ResponseError } from '@furystack/rest-client-fetch'
|
|
3
3
|
import { usingAsync } from '@furystack/utils'
|
|
4
|
-
import { JsonResult } from './request-action-implementation'
|
|
5
|
-
import { Validate } from './validate'
|
|
6
|
-
import './helpers'
|
|
7
|
-
|
|
4
|
+
import { JsonResult } from './request-action-implementation.js'
|
|
5
|
+
import { Validate } from './validate.js'
|
|
8
6
|
import schema from './validate.integration.spec.schema.json' assert { type: 'json' }
|
|
9
|
-
import type { ValidationApi } from './validate.integration.schema'
|
|
10
|
-
import { useRestService } from './helpers'
|
|
7
|
+
import type { ValidationApi } from './validate.integration.schema.js'
|
|
8
|
+
import { useRestService } from './helpers.js'
|
|
11
9
|
import { describe, it, expect } from 'vitest'
|
|
12
|
-
import { assert } from 'console'
|
|
13
10
|
|
|
14
11
|
// 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
|
|
15
12
|
|