@daloyjs/core 1.0.0-beta.4 → 1.0.0-beta.6
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 +50 -46
- package/dist/app.d.ts +42 -21
- package/dist/app.js +100 -116
- package/dist/docs.d.ts +44 -0
- package/dist/docs.js +47 -8
- package/dist/index.d.ts +19 -17
- package/dist/index.js +6 -5
- package/dist/mcp.d.ts +432 -0
- package/dist/mcp.js +419 -0
- package/dist/sbom.cdx.json +9 -9
- package/dist/sbom.spdx.json +5 -5
- package/dist/tenancy.d.ts +16 -7
- package/dist/tenancy.js +16 -7
- package/package.json +11 -5
package/dist/docs.js
CHANGED
|
@@ -49,8 +49,7 @@ function integrityAttr(integrity, crossOrigin) {
|
|
|
49
49
|
export function scalarHtml(opts) {
|
|
50
50
|
const title = escapeHtml(opts.title ?? "API Reference");
|
|
51
51
|
const url = escapeHtml(opts.specUrl);
|
|
52
|
-
const scriptUrl = escapeHtml(opts.assets?.scalarScriptUrl ??
|
|
53
|
-
`${JSDELIVR_ORIGIN}/npm/@scalar/api-reference`);
|
|
52
|
+
const scriptUrl = escapeHtml(opts.assets?.scalarScriptUrl ?? `${JSDELIVR_ORIGIN}/npm/@scalar/api-reference`);
|
|
54
53
|
const scriptSri = integrityAttr(opts.assets?.scalarScriptIntegrity, opts.assets?.crossOrigin);
|
|
55
54
|
const nonce = nonceAttr(opts.scriptNonce);
|
|
56
55
|
const configuration = scalarConfigurationAttr(opts.specUrl, opts.configuration);
|
|
@@ -62,6 +61,7 @@ export function scalarHtml(opts) {
|
|
|
62
61
|
</head><body>
|
|
63
62
|
<script id="api-reference" data-url="${url}"${configuration}${nonce}></script>
|
|
64
63
|
<script src="${scriptUrl}"${scriptSri}${nonce}></script>
|
|
64
|
+
${docsAuthLauncherHtml(opts.auth, opts.scriptNonce)}
|
|
65
65
|
</body></html>`;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
@@ -74,10 +74,8 @@ export function scalarHtml(opts) {
|
|
|
74
74
|
*/
|
|
75
75
|
export function swaggerUiHtml(opts) {
|
|
76
76
|
const title = escapeHtml(opts.title ?? "API Docs");
|
|
77
|
-
const cssUrl = escapeHtml(opts.assets?.swaggerUiCssUrl ??
|
|
78
|
-
|
|
79
|
-
const bundleUrl = escapeHtml(opts.assets?.swaggerUiBundleUrl ??
|
|
80
|
-
`${JSDELIVR_ORIGIN}/npm/swagger-ui-dist/swagger-ui-bundle.js`);
|
|
77
|
+
const cssUrl = escapeHtml(opts.assets?.swaggerUiCssUrl ?? `${JSDELIVR_ORIGIN}/npm/swagger-ui-dist/swagger-ui.css`);
|
|
78
|
+
const bundleUrl = escapeHtml(opts.assets?.swaggerUiBundleUrl ?? `${JSDELIVR_ORIGIN}/npm/swagger-ui-dist/swagger-ui-bundle.js`);
|
|
81
79
|
const cssSri = integrityAttr(opts.assets?.swaggerUiCssIntegrity, opts.assets?.crossOrigin);
|
|
82
80
|
const bundleSri = integrityAttr(opts.assets?.swaggerUiBundleIntegrity, opts.assets?.crossOrigin);
|
|
83
81
|
const nonce = nonceAttr(opts.scriptNonce);
|
|
@@ -97,6 +95,7 @@ export function swaggerUiHtml(opts) {
|
|
|
97
95
|
<div id="swagger"></div>
|
|
98
96
|
<script src="${bundleUrl}"${bundleSri}${nonce}></script>
|
|
99
97
|
<script${nonce}>window.onload=()=>SwaggerUIBundle(${configuration});</script>
|
|
98
|
+
${docsAuthLauncherHtml(opts.auth, opts.scriptNonce)}
|
|
100
99
|
</body></html>`;
|
|
101
100
|
}
|
|
102
101
|
/**
|
|
@@ -115,8 +114,7 @@ export function swaggerUiHtml(opts) {
|
|
|
115
114
|
*/
|
|
116
115
|
export function redocHtml(opts) {
|
|
117
116
|
const title = escapeHtml(opts.title ?? "API Docs");
|
|
118
|
-
const scriptUrl = escapeHtml(opts.assets?.redocScriptUrl ??
|
|
119
|
-
`${JSDELIVR_ORIGIN}/npm/redoc/bundles/redoc.standalone.js`);
|
|
117
|
+
const scriptUrl = escapeHtml(opts.assets?.redocScriptUrl ?? `${JSDELIVR_ORIGIN}/npm/redoc/bundles/redoc.standalone.js`);
|
|
120
118
|
const scriptSri = integrityAttr(opts.assets?.redocScriptIntegrity, opts.assets?.crossOrigin);
|
|
121
119
|
const nonce = nonceAttr(opts.scriptNonce);
|
|
122
120
|
const specArg = jsonForScript(opts.specUrl);
|
|
@@ -130,6 +128,7 @@ export function redocHtml(opts) {
|
|
|
130
128
|
<div id="redoc"></div>
|
|
131
129
|
<script src="${scriptUrl}"${scriptSri}${nonce}></script>
|
|
132
130
|
<script${nonce}>Redoc.init(${specArg},${optionsArg},document.getElementById("redoc"));</script>
|
|
131
|
+
${docsAuthLauncherHtml(opts.auth, opts.scriptNonce)}
|
|
133
132
|
</body></html>`;
|
|
134
133
|
}
|
|
135
134
|
/**
|
|
@@ -238,6 +237,46 @@ function escapeHtml(s) {
|
|
|
238
237
|
function jsonForScript(value) {
|
|
239
238
|
return JSON.stringify(value).replace(/[<\u2028\u2029]/g, (c) => ({ "<": "\\u003c", "\u2028": "\\u2028", "\u2029": "\\u2029" })[c]);
|
|
240
239
|
}
|
|
240
|
+
function docsAuthLauncherHtml(auth, scriptNonce) {
|
|
241
|
+
if (!auth)
|
|
242
|
+
return "";
|
|
243
|
+
const loginUrl = normalizeDocsAuthLoginUrl(auth.loginUrl);
|
|
244
|
+
const label = auth.label ?? "Authorize";
|
|
245
|
+
const description = auth.description ?? "Open login or identity provider";
|
|
246
|
+
const target = auth.target ?? "popup";
|
|
247
|
+
const popupWidth = positiveIntegerOrDefault(auth.popupWidth, 520);
|
|
248
|
+
const popupHeight = positiveIntegerOrDefault(auth.popupHeight, 720);
|
|
249
|
+
const payload = jsonForScript({
|
|
250
|
+
loginUrl,
|
|
251
|
+
target,
|
|
252
|
+
popupWidth,
|
|
253
|
+
popupHeight,
|
|
254
|
+
});
|
|
255
|
+
const nonce = nonceAttr(scriptNonce);
|
|
256
|
+
return `<style>
|
|
257
|
+
.daloy-docs-auth{position:fixed;right:16px;top:16px;z-index:2147483647;display:inline-flex;align-items:center;gap:8px;border:1px solid #1d4ed8;border-radius:6px;background:#2563eb;color:#fff;font:600 14px/1.2 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;padding:10px 14px;box-shadow:0 8px 24px rgba(15,23,42,.18);cursor:pointer}
|
|
258
|
+
.daloy-docs-auth:focus{outline:3px solid rgba(37,99,235,.35);outline-offset:2px}
|
|
259
|
+
</style>
|
|
260
|
+
<button type="button" class="daloy-docs-auth" data-daloy-docs-auth title="${escapeHtml(description)}" aria-label="${escapeHtml(description)}">${escapeHtml(label)}</button>
|
|
261
|
+
<script${nonce}>(()=>{const o=${payload};const b=document.querySelector("[data-daloy-docs-auth]");if(!b)return;b.addEventListener("click",()=>{if(o.target==="_self"){window.location.assign(o.loginUrl);return;}if(o.target==="_blank"){window.open(o.loginUrl,"_blank","noopener,noreferrer");return;}const left=Math.max(0,Math.round((window.screenX||0)+((window.outerWidth||o.popupWidth)-o.popupWidth)/2));const top=Math.max(0,Math.round((window.screenY||0)+((window.outerHeight||o.popupHeight)-o.popupHeight)/2));const features="popup=yes,width="+o.popupWidth+",height="+o.popupHeight+",left="+left+",top="+top+",noopener,noreferrer";window.open(o.loginUrl,"daloy_docs_auth",features);});})();</script>`;
|
|
262
|
+
}
|
|
263
|
+
function normalizeDocsAuthLoginUrl(loginUrl) {
|
|
264
|
+
if (typeof loginUrl !== "string" || loginUrl.trim() === "") {
|
|
265
|
+
throw new TypeError("docs auth loginUrl must be a non-empty string");
|
|
266
|
+
}
|
|
267
|
+
const trimmed = loginUrl.trim();
|
|
268
|
+
const parsed = new URL(trimmed, "https://daloyjs.local");
|
|
269
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
270
|
+
throw new TypeError(`docs auth loginUrl must be an http(s) or relative URL; got ${JSON.stringify(loginUrl)}`);
|
|
271
|
+
}
|
|
272
|
+
return trimmed;
|
|
273
|
+
}
|
|
274
|
+
function positiveIntegerOrDefault(value, fallback) {
|
|
275
|
+
if (typeof value === "number" && Number.isInteger(value) && value > 0) {
|
|
276
|
+
return value;
|
|
277
|
+
}
|
|
278
|
+
return fallback;
|
|
279
|
+
}
|
|
241
280
|
function scalarConfigurationAttr(specUrl, configuration) {
|
|
242
281
|
if (!configuration)
|
|
243
282
|
return "";
|
package/dist/index.d.ts
CHANGED
|
@@ -11,28 +11,30 @@ export type { BehindProxyConfig, ConnInfo } from "./conn-info.js";
|
|
|
11
11
|
export { subdomains, PSL_SNAPSHOT_DATE, PSL_PUBLIC_SUFFIXES, MAX_SNAPSHOT_AGE_DAYS, } from "./subdomains.js";
|
|
12
12
|
export type { SubdomainsOptions, SubdomainsResult } from "./subdomains.js";
|
|
13
13
|
export { defineDependency, DEPENDENCY_MARKER } from "./dependency.js";
|
|
14
|
-
export type { DependencyHooks, DependencyOptions
|
|
14
|
+
export type { DependencyHooks, DependencyOptions } from "./dependency.js";
|
|
15
15
|
export type { RouteDefinition, HttpMethod, PathString, RequestSchemas, ResponsesMap, ResponseSpec, AuthSpec, Hooks, BaseContext, AppState, AuthScheme, AuthContext, HandlerReturn, InferRequest, ParamsOf, PathParams, CallbackDefinition, CallbackMap, CallbackOperation, RouteExample, RouteMeta, } from "./types.js";
|
|
16
16
|
export { HttpError, BadRequestError, ValidationError, NotFoundError, ConflictError, UnauthorizedError, ForbiddenError, MethodNotAllowedError, PayloadTooLargeError, RequestHeaderFieldsTooLargeError, UnsupportedMediaTypeError, TooManyRequestsError, RequestTimeoutError, InternalError, MessageLeakError, httpError, SAFE_CUSTOM_ERROR_RESPONSE_HEADERS, checkCustomErrorResponseHeaders, } from "./errors.js";
|
|
17
17
|
export type { ProblemDetails, ProblemRenderOptions, HttpErrorOptions } from "./errors.js";
|
|
18
18
|
export type { StandardSchemaV1 } from "./schema.js";
|
|
19
19
|
export { validate, isStandardSchema } from "./schema.js";
|
|
20
20
|
export { diffOpenAPI, hasBreakingChanges } from "./openapi-diff.js";
|
|
21
|
-
export type { ChangeSeverity, OpenAPIChange, OpenAPIDiffResult
|
|
21
|
+
export type { ChangeSeverity, OpenAPIChange, OpenAPIDiffResult } from "./openapi-diff.js";
|
|
22
|
+
export { MCP_DEFAULT_MAX_BODY_BYTES, MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSIONS, McpToolError, createMcpHandler, mcpRoutes, } from "./mcp.js";
|
|
23
|
+
export type { McpContent, McpEmbeddedResourceContent, McpHandler, McpHandlerOptions, McpImageContent, McpJsonObject, McpJsonRpcId, McpJsonSchema, McpJsonValue, McpPrompt, McpPromptArgument, McpPromptDefinition, McpPromptMessage, McpPromptResult, McpRequestContext, McpResource, McpResourceContents, McpResourceDefinition, McpServerInfo, McpTextContent, McpTool, McpToolHandler, McpToolResult, } from "./mcp.js";
|
|
22
24
|
export { readBodyLimited, safeJsonParse, isForbiddenObjectKey, sanitizeHeaderName, sanitizeHeaderValue, timingSafeEqual, randomId, assertNoDuplicateSingletonHeaders, assertNoReservedInternalHeaders, assertHeaderCountWithinLimit, DEFAULT_MAX_HEADER_COUNT, RESERVED_INBOUND_HEADER_PREFIXES, SMUGGLING_SINGLETON_HEADERS, verifyWebhookSignature, signWebhookPayload, WEBHOOK_DEFAULT_TOLERANCE_SECONDS, assertStrongSecret, MIN_PROD_SECRET_BYTES, WEAK_SECRET_STRINGS, sanitizeFilename, assertSafeRelativePath, hasMongoOperatorKeys, assertNoMongoOperators, } from "./security.js";
|
|
23
25
|
export type { WebhookHmacAlgorithm } from "./security.js";
|
|
24
26
|
export { requestId, secureHeaders, SECURE_HEADERS_MARKER, cors, CORS_HOOK_MARKER, CORS_ORIGIN_ALLOW_MARKER, CORS_WILDCARD_ORIGIN_MARKER, rateLimit, loginThrottle, timing, bearerAuth, basicAuth, csrf, CSRF_HOOK_MARKER, fetchMetadata, requireScopes, REQUIRE_SCOPES_AGGREGATE_KEY, REQUIRE_SCOPES_HOOK_MARKER, _resetSharedRateLimitStoresForTests, } from "./middleware.js";
|
|
25
27
|
export { etag } from "./etag.js";
|
|
26
28
|
export type { ETagOptions } from "./etag.js";
|
|
27
29
|
export { compression, COMPRESSION_HOOK_MARKER, _resetCompressionRuntimeProbeForTests, } from "./compression.js";
|
|
28
|
-
export type { CompressionEncoding, CompressionOptions
|
|
30
|
+
export type { CompressionEncoding, CompressionOptions } from "./compression.js";
|
|
29
31
|
export { createJwtSigner, createJwtVerifier, JwtError, DEFAULT_JWT_MAX_LIFETIME_SECONDS, } from "./jwt.js";
|
|
30
32
|
export type { JwtAlgorithm, JwtKeyMaterial, JwtSignerOptions, JwtVerifierOptions, JwtVerified, } from "./jwt.js";
|
|
31
33
|
export { jwk } from "./jwk.js";
|
|
32
|
-
export type { JwkAlgorithm, JwkOptions, JwkSet, JwkSource, JwkVerifyHook
|
|
34
|
+
export type { JwkAlgorithm, JwkOptions, JwkSet, JwkSource, JwkVerifyHook } from "./jwk.js";
|
|
33
35
|
export { serializeCookie, serializeClearCookie, assertCookieAttributes, readRequestCookie, } from "./cookie.js";
|
|
34
36
|
export type { CookieAttributes, CookieSameSite } from "./cookie.js";
|
|
35
|
-
export { assertTemporalClaims, TemporalClaimError
|
|
37
|
+
export { assertTemporalClaims, TemporalClaimError } from "./time-claims.js";
|
|
36
38
|
export type { TemporalClaims, TemporalClaimErrorCode, AssertTemporalClaimsOptions, } from "./time-claims.js";
|
|
37
39
|
export { every, some, except } from "./combine.js";
|
|
38
40
|
export type { ExceptPredicate } from "./combine.js";
|
|
@@ -42,24 +44,24 @@ export { fetchGuard, SsrfBlockedError } from "./fetch-guard.js";
|
|
|
42
44
|
export type { FetchGuardOptions, SsrfBlockReason } from "./fetch-guard.js";
|
|
43
45
|
export { resilientFetch, CircuitBreaker, CircuitOpenError, FetchTimeoutError, } from "./fetch-resilience.js";
|
|
44
46
|
export type { ResilientFetchOptions, CircuitBreakerOptions, CircuitState, RetryContext, } from "./fetch-resilience.js";
|
|
45
|
-
export { createWebhookSender, MemoryWebhookDeadLetterSink
|
|
47
|
+
export { createWebhookSender, MemoryWebhookDeadLetterSink } from "./webhook-delivery.js";
|
|
46
48
|
export type { WebhookEvent, WebhookSenderOptions, WebhookDeliveryResult, WebhookDeadLetter, WebhookDeadLetterSink, WebhookAttempt, } from "./webhook-delivery.js";
|
|
47
|
-
export { Scheduler, CronParseError, parseCron, nextCronRun
|
|
49
|
+
export { Scheduler, CronParseError, parseCron, nextCronRun } from "./scheduler.js";
|
|
48
50
|
export type { SchedulerOptions, SchedulerLogger, TimerFns, TaskDefinition, TaskHandler, TaskRunContext, TaskErrorInfo, TaskState, CronFields, } from "./scheduler.js";
|
|
49
51
|
export { clientCertAuth, setClientCertificate, getClientCertificate, normalizePeerCertificate, parseForwardedClientCert, } from "./mtls.js";
|
|
50
52
|
export type { ClientCertificate, ClientCertificateSource, ClientCertAuthOptions, ClientCertHeaderConfig, PeerCertificateLike, } from "./mtls.js";
|
|
51
53
|
export { signMessage, signRequest, verifyMessage, verifyRequest, httpSignatureAuth, contentDigest, verifyContentDigest, DEFAULT_SIGNATURE_LABEL, DEFAULT_MAX_SIGNATURE_AGE_SECONDS, DEFAULT_SIGNATURE_CLOCK_SKEW_SECONDS, } from "./http-signatures.js";
|
|
52
54
|
export type { HttpSignatureAlgorithm, HttpSignatureKeyMaterial, HttpSignatureKey, SignMessageOptions, SignRequestOptions, MessageSignature, VerifyMessageOptions, VerifyResult, VerifySuccess, VerifyFailure, KeyResolutionInfo, HttpSignatureAuthOptions, ContentDigestAlgorithm, } from "./http-signatures.js";
|
|
53
|
-
export { autoBan, MemoryAutoBanStore, _resetAutoBanStoresForTests
|
|
55
|
+
export { autoBan, MemoryAutoBanStore, _resetAutoBanStoresForTests } from "./auto-ban.js";
|
|
54
56
|
export type { AutoBanOptions, AutoBanStore, AutoBanRecord, AutoBanEvent, AutoBanStrikeEvent, } from "./auto-ban.js";
|
|
55
57
|
export { botGuard, GOOGLEBOT, BINGBOT, WELL_KNOWN_BOTS } from "./bot-guard.js";
|
|
56
|
-
export type { BotGuardOptions, BotGuardEvent, BotResolver, VerifiedBotRule
|
|
58
|
+
export type { BotGuardOptions, BotGuardEvent, BotResolver, VerifiedBotRule } from "./bot-guard.js";
|
|
57
59
|
export { ipReputation, urlFeed } from "./ip-reputation.js";
|
|
58
60
|
export type { IpReputationOptions, IpReputationFeed, IpReputationMatch, IpReputationController, UrlFeedOptions, } from "./ip-reputation.js";
|
|
59
61
|
export { geoBlock } from "./geo-block.js";
|
|
60
62
|
export type { GeoBlockOptions, GeoBlockDecision, GeoBlockReason, GeoState, CountryFromIp, CountryFromContext, } from "./geo-block.js";
|
|
61
63
|
export { concurrencyLimit } from "./concurrency-limit.js";
|
|
62
|
-
export type { ConcurrencyLimitOptions, ConcurrencyRejection
|
|
64
|
+
export type { ConcurrencyLimitOptions, ConcurrencyRejection } from "./concurrency-limit.js";
|
|
63
65
|
export { requestDecompression, decompressRequestBody, DecompressionBombError, UnsupportedContentEncodingError, MalformedCompressedBodyError, _resetRequestDecompressionProbeForTests, } from "./request-decompression.js";
|
|
64
66
|
export type { RequestDecompressionOptions, RequestDecompressionEncoding, DecompressionBombInfo, } from "./request-decompression.js";
|
|
65
67
|
export { waf } from "./waf.js";
|
|
@@ -67,17 +69,17 @@ export type { WafOptions, WafMode, WafRuleId, WafRuleConfig, WafInspectConfig, W
|
|
|
67
69
|
export { safeRedirect, OpenRedirectBlockedError } from "./safe-redirect.js";
|
|
68
70
|
export type { SafeRedirectOptions, SafeRedirectStatus, SafeRedirectBlockReason, } from "./safe-redirect.js";
|
|
69
71
|
export { loadShedding, LOAD_SHEDDING_MARKER } from "./load-shedding.js";
|
|
70
|
-
export type { LoadSheddingOptions, LoadSheddingSnapshot
|
|
72
|
+
export type { LoadSheddingOptions, LoadSheddingSnapshot } from "./load-shedding.js";
|
|
71
73
|
export { defineConfig, ConfigValidationError } from "./config.js";
|
|
72
|
-
export type { ConfigSource, DefineConfigOptions
|
|
74
|
+
export type { ConfigSource, DefineConfigOptions } from "./config.js";
|
|
73
75
|
export type { RequestIdOptions, SecureHeadersOptions, CspDirectivesOptions, CorsOptions, CorsOriginAllow, RateLimitOptions, RateLimitStore, LoginThrottleOptions, CsrfOptions, CsrfCookieOptions, FetchMetadataOptions, BasicAuthOptions, } from "./middleware.js";
|
|
74
76
|
export type { BearerAuthOptions, BearerAuthVerifyHook } from "./middleware.js";
|
|
75
77
|
export { createLogger, noopLogger, DEFAULT_REDACT_KEYS } from "./logger.js";
|
|
76
|
-
export type { Logger, LogLevel, ConsoleLoggerOptions, LoggerRedactionOptions
|
|
77
|
-
export type { ScalarJsonPrimitive, ScalarJsonValue, ScalarReferenceConfiguration, ScalarTheme, RedocConfiguration, RedocHtmlOptions, SwaggerUiConfiguration, SwaggerUiHtmlOptions, AsyncApiHtmlOptions, DocsAssetOptions, } from "./docs.js";
|
|
78
|
+
export type { Logger, LogLevel, ConsoleLoggerOptions, LoggerRedactionOptions } from "./logger.js";
|
|
79
|
+
export type { ScalarJsonPrimitive, ScalarJsonValue, ScalarReferenceConfiguration, ScalarTheme, RedocConfiguration, RedocHtmlOptions, SwaggerUiConfiguration, SwaggerUiHtmlOptions, AsyncApiHtmlOptions, DocsAssetOptions, DocsAuthLauncherOptions, } from "./docs.js";
|
|
78
80
|
export { formatStartupBanner, printStartupBanner } from "./banner.js";
|
|
79
81
|
export type { StartupBannerLink, StartupBannerOptions } from "./banner.js";
|
|
80
|
-
export { sseStream, sseResponse, ndjsonStream, ndjsonResponse
|
|
82
|
+
export { sseStream, sseResponse, ndjsonStream, ndjsonResponse } from "./streaming.js";
|
|
81
83
|
export type { SSEMessage, StreamOptions, SSEStreamOptions, SSEResponseOptions, NDJSONResponseOptions, } from "./streaming.js";
|
|
82
84
|
export { httpBearerScheme, httpBasicScheme, apiKeyScheme, oauth2Scheme, openIdConnectScheme, REQUIRE_PAYLOAD_AUTH_EXTENSION, securitySchemeRequiresPayloadAuth, toOpenAPISecurityScheme, } from "./security-schemes.js";
|
|
83
85
|
export type { ApiKeyLocation, ApiKeyScheme, ApiKeySchemeOptions, HttpBasicScheme, HttpBasicSchemeOptions, HttpBearerScheme, HttpBearerSchemeOptions, OAuth2AuthorizationCodeFlow, OAuth2ClientCredentialsFlow, OAuth2Flows, OAuth2ImplicitFlow, OAuth2PasswordFlow, OAuth2Scheme, OAuth2SchemeOptions, OpenIdConnectScheme, OpenIdConnectSchemeOptions, SecurityScheme, RequirePayloadAuthExtension, } from "./security-schemes.js";
|
|
@@ -88,11 +90,11 @@ export type { SessionOptions, SessionCookieOptions, SessionContext, SessionRecor
|
|
|
88
90
|
export { idempotency, MemoryIdempotencyStore, _resetSharedIdempotencyStoresForTests, } from "./idempotency.js";
|
|
89
91
|
export type { IdempotencyOptions, IdempotencyStore, IdempotencyRecord, StoredIdempotentResponse, } from "./idempotency.js";
|
|
90
92
|
export { responseCache, MemoryResponseCacheStore, _resetSharedResponseCacheStoresForTests, } from "./response-cache.js";
|
|
91
|
-
export type { ResponseCacheOptions, ResponseCacheStore, CachedResponse
|
|
93
|
+
export type { ResponseCacheOptions, ResponseCacheStore, CachedResponse } from "./response-cache.js";
|
|
92
94
|
export { encodeCursor, decodeCursor, buildLinkHeader, buildPageLinks, paginationQuery, MAX_CURSOR_LENGTH, } from "./pagination.js";
|
|
93
95
|
export type { PaginationLink, PageLinkOptions, PageLinks, PaginationQueryOptions, PaginationParams, PaginationQuerySchema, } from "./pagination.js";
|
|
94
96
|
export { MetricsRegistry, Counter, Gauge, Histogram, httpMetrics, DEFAULT_DURATION_BUCKETS, PROMETHEUS_CONTENT_TYPE, } from "./metrics.js";
|
|
95
|
-
export type { MetricLabels, MetricsRegistryOptions, HttpMetricsOptions
|
|
97
|
+
export type { MetricLabels, MetricsRegistryOptions, HttpMetricsOptions } from "./metrics.js";
|
|
96
98
|
export { fileField, multipartObject, isFileFieldSchema, isMultipartObjectSchema, } from "./multipart.js";
|
|
97
99
|
export type { FileFieldSchema, FileFieldOptions, FileMagicBytesOption, FileMagicBytesSignature, MultipartObjectOptions, MultipartShape, UploadedFile, } from "./multipart.js";
|
|
98
100
|
export { otelTracing, TRACING_SPAN_KIND_SERVER, TRACING_SPAN_STATUS_UNSET, TRACING_SPAN_STATUS_OK, TRACING_SPAN_STATUS_ERROR, } from "./tracing.js";
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { defineDependency, DEPENDENCY_MARKER } from "./dependency.js";
|
|
|
11
11
|
export { HttpError, BadRequestError, ValidationError, NotFoundError, ConflictError, UnauthorizedError, ForbiddenError, MethodNotAllowedError, PayloadTooLargeError, RequestHeaderFieldsTooLargeError, UnsupportedMediaTypeError, TooManyRequestsError, RequestTimeoutError, InternalError, MessageLeakError, httpError, SAFE_CUSTOM_ERROR_RESPONSE_HEADERS, checkCustomErrorResponseHeaders, } from "./errors.js";
|
|
12
12
|
export { validate, isStandardSchema } from "./schema.js";
|
|
13
13
|
export { diffOpenAPI, hasBreakingChanges } from "./openapi-diff.js";
|
|
14
|
+
export { MCP_DEFAULT_MAX_BODY_BYTES, MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSIONS, McpToolError, createMcpHandler, mcpRoutes, } from "./mcp.js";
|
|
14
15
|
export { readBodyLimited, safeJsonParse, isForbiddenObjectKey, sanitizeHeaderName, sanitizeHeaderValue, timingSafeEqual, randomId, assertNoDuplicateSingletonHeaders, assertNoReservedInternalHeaders, assertHeaderCountWithinLimit, DEFAULT_MAX_HEADER_COUNT, RESERVED_INBOUND_HEADER_PREFIXES, SMUGGLING_SINGLETON_HEADERS, verifyWebhookSignature, signWebhookPayload, WEBHOOK_DEFAULT_TOLERANCE_SECONDS, assertStrongSecret, MIN_PROD_SECRET_BYTES, WEAK_SECRET_STRINGS, sanitizeFilename, assertSafeRelativePath, hasMongoOperatorKeys, assertNoMongoOperators, } from "./security.js";
|
|
15
16
|
export { requestId, secureHeaders, SECURE_HEADERS_MARKER, cors, CORS_HOOK_MARKER, CORS_ORIGIN_ALLOW_MARKER, CORS_WILDCARD_ORIGIN_MARKER, rateLimit, loginThrottle, timing, bearerAuth, basicAuth, csrf, CSRF_HOOK_MARKER, fetchMetadata, requireScopes, REQUIRE_SCOPES_AGGREGATE_KEY, REQUIRE_SCOPES_HOOK_MARKER, _resetSharedRateLimitStoresForTests, } from "./middleware.js";
|
|
16
17
|
export { etag } from "./etag.js";
|
|
@@ -18,16 +19,16 @@ export { compression, COMPRESSION_HOOK_MARKER, _resetCompressionRuntimeProbeForT
|
|
|
18
19
|
export { createJwtSigner, createJwtVerifier, JwtError, DEFAULT_JWT_MAX_LIFETIME_SECONDS, } from "./jwt.js";
|
|
19
20
|
export { jwk } from "./jwk.js";
|
|
20
21
|
export { serializeCookie, serializeClearCookie, assertCookieAttributes, readRequestCookie, } from "./cookie.js";
|
|
21
|
-
export { assertTemporalClaims, TemporalClaimError
|
|
22
|
+
export { assertTemporalClaims, TemporalClaimError } from "./time-claims.js";
|
|
22
23
|
export { every, some, except } from "./combine.js";
|
|
23
24
|
export { ipRestriction } from "./ip-restriction.js";
|
|
24
25
|
export { fetchGuard, SsrfBlockedError } from "./fetch-guard.js";
|
|
25
26
|
export { resilientFetch, CircuitBreaker, CircuitOpenError, FetchTimeoutError, } from "./fetch-resilience.js";
|
|
26
|
-
export { createWebhookSender, MemoryWebhookDeadLetterSink
|
|
27
|
-
export { Scheduler, CronParseError, parseCron, nextCronRun
|
|
27
|
+
export { createWebhookSender, MemoryWebhookDeadLetterSink } from "./webhook-delivery.js";
|
|
28
|
+
export { Scheduler, CronParseError, parseCron, nextCronRun } from "./scheduler.js";
|
|
28
29
|
export { clientCertAuth, setClientCertificate, getClientCertificate, normalizePeerCertificate, parseForwardedClientCert, } from "./mtls.js";
|
|
29
30
|
export { signMessage, signRequest, verifyMessage, verifyRequest, httpSignatureAuth, contentDigest, verifyContentDigest, DEFAULT_SIGNATURE_LABEL, DEFAULT_MAX_SIGNATURE_AGE_SECONDS, DEFAULT_SIGNATURE_CLOCK_SKEW_SECONDS, } from "./http-signatures.js";
|
|
30
|
-
export { autoBan, MemoryAutoBanStore, _resetAutoBanStoresForTests
|
|
31
|
+
export { autoBan, MemoryAutoBanStore, _resetAutoBanStoresForTests } from "./auto-ban.js";
|
|
31
32
|
export { botGuard, GOOGLEBOT, BINGBOT, WELL_KNOWN_BOTS } from "./bot-guard.js";
|
|
32
33
|
export { ipReputation, urlFeed } from "./ip-reputation.js";
|
|
33
34
|
export { geoBlock } from "./geo-block.js";
|
|
@@ -39,7 +40,7 @@ export { loadShedding, LOAD_SHEDDING_MARKER } from "./load-shedding.js";
|
|
|
39
40
|
export { defineConfig, ConfigValidationError } from "./config.js";
|
|
40
41
|
export { createLogger, noopLogger, DEFAULT_REDACT_KEYS } from "./logger.js";
|
|
41
42
|
export { formatStartupBanner, printStartupBanner } from "./banner.js";
|
|
42
|
-
export { sseStream, sseResponse, ndjsonStream, ndjsonResponse
|
|
43
|
+
export { sseStream, sseResponse, ndjsonStream, ndjsonResponse } from "./streaming.js";
|
|
43
44
|
export { httpBearerScheme, httpBasicScheme, apiKeyScheme, oauth2Scheme, openIdConnectScheme, REQUIRE_PAYLOAD_AUTH_EXTENSION, securitySchemeRequiresPayloadAuth, toOpenAPISecurityScheme, } from "./security-schemes.js";
|
|
44
45
|
export { discriminator, discriminatedUnion } from "./discriminator.js";
|
|
45
46
|
export { session, rotateSession, signValue, verifySignedValue, MemorySessionStore, SESSION_HOOK_MARKER, SESSION_SECRETS_MARKER, } from "./session.js";
|