@webpieces/http-routing 0.4.863 → 0.4.865
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/README.md +3 -1
- package/package.json +4 -4
- package/src/ApiClientFactory.js +1 -1
- package/src/ApiClientFactory.js.map +1 -1
- package/src/ApiFactory.d.ts +3 -0
- package/src/ApiFactory.js.map +1 -1
- package/src/ApiRoutingFactory.js +3 -3
- package/src/ApiRoutingFactory.js.map +1 -1
- package/src/AuthConfig.d.ts +15 -8
- package/src/AuthConfig.js +20 -8
- package/src/AuthConfig.js.map +1 -1
- package/src/AuthHooks.d.ts +13 -61
- package/src/AuthHooks.js +7 -44
- package/src/AuthHooks.js.map +1 -1
- package/src/AuthenticatedCallerContext.d.ts +6 -0
- package/src/AuthenticatedCallerContext.js +44 -0
- package/src/AuthenticatedCallerContext.js.map +1 -1
- package/src/AuthorizationHook.d.ts +34 -0
- package/src/AuthorizationHook.js +121 -0
- package/src/AuthorizationHook.js.map +1 -0
- package/src/AuthorizedApiDocument.d.ts +18 -0
- package/src/AuthorizedApiDocument.js +137 -0
- package/src/AuthorizedApiDocument.js.map +1 -0
- package/src/DefaultJwtHook.d.ts +4 -4
- package/src/DefaultJwtHook.js +10 -7
- package/src/DefaultJwtHook.js.map +1 -1
- package/src/DefaultOidcVerifier.d.ts +4 -3
- package/src/DefaultOidcVerifier.js +6 -4
- package/src/DefaultOidcVerifier.js.map +1 -1
- package/src/InvocationAuthentication.d.ts +7 -7
- package/src/InvocationAuthentication.js +18 -17
- package/src/InvocationAuthentication.js.map +1 -1
- package/src/JwtHookCompileAssertions.d.ts +1 -1
- package/src/JwtHookCompileAssertions.js +2 -5
- package/src/JwtHookCompileAssertions.js.map +1 -1
- package/src/RouteBuilderImpl.js +7 -0
- package/src/RouteBuilderImpl.js.map +1 -1
- package/src/WebpiecesRouter.d.ts +2 -0
- package/src/WebpiecesRouter.js +6 -0
- package/src/WebpiecesRouter.js.map +1 -1
- package/src/filters/AuthFilter.d.ts +11 -22
- package/src/filters/AuthFilter.js +75 -80
- package/src/filters/AuthFilter.js.map +1 -1
- package/src/filters/AuthorizationFilter.d.ts +10 -0
- package/src/filters/AuthorizationFilter.js +34 -0
- package/src/filters/AuthorizationFilter.js.map +1 -0
- package/src/index.d.ts +5 -2
- package/src/index.js +25 -10
- package/src/index.js.map +1 -1
- package/src/setupRuntime.d.ts +2 -2
- package/src/setupRuntime.js +2 -2
- package/src/setupRuntime.js.map +1 -1
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ApiPath, Endpoint, PathParam, QueryParam, WpAuthPublic,
|
|
1
|
+
export { ApiPath, Endpoint, PathParam, QueryParam, WpAuthPublic, WpAuth, WpLocalOnly, isLocalOnly, jwt, oidc, sharedSecret, webhook, apiKey, WpAuthorization, AuthorizationType, getAuthorization, Rpc, PubSub, Queue, getApiPath, getEndpoints, getEndpointOptions, getEndpointHttpMethod, getEndpointOperation, getHttpParameterDeclarations, isFormPost, isRawBody, isApiPath, getAuthMeta, assertEveryEndpointHasAuthMode, getApiKind, assertApiKind, assertPubSubConventions, getQueueName, AuthMeta, RouteMetadata, RouteMetadataFactory, HttpContractMapper, METADATA_KEYS, ValidateImplementation, GET, POST, READ, WRITE_IDEMPOTENT, WRITE, RPC, CLOUDTASKS, CRON, EXTERNAL, DocumentDesign, isDocumentDesign, } from '@webpieces/core-util';
|
|
2
2
|
export type { AuthMode, ApiKind, HttpMethod, EndpointOperation, EndpointKind, EndpointOptions, EndpointResponseType, } from '@webpieces/core-util';
|
|
3
3
|
export { SourceFile, ROUTING_METADATA_KEYS } from './decorators';
|
|
4
4
|
export { provideSingletonDefaultForApi } from '@webpieces/core-context';
|
|
@@ -16,7 +16,7 @@ export { FilterMatcher, HttpFilter } from './FilterMatcher';
|
|
|
16
16
|
export { AppModules, RouteModule } from './AppModules';
|
|
17
17
|
export { ApiFactory } from './ApiFactory';
|
|
18
18
|
export { ApiClient, ApiClientProxy } from './ApiClient';
|
|
19
|
-
export { AuthConfig, AUTH_CONFIG, AuthenticatedCaller, AUTHENTICATED_CALLER_KEY, SharedSecrets, } from './AuthConfig';
|
|
19
|
+
export { AuthConfig, AUTH_CONFIG, AuthenticatedCaller, AuthenticatedMachineIdentity, AUTHENTICATED_CALLER_KEY, SharedSecrets, } from './AuthConfig';
|
|
20
20
|
export { JwtHook, MintedJwt, JWT_HOOK, OidcHook, OIDC_HOOK, WebhookAuthCallback, WEBHOOK_AUTH_CALLBACK, ApiKeyHook, API_KEY_HOOK, } from './AuthHooks';
|
|
21
21
|
export { DefaultOidcVerifier } from './DefaultOidcVerifier';
|
|
22
22
|
export { DefaultJwtHook, DefaultJwtMintRequest } from './DefaultJwtHook';
|
|
@@ -24,3 +24,6 @@ export { WebpiecesRouter, WebpiecesRouterFactory, WebpiecesRouterOptions } from
|
|
|
24
24
|
export { setupRuntime, RuntimeSetupOptions } from './setupRuntime';
|
|
25
25
|
export { WebpiecesConfig, WEBPIECES_CONFIG_TOKEN } from './WebpiecesConfig';
|
|
26
26
|
export { ServerWiring, ServerWiringOptions } from './ServerWiring';
|
|
27
|
+
export { AuthorizationHook, AuthorizationService, CanonicalUserRoles, AUTHORIZATION_HOOK, VERIFIED_MACHINE_CALLER, VerifiedMachineCaller } from './AuthorizationHook';
|
|
28
|
+
export { AuthorizedApiDocument } from './AuthorizedApiDocument';
|
|
29
|
+
export type { ApiDocumentObject, ApiDocumentValue } from './AuthorizedApiDocument';
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.ServerWiringOptions = exports.ServerWiring = exports.WEBPIECES_CONFIG_TOKEN = exports.WebpiecesConfig = exports.RuntimeSetupOptions = exports.setupRuntime = exports.WebpiecesRouterFactory = exports.WebpiecesRouter = exports.DefaultJwtMintRequest = exports.DefaultJwtHook = exports.DefaultOidcVerifier = exports.API_KEY_HOOK = exports.ApiKeyHook = exports.WEBHOOK_AUTH_CALLBACK = exports.WebhookAuthCallback = exports.OIDC_HOOK = exports.OidcHook = exports.JWT_HOOK = exports.MintedJwt = exports.JwtHook = exports.SharedSecrets = exports.AUTHENTICATED_CALLER_KEY = exports.AuthenticatedCaller = exports.AUTH_CONFIG = exports.AuthConfig = exports.ApiClient = exports.FilterMatcher = exports.LogApiFilter = exports.RouteHandler = exports.MethodMeta = exports.InvocationAuthentication = exports.AuthenticatedCallerContext = exports.WpResponse = exports.RawRequest = exports.HttpRequest = exports.FilterDefinition = exports.RouteDefinition = exports.ApiRoutingFactory = exports.buildFrameworkModule = exports.provideFrameworkSingletonDefaultForApi = void 0;
|
|
3
|
+
exports.isDocumentDesign = exports.DocumentDesign = exports.EXTERNAL = exports.CRON = exports.CLOUDTASKS = exports.RPC = exports.WRITE = exports.WRITE_IDEMPOTENT = exports.READ = exports.POST = exports.GET = exports.METADATA_KEYS = exports.HttpContractMapper = exports.RouteMetadataFactory = exports.RouteMetadata = exports.AuthMeta = exports.getQueueName = exports.assertPubSubConventions = exports.assertApiKind = exports.getApiKind = exports.assertEveryEndpointHasAuthMode = exports.getAuthMeta = exports.isApiPath = exports.isRawBody = exports.isFormPost = exports.getHttpParameterDeclarations = exports.getEndpointOperation = exports.getEndpointHttpMethod = exports.getEndpointOptions = exports.getEndpoints = exports.getApiPath = exports.Queue = exports.PubSub = exports.Rpc = exports.getAuthorization = exports.AuthorizationType = exports.WpAuthorization = exports.apiKey = exports.webhook = exports.sharedSecret = exports.oidc = exports.jwt = exports.isLocalOnly = exports.WpLocalOnly = exports.WpAuth = exports.WpAuthPublic = exports.QueryParam = exports.PathParam = exports.Endpoint = exports.ApiPath = void 0;
|
|
4
|
+
exports.VERIFIED_MACHINE_CALLER = exports.AUTHORIZATION_HOOK = exports.CanonicalUserRoles = exports.AuthorizationService = exports.AuthorizationHook = exports.ServerWiringOptions = exports.ServerWiring = exports.WEBPIECES_CONFIG_TOKEN = exports.WebpiecesConfig = exports.RuntimeSetupOptions = exports.setupRuntime = exports.WebpiecesRouterFactory = exports.WebpiecesRouter = exports.DefaultJwtMintRequest = exports.DefaultJwtHook = exports.DefaultOidcVerifier = exports.API_KEY_HOOK = exports.ApiKeyHook = exports.WEBHOOK_AUTH_CALLBACK = exports.WebhookAuthCallback = exports.OIDC_HOOK = exports.OidcHook = exports.JWT_HOOK = exports.MintedJwt = exports.JwtHook = exports.SharedSecrets = exports.AUTHENTICATED_CALLER_KEY = exports.AuthenticatedMachineIdentity = exports.AuthenticatedCaller = exports.AUTH_CONFIG = exports.AuthConfig = exports.ApiClient = exports.FilterMatcher = exports.LogApiFilter = exports.RouteHandler = exports.MethodMeta = exports.InvocationAuthentication = exports.AuthenticatedCallerContext = exports.WpResponse = exports.RawRequest = exports.HttpRequest = exports.FilterDefinition = exports.RouteDefinition = exports.ApiRoutingFactory = exports.buildFrameworkModule = exports.provideFrameworkSingletonDefaultForApi = exports.provideFrameworkSingleton = exports.provideSingletonDefaultForApi = exports.ROUTING_METADATA_KEYS = exports.SourceFile = void 0;
|
|
5
|
+
exports.AuthorizedApiDocument = exports.VerifiedMachineCaller = void 0;
|
|
5
6
|
// Re-export API decorators from core-util for convenience
|
|
6
7
|
var core_util_1 = require("@webpieces/core-util");
|
|
7
8
|
Object.defineProperty(exports, "ApiPath", { enumerable: true, get: function () { return core_util_1.ApiPath; } });
|
|
@@ -9,12 +10,17 @@ Object.defineProperty(exports, "Endpoint", { enumerable: true, get: function ()
|
|
|
9
10
|
Object.defineProperty(exports, "PathParam", { enumerable: true, get: function () { return core_util_1.PathParam; } });
|
|
10
11
|
Object.defineProperty(exports, "QueryParam", { enumerable: true, get: function () { return core_util_1.QueryParam; } });
|
|
11
12
|
Object.defineProperty(exports, "WpAuthPublic", { enumerable: true, get: function () { return core_util_1.WpAuthPublic; } });
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
Object.defineProperty(exports, "
|
|
14
|
-
Object.defineProperty(exports, "
|
|
15
|
-
Object.defineProperty(exports, "
|
|
16
|
-
Object.defineProperty(exports, "
|
|
17
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "WpAuth", { enumerable: true, get: function () { return core_util_1.WpAuth; } });
|
|
14
|
+
Object.defineProperty(exports, "WpLocalOnly", { enumerable: true, get: function () { return core_util_1.WpLocalOnly; } });
|
|
15
|
+
Object.defineProperty(exports, "isLocalOnly", { enumerable: true, get: function () { return core_util_1.isLocalOnly; } });
|
|
16
|
+
Object.defineProperty(exports, "jwt", { enumerable: true, get: function () { return core_util_1.jwt; } });
|
|
17
|
+
Object.defineProperty(exports, "oidc", { enumerable: true, get: function () { return core_util_1.oidc; } });
|
|
18
|
+
Object.defineProperty(exports, "sharedSecret", { enumerable: true, get: function () { return core_util_1.sharedSecret; } });
|
|
19
|
+
Object.defineProperty(exports, "webhook", { enumerable: true, get: function () { return core_util_1.webhook; } });
|
|
20
|
+
Object.defineProperty(exports, "apiKey", { enumerable: true, get: function () { return core_util_1.apiKey; } });
|
|
21
|
+
Object.defineProperty(exports, "WpAuthorization", { enumerable: true, get: function () { return core_util_1.WpAuthorization; } });
|
|
22
|
+
Object.defineProperty(exports, "AuthorizationType", { enumerable: true, get: function () { return core_util_1.AuthorizationType; } });
|
|
23
|
+
Object.defineProperty(exports, "getAuthorization", { enumerable: true, get: function () { return core_util_1.getAuthorization; } });
|
|
18
24
|
Object.defineProperty(exports, "Rpc", { enumerable: true, get: function () { return core_util_1.Rpc; } });
|
|
19
25
|
Object.defineProperty(exports, "PubSub", { enumerable: true, get: function () { return core_util_1.PubSub; } });
|
|
20
26
|
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return core_util_1.Queue; } });
|
|
@@ -28,7 +34,6 @@ Object.defineProperty(exports, "isFormPost", { enumerable: true, get: function (
|
|
|
28
34
|
Object.defineProperty(exports, "isRawBody", { enumerable: true, get: function () { return core_util_1.isRawBody; } });
|
|
29
35
|
Object.defineProperty(exports, "isApiPath", { enumerable: true, get: function () { return core_util_1.isApiPath; } });
|
|
30
36
|
Object.defineProperty(exports, "getAuthMeta", { enumerable: true, get: function () { return core_util_1.getAuthMeta; } });
|
|
31
|
-
Object.defineProperty(exports, "getAuthMode", { enumerable: true, get: function () { return core_util_1.getAuthMode; } });
|
|
32
37
|
Object.defineProperty(exports, "assertEveryEndpointHasAuthMode", { enumerable: true, get: function () { return core_util_1.assertEveryEndpointHasAuthMode; } });
|
|
33
38
|
Object.defineProperty(exports, "getApiKind", { enumerable: true, get: function () { return core_util_1.getApiKind; } });
|
|
34
39
|
Object.defineProperty(exports, "assertApiKind", { enumerable: true, get: function () { return core_util_1.assertApiKind; } });
|
|
@@ -100,7 +105,7 @@ Object.defineProperty(exports, "FilterMatcher", { enumerable: true, get: functio
|
|
|
100
105
|
var ApiClient_1 = require("./ApiClient");
|
|
101
106
|
Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return ApiClient_1.ApiClient; } });
|
|
102
107
|
// Auth: the app-provided, container-bound pieces the framework AuthFilter injects.
|
|
103
|
-
// - AuthConfig: shared-secret STATE (
|
|
108
|
+
// - AuthConfig: shared-secret STATE (sharedSecret(...) values).
|
|
104
109
|
// - JwtHook / OidcHook / WebhookAuthCallback / ApiKeyHook: OPTIONAL verification mechanisms
|
|
105
110
|
// (bind only what you use; unbound means the matching endpoints 401, never open).
|
|
106
111
|
// - DefaultOidcVerifier: the built-in Google OIDC verifier used when no OidcHook is bound.
|
|
@@ -108,6 +113,7 @@ var AuthConfig_1 = require("./AuthConfig");
|
|
|
108
113
|
Object.defineProperty(exports, "AuthConfig", { enumerable: true, get: function () { return AuthConfig_1.AuthConfig; } });
|
|
109
114
|
Object.defineProperty(exports, "AUTH_CONFIG", { enumerable: true, get: function () { return AuthConfig_1.AUTH_CONFIG; } });
|
|
110
115
|
Object.defineProperty(exports, "AuthenticatedCaller", { enumerable: true, get: function () { return AuthConfig_1.AuthenticatedCaller; } });
|
|
116
|
+
Object.defineProperty(exports, "AuthenticatedMachineIdentity", { enumerable: true, get: function () { return AuthConfig_1.AuthenticatedMachineIdentity; } });
|
|
111
117
|
Object.defineProperty(exports, "AUTHENTICATED_CALLER_KEY", { enumerable: true, get: function () { return AuthConfig_1.AUTHENTICATED_CALLER_KEY; } });
|
|
112
118
|
Object.defineProperty(exports, "SharedSecrets", { enumerable: true, get: function () { return AuthConfig_1.SharedSecrets; } });
|
|
113
119
|
var AuthHooks_1 = require("./AuthHooks");
|
|
@@ -143,4 +149,13 @@ Object.defineProperty(exports, "WEBPIECES_CONFIG_TOKEN", { enumerable: true, get
|
|
|
143
149
|
var ServerWiring_1 = require("./ServerWiring");
|
|
144
150
|
Object.defineProperty(exports, "ServerWiring", { enumerable: true, get: function () { return ServerWiring_1.ServerWiring; } });
|
|
145
151
|
Object.defineProperty(exports, "ServerWiringOptions", { enumerable: true, get: function () { return ServerWiring_1.ServerWiringOptions; } });
|
|
152
|
+
var AuthorizationHook_1 = require("./AuthorizationHook");
|
|
153
|
+
Object.defineProperty(exports, "AuthorizationHook", { enumerable: true, get: function () { return AuthorizationHook_1.AuthorizationHook; } });
|
|
154
|
+
Object.defineProperty(exports, "AuthorizationService", { enumerable: true, get: function () { return AuthorizationHook_1.AuthorizationService; } });
|
|
155
|
+
Object.defineProperty(exports, "CanonicalUserRoles", { enumerable: true, get: function () { return AuthorizationHook_1.CanonicalUserRoles; } });
|
|
156
|
+
Object.defineProperty(exports, "AUTHORIZATION_HOOK", { enumerable: true, get: function () { return AuthorizationHook_1.AUTHORIZATION_HOOK; } });
|
|
157
|
+
Object.defineProperty(exports, "VERIFIED_MACHINE_CALLER", { enumerable: true, get: function () { return AuthorizationHook_1.VERIFIED_MACHINE_CALLER; } });
|
|
158
|
+
Object.defineProperty(exports, "VerifiedMachineCaller", { enumerable: true, get: function () { return AuthorizationHook_1.VerifiedMachineCaller; } });
|
|
159
|
+
var AuthorizedApiDocument_1 = require("./AuthorizedApiDocument");
|
|
160
|
+
Object.defineProperty(exports, "AuthorizedApiDocument", { enumerable: true, get: function () { return AuthorizedApiDocument_1.AuthorizedApiDocument; } });
|
|
146
161
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/index.ts"],"names":[],"mappings":";;;;;AAAA,0DAA0D;AAC1D,kDA6C8B;AA5C1B,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,sGAAA,SAAS,OAAA;AACT,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,mGAAA,MAAM,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,gGAAA,GAAG,OAAA;AAAE,iGAAA,IAAI,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,oGAAA,OAAO,OAAA;AAAE,mGAAA,MAAM,OAAA;AAC1E,4GAAA,eAAe,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AACpD,gGAAA,GAAG,OAAA;AACH,mGAAA,MAAM,OAAA;AACN,kGAAA,KAAK,OAAA;AACL,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,+GAAA,kBAAkB,OAAA;AAClB,kHAAA,qBAAqB,OAAA;AACrB,iHAAA,oBAAoB,OAAA;AACpB,yHAAA,4BAA4B,OAAA;AAC5B,uGAAA,UAAU,OAAA;AACV,sGAAA,SAAS,OAAA;AACT,sGAAA,SAAS,OAAA;AACT,wGAAA,WAAW,OAAA;AACX,2HAAA,8BAA8B,OAAA;AAC9B,uGAAA,UAAU,OAAA;AACV,0GAAA,aAAa,OAAA;AACb,oHAAA,uBAAuB,OAAA;AACvB,yGAAA,YAAY,OA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kBAAkB,OAAA;AAAE,4HAAA,uBAAuB,OAAA;AAAE,0HAAA,qBAAqB,OAAA;AACxI,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA","sourcesContent":["// Re-export API decorators from core-util for convenience\nexport {\n ApiPath,\n Endpoint,\n PathParam,\n QueryParam,\n WpAuthPublic,\n WpAuth, WpLocalOnly, isLocalOnly, jwt, oidc, sharedSecret, webhook, apiKey,\n WpAuthorization, AuthorizationType, getAuthorization,\n Rpc,\n PubSub,\n Queue,\n getApiPath,\n getEndpoints,\n getEndpointOptions,\n getEndpointHttpMethod,\n getEndpointOperation,\n getHttpParameterDeclarations,\n isFormPost,\n isRawBody,\n isApiPath,\n getAuthMeta,\n assertEveryEndpointHasAuthMode,\n getApiKind,\n assertApiKind,\n assertPubSubConventions,\n getQueueName,\n AuthMeta,\n RouteMetadata,\n RouteMetadataFactory,\n HttpContractMapper,\n METADATA_KEYS,\n ValidateImplementation,\n GET,\n POST,\n READ,\n WRITE_IDEMPOTENT,\n WRITE,\n RPC,\n CLOUDTASKS,\n CRON,\n EXTERNAL,\n // @DocumentDesign moved to core-util (design-root marker, browser + Node);\n // re-exported here for back-compat.\n DocumentDesign,\n isDocumentDesign,\n} from '@webpieces/core-util';\nexport type {\n AuthMode,\n ApiKind,\n HttpMethod,\n EndpointOperation,\n EndpointKind,\n EndpointOptions,\n EndpointResponseType,\n} from '@webpieces/core-util';\n\n// Server-side routing decorators and utilities\nexport { SourceFile, ROUTING_METADATA_KEYS } from './decorators';\n\n// DI provider decorators moved to core-context; re-exported here for back-compat\nexport { provideSingletonDefaultForApi } from '@webpieces/core-context';\n// Framework-only DI registry (packages/** framework classes use these; see frameworkProvide.ts)\nexport {\n provideFrameworkSingleton,\n provideFrameworkSingletonDefaultForApi,\n buildFrameworkModule,\n} from '@webpieces/core-context';\n\nexport { ApiRoutingFactory, ClassType } from './ApiRoutingFactory';\n\n// Core routing types\nexport { Routes, RouteBuilder, RouteDefinition, FilterDefinition } from './WebAppMeta';\n\n// The transport-neutral request type (defined in core-context; this is http-routing's\n// public request — a transport adapter builds one and the chain reads it from RequestContext).\nexport { HttpRequest, RawHttpRequest, RawRequest } from '@webpieces/core-context';\n\n// The INBOUND chain's response type. `Filter`, `Service` and `FilterChain` are NOT re-exported\n// here: they moved to @webpieces/core-util so the outbound client chain is the SAME abstraction\n// rather than a second spelling of it. Import them from '@webpieces/core-util'.\nexport { WpResponse } from './WpResponse';\nexport { AuthenticatedCallerContext } from './AuthenticatedCallerContext';\nexport { InvocationAuthentication } from './InvocationAuthentication';\nexport { MethodMeta } from './MethodMeta';\nexport { RouteHandler } from './RouteHandler';\n\n// LogApiFilter: the fixed OUTERMOST framework filter (auto-installed at 1,000,000 above\n// AuthFilter). Exported for reference/testing only — apps must NOT install it themselves.\nexport { LogApiFilter } from './filters/LogApiFilter';\n\n// RouteBuilderImpl (the route table + chain composer) is now INTERNAL — it is never\n// handed to upper layers. The express layer consumes ApiFactory.apiClients() instead.\n\n// Filter matching\nexport { FilterMatcher, HttpFilter } from './FilterMatcher';\n\n// The app's server-surface declaration: DI binding modules + route groups + headers.\nexport { AppModules, RouteModule } from './AppModules';\n\n// The public API-surface abstraction: declare routes/filters, get them back as ApiClient[].\nexport { ApiFactory } from './ApiFactory';\nexport { ApiClient, ApiClientProxy } from './ApiClient';\n\n// Auth: the app-provided, container-bound pieces the framework AuthFilter injects.\n// - AuthConfig: shared-secret STATE (sharedSecret(...) values).\n// - JwtHook / OidcHook / WebhookAuthCallback / ApiKeyHook: OPTIONAL verification mechanisms\n// (bind only what you use; unbound means the matching endpoints 401, never open).\n// - DefaultOidcVerifier: the built-in Google OIDC verifier used when no OidcHook is bound.\nexport {\n AuthConfig,\n AUTH_CONFIG,\n AuthenticatedCaller,\n AuthenticatedMachineIdentity,\n AUTHENTICATED_CALLER_KEY,\n SharedSecrets,\n} from './AuthConfig';\nexport {\n JwtHook,\n MintedJwt,\n JWT_HOOK,\n OidcHook,\n OIDC_HOOK,\n WebhookAuthCallback,\n WEBHOOK_AUTH_CALLBACK,\n ApiKeyHook,\n API_KEY_HOOK,\n} from './AuthHooks';\nexport { DefaultOidcVerifier } from './DefaultOidcVerifier';\n// DefaultJwtHook: batteries-included HS256 JwtHook — `new DefaultJwtHook(secret)` and go.\nexport { DefaultJwtHook, DefaultJwtMintRequest } from './DefaultJwtHook';\n\n// Above-boundary context setup shared by every transport adapter.\n\n// Node-only router (the express-free heart: container + filter chain + in-process client)\nexport { WebpiecesRouter, WebpiecesRouterFactory, WebpiecesRouterOptions } from './WebpiecesRouter';\n\n// The ONE transport-free startup sequence (headers → logging → router → routes) → ApiFactory.\n// Reusable by any company/app and any framework adapter; a company wraps it with its own headers.\nexport { setupRuntime, RuntimeSetupOptions } from './setupRuntime';\n\n// Server configuration\nexport { WebpiecesConfig, WEBPIECES_CONFIG_TOKEN } from './WebpiecesConfig';\n\nexport { ServerWiring, ServerWiringOptions } from './ServerWiring';\n\nexport { AuthorizationHook, AuthorizationService, CanonicalUserRoles, AUTHORIZATION_HOOK, VERIFIED_MACHINE_CALLER, VerifiedMachineCaller } from './AuthorizationHook';\nexport { AuthorizedApiDocument } from './AuthorizedApiDocument';\nexport type { ApiDocumentObject, ApiDocumentValue } from './AuthorizedApiDocument';\n"]}
|
package/src/setupRuntime.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare class RuntimeSetupOptions {
|
|
|
23
23
|
readonly svcVersion: string;
|
|
24
24
|
/**
|
|
25
25
|
* WHERE this process runs — `'local'` (a developer's machine) or `'deployed'` (everything
|
|
26
|
-
* else). Published to {@link RuntimeLocality}; the ONE input to `@
|
|
26
|
+
* else). Published to {@link RuntimeLocality}; the ONE input to `@WpLocalOnly` enforcement.
|
|
27
27
|
*
|
|
28
28
|
* REQUIRED and POSITIONAL on purpose, exactly like `@Endpoint(path, kind)`: only the app
|
|
29
29
|
* knows how its platform is detected (Cloud Run's `K_SERVICE`, an ECS metadata URL, the
|
|
@@ -48,7 +48,7 @@ export declare class RuntimeSetupOptions {
|
|
|
48
48
|
svcVersion: string,
|
|
49
49
|
/**
|
|
50
50
|
* WHERE this process runs — `'local'` (a developer's machine) or `'deployed'` (everything
|
|
51
|
-
* else). Published to {@link RuntimeLocality}; the ONE input to `@
|
|
51
|
+
* else). Published to {@link RuntimeLocality}; the ONE input to `@WpLocalOnly` enforcement.
|
|
52
52
|
*
|
|
53
53
|
* REQUIRED and POSITIONAL on purpose, exactly like `@Endpoint(path, kind)`: only the app
|
|
54
54
|
* knows how its platform is detected (Cloud Run's `K_SERVICE`, an ECS metadata URL, the
|
package/src/setupRuntime.js
CHANGED
|
@@ -32,7 +32,7 @@ class RuntimeSetupOptions {
|
|
|
32
32
|
svcVersion,
|
|
33
33
|
/**
|
|
34
34
|
* WHERE this process runs — `'local'` (a developer's machine) or `'deployed'` (everything
|
|
35
|
-
* else). Published to {@link RuntimeLocality}; the ONE input to `@
|
|
35
|
+
* else). Published to {@link RuntimeLocality}; the ONE input to `@WpLocalOnly` enforcement.
|
|
36
36
|
*
|
|
37
37
|
* REQUIRED and POSITIONAL on purpose, exactly like `@Endpoint(path, kind)`: only the app
|
|
38
38
|
* knows how its platform is detected (Cloud Run's `K_SERVICE`, an ECS metadata URL, the
|
|
@@ -82,7 +82,7 @@ appOverrides) {
|
|
|
82
82
|
// one startup every server runs.
|
|
83
83
|
core_util_1.ServiceInfo.setInfo(options.svcName, options.svcVersion);
|
|
84
84
|
// 0b. Declare WHERE we run, before any route is built: ApiRoutingFactory reads it in step 4 to
|
|
85
|
-
// decide whether @
|
|
85
|
+
// decide whether @WpLocalOnly routes are registered at all. Undeclared reads as DEPLOYED, so
|
|
86
86
|
// this call is what lets a local-only endpoint exist — never what hides one.
|
|
87
87
|
core_util_1.RuntimeLocality.declare(options.locality);
|
|
88
88
|
// 1. Register the global HeaderRegistry FIRST (this service's own keys come from AppModules).
|
package/src/setupRuntime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupRuntime.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/setupRuntime.ts"],"names":[],"mappings":";;;AAmEA,oCAsCC;AAxGD,oDAO8B;AAC9B,uDAAoD;AACpD,uDAA2D;AAI3D;;;;;;;;;GASG;AACH,MAAa,mBAAmB;IAIR;IAIA;IAWA;IAEA;IAEA;IAEA;IAxBpB;IACI;iFAC6E;IAC7D,OAAe;IAC/B;;+DAE2D;IAC3C,UAAkB;IAClC;;;;;;;;;OASG;IACa,QAAkB;IAClC,0DAA0D;IAC1C,aAA4B;IAC5C,sDAAsD;IACtC,kBAA2B,IAAI;IAC/C,gFAAgF;IAChE,MAAwB;QArBxB,YAAO,GAAP,OAAO,CAAQ;QAIf,eAAU,GAAV,UAAU,CAAQ;QAWlB,aAAQ,GAAR,QAAQ,CAAU;QAElB,kBAAa,GAAb,aAAa,CAAe;QAE5B,oBAAe,GAAf,eAAe,CAAgB;QAE/B,WAAM,GAAN,MAAM,CAAkB;IACzC,CAAC;CACP;AA3BD,kDA2BC;AAED;;;;;;;;;;;;;GAaG;AACI,KAAK,UAAU,YAAY,CAC9B,OAA4B,EAC5B,UAAsB;AACtB;mEACmE;AACnE,YAA8B;IAE9B,gGAAgG;IAChG,6FAA6F;IAC7F,kGAAkG;IAClG,kGAAkG;IAClG,kGAAkG;IAClG,iCAAiC;IACjC,uBAAW,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzD,+FAA+F;IAC/F,
|
|
1
|
+
{"version":3,"file":"setupRuntime.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/setupRuntime.ts"],"names":[],"mappings":";;;AAmEA,oCAsCC;AAxGD,oDAO8B;AAC9B,uDAAoD;AACpD,uDAA2D;AAI3D;;;;;;;;;GASG;AACH,MAAa,mBAAmB;IAIR;IAIA;IAWA;IAEA;IAEA;IAEA;IAxBpB;IACI;iFAC6E;IAC7D,OAAe;IAC/B;;+DAE2D;IAC3C,UAAkB;IAClC;;;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EAAE,CAAC;QACvD,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { ContainerModule } from 'inversify';\nimport {\n HeaderRegistry,\n Locality,\n LoggerFactory,\n LogManager,\n RuntimeLocality,\n ServiceInfo,\n} from '@webpieces/core-util';\nimport { WebpiecesConfig } from './WebpiecesConfig';\nimport { WebpiecesRouterFactory } from './WebpiecesRouter';\nimport { AppModules } from './AppModules';\nimport { ApiFactory } from './ApiFactory';\n\n/**\n * RuntimeSetupOptions - the environment/wiring inputs to {@link setupRuntime} (everything NOT\n * declared by the app's {@link AppModules}): the logging backend, whether to include the platform\n * default headers, and config. Data-only structure (a class, per the webpieces guidelines). The\n * app's own binding modules + route groups + headers come from the AppModules passed alongside;\n * the test-override module is the separate `appOverrides` param of {@link setupRuntime}.\n *\n * Headers: {@link HeaderRegistry.configure} registers the platform defaults (when\n * `platformHeaders` is true) plus AppModules.getHeaders() (by convention the company-wide set).\n */\nexport class RuntimeSetupOptions {\n constructor(\n /** This service's name — published to ServiceInfo. Names every log line and stamps\n * `requestIdSource` on request-ids this service mints. Must be non-blank. */\n public readonly svcName: string,\n /** This build's version — published to ServiceInfo alongside svcName. Opaque to webpieces\n * (a git SHA, a semver tag, a CI build number); it just has to identify THIS build so a log\n * line can say which one emitted it. Must be non-blank. */\n public readonly svcVersion: string,\n /**\n * WHERE this process runs — `'local'` (a developer's machine) or `'deployed'` (everything\n * else). Published to {@link RuntimeLocality}; the ONE input to `@WpLocalOnly` enforcement.\n *\n * REQUIRED and POSITIONAL on purpose, exactly like `@Endpoint(path, kind)`: only the app\n * knows how its platform is detected (Cloud Run's `K_SERVICE`, an ECS metadata URL, the\n * absence of both), the framework must not guess, and a defaulted field would mean \"forgot\n * to say\" and \"said deployed\" are the same line of code. Derive it at your startup, e.g.\n * `getServiceName() === 'local' ? 'local' : 'deployed'`.\n */\n public readonly locality: Locality,\n /** Logging backend to install (LogManager.setFactory). */\n public readonly loggerFactory: LoggerFactory,\n /** Include the webpieces platform default headers. */\n public readonly platformHeaders: boolean = true,\n /** Optional WebpiecesConfig (e.g. recording flags); defaults to a fresh one. */\n public readonly config?: WebpiecesConfig,\n ) {}\n}\n\n/**\n * setupRuntime - the ONE canonical, TRANSPORT-FREE startup sequence, reusable by any company/app\n * AND any framework adapter (express, fastify, a serverless handler, ...). It runs, in the correct\n * fail-fast order:\n *\n * 1. HeaderRegistry.configure (filters read it at construction; logging masks off it)\n * 2. LogManager.setFactory (fails fast unless the registry is configured first)\n * 3. build the router + DI container (from appModules.getBindingModules())\n * 4. configure each appModules.getRoutingModules() onto the router (addRoutes/addFilter)\n *\n * and returns the built {@link ApiFactory} — `apiClients()` for a transport to bind, or\n * `createApiClient()` for in-process tests. There is NO express (or any transport) here; a\n * transport adapter (e.g. WebpiecesExpressRouter in @webpieces/http-server) serves the result.\n */\nexport async function setupRuntime(\n options: RuntimeSetupOptions,\n appModules: AppModules,\n /** A single DI module loaded LAST so tests can rebind bindings to mocks.\n * Or special case servers that want to override specific things */\n appOverrides?: ContainerModule,\n): Promise<ApiFactory> {\n // 0. IDENTIFY this service (name + build version) FIRST, before anything logs. Name and version\n // are REQUIRED inputs to this call, so a build cannot boot anonymously — setInfo throws on a\n // blank value, which kills the deploy (the revision never goes healthy) rather than shipping logs\n // that cannot say which build emitted them. Reads of ServiceInfo elsewhere never throw (a missing\n // log field must never 500 live traffic); the \"say which build you are\" guarantee lives HERE, the\n // one startup every server runs.\n ServiceInfo.setInfo(options.svcName, options.svcVersion);\n\n // 0b. Declare WHERE we run, before any route is built: ApiRoutingFactory reads it in step 4 to\n // decide whether @WpLocalOnly routes are registered at all. Undeclared reads as DEPLOYED, so\n // this call is what lets a local-only endpoint exist — never what hides one.\n RuntimeLocality.declare(options.locality);\n\n // 1. Register the global HeaderRegistry FIRST (this service's own keys come from AppModules).\n HeaderRegistry.configure(appModules.getHeaders(), options.platformHeaders);\n\n // 2. Install the logging backend ONCE, before anything else logs.\n LogManager.setFactory(options.loggerFactory);\n\n // 3. Build the node-only router + DI container.\n const router = await WebpiecesRouterFactory.create({\n appBindings: [...appModules.getBindingModules()],\n appOverrides: appOverrides,\n config: options.config ?? new WebpiecesConfig(),\n });\n\n // 4. Let each route group declare its routes + filters, then hand back the consumer surface.\n for (const routeModule of appModules.getRoutingModules()) {\n routeModule.configure(router);\n }\n return router;\n}\n"]}
|