@furystack/rest-service 7.0.11 → 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/api-manager.js +4 -4
- package/esm/api-manager.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.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/endpoint-generators/utils.js +2 -0
- package/esm/endpoint-generators/utils.js.map +1 -1
- 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-authentication-settings.js +7 -8
- package/esm/http-authentication-settings.js.map +1 -1
- package/esm/http-user-context.js +24 -21
- 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/models/default-session.js +8 -0
- package/esm/models/default-session.js.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-validation-error.js +1 -0
- package/esm/schema-validator/schema-validation-error.js.map +1 -1
- package/esm/schema-validator/schema-validator.d.ts +1 -2
- package/esm/schema-validator/schema-validator.d.ts.map +1 -1
- package/esm/schema-validator/schema-validator.js +3 -2
- 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.js +12 -12
- package/esm/server-manager.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.js +26 -26
- 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.js +2 -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/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/schema-validator/schema-validator.ts +6 -5
- package/src/server-response-extensions.spec.ts +1 -1
- package/src/static-server-manager.spec.ts +15 -15
- package/src/validate.integration.spec.ts +4 -7
|
@@ -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', () => {
|
|
@@ -4,14 +4,15 @@ import useFormats from 'ajv-formats'
|
|
|
4
4
|
import { SchemaValidationError } from './schema-validation-error.js'
|
|
5
5
|
|
|
6
6
|
export class SchemaValidator<TSchema extends { definitions: {} }> {
|
|
7
|
-
private readonly ajv
|
|
8
|
-
allErrors: true,
|
|
9
|
-
...this.ajvOptions,
|
|
10
|
-
})
|
|
7
|
+
private readonly ajv: Ajv.default
|
|
11
8
|
constructor(
|
|
12
9
|
private readonly schema: TSchema,
|
|
13
|
-
|
|
10
|
+
ajvOptions?: Options,
|
|
14
11
|
) {
|
|
12
|
+
this.ajv = new Ajv.default({
|
|
13
|
+
allErrors: true,
|
|
14
|
+
...ajvOptions,
|
|
15
|
+
})
|
|
15
16
|
useFormats.default(this.ajv)
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -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
|
/**
|
|
@@ -10,7 +10,7 @@ import { describe, it, expect, vi } from 'vitest'
|
|
|
10
10
|
* @yields a port for testing
|
|
11
11
|
* @returns The Port number
|
|
12
12
|
*/
|
|
13
|
-
function*
|
|
13
|
+
function* portGenerator(initialPort = 1234) {
|
|
14
14
|
let port = initialPort
|
|
15
15
|
|
|
16
16
|
while (true) {
|
|
@@ -19,14 +19,14 @@ function* getPort(initialPort = 1234) {
|
|
|
19
19
|
return port
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
const portGenerator = getPort()
|
|
22
|
+
const getPort = () => portGenerator().next().value
|
|
24
23
|
|
|
24
|
+
describe('StaticServerManager', () => {
|
|
25
25
|
describe('Top level routing', () => {
|
|
26
26
|
it('Should return a 404 without fallback', async () => {
|
|
27
27
|
await usingAsync(new Injector(), async (injector) => {
|
|
28
28
|
const staticServerManager = injector.getInstance(StaticServerManager)
|
|
29
|
-
const port =
|
|
29
|
+
const port = getPort()
|
|
30
30
|
await staticServerManager.addStaticSite({
|
|
31
31
|
baseUrl: '/',
|
|
32
32
|
path: '.',
|
|
@@ -45,7 +45,7 @@ describe('StaticServerManager', () => {
|
|
|
45
45
|
it('Should return a fallback', async () => {
|
|
46
46
|
await usingAsync(new Injector(), async (injector) => {
|
|
47
47
|
const staticServerManager = injector.getInstance(StaticServerManager)
|
|
48
|
-
const port =
|
|
48
|
+
const port = getPort()
|
|
49
49
|
|
|
50
50
|
await staticServerManager.addStaticSite({
|
|
51
51
|
baseUrl: '/',
|
|
@@ -67,7 +67,7 @@ describe('StaticServerManager', () => {
|
|
|
67
67
|
it('Should return a fallback for root files', async () => {
|
|
68
68
|
await usingAsync(new Injector(), async (injector) => {
|
|
69
69
|
const staticServerManager = injector.getInstance(StaticServerManager)
|
|
70
|
-
const port =
|
|
70
|
+
const port = getPort()
|
|
71
71
|
|
|
72
72
|
await staticServerManager.addStaticSite({
|
|
73
73
|
baseUrl: '/',
|
|
@@ -89,7 +89,7 @@ describe('StaticServerManager', () => {
|
|
|
89
89
|
it('Should return a defined file from a root directory', async () => {
|
|
90
90
|
await usingAsync(new Injector(), async (injector) => {
|
|
91
91
|
const staticServerManager = injector.getInstance(StaticServerManager)
|
|
92
|
-
const port =
|
|
92
|
+
const port = getPort()
|
|
93
93
|
|
|
94
94
|
await staticServerManager.addStaticSite({
|
|
95
95
|
baseUrl: '/',
|
|
@@ -110,7 +110,7 @@ describe('StaticServerManager', () => {
|
|
|
110
110
|
it('Should return a defined file from a subdirectory', async () => {
|
|
111
111
|
await usingAsync(new Injector(), async (injector) => {
|
|
112
112
|
const staticServerManager = injector.getInstance(StaticServerManager)
|
|
113
|
-
const port =
|
|
113
|
+
const port = getPort()
|
|
114
114
|
|
|
115
115
|
await staticServerManager.addStaticSite({
|
|
116
116
|
baseUrl: '/',
|
|
@@ -129,7 +129,7 @@ describe('StaticServerManager', () => {
|
|
|
129
129
|
it('Should not handle a request when the path is not matching', async () => {
|
|
130
130
|
await usingAsync(new Injector(), async (injector) => {
|
|
131
131
|
const staticServerManager = injector.getInstance(StaticServerManager)
|
|
132
|
-
const port =
|
|
132
|
+
const port = getPort()
|
|
133
133
|
|
|
134
134
|
await staticServerManager.addStaticSite({
|
|
135
135
|
baseUrl: '/bundle',
|
|
@@ -154,7 +154,7 @@ describe('StaticServerManager', () => {
|
|
|
154
154
|
it('Should return a 404 without fallback', async () => {
|
|
155
155
|
await usingAsync(new Injector(), async (injector) => {
|
|
156
156
|
const staticServerManager = injector.getInstance(StaticServerManager)
|
|
157
|
-
const port =
|
|
157
|
+
const port = getPort()
|
|
158
158
|
|
|
159
159
|
await staticServerManager.addStaticSite({
|
|
160
160
|
baseUrl: '/bundle',
|
|
@@ -174,7 +174,7 @@ describe('StaticServerManager', () => {
|
|
|
174
174
|
it('Should return a fallback', async () => {
|
|
175
175
|
await usingAsync(new Injector(), async (injector) => {
|
|
176
176
|
const staticServerManager = injector.getInstance(StaticServerManager)
|
|
177
|
-
const port =
|
|
177
|
+
const port = getPort()
|
|
178
178
|
|
|
179
179
|
await staticServerManager.addStaticSite({
|
|
180
180
|
baseUrl: '/bundle',
|
|
@@ -192,7 +192,7 @@ describe('StaticServerManager', () => {
|
|
|
192
192
|
it('Should return a defined file from a root directory', async () => {
|
|
193
193
|
await usingAsync(new Injector(), async (injector) => {
|
|
194
194
|
const staticServerManager = injector.getInstance(StaticServerManager)
|
|
195
|
-
const port =
|
|
195
|
+
const port = getPort()
|
|
196
196
|
|
|
197
197
|
await staticServerManager.addStaticSite({
|
|
198
198
|
baseUrl: '/',
|
|
@@ -209,7 +209,7 @@ describe('StaticServerManager', () => {
|
|
|
209
209
|
it('Should return a defined file from a subdirectory', async () => {
|
|
210
210
|
await usingAsync(new Injector(), async (injector) => {
|
|
211
211
|
const staticServerManager = injector.getInstance(StaticServerManager)
|
|
212
|
-
const port =
|
|
212
|
+
const port = getPort()
|
|
213
213
|
|
|
214
214
|
await staticServerManager.addStaticSite({
|
|
215
215
|
baseUrl: '/',
|
|
@@ -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
|
|