@furystack/rest-service 12.3.5 → 14.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/CHANGELOG.md +55 -0
- package/README.md +47 -28
- package/esm/actions/get-current-user.spec.js +10 -6
- package/esm/actions/get-current-user.spec.js.map +1 -1
- package/esm/actions/index.d.ts +0 -1
- package/esm/actions/index.d.ts.map +1 -1
- package/esm/actions/index.js +0 -1
- package/esm/actions/index.js.map +1 -1
- package/esm/actions/is-authenticated.spec.js +10 -6
- package/esm/actions/is-authenticated.spec.js.map +1 -1
- package/esm/actions/logout-action.spec.js +11 -9
- package/esm/actions/logout-action.spec.js.map +1 -1
- package/esm/actions/logout.js +1 -1
- package/esm/actions/logout.js.map +1 -1
- package/esm/actions/password-login-action.js +1 -1
- package/esm/actions/password-login-action.js.map +1 -1
- package/esm/actions/password-login-action.spec.js +23 -28
- package/esm/actions/password-login-action.spec.js.map +1 -1
- package/esm/authenticate.js +1 -1
- package/esm/authenticate.js.map +1 -1
- package/esm/authenticate.spec.js +41 -33
- package/esm/authenticate.spec.js.map +1 -1
- package/esm/authorize.spec.js +34 -29
- package/esm/authorize.spec.js.map +1 -1
- package/esm/endpoint-generators/create-delete-endpoint.d.ts +6 -11
- package/esm/endpoint-generators/create-delete-endpoint.d.ts.map +1 -1
- package/esm/endpoint-generators/create-delete-endpoint.js +7 -11
- package/esm/endpoint-generators/create-delete-endpoint.js.map +1 -1
- package/esm/endpoint-generators/create-delete-endpoint.spec.js +14 -21
- package/esm/endpoint-generators/create-delete-endpoint.spec.js.map +1 -1
- package/esm/endpoint-generators/create-get-collection-endpoint.d.ts +11 -11
- package/esm/endpoint-generators/create-get-collection-endpoint.d.ts.map +1 -1
- package/esm/endpoint-generators/create-get-collection-endpoint.js +13 -12
- package/esm/endpoint-generators/create-get-collection-endpoint.js.map +1 -1
- package/esm/endpoint-generators/create-get-collection-endpoint.spec.js +43 -70
- package/esm/endpoint-generators/create-get-collection-endpoint.spec.js.map +1 -1
- package/esm/endpoint-generators/create-get-entity-endpoint.d.ts +6 -11
- package/esm/endpoint-generators/create-get-entity-endpoint.d.ts.map +1 -1
- package/esm/endpoint-generators/create-get-entity-endpoint.js +7 -11
- package/esm/endpoint-generators/create-get-entity-endpoint.js.map +1 -1
- package/esm/endpoint-generators/create-get-entity-endpoint.spec.js +16 -33
- package/esm/endpoint-generators/create-get-entity-endpoint.spec.js.map +1 -1
- package/esm/endpoint-generators/create-get-openapi-document-action.d.ts +1 -15
- package/esm/endpoint-generators/create-get-openapi-document-action.d.ts.map +1 -1
- package/esm/endpoint-generators/create-get-openapi-document-action.js +1 -24
- package/esm/endpoint-generators/create-get-openapi-document-action.js.map +1 -1
- package/esm/endpoint-generators/create-get-schema-action.d.ts +1 -1
- package/esm/endpoint-generators/create-get-schema-action.d.ts.map +1 -1
- package/esm/endpoint-generators/create-get-schema-action.js.map +1 -1
- package/esm/endpoint-generators/create-patch-endpoint.d.ts +7 -13
- package/esm/endpoint-generators/create-patch-endpoint.d.ts.map +1 -1
- package/esm/endpoint-generators/create-patch-endpoint.js +8 -13
- package/esm/endpoint-generators/create-patch-endpoint.js.map +1 -1
- package/esm/endpoint-generators/create-patch-endpoint.spec.js +10 -17
- package/esm/endpoint-generators/create-patch-endpoint.spec.js.map +1 -1
- package/esm/endpoint-generators/create-post-endpoint.d.ts +7 -13
- package/esm/endpoint-generators/create-post-endpoint.d.ts.map +1 -1
- package/esm/endpoint-generators/create-post-endpoint.js +8 -13
- package/esm/endpoint-generators/create-post-endpoint.js.map +1 -1
- package/esm/endpoint-generators/create-post-endpoint.spec.js +41 -14
- package/esm/endpoint-generators/create-post-endpoint.spec.js.map +1 -1
- package/esm/endpoint-generators/utils.d.ts +17 -2
- package/esm/endpoint-generators/utils.d.ts.map +1 -1
- package/esm/endpoint-generators/utils.js +33 -20
- package/esm/endpoint-generators/utils.js.map +1 -1
- package/esm/endpoint-generators/with-schema-and-openapi-action.d.ts +0 -2
- package/esm/endpoint-generators/with-schema-and-openapi-action.d.ts.map +1 -1
- package/esm/get-schema-from-api.d.ts +1 -1
- package/esm/get-schema-from-api.d.ts.map +1 -1
- package/esm/get-schema-from-api.spec.js.map +1 -1
- package/esm/helpers.d.ts +53 -87
- package/esm/helpers.d.ts.map +1 -1
- package/esm/helpers.js +91 -92
- package/esm/helpers.js.map +1 -1
- package/esm/helpers.spec.d.ts +2 -1
- package/esm/helpers.spec.d.ts.map +1 -1
- package/esm/helpers.spec.js +41 -38
- package/esm/helpers.spec.js.map +1 -1
- package/esm/http-authentication-settings.d.ts +35 -12
- package/esm/http-authentication-settings.d.ts.map +1 -1
- package/esm/http-authentication-settings.js +21 -29
- package/esm/http-authentication-settings.js.map +1 -1
- package/esm/http-server-pool.d.ts +64 -0
- package/esm/http-server-pool.d.ts.map +1 -0
- package/esm/http-server-pool.js +95 -0
- package/esm/http-server-pool.js.map +1 -0
- package/esm/http-server-pool.spec.d.ts +2 -0
- package/esm/http-server-pool.spec.d.ts.map +1 -0
- package/esm/http-server-pool.spec.js +193 -0
- package/esm/http-server-pool.spec.js.map +1 -0
- package/esm/http-user-context.d.ts +31 -44
- package/esm/http-user-context.d.ts.map +1 -1
- package/esm/http-user-context.js +76 -95
- package/esm/http-user-context.js.map +1 -1
- package/esm/http-user-context.spec.d.ts +8 -2
- package/esm/http-user-context.spec.d.ts.map +1 -1
- package/esm/http-user-context.spec.js +189 -337
- package/esm/http-user-context.spec.js.map +1 -1
- package/esm/index.d.ts +6 -4
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +6 -4
- package/esm/index.js.map +1 -1
- package/esm/login-response-strategy.d.ts +11 -10
- package/esm/login-response-strategy.d.ts.map +1 -1
- package/esm/login-response-strategy.js +7 -6
- package/esm/login-response-strategy.js.map +1 -1
- package/esm/login-response-strategy.spec.js +25 -29
- package/esm/login-response-strategy.spec.js.map +1 -1
- package/esm/openapi/generate-openapi-document.d.ts +0 -8
- package/esm/openapi/generate-openapi-document.d.ts.map +1 -1
- package/esm/openapi/generate-openapi-document.js +0 -2
- package/esm/openapi/generate-openapi-document.js.map +1 -1
- package/esm/proxy-manager.spec.js +152 -176
- package/esm/proxy-manager.spec.js.map +1 -1
- package/esm/proxy-runtime.d.ts +27 -0
- package/esm/proxy-runtime.d.ts.map +1 -0
- package/esm/proxy-runtime.js +45 -0
- package/esm/proxy-runtime.js.map +1 -0
- package/esm/proxy-runtime.spec.d.ts +2 -0
- package/esm/proxy-runtime.spec.d.ts.map +1 -0
- package/esm/proxy-runtime.spec.js +39 -0
- package/esm/proxy-runtime.spec.js.map +1 -0
- package/esm/rest-api-runtime.d.ts +76 -0
- package/esm/rest-api-runtime.d.ts.map +1 -0
- package/esm/rest-api-runtime.js +131 -0
- package/esm/rest-api-runtime.js.map +1 -0
- package/esm/rest-api-runtime.spec.d.ts +2 -0
- package/esm/rest-api-runtime.spec.d.ts.map +1 -0
- package/esm/rest-api-runtime.spec.js +58 -0
- package/esm/rest-api-runtime.spec.js.map +1 -0
- package/esm/rest-service.integration.spec.d.ts +1 -1
- package/esm/rest-service.integration.spec.d.ts.map +1 -1
- package/esm/rest-service.integration.spec.js +60 -82
- package/esm/rest-service.integration.spec.js.map +1 -1
- package/esm/rest.integration.test.js +26 -84
- package/esm/rest.integration.test.js.map +1 -1
- package/esm/server-telemetry.d.ts +57 -0
- package/esm/server-telemetry.d.ts.map +1 -0
- package/esm/server-telemetry.js +26 -0
- package/esm/server-telemetry.js.map +1 -0
- package/esm/server-telemetry.spec.d.ts +2 -0
- package/esm/server-telemetry.spec.d.ts.map +1 -0
- package/esm/server-telemetry.spec.js +52 -0
- package/esm/server-telemetry.spec.js.map +1 -0
- package/esm/static-server-manager.spec.js +60 -125
- package/esm/static-server-manager.spec.js.map +1 -1
- package/esm/static-site-runtime.d.ts +21 -0
- package/esm/static-site-runtime.d.ts.map +1 -0
- package/esm/static-site-runtime.js +48 -0
- package/esm/static-site-runtime.js.map +1 -0
- package/esm/static-site-runtime.spec.d.ts +2 -0
- package/esm/static-site-runtime.spec.d.ts.map +1 -0
- package/esm/static-site-runtime.spec.js +30 -0
- package/esm/static-site-runtime.spec.js.map +1 -0
- package/esm/user-store.d.ts +39 -0
- package/esm/user-store.d.ts.map +1 -0
- package/esm/user-store.js +62 -0
- package/esm/user-store.js.map +1 -0
- package/esm/user-store.spec.d.ts +2 -0
- package/esm/user-store.spec.d.ts.map +1 -0
- package/esm/user-store.spec.js +72 -0
- package/esm/user-store.spec.js.map +1 -0
- package/esm/validate.integration.spec.js +26 -83
- package/esm/validate.integration.spec.js.map +1 -1
- package/package.json +8 -8
- package/src/actions/get-current-user.spec.ts +11 -10
- package/src/actions/index.ts +0 -1
- package/src/actions/is-authenticated.spec.ts +12 -7
- package/src/actions/logout-action.spec.ts +12 -12
- package/src/actions/logout.ts +1 -1
- package/src/actions/password-login-action.spec.ts +30 -30
- package/src/actions/password-login-action.ts +1 -1
- package/src/authenticate.spec.ts +45 -51
- package/src/authenticate.ts +1 -1
- package/src/authorize.spec.ts +37 -39
- package/src/endpoint-generators/create-delete-endpoint.spec.ts +16 -24
- package/src/endpoint-generators/create-delete-endpoint.ts +11 -17
- package/src/endpoint-generators/create-get-collection-endpoint.spec.ts +45 -78
- package/src/endpoint-generators/create-get-collection-endpoint.ts +17 -19
- package/src/endpoint-generators/create-get-entity-endpoint.spec.ts +17 -33
- package/src/endpoint-generators/create-get-entity-endpoint.ts +11 -17
- package/src/endpoint-generators/create-get-openapi-document-action.ts +2 -38
- package/src/endpoint-generators/create-get-schema-action.ts +1 -1
- package/src/endpoint-generators/create-patch-endpoint.spec.ts +11 -18
- package/src/endpoint-generators/create-patch-endpoint.ts +12 -23
- package/src/endpoint-generators/create-post-endpoint.spec.ts +45 -14
- package/src/endpoint-generators/create-post-endpoint.ts +13 -23
- package/src/endpoint-generators/utils.ts +36 -28
- package/src/endpoint-generators/with-schema-and-openapi-action.ts +0 -3
- package/src/get-schema-from-api.spec.ts +1 -1
- package/src/get-schema-from-api.ts +1 -1
- package/src/helpers.spec.ts +51 -41
- package/src/helpers.ts +140 -109
- package/src/http-authentication-settings.ts +51 -25
- package/src/http-server-pool.spec.ts +220 -0
- package/src/http-server-pool.ts +169 -0
- package/src/http-user-context.spec.ts +203 -383
- package/src/http-user-context.ts +114 -91
- package/src/index.ts +6 -4
- package/src/login-response-strategy.spec.ts +32 -31
- package/src/login-response-strategy.ts +13 -12
- package/src/openapi/generate-openapi-document.ts +0 -3
- package/src/proxy-manager.spec.ts +152 -182
- package/src/proxy-runtime.spec.ts +50 -0
- package/src/proxy-runtime.ts +75 -0
- package/src/rest-api-runtime.spec.ts +77 -0
- package/src/rest-api-runtime.ts +204 -0
- package/src/rest-service.integration.spec.ts +68 -87
- package/src/rest.integration.test.ts +27 -87
- package/src/server-telemetry.spec.ts +56 -0
- package/src/server-telemetry.ts +51 -0
- package/src/static-server-manager.spec.ts +63 -151
- package/src/static-site-runtime.spec.ts +39 -0
- package/src/static-site-runtime.ts +75 -0
- package/src/user-store.spec.ts +86 -0
- package/src/user-store.ts +68 -0
- package/src/validate.integration.spec.ts +39 -97
- package/esm/actions/login-action.spec.d.ts +0 -2
- package/esm/actions/login-action.spec.d.ts.map +0 -1
- package/esm/actions/login-action.spec.js +0 -34
- package/esm/actions/login-action.spec.js.map +0 -1
- package/esm/actions/login.d.ts +0 -19
- package/esm/actions/login.d.ts.map +0 -1
- package/esm/actions/login.js +0 -27
- package/esm/actions/login.js.map +0 -1
- package/esm/api-manager.d.ts +0 -104
- package/esm/api-manager.d.ts.map +0 -1
- package/esm/api-manager.js +0 -180
- package/esm/api-manager.js.map +0 -1
- package/esm/proxy-manager.d.ts +0 -53
- package/esm/proxy-manager.d.ts.map +0 -1
- package/esm/proxy-manager.js +0 -84
- package/esm/proxy-manager.js.map +0 -1
- package/esm/server-manager.d.ts +0 -48
- package/esm/server-manager.d.ts.map +0 -1
- package/esm/server-manager.js +0 -100
- package/esm/server-manager.js.map +0 -1
- package/esm/static-server-manager.d.ts +0 -19
- package/esm/static-server-manager.d.ts.map +0 -1
- package/esm/static-server-manager.js +0 -65
- package/esm/static-server-manager.js.map +0 -1
- package/esm/swagger/generate-swagger-json.spec.d.ts +0 -2
- package/esm/swagger/generate-swagger-json.spec.d.ts.map +0 -1
- package/esm/swagger/generate-swagger-json.spec.js +0 -215
- package/esm/swagger/generate-swagger-json.spec.js.map +0 -1
- package/src/actions/login-action.spec.ts +0 -42
- package/src/actions/login.ts +0 -32
- package/src/api-manager.ts +0 -308
- package/src/proxy-manager.ts +0 -102
- package/src/server-manager.ts +0 -135
- package/src/static-server-manager.ts +0 -90
- package/src/swagger/generate-swagger-json.spec.ts +0 -250
package/esm/helpers.js
CHANGED
|
@@ -1,119 +1,118 @@
|
|
|
1
1
|
import { useSystemIdentityContext } from '@furystack/core';
|
|
2
2
|
import { PasswordAuthenticator } from '@furystack/security';
|
|
3
|
-
import {
|
|
3
|
+
import { PathHelper } from '@furystack/utils';
|
|
4
4
|
import { createBasicAuthProvider } from './authentication-providers/basic-auth-provider.js';
|
|
5
5
|
import { createCookieAuthProvider } from './authentication-providers/cookie-auth-provider.js';
|
|
6
6
|
import { authenticateUserWithDataSet, findSessionById, findUserByName } from './authentication-providers/helpers.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { CreateGetOpenApiDocumentAction } from './endpoint-generators/create-get-openapi-document-action.js';
|
|
8
|
+
import { CreateGetSchemaAction } from './endpoint-generators/create-get-schema-action.js';
|
|
9
|
+
import { defaultHttpAuthenticationSettings, HttpAuthenticationSettings } from './http-authentication-settings.js';
|
|
10
|
+
import { HttpServerPoolToken } from './http-server-pool.js';
|
|
11
|
+
import { HttpUserContext } from './http-user-context.js';
|
|
12
|
+
import { buildProxyServerApi } from './proxy-runtime.js';
|
|
13
|
+
import { compileApi, onRestApiMessage, shouldExecRequest } from './rest-api-runtime.js';
|
|
14
|
+
import { ServerTelemetryToken } from './server-telemetry.js';
|
|
15
|
+
import { buildStaticSiteServerApi } from './static-site-runtime.js';
|
|
10
16
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
13
|
-
*
|
|
17
|
+
* Acquires a pooled HTTP server, compiles the user-supplied API definition
|
|
18
|
+
* and attaches a {@link ServerApi} that dispatches matching requests.
|
|
19
|
+
*
|
|
20
|
+
* Public contract is unchanged from the pre-migration release; internally
|
|
21
|
+
* everything goes through the functional tokens.
|
|
14
22
|
*/
|
|
15
|
-
export const useRestService = async (
|
|
23
|
+
export const useRestService = async (options) => {
|
|
24
|
+
const { injector, api, hostName, port, root, cors, deserializeQueryParams, enableGetSchema, name, description, version, } = options;
|
|
25
|
+
const extendedApi = enableGetSchema
|
|
26
|
+
? {
|
|
27
|
+
...api,
|
|
28
|
+
GET: {
|
|
29
|
+
...api.GET,
|
|
30
|
+
'/schema': CreateGetSchemaAction(api, name, description, version),
|
|
31
|
+
'/openapi.json': CreateGetOpenApiDocumentAction(api, name, description, version),
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
: api;
|
|
35
|
+
const supportedMethods = Object.keys(extendedApi);
|
|
36
|
+
const rootApiPath = PathHelper.normalize(root);
|
|
37
|
+
const compiledApi = compileApi(extendedApi, root);
|
|
38
|
+
const serverApi = {
|
|
39
|
+
shouldExec: ({ req }) => shouldExecRequest({
|
|
40
|
+
method: req.method?.toUpperCase(),
|
|
41
|
+
url: PathHelper.normalize(req.url || ''),
|
|
42
|
+
rootApiPath,
|
|
43
|
+
supportedMethods,
|
|
44
|
+
}),
|
|
45
|
+
onRequest: (msg) => onRestApiMessage({
|
|
46
|
+
...msg,
|
|
47
|
+
compiledApi,
|
|
48
|
+
rootApiPath,
|
|
49
|
+
port,
|
|
50
|
+
supportedMethods,
|
|
51
|
+
cors,
|
|
52
|
+
injector,
|
|
53
|
+
hostName,
|
|
54
|
+
deserializeQueryParams,
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
const pool = injector.get(HttpServerPoolToken);
|
|
58
|
+
const record = await pool.acquire({ port, hostName });
|
|
59
|
+
record.apis.push(serverApi);
|
|
60
|
+
return serverApi;
|
|
61
|
+
};
|
|
16
62
|
/**
|
|
17
|
-
*
|
|
63
|
+
* Installs HTTP authentication on the given injector: builds the provider
|
|
64
|
+
* chain (Basic + Cookie by default), appends any caller-provided providers
|
|
65
|
+
* and rebinds {@link HttpAuthenticationSettings}.
|
|
18
66
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @param injector The Injector instance
|
|
23
|
-
* @param settings Settings for HTTP Authentication
|
|
67
|
+
* Prerequisite: {@link UserStore} and {@link SessionStore} must be bound to
|
|
68
|
+
* persistent implementations before calling this helper, since the Basic
|
|
69
|
+
* and Cookie providers need to read users and sessions immediately.
|
|
24
70
|
*/
|
|
25
|
-
export const useHttpAuthentication = (injector,
|
|
26
|
-
const mergedSettings =
|
|
71
|
+
export const useHttpAuthentication = (injector, overrides) => {
|
|
72
|
+
const mergedSettings = {
|
|
73
|
+
...defaultHttpAuthenticationSettings(),
|
|
74
|
+
...overrides,
|
|
75
|
+
};
|
|
27
76
|
const systemInjector = useSystemIdentityContext({ injector, username: 'useHttpAuthentication' });
|
|
28
|
-
const passwordAuthenticator = injector.
|
|
29
|
-
const userDataSet = mergedSettings.
|
|
30
|
-
const sessionDataSet = mergedSettings.
|
|
77
|
+
const passwordAuthenticator = injector.get(PasswordAuthenticator);
|
|
78
|
+
const userDataSet = systemInjector.get(mergedSettings.userDataSet);
|
|
79
|
+
const sessionDataSet = systemInjector.get(mergedSettings.sessionDataSet);
|
|
31
80
|
const providers = [];
|
|
32
81
|
if (mergedSettings.enableBasicAuth) {
|
|
33
82
|
providers.push(createBasicAuthProvider((username, password) => authenticateUserWithDataSet(passwordAuthenticator, userDataSet, systemInjector, username, password)));
|
|
34
83
|
}
|
|
35
84
|
providers.push(createCookieAuthProvider(mergedSettings.cookieName, (sessionId) => findSessionById(sessionDataSet, systemInjector, sessionId), (username) => findUserByName(userDataSet, systemInjector, username)));
|
|
36
|
-
providers.push(...(
|
|
85
|
+
providers.push(...(overrides?.authenticationProviders ?? []));
|
|
37
86
|
mergedSettings.authenticationProviders = providers;
|
|
38
|
-
injector.
|
|
87
|
+
injector.bind(HttpAuthenticationSettings, () => mergedSettings);
|
|
88
|
+
injector.invalidate(HttpAuthenticationSettings);
|
|
89
|
+
injector.invalidate(HttpUserContext);
|
|
39
90
|
};
|
|
40
91
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @param options.injector The Injector instance
|
|
44
|
-
* @param options.settings Settings for the static file server
|
|
45
|
-
* @returns a promise that resolves when the server is ready
|
|
92
|
+
* Attaches a static-file {@link ServerApi} to the pooled HTTP server
|
|
93
|
+
* identified by `options.port`/`options.hostName`.
|
|
46
94
|
*/
|
|
47
|
-
export const useStaticFiles = (options) => {
|
|
95
|
+
export const useStaticFiles = async (options) => {
|
|
48
96
|
const { injector, ...settings } = options;
|
|
49
|
-
|
|
97
|
+
const pool = injector.get(HttpServerPoolToken);
|
|
98
|
+
const record = await pool.acquire({ port: settings.port, hostName: settings.hostName });
|
|
99
|
+
const serverApi = buildStaticSiteServerApi(settings);
|
|
100
|
+
record.apis.push(serverApi);
|
|
101
|
+
return serverApi;
|
|
50
102
|
};
|
|
51
103
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* and emits 'onProxyFailed' events for monitoring.
|
|
57
|
-
*
|
|
58
|
-
* WebSocket connections can also be proxied by setting `enableWebsockets: true`, allowing
|
|
59
|
-
* bidirectional real-time communication through the proxy.
|
|
60
|
-
*
|
|
61
|
-
* @param options The settings for the proxy server
|
|
62
|
-
* @param options.injector The Injector instance
|
|
63
|
-
* @param options.sourceBaseUrl The base URL path to match for proxying (e.g., '/api', '/old').
|
|
64
|
-
* Can be specified with or without a trailing slash.
|
|
65
|
-
* @param options.targetBaseUrl The target server URL (must be a valid HTTP/HTTPS URL)
|
|
66
|
-
* @param options.pathRewrite Optional function to rewrite the path before forwarding.
|
|
67
|
-
* Receives the path after sourceBaseUrl, including leading slash and query string.
|
|
68
|
-
* Example: for 'GET /api/users?active=true' with sourceBaseUrl='/api',
|
|
69
|
-
* pathRewrite receives '/users?active=true'
|
|
70
|
-
* @param options.sourceHostName The hostname for the source server (optional, defaults to all interfaces)
|
|
71
|
-
* @param options.sourcePort The port for the source server
|
|
72
|
-
* @param options.headers Optional function to transform request headers.
|
|
73
|
-
* **Note**: Receives headers AFTER filtering hop-by-hop headers
|
|
74
|
-
* (Connection, Keep-Alive, Transfer-Encoding, Upgrade, etc.) for security
|
|
75
|
-
* and protocol compliance. The proxy automatically adds X-Forwarded-* headers.
|
|
76
|
-
* This transformation applies to both HTTP and WebSocket requests.
|
|
77
|
-
* @param options.cookies Optional function to transform request cookies (array of cookie strings)
|
|
78
|
-
* @param options.responseCookies Optional function to transform response Set-Cookie headers
|
|
79
|
-
* @param options.timeout Optional timeout in milliseconds for proxy requests (default: 30000).
|
|
80
|
-
* If exceeded, the request is aborted and 502 is returned.
|
|
81
|
-
* Applies to both HTTP and WebSocket upgrade requests.
|
|
82
|
-
* @param options.enableWebsockets Optional flag to enable WebSocket proxying (default: false).
|
|
83
|
-
* When enabled, WebSocket upgrade requests will be forwarded to the target.
|
|
84
|
-
* @returns a promise that resolves when the proxy is set up
|
|
85
|
-
* @example
|
|
86
|
-
* ```ts
|
|
87
|
-
* // Basic HTTP proxy with timeout
|
|
88
|
-
* await useProxy({
|
|
89
|
-
* injector,
|
|
90
|
-
* sourceBaseUrl: '/api',
|
|
91
|
-
* targetBaseUrl: 'https://api.example.com',
|
|
92
|
-
* sourcePort: 3000,
|
|
93
|
-
* timeout: 5000,
|
|
94
|
-
* })
|
|
95
|
-
*
|
|
96
|
-
* // Proxy with WebSocket support
|
|
97
|
-
* await useProxy({
|
|
98
|
-
* injector,
|
|
99
|
-
* sourceBaseUrl: '/ws',
|
|
100
|
-
* targetBaseUrl: 'https://ws.example.com',
|
|
101
|
-
* sourcePort: 3000,
|
|
102
|
-
* enableWebsockets: true,
|
|
103
|
-
* })
|
|
104
|
-
*
|
|
105
|
-
* // Proxy with error monitoring (HTTP and WebSocket)
|
|
106
|
-
* const proxyManager = injector.getInstance(ProxyManager)
|
|
107
|
-
* proxyManager.subscribe('onProxyFailed', ({ from, to, error }) => {
|
|
108
|
-
* console.error(`HTTP Proxy failed: ${from} -> ${to}`, error)
|
|
109
|
-
* })
|
|
110
|
-
* proxyManager.subscribe('onWebSocketProxyFailed', ({ from, to, error }) => {
|
|
111
|
-
* console.error(`WebSocket Proxy failed: ${from} -> ${to}`, error)
|
|
112
|
-
* })
|
|
113
|
-
* ```
|
|
104
|
+
* Attaches a proxy {@link ServerApi} that forwards HTTP (and optionally
|
|
105
|
+
* WebSocket) traffic from `options.sourceBaseUrl` to `options.targetBaseUrl`.
|
|
106
|
+
* Emits `onProxyFailed` and `onWebSocketProxyFailed` events into the shared
|
|
107
|
+
* {@link ServerTelemetryToken} — subscribe there for observability.
|
|
114
108
|
*/
|
|
115
|
-
export const useProxy = (options) => {
|
|
109
|
+
export const useProxy = async (options) => {
|
|
116
110
|
const { injector, ...settings } = options;
|
|
117
|
-
|
|
111
|
+
const telemetry = injector.get(ServerTelemetryToken);
|
|
112
|
+
const pool = injector.get(HttpServerPoolToken);
|
|
113
|
+
const record = await pool.acquire({ port: settings.sourcePort, hostName: settings.sourceHostName });
|
|
114
|
+
const serverApi = buildProxyServerApi(settings, telemetry);
|
|
115
|
+
record.apis.push(serverApi);
|
|
116
|
+
return serverApi;
|
|
118
117
|
};
|
|
119
118
|
//# sourceMappingURL=helpers.js.map
|
package/esm/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.spec.d.ts","sourceRoot":"","sources":["../src/helpers.spec.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"helpers.spec.d.ts","sourceRoot":"","sources":["../src/helpers.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AA4G3C,YAAY,EAAE,IAAI,EAAE,CAAA"}
|
package/esm/helpers.spec.js
CHANGED
|
@@ -1,52 +1,46 @@
|
|
|
1
|
-
import { InMemoryStore, User
|
|
1
|
+
import { InMemoryStore, User as UserModel } from '@furystack/core';
|
|
2
2
|
import { getPort } from '@furystack/core/port-generator';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { PasswordCredential, PasswordResetToken, usePasswordPolicy } from '@furystack/security';
|
|
3
|
+
import { createInjector } from '@furystack/inject';
|
|
4
|
+
import { PasswordCredential, PasswordCredentialStore, PasswordResetToken, PasswordResetTokenStore, usePasswordPolicy, } from '@furystack/security';
|
|
6
5
|
import { usingAsync } from '@furystack/utils';
|
|
7
6
|
import { describe, expect, it } from 'vitest';
|
|
8
|
-
import { ApiManager } from './api-manager.js';
|
|
9
7
|
import { useHttpAuthentication, useProxy, useRestService, useStaticFiles } from './helpers.js';
|
|
10
8
|
import { HttpAuthenticationSettings } from './http-authentication-settings.js';
|
|
9
|
+
import { HttpServerPoolToken } from './http-server-pool.js';
|
|
11
10
|
import { DefaultSession } from './models/default-session.js';
|
|
12
|
-
import {
|
|
13
|
-
import { StaticServerManager } from './static-server-manager.js';
|
|
11
|
+
import { SessionStore, UserStore } from './user-store.js';
|
|
14
12
|
const setupAuthStores = (i) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const repo = getRepository(i);
|
|
20
|
-
repo.createDataSet(User, 'username');
|
|
21
|
-
repo.createDataSet(DefaultSession, 'sessionId');
|
|
22
|
-
repo.createDataSet(PasswordCredential, 'userName');
|
|
23
|
-
repo.createDataSet(PasswordResetToken, 'token');
|
|
13
|
+
i.bind(UserStore, () => new InMemoryStore({ model: UserModel, primaryKey: 'username' }));
|
|
14
|
+
i.bind(SessionStore, () => new InMemoryStore({ model: DefaultSession, primaryKey: 'sessionId' }));
|
|
15
|
+
i.bind(PasswordCredentialStore, () => new InMemoryStore({ model: PasswordCredential, primaryKey: 'userName' }));
|
|
16
|
+
i.bind(PasswordResetTokenStore, () => new InMemoryStore({ model: PasswordResetToken, primaryKey: 'token' }));
|
|
24
17
|
usePasswordPolicy(i);
|
|
25
18
|
};
|
|
26
|
-
describe('
|
|
19
|
+
describe('rest-service setup helpers', () => {
|
|
27
20
|
describe('useHttpAuthentication', () => {
|
|
28
|
-
it('
|
|
29
|
-
await usingAsync(
|
|
21
|
+
it('binds HttpAuthenticationSettings on the injector', async () => {
|
|
22
|
+
await usingAsync(createInjector(), async (i) => {
|
|
30
23
|
setupAuthStores(i);
|
|
31
24
|
useHttpAuthentication(i);
|
|
32
|
-
|
|
25
|
+
const settings = i.get(HttpAuthenticationSettings);
|
|
26
|
+
expect(settings).toBeDefined();
|
|
33
27
|
});
|
|
34
28
|
});
|
|
35
|
-
it('
|
|
36
|
-
await usingAsync(
|
|
29
|
+
it('registers basic-auth and cookie-auth providers by default', async () => {
|
|
30
|
+
await usingAsync(createInjector(), async (i) => {
|
|
37
31
|
setupAuthStores(i);
|
|
38
32
|
useHttpAuthentication(i);
|
|
39
|
-
const settings = i.
|
|
33
|
+
const settings = i.get(HttpAuthenticationSettings);
|
|
40
34
|
const providerNames = settings.authenticationProviders.map((p) => p.name);
|
|
41
35
|
expect(providerNames).toContain('basic-auth');
|
|
42
36
|
expect(providerNames).toContain('cookie-auth');
|
|
43
37
|
});
|
|
44
38
|
});
|
|
45
|
-
it('
|
|
46
|
-
await usingAsync(
|
|
39
|
+
it('omits the basic-auth provider when enableBasicAuth is false', async () => {
|
|
40
|
+
await usingAsync(createInjector(), async (i) => {
|
|
47
41
|
setupAuthStores(i);
|
|
48
42
|
useHttpAuthentication(i, { enableBasicAuth: false });
|
|
49
|
-
const settings = i.
|
|
43
|
+
const settings = i.get(HttpAuthenticationSettings);
|
|
50
44
|
const providerNames = settings.authenticationProviders.map((p) => p.name);
|
|
51
45
|
expect(providerNames).not.toContain('basic-auth');
|
|
52
46
|
expect(providerNames).toContain('cookie-auth');
|
|
@@ -54,35 +48,44 @@ describe('Injector extensions', () => {
|
|
|
54
48
|
});
|
|
55
49
|
});
|
|
56
50
|
describe('useRestService()', () => {
|
|
57
|
-
it('
|
|
58
|
-
await usingAsync(
|
|
51
|
+
it('acquires a pooled HTTP server and attaches a serverApi', async () => {
|
|
52
|
+
await usingAsync(createInjector(), async (i) => {
|
|
59
53
|
const port = getPort();
|
|
60
|
-
await useRestService({ injector: i, api: {}, root: '/', port });
|
|
61
|
-
expect(
|
|
54
|
+
const serverApi = await useRestService({ injector: i, api: {}, root: '/', port });
|
|
55
|
+
expect(serverApi).toBeDefined();
|
|
56
|
+
const pool = i.get(HttpServerPoolToken);
|
|
57
|
+
const record = await pool.acquire({ port });
|
|
58
|
+
expect(record.apis).toContain(serverApi);
|
|
62
59
|
});
|
|
63
60
|
});
|
|
64
61
|
});
|
|
65
62
|
describe('useStaticFiles()', () => {
|
|
66
|
-
it('
|
|
67
|
-
await usingAsync(
|
|
63
|
+
it('attaches a static-file serverApi to the pooled HTTP server', async () => {
|
|
64
|
+
await usingAsync(createInjector(), async (i) => {
|
|
68
65
|
const port = getPort();
|
|
69
|
-
await useStaticFiles({ injector: i, baseUrl: '/', path: '.', port });
|
|
70
|
-
expect(
|
|
66
|
+
const serverApi = await useStaticFiles({ injector: i, baseUrl: '/', path: '.', port });
|
|
67
|
+
expect(serverApi).toBeDefined();
|
|
68
|
+
const pool = i.get(HttpServerPoolToken);
|
|
69
|
+
const record = await pool.acquire({ port });
|
|
70
|
+
expect(record.apis).toContain(serverApi);
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
74
|
describe('useProxy()', () => {
|
|
75
|
-
it('
|
|
76
|
-
await usingAsync(
|
|
75
|
+
it('attaches a proxy serverApi to the pooled HTTP server', async () => {
|
|
76
|
+
await usingAsync(createInjector(), async (i) => {
|
|
77
77
|
const sourcePort = getPort();
|
|
78
78
|
const targetPort = getPort();
|
|
79
|
-
await useProxy({
|
|
79
|
+
const serverApi = await useProxy({
|
|
80
80
|
injector: i,
|
|
81
81
|
sourceBaseUrl: '/api',
|
|
82
82
|
targetBaseUrl: `http://localhost:${targetPort}`,
|
|
83
83
|
sourcePort,
|
|
84
84
|
});
|
|
85
|
-
expect(
|
|
85
|
+
expect(serverApi).toBeDefined();
|
|
86
|
+
const pool = i.get(HttpServerPoolToken);
|
|
87
|
+
const record = await pool.acquire({ port: sourcePort });
|
|
88
|
+
expect(record.apis).toContain(serverApi);
|
|
86
89
|
});
|
|
87
90
|
});
|
|
88
91
|
});
|
package/esm/helpers.spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.spec.js","sourceRoot":"","sources":["../src/helpers.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.spec.js","sourceRoot":"","sources":["../src/helpers.spec.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,cAAc,EAAiB,MAAM,mBAAmB,CAAA;AACjE,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,qBAAqB,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C,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,22 +1,45 @@
|
|
|
1
|
-
import { User } from '@furystack/core';
|
|
2
|
-
import
|
|
1
|
+
import type { User } from '@furystack/core';
|
|
2
|
+
import { type Token } from '@furystack/inject';
|
|
3
|
+
import type { DataSetToken } from '@furystack/repository';
|
|
3
4
|
import type { AuthenticationProvider } from './authentication-providers/authentication-provider.js';
|
|
4
|
-
import { DefaultSession } from './models/default-session.js';
|
|
5
|
+
import type { DefaultSession } from './models/default-session.js';
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* HTTP-authentication settings — rebound by {@link useHttpAuthentication}
|
|
8
|
+
* during application setup and consumed by {@link HttpUserContext},
|
|
9
|
+
* cookie-login strategies and OpenAPI generators.
|
|
10
|
+
*
|
|
11
|
+
* The field shape reflects the functional-DI redesign:
|
|
12
|
+
*
|
|
13
|
+
* - `userDataSet` / `sessionDataSet` are token references (not accessors).
|
|
14
|
+
* Consumers resolve them through the injector at the appropriate scope.
|
|
15
|
+
* - `authenticationProviders` is a simple ordered list; `HttpUserContext`
|
|
16
|
+
* walks it on every unauthenticated request.
|
|
7
17
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
export interface HttpAuthenticationSettings {
|
|
19
|
+
/** Data set token for user lookups. */
|
|
20
|
+
userDataSet: DataSetToken<User, 'username'>;
|
|
21
|
+
/** Data set token for session lookups. */
|
|
22
|
+
sessionDataSet: DataSetToken<DefaultSession, 'sessionId'>;
|
|
23
|
+
/** Cookie name used by the built-in cookie-auth provider. */
|
|
13
24
|
cookieName: string;
|
|
25
|
+
/** Whether the built-in Basic Auth provider is installed by {@link useHttpAuthentication}. */
|
|
14
26
|
enableBasicAuth: boolean;
|
|
15
27
|
/**
|
|
16
|
-
* Ordered list of authentication providers. Populated
|
|
17
|
-
* and extended by
|
|
18
|
-
*
|
|
28
|
+
* Ordered list of authentication providers. Populated during
|
|
29
|
+
* {@link useHttpAuthentication} and extended by plugins such as
|
|
30
|
+
* `useJwtAuthentication`.
|
|
19
31
|
*/
|
|
20
32
|
authenticationProviders: AuthenticationProvider[];
|
|
21
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns a fresh copy of the default {@link HttpAuthenticationSettings}.
|
|
36
|
+
* Used as the starting point inside {@link useHttpAuthentication}.
|
|
37
|
+
*/
|
|
38
|
+
export declare const defaultHttpAuthenticationSettings: () => HttpAuthenticationSettings;
|
|
39
|
+
/**
|
|
40
|
+
* DI token carrying the current {@link HttpAuthenticationSettings}. Rebind
|
|
41
|
+
* via {@link useHttpAuthentication} (preferred) or directly through
|
|
42
|
+
* {@link Injector.bind} for advanced scenarios.
|
|
43
|
+
*/
|
|
44
|
+
export declare const HttpAuthenticationSettings: Token<HttpAuthenticationSettings, 'singleton'>;
|
|
22
45
|
//# sourceMappingURL=http-authentication-settings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-authentication-settings.d.ts","sourceRoot":"","sources":["../src/http-authentication-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"http-authentication-settings.d.ts","sourceRoot":"","sources":["../src/http-authentication-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAiB,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAA;AACnG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAGjE;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,0BAA0B;IACzC,uCAAuC;IACvC,WAAW,EAAE,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IAC3C,0CAA0C;IAC1C,cAAc,EAAE,YAAY,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;IACzD,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAA;IAClB,8FAA8F;IAC9F,eAAe,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,uBAAuB,EAAE,sBAAsB,EAAE,CAAA;CAClD;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,QAAO,0BAMnD,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,0BAA0B,EAAE,WAAW,CAIpF,CAAA"}
|
|
@@ -1,32 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { User } from '@furystack/core';
|
|
8
|
-
import { Injectable } from '@furystack/inject';
|
|
9
|
-
import { getDataSetFor } from '@furystack/repository';
|
|
10
|
-
import { DefaultSession } from './models/default-session.js';
|
|
1
|
+
import { defineService } from '@furystack/inject';
|
|
2
|
+
import { SessionDataSet, UserDataSet } from './user-store.js';
|
|
11
3
|
/**
|
|
12
|
-
*
|
|
4
|
+
* Returns a fresh copy of the default {@link HttpAuthenticationSettings}.
|
|
5
|
+
* Used as the starting point inside {@link useHttpAuthentication}.
|
|
13
6
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export { HttpAuthenticationSettings };
|
|
7
|
+
export const defaultHttpAuthenticationSettings = () => ({
|
|
8
|
+
userDataSet: UserDataSet,
|
|
9
|
+
sessionDataSet: SessionDataSet,
|
|
10
|
+
cookieName: 'fss',
|
|
11
|
+
enableBasicAuth: true,
|
|
12
|
+
authenticationProviders: [],
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* DI token carrying the current {@link HttpAuthenticationSettings}. Rebind
|
|
16
|
+
* via {@link useHttpAuthentication} (preferred) or directly through
|
|
17
|
+
* {@link Injector.bind} for advanced scenarios.
|
|
18
|
+
*/
|
|
19
|
+
export const HttpAuthenticationSettings = defineService({
|
|
20
|
+
name: 'furystack/rest-service/HttpAuthenticationSettings',
|
|
21
|
+
lifetime: 'singleton',
|
|
22
|
+
factory: () => defaultHttpAuthenticationSettings(),
|
|
23
|
+
});
|
|
32
24
|
//# sourceMappingURL=http-authentication-settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-authentication-settings.js","sourceRoot":"","sources":["../src/http-authentication-settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-authentication-settings.js","sourceRoot":"","sources":["../src/http-authentication-settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAc,MAAM,mBAAmB,CAAA;AAI7D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AA+B7D;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAA+B,EAAE,CAAC,CAAC;IAClF,WAAW,EAAE,WAAW;IACxB,cAAc,EAAE,cAAc;IAC9B,UAAU,EAAE,KAAK;IACjB,eAAe,EAAE,IAAI;IACrB,uBAAuB,EAAE,EAAE;CAC5B,CAAC,CAAA;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAmD,aAAa,CAAC;IACtG,IAAI,EAAE,mDAAmD;IACzD,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,GAAG,EAAE,CAAC,iCAAiC,EAAE;CACnD,CAAC,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type Token } from '@furystack/inject';
|
|
2
|
+
import type { IncomingMessage, Server, ServerResponse } from 'http';
|
|
3
|
+
import type { Duplex } from 'stream';
|
|
4
|
+
/**
|
|
5
|
+
* Options accepted by {@link HttpServerPool.acquire}.
|
|
6
|
+
*/
|
|
7
|
+
export interface ServerOptions {
|
|
8
|
+
hostName?: string;
|
|
9
|
+
port: number;
|
|
10
|
+
}
|
|
11
|
+
/** Payload passed to every {@link ServerApi.onRequest} invocation. */
|
|
12
|
+
export interface OnRequest {
|
|
13
|
+
req: IncomingMessage;
|
|
14
|
+
res: ServerResponse;
|
|
15
|
+
}
|
|
16
|
+
/** Payload passed to every {@link ServerApi.onUpgrade} invocation. */
|
|
17
|
+
export interface OnUpgrade {
|
|
18
|
+
req: IncomingMessage;
|
|
19
|
+
socket: Duplex;
|
|
20
|
+
head: Buffer;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Contract every server-side consumer (REST, static sites, proxies,
|
|
24
|
+
* websockets) implements. Pushed into {@link ServerRecord.apis} by
|
|
25
|
+
* `useRestService` / `useStaticFiles` / `useProxy` / websocket wiring.
|
|
26
|
+
*/
|
|
27
|
+
export interface ServerApi {
|
|
28
|
+
shouldExec: (options: OnRequest) => boolean;
|
|
29
|
+
onRequest: (options: OnRequest) => Promise<void>;
|
|
30
|
+
onUpgrade?: (options: OnUpgrade) => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Shared-port registry entry. Multiple {@link ServerApi}s attached to the
|
|
34
|
+
* same `port`/`hostName` share a single `http.Server` via the pool and
|
|
35
|
+
* dispatch to the first matching `shouldExec`.
|
|
36
|
+
*/
|
|
37
|
+
export interface ServerRecord {
|
|
38
|
+
server: Server;
|
|
39
|
+
apis: ServerApi[];
|
|
40
|
+
}
|
|
41
|
+
export declare const DEFAULT_HOST = "localhost";
|
|
42
|
+
/**
|
|
43
|
+
* Public surface of the {@link HttpServerPoolToken}. Acquires shared
|
|
44
|
+
* `http.Server` instances keyed by url. Consumers push their
|
|
45
|
+
* {@link ServerApi}s onto the returned record's `apis` array.
|
|
46
|
+
*
|
|
47
|
+
* Internal to the rest-service package — application code interacts with
|
|
48
|
+
* the pool indirectly through `useRestService` / `useStaticFiles` /
|
|
49
|
+
* `useProxy`.
|
|
50
|
+
*/
|
|
51
|
+
export interface HttpServerPool {
|
|
52
|
+
/**
|
|
53
|
+
* Returns the {@link ServerRecord} for the given options, opening a new
|
|
54
|
+
* `http.Server` on first request and returning the cached instance on
|
|
55
|
+
* subsequent requests to the same url.
|
|
56
|
+
*/
|
|
57
|
+
acquire(options: ServerOptions): Promise<ServerRecord>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* DI token for the {@link HttpServerPool}. Scoped so each test / application
|
|
61
|
+
* scope has its own set of HTTP servers and sockets.
|
|
62
|
+
*/
|
|
63
|
+
export declare const HttpServerPoolToken: Token<HttpServerPool, 'scoped'>;
|
|
64
|
+
//# sourceMappingURL=http-server-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-server-pool.d.ts","sourceRoot":"","sources":["../src/http-server-pool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AAGnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAGpC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACxB,GAAG,EA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