@furystack/rest-service 6.2.22 → 7.0.0
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/package.json +29 -12
- package/src/actions/error-action.spec.ts +1 -0
- package/src/actions/get-current-user.spec.ts +1 -0
- package/src/actions/get-current-user.ts +0 -1
- package/src/actions/is-authenticated.spec.ts +1 -0
- package/src/actions/is-authenticated.ts +0 -1
- package/src/actions/login-action.spec.ts +3 -2
- package/src/actions/logout-action.spec.ts +2 -1
- package/src/actions/logout.ts +0 -1
- package/src/actions/not-found-action.spec.ts +1 -0
- package/src/add-cors-header.spec.ts +7 -6
- package/src/authenticate.spec.ts +7 -6
- package/src/authorize.spec.ts +7 -6
- package/src/endpoint-generators/create-delete-endpoint.spec.ts +1 -0
- package/src/endpoint-generators/create-delete-endpoint.ts +0 -1
- package/src/endpoint-generators/create-get-collection-endpoint.spec.ts +1 -0
- package/src/endpoint-generators/create-get-collection-endpoint.ts +0 -1
- package/src/endpoint-generators/create-get-entity-endpoint.spec.ts +1 -0
- package/src/endpoint-generators/create-get-entity-endpoint.ts +0 -1
- package/src/endpoint-generators/create-patch-endpoint.spec.ts +1 -0
- package/src/endpoint-generators/create-patch-endpoint.ts +0 -1
- package/src/endpoint-generators/create-post-endpoint.spec.ts +1 -0
- package/src/endpoint-generators/create-post-endpoint.ts +0 -1
- package/src/helpers.spec.ts +1 -0
- package/src/helpers.ts +2 -6
- package/src/http-user-context.spec.ts +15 -14
- package/src/http-user-context.ts +0 -3
- package/src/incoming-message-extensions.spec.ts +1 -0
- package/src/mime-types.spec.ts +1 -0
- package/src/rest-service.integration.spec.ts +1 -0
- package/src/rest.integration.test.ts +1 -0
- package/src/schema-validator/schema-validator.test.ts +1 -0
- package/src/server-manager.ts +2 -2
- package/src/server-response-extensions.spec.ts +23 -18
- package/src/static-server-manager.spec.ts +2 -2
- package/src/utils.ts +0 -2
- package/src/validate.integration.spec.ts +1 -0
- package/types/actions/get-current-user.d.ts +0 -1
- package/types/actions/get-current-user.d.ts.map +1 -1
- package/types/actions/is-authenticated.d.ts +0 -1
- package/types/actions/is-authenticated.d.ts.map +1 -1
- package/types/actions/logout.d.ts +0 -1
- package/types/actions/logout.d.ts.map +1 -1
- package/types/endpoint-generators/create-delete-endpoint.d.ts +0 -1
- package/types/endpoint-generators/create-delete-endpoint.d.ts.map +1 -1
- package/types/endpoint-generators/create-get-collection-endpoint.d.ts +0 -1
- package/types/endpoint-generators/create-get-collection-endpoint.d.ts.map +1 -1
- package/types/endpoint-generators/create-get-entity-endpoint.d.ts +0 -1
- package/types/endpoint-generators/create-get-entity-endpoint.d.ts.map +1 -1
- package/types/endpoint-generators/create-patch-endpoint.d.ts +0 -1
- package/types/endpoint-generators/create-patch-endpoint.d.ts.map +1 -1
- package/types/endpoint-generators/create-post-endpoint.d.ts +0 -1
- package/types/endpoint-generators/create-post-endpoint.d.ts.map +1 -1
- package/types/helpers.d.ts +2 -4
- package/types/helpers.d.ts.map +1 -1
- package/types/http-user-context.d.ts +0 -3
- package/types/http-user-context.d.ts.map +1 -1
- package/types/server-manager.d.ts.map +1 -1
- package/types/utils.d.ts +0 -2
- package/types/utils.d.ts.map +1 -1
- package/dist/actions/error-action.js +0 -29
- package/dist/actions/error-action.js.map +0 -1
- package/dist/actions/error-action.spec.js +0 -48
- package/dist/actions/error-action.spec.js.map +0 -1
- package/dist/actions/get-current-user.js +0 -16
- package/dist/actions/get-current-user.js.map +0 -1
- package/dist/actions/get-current-user.spec.js +0 -20
- package/dist/actions/get-current-user.spec.js.map +0 -1
- package/dist/actions/index.js +0 -23
- package/dist/actions/index.js.map +0 -1
- package/dist/actions/is-authenticated.js +0 -18
- package/dist/actions/is-authenticated.js.map +0 -1
- package/dist/actions/is-authenticated.spec.js +0 -19
- package/dist/actions/is-authenticated.spec.js.map +0 -1
- package/dist/actions/login-action.spec.js +0 -35
- package/dist/actions/login-action.spec.js.map +0 -1
- package/dist/actions/login.js +0 -26
- package/dist/actions/login.js.map +0 -1
- package/dist/actions/logout-action.spec.js +0 -23
- package/dist/actions/logout-action.spec.js.map +0 -1
- package/dist/actions/logout.js +0 -20
- package/dist/actions/logout.js.map +0 -1
- package/dist/actions/not-found-action.js +0 -14
- package/dist/actions/not-found-action.js.map +0 -1
- package/dist/actions/not-found-action.spec.js +0 -17
- package/dist/actions/not-found-action.spec.js.map +0 -1
- package/dist/add-cors-header.spec.js +0 -99
- package/dist/add-cors-header.spec.js.map +0 -1
- package/dist/api-manager.js +0 -156
- package/dist/api-manager.js.map +0 -1
- package/dist/authenticate.js +0 -20
- package/dist/authenticate.js.map +0 -1
- package/dist/authenticate.spec.js +0 -59
- package/dist/authenticate.spec.js.map +0 -1
- package/dist/authorize.js +0 -23
- package/dist/authorize.js.map +0 -1
- package/dist/authorize.spec.js +0 -55
- package/dist/authorize.spec.js.map +0 -1
- package/dist/endpoint-generators/create-delete-endpoint.js +0 -25
- package/dist/endpoint-generators/create-delete-endpoint.js.map +0 -1
- package/dist/endpoint-generators/create-delete-endpoint.spec.js +0 -35
- package/dist/endpoint-generators/create-delete-endpoint.spec.js.map +0 -1
- package/dist/endpoint-generators/create-get-collection-endpoint.js +0 -27
- package/dist/endpoint-generators/create-get-collection-endpoint.js.map +0 -1
- package/dist/endpoint-generators/create-get-collection-endpoint.spec.js +0 -157
- package/dist/endpoint-generators/create-get-collection-endpoint.spec.js.map +0 -1
- package/dist/endpoint-generators/create-get-entity-endpoint.js +0 -30
- package/dist/endpoint-generators/create-get-entity-endpoint.js.map +0 -1
- package/dist/endpoint-generators/create-get-entity-endpoint.spec.js +0 -75
- package/dist/endpoint-generators/create-get-entity-endpoint.spec.js.map +0 -1
- package/dist/endpoint-generators/create-patch-endpoint.js +0 -27
- package/dist/endpoint-generators/create-patch-endpoint.js.map +0 -1
- package/dist/endpoint-generators/create-patch-endpoint.spec.js +0 -38
- package/dist/endpoint-generators/create-patch-endpoint.spec.js.map +0 -1
- package/dist/endpoint-generators/create-post-endpoint.js +0 -30
- package/dist/endpoint-generators/create-post-endpoint.js.map +0 -1
- package/dist/endpoint-generators/create-post-endpoint.spec.js +0 -36
- package/dist/endpoint-generators/create-post-endpoint.spec.js.map +0 -1
- package/dist/endpoint-generators/index.js +0 -22
- package/dist/endpoint-generators/index.js.map +0 -1
- package/dist/endpoint-generators/utils.js +0 -28
- package/dist/endpoint-generators/utils.js.map +0 -1
- package/dist/helpers.js +0 -39
- package/dist/helpers.js.map +0 -1
- package/dist/helpers.spec.js +0 -35
- package/dist/helpers.spec.js.map +0 -1
- package/dist/http-authentication-settings.js +0 -29
- package/dist/http-authentication-settings.js.map +0 -1
- package/dist/http-user-context.js +0 -174
- package/dist/http-user-context.js.map +0 -1
- package/dist/http-user-context.spec.js +0 -272
- package/dist/http-user-context.spec.js.map +0 -1
- package/dist/incoming-message-extensions.js +0 -16
- package/dist/incoming-message-extensions.js.map +0 -1
- package/dist/incoming-message-extensions.spec.js +0 -39
- package/dist/incoming-message-extensions.spec.js.map +0 -1
- package/dist/index.js +0 -35
- package/dist/index.js.map +0 -1
- package/dist/mime-types.js +0 -340
- package/dist/mime-types.js.map +0 -1
- package/dist/mime-types.spec.js +0 -15
- package/dist/mime-types.spec.js.map +0 -1
- package/dist/models/cors-options.js +0 -3
- package/dist/models/cors-options.js.map +0 -1
- package/dist/models/default-session.js +0 -10
- package/dist/models/default-session.js.map +0 -1
- package/dist/models/index.js +0 -19
- package/dist/models/index.js.map +0 -1
- package/dist/request-action-implementation.js +0 -42
- package/dist/request-action-implementation.js.map +0 -1
- package/dist/rest-service.integration.spec.js +0 -143
- package/dist/rest-service.integration.spec.js.map +0 -1
- package/dist/rest.integration.test.js +0 -156
- package/dist/rest.integration.test.js.map +0 -1
- package/dist/schema-validator/index.js +0 -19
- package/dist/schema-validator/index.js.map +0 -1
- package/dist/schema-validator/schema-validation-error.js +0 -15
- package/dist/schema-validator/schema-validation-error.js.map +0 -1
- package/dist/schema-validator/schema-validator.js +0 -38
- package/dist/schema-validator/schema-validator.js.map +0 -1
- package/dist/schema-validator/schema-validator.test.js +0 -62
- package/dist/schema-validator/schema-validator.test.js.map +0 -1
- package/dist/schema-validator/validate-examples.js +0 -29
- package/dist/schema-validator/validate-examples.js.map +0 -1
- package/dist/server-manager.js +0 -79
- package/dist/server-manager.js.map +0 -1
- package/dist/server-response-extensions.js +0 -17
- package/dist/server-response-extensions.js.map +0 -1
- package/dist/server-response-extensions.spec.js +0 -49
- package/dist/server-response-extensions.spec.js.map +0 -1
- package/dist/static-server-manager.js +0 -71
- package/dist/static-server-manager.js.map +0 -1
- package/dist/static-server-manager.spec.js +0 -218
- package/dist/static-server-manager.spec.js.map +0 -1
- package/dist/utils.js +0 -75
- package/dist/utils.js.map +0 -1
- package/dist/validate.integration.schema.js +0 -3
- package/dist/validate.integration.schema.js.map +0 -1
- package/dist/validate.integration.spec.js +0 -216
- package/dist/validate.integration.spec.js.map +0 -1
- package/dist/validate.integration.spec.schema.json +0 -903
- package/dist/validate.js +0 -47
- package/dist/validate.js.map +0 -1
- package/types/actions/error-action.spec.d.ts +0 -2
- package/types/actions/error-action.spec.d.ts.map +0 -1
- package/types/actions/get-current-user.spec.d.ts +0 -2
- package/types/actions/get-current-user.spec.d.ts.map +0 -1
- package/types/actions/is-authenticated.spec.d.ts +0 -2
- package/types/actions/is-authenticated.spec.d.ts.map +0 -1
- package/types/actions/login-action.spec.d.ts +0 -2
- package/types/actions/login-action.spec.d.ts.map +0 -1
- package/types/actions/logout-action.spec.d.ts +0 -2
- package/types/actions/logout-action.spec.d.ts.map +0 -1
- package/types/actions/not-found-action.spec.d.ts +0 -2
- package/types/actions/not-found-action.spec.d.ts.map +0 -1
- package/types/add-cors-header.spec.d.ts +0 -2
- package/types/add-cors-header.spec.d.ts.map +0 -1
- package/types/authenticate.spec.d.ts +0 -2
- package/types/authenticate.spec.d.ts.map +0 -1
- package/types/authorize.spec.d.ts +0 -2
- package/types/authorize.spec.d.ts.map +0 -1
- package/types/endpoint-generators/create-delete-endpoint.spec.d.ts +0 -2
- package/types/endpoint-generators/create-delete-endpoint.spec.d.ts.map +0 -1
- package/types/endpoint-generators/create-get-collection-endpoint.spec.d.ts +0 -2
- package/types/endpoint-generators/create-get-collection-endpoint.spec.d.ts.map +0 -1
- package/types/endpoint-generators/create-get-entity-endpoint.spec.d.ts +0 -2
- package/types/endpoint-generators/create-get-entity-endpoint.spec.d.ts.map +0 -1
- package/types/endpoint-generators/create-patch-endpoint.spec.d.ts +0 -2
- package/types/endpoint-generators/create-patch-endpoint.spec.d.ts.map +0 -1
- package/types/endpoint-generators/create-post-endpoint.spec.d.ts +0 -2
- package/types/endpoint-generators/create-post-endpoint.spec.d.ts.map +0 -1
- package/types/helpers.spec.d.ts +0 -2
- package/types/helpers.spec.d.ts.map +0 -1
- package/types/http-user-context.spec.d.ts +0 -3
- package/types/http-user-context.spec.d.ts.map +0 -1
- package/types/incoming-message-extensions.spec.d.ts +0 -2
- package/types/incoming-message-extensions.spec.d.ts.map +0 -1
- package/types/mime-types.spec.d.ts +0 -2
- package/types/mime-types.spec.d.ts.map +0 -1
- package/types/rest-service.integration.spec.d.ts +0 -2
- package/types/rest-service.integration.spec.d.ts.map +0 -1
- package/types/rest.integration.test.d.ts +0 -90
- package/types/rest.integration.test.d.ts.map +0 -1
- package/types/schema-validator/schema-validator.test.d.ts +0 -2
- package/types/schema-validator/schema-validator.test.d.ts.map +0 -1
- package/types/server-response-extensions.spec.d.ts +0 -2
- package/types/server-response-extensions.spec.d.ts.map +0 -1
- package/types/static-server-manager.spec.d.ts +0 -2
- package/types/static-server-manager.spec.d.ts.map +0 -1
- package/types/validate.integration.spec.d.ts +0 -2
- package/types/validate.integration.spec.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@furystack/rest-service",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Repository implementation for FuryStack",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build:es6": "tsc --outDir ./esm"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./esm/index.js",
|
|
12
|
+
"types": "./types/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"typesVersions": {
|
|
17
|
+
"*": {
|
|
18
|
+
"*": [
|
|
19
|
+
"types/*"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
6
23
|
"files": [
|
|
7
24
|
"dist",
|
|
8
25
|
"types",
|
|
@@ -29,22 +46,22 @@
|
|
|
29
46
|
},
|
|
30
47
|
"homepage": "https://github.com/furystack/furystack",
|
|
31
48
|
"dependencies": {
|
|
32
|
-
"@furystack/core": "^
|
|
33
|
-
"@furystack/inject": "^
|
|
34
|
-
"@furystack/repository": "^
|
|
35
|
-
"@furystack/rest": "^
|
|
36
|
-
"@furystack/security": "^
|
|
37
|
-
"@furystack/utils": "^
|
|
49
|
+
"@furystack/core": "^12.0.0",
|
|
50
|
+
"@furystack/inject": "^8.0.0",
|
|
51
|
+
"@furystack/repository": "^7.0.0",
|
|
52
|
+
"@furystack/rest": "^5.0.0",
|
|
53
|
+
"@furystack/security": "^3.0.0",
|
|
54
|
+
"@furystack/utils": "^4.0.0",
|
|
38
55
|
"ajv": "^8.12.0",
|
|
39
56
|
"ajv-formats": "^2.1.1",
|
|
40
57
|
"path-to-regexp": "^6.2.1",
|
|
41
58
|
"semaphore-async-await": "^1.5.1"
|
|
42
59
|
},
|
|
43
60
|
"devDependencies": {
|
|
44
|
-
"@furystack/rest-client-fetch": "^
|
|
45
|
-
"@types/
|
|
46
|
-
"
|
|
61
|
+
"@furystack/rest-client-fetch": "^5.0.0",
|
|
62
|
+
"@types/node": "^18.15.11",
|
|
63
|
+
"typescript": "^5.0.4",
|
|
64
|
+
"vitest": "^0.30.1"
|
|
47
65
|
},
|
|
48
|
-
"typings": "./types/index.d.ts",
|
|
49
66
|
"gitHead": "1045d854bfd8c475b7035471d130d401417a2321"
|
|
50
67
|
}
|
|
@@ -5,6 +5,7 @@ import type { IncomingMessage } from 'http'
|
|
|
5
5
|
import { RequestError } from '@furystack/rest'
|
|
6
6
|
import { AuthorizationError } from '@furystack/core'
|
|
7
7
|
import type { ServerResponse } from 'http'
|
|
8
|
+
import { describe, it, expect } from 'vitest'
|
|
8
9
|
|
|
9
10
|
describe('ErrorAction tests', () => {
|
|
10
11
|
const request = { url: 'https://google.com' } as IncomingMessage
|
|
@@ -3,6 +3,7 @@ import { usingAsync } from '@furystack/utils'
|
|
|
3
3
|
import { GetCurrentUser } from './get-current-user'
|
|
4
4
|
import type { IncomingMessage, ServerResponse } from 'http'
|
|
5
5
|
import { IdentityContext } from '@furystack/core'
|
|
6
|
+
import { describe, it, expect } from 'vitest'
|
|
6
7
|
|
|
7
8
|
describe('getCurrentUser', () => {
|
|
8
9
|
const request = { url: 'https://google.com' } as IncomingMessage
|
|
@@ -3,6 +3,7 @@ import { usingAsync } from '@furystack/utils'
|
|
|
3
3
|
import { IsAuthenticated } from './is-authenticated'
|
|
4
4
|
import type { IncomingMessage, ServerResponse } from 'http'
|
|
5
5
|
import { IdentityContext } from '@furystack/core'
|
|
6
|
+
import { describe, it, expect } from 'vitest'
|
|
6
7
|
|
|
7
8
|
describe('isAuthenticated', () => {
|
|
8
9
|
const request = { url: 'https://google.com' } as IncomingMessage
|
|
@@ -4,7 +4,6 @@ import { JsonResult } from '../request-action-implementation'
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Action that returns if the current user is authenticated
|
|
7
|
-
*
|
|
8
7
|
* @param options The options for the Custom Action
|
|
9
8
|
* @param options.injector The Injector from the current context
|
|
10
9
|
* @returns A standard authentication result
|
|
@@ -3,6 +3,7 @@ import { Injector } from '@furystack/inject'
|
|
|
3
3
|
import { usingAsync } from '@furystack/utils'
|
|
4
4
|
import { LoginAction } from './login'
|
|
5
5
|
import { HttpUserContext } from '../http-user-context'
|
|
6
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
6
7
|
|
|
7
8
|
describe('LoginAction', () => {
|
|
8
9
|
const request = { url: 'https://google.com' } as IncomingMessage
|
|
@@ -13,8 +14,8 @@ describe('LoginAction', () => {
|
|
|
13
14
|
await usingAsync(new Injector(), async (i) => {
|
|
14
15
|
i.setExplicitInstance(
|
|
15
16
|
{
|
|
16
|
-
authenticateUser:
|
|
17
|
-
cookieLogin:
|
|
17
|
+
authenticateUser: vi.fn(async () => testUser),
|
|
18
|
+
cookieLogin: vi.fn(async () => testUser),
|
|
18
19
|
authentication: {},
|
|
19
20
|
},
|
|
20
21
|
HttpUserContext,
|
|
@@ -3,6 +3,7 @@ import { usingAsync } from '@furystack/utils'
|
|
|
3
3
|
import { HttpUserContext } from '../http-user-context'
|
|
4
4
|
import { LogoutAction } from './logout'
|
|
5
5
|
import type { IncomingMessage, ServerResponse } from 'http'
|
|
6
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
6
7
|
|
|
7
8
|
describe('LogoutAction', () => {
|
|
8
9
|
const request = { url: 'https://google.com' } as IncomingMessage
|
|
@@ -10,7 +11,7 @@ describe('LogoutAction', () => {
|
|
|
10
11
|
|
|
11
12
|
it('exec', async () => {
|
|
12
13
|
await usingAsync(new Injector(), async (i) => {
|
|
13
|
-
const cookieLogout =
|
|
14
|
+
const cookieLogout = vi.fn(async () => true)
|
|
14
15
|
i.setExplicitInstance(
|
|
15
16
|
{
|
|
16
17
|
cookieLogout,
|
package/src/actions/logout.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Injector } from '@furystack/inject'
|
|
|
2
2
|
import { usingAsync } from '@furystack/utils'
|
|
3
3
|
import { NotFoundAction } from './not-found-action'
|
|
4
4
|
import type { IncomingMessage, ServerResponse } from 'http'
|
|
5
|
+
import { describe, it, expect } from 'vitest'
|
|
5
6
|
|
|
6
7
|
describe('NotFoundAction tests', () => {
|
|
7
8
|
const request = { url: 'https://google.com' } as IncomingMessage
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'http'
|
|
2
2
|
import { Utils } from './utils'
|
|
3
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
3
4
|
|
|
4
5
|
describe('AddCorsHeaders', () => {
|
|
5
6
|
const utils = new Utils()
|
|
@@ -8,7 +9,7 @@ describe('AddCorsHeaders', () => {
|
|
|
8
9
|
headers: { origin: 'http://localhost/', host: 'http://localhost' },
|
|
9
10
|
} as any as IncomingMessage
|
|
10
11
|
const resp: ServerResponse = {
|
|
11
|
-
setHeader:
|
|
12
|
+
setHeader: vi.fn(),
|
|
12
13
|
} as unknown as ServerResponse
|
|
13
14
|
|
|
14
15
|
utils.addCorsHeaders(
|
|
@@ -28,7 +29,7 @@ describe('AddCorsHeaders', () => {
|
|
|
28
29
|
headers: { origin: 'http://localhost/', host: 'http://google.com' },
|
|
29
30
|
} as any as IncomingMessage
|
|
30
31
|
const resp: ServerResponse = {
|
|
31
|
-
setHeader:
|
|
32
|
+
setHeader: vi.fn(),
|
|
32
33
|
} as unknown as ServerResponse
|
|
33
34
|
|
|
34
35
|
utils.addCorsHeaders(
|
|
@@ -48,7 +49,7 @@ describe('AddCorsHeaders', () => {
|
|
|
48
49
|
headers: { origin: 'http://localhost/', host: 'http://github.com' },
|
|
49
50
|
} as any as IncomingMessage
|
|
50
51
|
const resp: ServerResponse = {
|
|
51
|
-
setHeader:
|
|
52
|
+
setHeader: vi.fn(),
|
|
52
53
|
} as unknown as ServerResponse
|
|
53
54
|
|
|
54
55
|
utils.addCorsHeaders(
|
|
@@ -67,7 +68,7 @@ describe('AddCorsHeaders', () => {
|
|
|
67
68
|
headers: { origin: 'http://localhost/', host: 'http://github.com' },
|
|
68
69
|
} as any as IncomingMessage
|
|
69
70
|
const resp: ServerResponse = {
|
|
70
|
-
setHeader:
|
|
71
|
+
setHeader: vi.fn(),
|
|
71
72
|
} as unknown as ServerResponse
|
|
72
73
|
|
|
73
74
|
utils.addCorsHeaders(
|
|
@@ -92,7 +93,7 @@ describe('AddCorsHeaders', () => {
|
|
|
92
93
|
headers: { origin: 'http://localhost/', host: 'http://github.com' },
|
|
93
94
|
} as any as IncomingMessage
|
|
94
95
|
const resp: ServerResponse = {
|
|
95
|
-
setHeader:
|
|
96
|
+
setHeader: vi.fn(),
|
|
96
97
|
} as unknown as ServerResponse
|
|
97
98
|
|
|
98
99
|
utils.addCorsHeaders(
|
|
@@ -115,7 +116,7 @@ describe('AddCorsHeaders', () => {
|
|
|
115
116
|
headers: { origin: 'http://localhost/', host: 'http://github.com' },
|
|
116
117
|
} as any as IncomingMessage
|
|
117
118
|
const resp: ServerResponse = {
|
|
118
|
-
setHeader:
|
|
119
|
+
setHeader: vi.fn(),
|
|
119
120
|
} as unknown as ServerResponse
|
|
120
121
|
|
|
121
122
|
utils.addCorsHeaders(
|
package/src/authenticate.spec.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Authenticate } from './authenticate'
|
|
|
6
6
|
import type { ServerResponse } from 'http'
|
|
7
7
|
import { IdentityContext } from '@furystack/core'
|
|
8
8
|
import { EmptyResult } from './request-action-implementation'
|
|
9
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
9
10
|
|
|
10
11
|
describe('Authenticate', () => {
|
|
11
12
|
const response = {} as any as ServerResponse
|
|
@@ -13,7 +14,7 @@ describe('Authenticate', () => {
|
|
|
13
14
|
|
|
14
15
|
it('Should return 403 w/o basic auth header, when unauthorized and basic auth is disabled', async () => {
|
|
15
16
|
await usingAsync(new Injector(), async (i) => {
|
|
16
|
-
const isAuthenticatedAction =
|
|
17
|
+
const isAuthenticatedAction = vi.fn(async () => false)
|
|
17
18
|
|
|
18
19
|
i.setExplicitInstance(
|
|
19
20
|
{ isAuthenticated: isAuthenticatedAction, getCurrentUser: async () => Promise.reject(':(') },
|
|
@@ -26,7 +27,7 @@ describe('Authenticate', () => {
|
|
|
26
27
|
},
|
|
27
28
|
HttpUserContext,
|
|
28
29
|
)
|
|
29
|
-
const exampleAuthenticatedAction =
|
|
30
|
+
const exampleAuthenticatedAction = vi.fn(async () => EmptyResult())
|
|
30
31
|
const authorized = Authenticate()(exampleAuthenticatedAction)
|
|
31
32
|
|
|
32
33
|
const result = await authorized({ injector: i, request, response })
|
|
@@ -39,7 +40,7 @@ describe('Authenticate', () => {
|
|
|
39
40
|
|
|
40
41
|
it('Should return 403 with basic auth headers when unauthorized and basic auth is enabled', async () => {
|
|
41
42
|
await usingAsync(new Injector(), async (i) => {
|
|
42
|
-
const isAuthenticatedAction =
|
|
43
|
+
const isAuthenticatedAction = vi.fn(async () => false)
|
|
43
44
|
i.setExplicitInstance(
|
|
44
45
|
{
|
|
45
46
|
isAuthenticated: isAuthenticatedAction,
|
|
@@ -48,7 +49,7 @@ describe('Authenticate', () => {
|
|
|
48
49
|
},
|
|
49
50
|
HttpUserContext,
|
|
50
51
|
)
|
|
51
|
-
const exampleAuthenticatedAction =
|
|
52
|
+
const exampleAuthenticatedAction = vi.fn(async () => EmptyResult())
|
|
52
53
|
const authorized = Authenticate()(exampleAuthenticatedAction)
|
|
53
54
|
|
|
54
55
|
const result = await authorized({ injector: i, request, response })
|
|
@@ -61,12 +62,12 @@ describe('Authenticate', () => {
|
|
|
61
62
|
|
|
62
63
|
it('Should exec the original action if authorized', async () => {
|
|
63
64
|
await usingAsync(new Injector(), async (i) => {
|
|
64
|
-
const isAuthenticatedAction =
|
|
65
|
+
const isAuthenticatedAction = vi.fn(async () => true)
|
|
65
66
|
i.setExplicitInstance(
|
|
66
67
|
{ isAuthenticated: isAuthenticatedAction, getCurrentUser: async () => Promise.reject(':(') },
|
|
67
68
|
IdentityContext,
|
|
68
69
|
)
|
|
69
|
-
const exampleAuthenticatedAction =
|
|
70
|
+
const exampleAuthenticatedAction = vi.fn(async () => EmptyResult())
|
|
70
71
|
const authorized = Authenticate()(exampleAuthenticatedAction)
|
|
71
72
|
const params = { injector: i, body: undefined, query: undefined, request, response }
|
|
72
73
|
const result = await authorized(params)
|
package/src/authorize.spec.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { IdentityContext } from '@furystack/core'
|
|
|
6
6
|
import { Authorize } from './authorize'
|
|
7
7
|
import type { ServerResponse } from 'http'
|
|
8
8
|
import { EmptyResult } from './request-action-implementation'
|
|
9
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
9
10
|
|
|
10
11
|
describe('Authorize', () => {
|
|
11
12
|
const response = {} as any as ServerResponse
|
|
@@ -13,12 +14,12 @@ describe('Authorize', () => {
|
|
|
13
14
|
|
|
14
15
|
it('Should return 403 when failed to get current user', async () => {
|
|
15
16
|
await usingAsync(new Injector(), async (i) => {
|
|
16
|
-
const isAuthorizedAction =
|
|
17
|
+
const isAuthorizedAction = vi.fn(async () => false)
|
|
17
18
|
i.setExplicitInstance(
|
|
18
19
|
{ isAuthorized: isAuthorizedAction, getCurrentUser: () => Promise.reject(':(') },
|
|
19
20
|
IdentityContext,
|
|
20
21
|
)
|
|
21
|
-
const exampleAuthorizedAction =
|
|
22
|
+
const exampleAuthorizedAction = vi.fn(async () => EmptyResult())
|
|
22
23
|
const authorized = Authorize('Role1')(exampleAuthorizedAction)
|
|
23
24
|
|
|
24
25
|
const result = await authorized({ injector: i, request, response })
|
|
@@ -30,7 +31,7 @@ describe('Authorize', () => {
|
|
|
30
31
|
|
|
31
32
|
it('Should return 403 if the current user does not have the role', async () => {
|
|
32
33
|
await usingAsync(new Injector(), async (i) => {
|
|
33
|
-
const isAuthorizedAction =
|
|
34
|
+
const isAuthorizedAction = vi.fn(async () => false)
|
|
34
35
|
i.setExplicitInstance(
|
|
35
36
|
{
|
|
36
37
|
isAuthorized: isAuthorizedAction,
|
|
@@ -38,7 +39,7 @@ describe('Authorize', () => {
|
|
|
38
39
|
},
|
|
39
40
|
IdentityContext,
|
|
40
41
|
)
|
|
41
|
-
const exampleAuthorizedAction =
|
|
42
|
+
const exampleAuthorizedAction = vi.fn(async () => EmptyResult())
|
|
42
43
|
const authorized = Authorize('Role2')(exampleAuthorizedAction)
|
|
43
44
|
|
|
44
45
|
const result = await authorized({ injector: i, request, response })
|
|
@@ -50,7 +51,7 @@ describe('Authorize', () => {
|
|
|
50
51
|
|
|
51
52
|
it('Should exec the original action if authorized', async () => {
|
|
52
53
|
await usingAsync(new Injector(), async (i) => {
|
|
53
|
-
const isAuthorizedAction =
|
|
54
|
+
const isAuthorizedAction = vi.fn(async () => true)
|
|
54
55
|
i.setExplicitInstance(
|
|
55
56
|
{
|
|
56
57
|
isAuthorized: isAuthorizedAction,
|
|
@@ -58,7 +59,7 @@ describe('Authorize', () => {
|
|
|
58
59
|
},
|
|
59
60
|
IdentityContext,
|
|
60
61
|
)
|
|
61
|
-
const exampleAuthorizedAction =
|
|
62
|
+
const exampleAuthorizedAction = vi.fn(async () => EmptyResult())
|
|
62
63
|
const authorized = Authorize('Role1')(exampleAuthorizedAction)
|
|
63
64
|
const params = { injector: i, body: undefined, query: undefined, request, response }
|
|
64
65
|
const result = await authorized(params)
|
|
@@ -5,6 +5,7 @@ import { createDeleteEndpoint } from './create-delete-endpoint'
|
|
|
5
5
|
import { MockClass, setupContext } from './utils'
|
|
6
6
|
import { useRestService } from '../helpers'
|
|
7
7
|
import { getDataSetFor } from '@furystack/repository'
|
|
8
|
+
import { describe, it, expect } from 'vitest'
|
|
8
9
|
|
|
9
10
|
describe('createDeleteEndpoint', () => {
|
|
10
11
|
it('Should delete the entity and report the success', async () => {
|
|
@@ -7,7 +7,6 @@ import { getRepository } from '@furystack/repository'
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Creates a DELETE endpoint for removing entities
|
|
10
|
-
*
|
|
11
10
|
* @param options The options for endpoint creation
|
|
12
11
|
* @param options.model The Model class
|
|
13
12
|
* @param options.primaryKey The field used as primary key on the model
|
|
@@ -7,6 +7,7 @@ import { serializeToQueryString } from '@furystack/rest'
|
|
|
7
7
|
import type { FindOptions } from '@furystack/core'
|
|
8
8
|
import { getDataSetFor, getRepository } from '@furystack/repository'
|
|
9
9
|
import { useRestService } from '../helpers'
|
|
10
|
+
import { describe, it, expect } from 'vitest'
|
|
10
11
|
|
|
11
12
|
const addMockEntities = async (i: Injector) =>
|
|
12
13
|
await getRepository(i)
|
|
@@ -7,7 +7,6 @@ import { getRepository } from '@furystack/repository'
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Creates a GetCollection endpoint for the given model. The model should have a Repository DataSet
|
|
10
|
-
*
|
|
11
10
|
* @param options The options for endpoint creation
|
|
12
11
|
* @param options.model The Model class
|
|
13
12
|
* @param options.primaryKey The field used as primary key on the model
|
|
@@ -6,6 +6,7 @@ import { MockClass, setupContext } from './utils'
|
|
|
6
6
|
import { createGetEntityEndpoint } from './create-get-entity-endpoint'
|
|
7
7
|
import { getDataSetFor } from '@furystack/repository'
|
|
8
8
|
import { useRestService } from '../helpers'
|
|
9
|
+
import { describe, it, expect } from 'vitest'
|
|
9
10
|
|
|
10
11
|
describe('createGetEntityEndpoint', () => {
|
|
11
12
|
it('Should return the entity', async () => {
|
|
@@ -8,7 +8,6 @@ import { getRepository } from '@furystack/repository'
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Creates a simple Get Entity endpoint for a specified model.
|
|
11
|
-
*
|
|
12
11
|
* @param options The options for endpoint creation
|
|
13
12
|
* @param options.model The entity model, should have a Repository DataSet
|
|
14
13
|
* @param options.primaryKey The field name used as primary key on the model
|
|
@@ -5,6 +5,7 @@ import { createPatchEndpoint } from './create-patch-endpoint'
|
|
|
5
5
|
import { MockClass, setupContext } from './utils'
|
|
6
6
|
import { getDataSetFor } from '@furystack/repository'
|
|
7
7
|
import { useRestService } from '../helpers'
|
|
8
|
+
import { describe, it, expect } from 'vitest'
|
|
8
9
|
|
|
9
10
|
describe('createPatchEndpoint', () => {
|
|
10
11
|
it('Should update the entity and report the success', async () => {
|
|
@@ -9,7 +9,6 @@ import type { WithOptionalId } from '@furystack/core'
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Creates a PATCH endpoint for updating entities
|
|
12
|
-
*
|
|
13
12
|
* @param options The options for endpoint creation
|
|
14
13
|
* @param options.model The Model class
|
|
15
14
|
* @param options.primaryKey The field name that is used as primary key on the model
|
|
@@ -5,6 +5,7 @@ import { createPostEndpoint } from './create-post-endpoint'
|
|
|
5
5
|
import { MockClass, setupContext } from './utils'
|
|
6
6
|
import { useRestService } from '../helpers'
|
|
7
7
|
import { getDataSetFor } from '@furystack/repository'
|
|
8
|
+
import { describe, it, expect } from 'vitest'
|
|
8
9
|
|
|
9
10
|
describe('createPostEndpoint', () => {
|
|
10
11
|
it('Should create the entity and report the success', async () => {
|
|
@@ -9,7 +9,6 @@ import type { WithOptionalId } from '@furystack/core'
|
|
|
9
9
|
import { getRepository } from '@furystack/repository'
|
|
10
10
|
/**
|
|
11
11
|
* Creates a POST endpoint for updating entities
|
|
12
|
-
*
|
|
13
12
|
* @param options The options for endpoint creation
|
|
14
13
|
* @param options.model The Model class
|
|
15
14
|
* @param options.primaryKey The field name used as primary key
|
package/src/helpers.spec.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ApiManager } from './api-manager'
|
|
|
4
4
|
import { HttpAuthenticationSettings } from './http-authentication-settings'
|
|
5
5
|
import { useHttpAuthentication, useRestService, useStaticFiles } from './helpers'
|
|
6
6
|
import { StaticServerManager } from './static-server-manager'
|
|
7
|
+
import { describe, it, expect } from 'vitest'
|
|
7
8
|
|
|
8
9
|
describe('Injector extensions', () => {
|
|
9
10
|
describe('useHttpAuthentication', () => {
|
package/src/helpers.ts
CHANGED
|
@@ -10,17 +10,14 @@ import { StaticServerManager } from './static-server-manager'
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Sets up the @furystack/rest-service with the provided settings
|
|
13
|
-
*
|
|
14
13
|
* @param api The API implementation details
|
|
14
|
+
* @returns a promise that resolves when the API is added to the server
|
|
15
15
|
*/
|
|
16
|
-
export const useRestService = async <T extends RestApi>(api: ImplementApiOptions<T>) =>
|
|
16
|
+
export const useRestService = async <T extends RestApi>(api: ImplementApiOptions<T>) =>
|
|
17
17
|
await api.injector.getInstance(ApiManager).addApi({ ...api })
|
|
18
|
-
return this
|
|
19
|
-
}
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* Sets up the HTTP Authentication
|
|
23
|
-
*
|
|
24
21
|
* @param injector The Injector instance
|
|
25
22
|
* @param settings Settings for HTTP Authentication
|
|
26
23
|
* @returns void
|
|
@@ -32,7 +29,6 @@ export const useHttpAuthentication = <TUser extends User, TSession extends Defau
|
|
|
32
29
|
|
|
33
30
|
/**
|
|
34
31
|
* Sets up a static file server
|
|
35
|
-
*
|
|
36
32
|
* @param options The settings for the static file server
|
|
37
33
|
* @param options.injector The Injector instance
|
|
38
34
|
* @param options.settings Settings for the static file server
|
|
@@ -6,6 +6,7 @@ import { DefaultSession } from './models/default-session'
|
|
|
6
6
|
import { HttpUserContext } from './http-user-context'
|
|
7
7
|
import { PasswordAuthenticator, PasswordCredential, UnauthenticatedError } from '@furystack/security'
|
|
8
8
|
import { useHttpAuthentication } from './helpers'
|
|
9
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
9
10
|
|
|
10
11
|
export const prepareInjector = async (i: Injector) => {
|
|
11
12
|
addStore(i, new InMemoryStore({ model: User, primaryKey: 'username' }))
|
|
@@ -43,7 +44,7 @@ describe('HttpUserContext', () => {
|
|
|
43
44
|
await usingAsync(new Injector(), async (i) => {
|
|
44
45
|
await prepareInjector(i)
|
|
45
46
|
const ctx = i.getInstance(HttpUserContext)
|
|
46
|
-
ctx.getCurrentUser =
|
|
47
|
+
ctx.getCurrentUser = vi.fn(async () => testUser)
|
|
47
48
|
const value = await ctx.isAuthenticated(request)
|
|
48
49
|
expect(value).toBe(true)
|
|
49
50
|
expect(ctx.getCurrentUser).toBeCalled()
|
|
@@ -54,7 +55,7 @@ describe('HttpUserContext', () => {
|
|
|
54
55
|
await usingAsync(new Injector(), async (i) => {
|
|
55
56
|
await prepareInjector(i)
|
|
56
57
|
const ctx = i.getInstance(HttpUserContext)
|
|
57
|
-
ctx.getCurrentUser =
|
|
58
|
+
ctx.getCurrentUser = vi.fn(async () => {
|
|
58
59
|
throw Error(':(')
|
|
59
60
|
})
|
|
60
61
|
await expect(ctx.isAuthenticated(request)).resolves.toEqual(false)
|
|
@@ -68,7 +69,7 @@ describe('HttpUserContext', () => {
|
|
|
68
69
|
await usingAsync(new Injector(), async (i) => {
|
|
69
70
|
await prepareInjector(i)
|
|
70
71
|
const ctx = i.getInstance(HttpUserContext)
|
|
71
|
-
ctx.getCurrentUser =
|
|
72
|
+
ctx.getCurrentUser = vi.fn(async () => testUser)
|
|
72
73
|
const value = await ctx.isAuthorized(request, 'grantedRole1', 'grantedRole2')
|
|
73
74
|
expect(value).toBe(true)
|
|
74
75
|
expect(ctx.getCurrentUser).toBeCalled()
|
|
@@ -79,7 +80,7 @@ describe('HttpUserContext', () => {
|
|
|
79
80
|
await usingAsync(new Injector(), async (i) => {
|
|
80
81
|
await prepareInjector(i)
|
|
81
82
|
const ctx = i.getInstance(HttpUserContext)
|
|
82
|
-
ctx.getCurrentUser =
|
|
83
|
+
ctx.getCurrentUser = vi.fn(async () => testUser)
|
|
83
84
|
const value = await ctx.isAuthorized(request, 'grantedRole1', 'nonGrantedRole2')
|
|
84
85
|
expect(value).toBe(false)
|
|
85
86
|
expect(ctx.getCurrentUser).toBeCalled()
|
|
@@ -187,7 +188,7 @@ describe('HttpUserContext', () => {
|
|
|
187
188
|
await usingAsync(new Injector(), async (i) => {
|
|
188
189
|
await prepareInjector(i)
|
|
189
190
|
const ctx = i.getInstance(HttpUserContext)
|
|
190
|
-
ctx.authenticateUser =
|
|
191
|
+
ctx.authenticateUser = vi.fn(async () => testUser)
|
|
191
192
|
const result = await ctx.authenticateRequest({
|
|
192
193
|
headers: { authorization: `Basic dGVzdHVzZXI6cGFzc3dvcmQ=` },
|
|
193
194
|
} as IncomingMessage)
|
|
@@ -201,7 +202,7 @@ describe('HttpUserContext', () => {
|
|
|
201
202
|
await prepareInjector(i)
|
|
202
203
|
const ctx = i.getInstance(HttpUserContext)
|
|
203
204
|
ctx.authentication.enableBasicAuth = false
|
|
204
|
-
ctx.authenticateUser =
|
|
205
|
+
ctx.authenticateUser = vi.fn(async () => testUser)
|
|
205
206
|
await expect(
|
|
206
207
|
ctx.authenticateRequest({
|
|
207
208
|
headers: { authorization: `Basic dGVzdHVzZXI6cGFzc3dvcmQ=` },
|
|
@@ -263,7 +264,7 @@ describe('HttpUserContext', () => {
|
|
|
263
264
|
await usingAsync(new Injector(), async (i) => {
|
|
264
265
|
await prepareInjector(i)
|
|
265
266
|
const ctx = i.getInstance(HttpUserContext)
|
|
266
|
-
ctx.authenticateRequest =
|
|
267
|
+
ctx.authenticateRequest = vi.fn(async () => testUser)
|
|
267
268
|
const result = await ctx.getCurrentUser(request)
|
|
268
269
|
const result2 = await ctx.getCurrentUser(request)
|
|
269
270
|
expect(ctx.authenticateRequest).toBeCalledTimes(1)
|
|
@@ -278,8 +279,8 @@ describe('HttpUserContext', () => {
|
|
|
278
279
|
await usingAsync(new Injector(), async (i) => {
|
|
279
280
|
await prepareInjector(i)
|
|
280
281
|
const ctx = i.getInstance(HttpUserContext)
|
|
281
|
-
const setHeader =
|
|
282
|
-
ctx.getSessionStore().add =
|
|
282
|
+
const setHeader = vi.fn()
|
|
283
|
+
ctx.getSessionStore().add = vi.fn(async () => {
|
|
283
284
|
return {} as any
|
|
284
285
|
})
|
|
285
286
|
const authResult = await ctx.cookieLogin(testUser, { setHeader } as any)
|
|
@@ -295,14 +296,14 @@ describe('HttpUserContext', () => {
|
|
|
295
296
|
await usingAsync(new Injector(), async (i) => {
|
|
296
297
|
await prepareInjector(i)
|
|
297
298
|
const ctx = i.getInstance(HttpUserContext)
|
|
298
|
-
const setHeader =
|
|
299
|
-
ctx.getSessionStore().add =
|
|
299
|
+
const setHeader = vi.fn()
|
|
300
|
+
ctx.getSessionStore().add = vi.fn(async () => {
|
|
300
301
|
return {} as any
|
|
301
302
|
})
|
|
302
|
-
ctx.authenticateRequest =
|
|
303
|
-
ctx.getSessionStore().remove =
|
|
303
|
+
ctx.authenticateRequest = vi.fn(async () => testUser)
|
|
304
|
+
ctx.getSessionStore().remove = vi.fn(async () => undefined)
|
|
304
305
|
ctx.getSessionIdFromRequest = () => 'example-session-id'
|
|
305
|
-
response.setHeader =
|
|
306
|
+
response.setHeader = vi.fn(() => response)
|
|
306
307
|
await ctx.cookieLogin(testUser, { setHeader } as any)
|
|
307
308
|
await ctx.cookieLogout(request, response)
|
|
308
309
|
expect(response.setHeader).toBeCalledWith('Set-Cookie', 'fss=; Path=/; HttpOnly')
|
package/src/http-user-context.ts
CHANGED
|
@@ -51,7 +51,6 @@ export class HttpUserContext {
|
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Returns if the current user can be authorized with ALL of the specified roles
|
|
54
|
-
*
|
|
55
54
|
* @param request The request to be authenticated
|
|
56
55
|
* @param roles The list of roles to authorize
|
|
57
56
|
* @returns a boolean value that indicates if the user is authenticated
|
|
@@ -68,7 +67,6 @@ export class HttpUserContext {
|
|
|
68
67
|
|
|
69
68
|
/**
|
|
70
69
|
* Checks if the system contains a user with the provided name and password, throws an error otherwise
|
|
71
|
-
*
|
|
72
70
|
* @param userName The username
|
|
73
71
|
* @param password The password
|
|
74
72
|
* @returns the authenticated User
|
|
@@ -137,7 +135,6 @@ export class HttpUserContext {
|
|
|
137
135
|
|
|
138
136
|
/**
|
|
139
137
|
* Creates and sets up a cookie-based session for the provided user
|
|
140
|
-
*
|
|
141
138
|
* @param user The user to create a session for
|
|
142
139
|
* @param serverResponse A serverResponse to set the cookie
|
|
143
140
|
* @returns the current User
|
package/src/mime-types.spec.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { User, InMemoryStore, addStore } from '@furystack/core'
|
|
|
7
7
|
import { DefaultSession } from './models/default-session'
|
|
8
8
|
import { JsonResult } from './request-action-implementation'
|
|
9
9
|
import { useHttpAuthentication, useRestService } from './helpers'
|
|
10
|
+
import { describe, it, expect } from 'vitest'
|
|
10
11
|
|
|
11
12
|
class UserWithPassword extends User {
|
|
12
13
|
password!: string
|
|
@@ -5,6 +5,7 @@ import { usingAsync } from '@furystack/utils'
|
|
|
5
5
|
import { JsonResult } from './request-action-implementation'
|
|
6
6
|
import './helpers'
|
|
7
7
|
import { useRestService } from './helpers'
|
|
8
|
+
import { describe, it, expect } from 'vitest'
|
|
8
9
|
|
|
9
10
|
export interface EchoApi extends RestApi {
|
|
10
11
|
GET: {
|
|
@@ -2,6 +2,7 @@ import { SchemaValidator } from './schema-validator'
|
|
|
2
2
|
import type { BodyParameters, Language } from './validate-examples'
|
|
3
3
|
import { exampleSchema } from './validate-examples'
|
|
4
4
|
import { SchemaValidationError } from './schema-validation-error'
|
|
5
|
+
import { describe, it, expect } from 'vitest'
|
|
5
6
|
|
|
6
7
|
describe('ValidateSchema', () => {
|
|
7
8
|
describe('String Literal checks', () => {
|