@cyanheads/mcp-ts-core 0.12.5 → 0.12.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/AGENTS.md +25 -14
- package/CLAUDE.md +25 -14
- package/README.md +1 -1
- package/changelog/0.12.x/0.12.6.md +44 -0
- package/dist/core/app.d.ts +2 -2
- package/dist/core/app.js +2 -2
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +2 -2
- package/dist/core/worker.d.ts +1 -1
- package/dist/core/worker.js +1 -1
- package/dist/mcp-server/apps/appBuilders.d.ts +2 -2
- package/dist/mcp-server/apps/appBuilders.js +2 -2
- package/dist/mcp-server/cacheHints.d.ts +1 -1
- package/dist/mcp-server/prompts/prompt-registration.d.ts +1 -1
- package/dist/mcp-server/prompts/prompt-registration.js +1 -1
- package/dist/mcp-server/resources/resource-registration.d.ts +3 -3
- package/dist/mcp-server/resources/resource-registration.js +1 -1
- package/dist/mcp-server/resources/resourceSubscriptions.d.ts +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +2 -2
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +4 -4
- package/dist/mcp-server/server.d.ts +4 -4
- package/dist/mcp-server/server.js +1 -1
- package/dist/mcp-server/tools/tool-registration.d.ts +3 -3
- package/dist/mcp-server/tools/tool-registration.js +2 -2
- package/dist/mcp-server/tools/utils/disabled-tool.d.ts +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js +4 -4
- package/dist/mcp-server/transports/auth/authFactory.d.ts +1 -1
- package/dist/mcp-server/transports/auth/authFactory.js +2 -2
- package/dist/mcp-server/transports/auth/authMiddleware.d.ts +1 -1
- package/dist/mcp-server/transports/auth/authMiddleware.js +1 -1
- package/dist/mcp-server/transports/auth/lib/authUtils.js +1 -1
- package/dist/mcp-server/transports/auth/lib/claimParser.d.ts +1 -1
- package/dist/mcp-server/transports/auth/strategies/authStrategy.d.ts +1 -1
- package/dist/mcp-server/transports/auth/strategies/jwtStrategy.d.ts +2 -2
- package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +1 -1
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts +2 -2
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +1 -1
- package/dist/mcp-server/transports/http/httpErrorHandler.d.ts +1 -1
- package/dist/mcp-server/transports/http/httpServer.d.ts +1 -1
- package/dist/mcp-server/transports/http/httpServer.js +1 -1
- package/dist/mcp-server/transports/http/httpTransport.d.ts +3 -3
- package/dist/mcp-server/transports/http/httpTransport.js +12 -12
- package/dist/mcp-server/transports/http/landing-page/handler.d.ts +1 -1
- package/dist/mcp-server/transports/http/sessionStore.js +1 -1
- package/dist/mcp-server/transports/manager.d.ts +2 -2
- package/dist/mcp-server/transports/manager.js +3 -3
- package/dist/services/llm/providers/openrouter.provider.d.ts +1 -1
- package/dist/storage/core/StorageService.d.ts +1 -1
- package/dist/storage/core/StorageService.js +1 -1
- package/dist/storage/core/storageFactory.d.ts +2 -2
- package/dist/storage/core/storageFactory.js +6 -6
- package/dist/storage/core/storageValidation.d.ts.map +1 -1
- package/dist/storage/core/storageValidation.js +5 -3
- package/dist/storage/core/storageValidation.js.map +1 -1
- package/dist/storage/providers/cloudflare/d1Provider.d.ts +1 -1
- package/dist/storage/providers/cloudflare/d1Provider.js +1 -1
- package/dist/storage/providers/cloudflare/kvProvider.d.ts +1 -1
- package/dist/storage/providers/cloudflare/kvProvider.js +1 -1
- package/dist/storage/providers/cloudflare/r2Provider.d.ts +1 -1
- package/dist/storage/providers/cloudflare/r2Provider.js +1 -1
- package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts +1 -1
- package/dist/storage/providers/fileSystem/fileSystemProvider.js +1 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.d.ts +3 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.d.ts.map +1 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.js +11 -7
- package/dist/storage/providers/inMemory/inMemoryProvider.js.map +1 -1
- package/dist/storage/providers/supabase/supabaseProvider.d.ts +2 -2
- package/dist/storage/providers/supabase/supabaseProvider.js +1 -1
- package/dist/testing/fuzz.d.ts.map +1 -1
- package/dist/testing/fuzz.js +92 -53
- package/dist/testing/fuzz.js.map +1 -1
- package/dist/utils/formatting/diffFormatter.d.ts +2 -2
- package/dist/utils/formatting/diffFormatter.js +4 -4
- package/dist/utils/formatting/tableFormatter.d.ts +2 -2
- package/dist/utils/formatting/tableFormatter.js +3 -3
- package/dist/utils/formatting/treeFormatter.d.ts +3 -3
- package/dist/utils/formatting/treeFormatter.js +4 -4
- package/dist/utils/internal/error-handler/errorHandler.js +6 -6
- package/dist/utils/internal/error-handler/helpers.js +1 -1
- package/dist/utils/internal/error-handler/types.d.ts +1 -1
- package/dist/utils/internal/health.js +2 -2
- package/dist/utils/internal/lazyImport.js +1 -1
- package/dist/utils/internal/logger.d.ts +3 -3
- package/dist/utils/internal/logger.js +4 -4
- package/dist/utils/internal/performance.d.ts +1 -1
- package/dist/utils/internal/performance.js +6 -6
- package/dist/utils/internal/requestContext.d.ts +1 -1
- package/dist/utils/internal/requestContext.js +2 -2
- package/dist/utils/metrics/tokenCounter.d.ts +1 -1
- package/dist/utils/metrics/tokenCounter.js +2 -2
- package/dist/utils/network/fetchWithTimeout.d.ts +1 -1
- package/dist/utils/network/fetchWithTimeout.js +6 -6
- package/dist/utils/network/httpError.js +1 -1
- package/dist/utils/network/retry.d.ts +1 -1
- package/dist/utils/network/retry.js +1 -1
- package/dist/utils/pagination/pagination.d.ts +2 -2
- package/dist/utils/pagination/pagination.js +4 -4
- package/dist/utils/parsing/csvParser.d.ts +4 -4
- package/dist/utils/parsing/csvParser.js +6 -6
- package/dist/utils/parsing/dateParser.d.ts +3 -3
- package/dist/utils/parsing/dateParser.js +6 -6
- package/dist/utils/parsing/frontmatterParser.d.ts +2 -2
- package/dist/utils/parsing/frontmatterParser.js +3 -3
- package/dist/utils/parsing/htmlExtractor.d.ts +3 -3
- package/dist/utils/parsing/htmlExtractor.js +5 -5
- package/dist/utils/parsing/jsonParser.d.ts +4 -4
- package/dist/utils/parsing/jsonParser.js +6 -6
- package/dist/utils/parsing/pdfParser.d.ts +2 -2
- package/dist/utils/parsing/pdfParser.js +4 -4
- package/dist/utils/parsing/xmlParser.d.ts +4 -4
- package/dist/utils/parsing/xmlParser.js +5 -5
- package/dist/utils/parsing/yamlParser.d.ts +4 -4
- package/dist/utils/parsing/yamlParser.js +6 -6
- package/dist/utils/scheduling/scheduler.d.ts +3 -3
- package/dist/utils/scheduling/scheduler.js +5 -5
- package/dist/utils/security/rateLimiter.d.ts +2 -2
- package/dist/utils/security/rateLimiter.js +3 -3
- package/dist/utils/security/rateLimiter.js.map +1 -1
- package/dist/utils/security/sanitization.d.ts +3 -3
- package/dist/utils/security/sanitization.js +7 -7
- package/dist/utils/telemetry/instrumentation.d.ts.map +1 -1
- package/dist/utils/telemetry/instrumentation.js +7 -8
- package/dist/utils/telemetry/instrumentation.js.map +1 -1
- package/dist/utils/telemetry/trace.d.ts +1 -1
- package/dist/utils/telemetry/trace.js +1 -1
- package/package.json +13 -7
- package/scripts/devcheck.ts +6 -4
- package/skills/api-workers/SKILL.md +3 -3
- package/templates/AGENTS.md +2 -2
- package/templates/CLAUDE.md +2 -2
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
import { ZodError, z } from 'zod';
|
|
7
7
|
import { config } from '../../../config/index.js';
|
|
8
8
|
import { attachTypedFail, createContext, readContentStore, readEnrichmentStore, } from '../../../core/context.js';
|
|
9
|
-
import { createContextInputs, createRequestInput, isInputRequiredSignal, } from '
|
|
10
|
-
import { selectNotifiers } from '
|
|
11
|
-
import { withRequiredScopes } from '
|
|
12
|
-
import { resolveSessionMode } from '
|
|
9
|
+
import { createContextInputs, createRequestInput, isInputRequiredSignal, } from '../../inputRequired.js';
|
|
10
|
+
import { selectNotifiers } from '../../notifications.js';
|
|
11
|
+
import { withRequiredScopes } from '../../transports/auth/lib/authUtils.js';
|
|
12
|
+
import { resolveSessionMode } from '../../types.js';
|
|
13
13
|
import { McpError } from '../../../types-global/errors.js';
|
|
14
14
|
import { ErrorHandler } from '../../../utils/internal/error-handler/errorHandler.js';
|
|
15
15
|
import { measureToolExecution } from '../../../utils/internal/performance.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuthStrategy } from '
|
|
1
|
+
import type { AuthStrategy } from './strategies/authStrategy.js';
|
|
2
2
|
/**
|
|
3
3
|
* Creates and returns an authentication strategy instance based on the
|
|
4
4
|
* application's configuration (`config.mcpAuthMode`).
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* @module src/mcp-server/transports/auth/authFactory
|
|
6
6
|
*/
|
|
7
7
|
import { config } from '../../../config/index.js';
|
|
8
|
-
import { JwtStrategy } from '
|
|
9
|
-
import { OauthStrategy } from '
|
|
8
|
+
import { JwtStrategy } from './strategies/jwtStrategy.js';
|
|
9
|
+
import { OauthStrategy } from './strategies/oauthStrategy.js';
|
|
10
10
|
import { logger } from '../../../utils/internal/logger.js';
|
|
11
11
|
import { requestContextService } from '../../../utils/internal/requestContext.js';
|
|
12
12
|
/**
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { HttpBindings } from '@hono/node-server';
|
|
13
13
|
import type { MiddlewareHandler } from 'hono';
|
|
14
|
-
import type { AuthStrategy } from '
|
|
14
|
+
import type { AuthStrategy } from './strategies/authStrategy.js';
|
|
15
15
|
/**
|
|
16
16
|
* Creates a Hono middleware function that enforces authentication using a given strategy.
|
|
17
17
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @module src/mcp-server/transports/auth/authMiddleware
|
|
11
11
|
*/
|
|
12
12
|
import { trace } from '@opentelemetry/api';
|
|
13
|
-
import { authContext } from '
|
|
13
|
+
import { authContext } from './lib/authContext.js';
|
|
14
14
|
import { unauthorized } from '../../../types-global/errors.js';
|
|
15
15
|
import { logger } from '../../../utils/internal/logger.js';
|
|
16
16
|
import { nowMs } from '../../../utils/internal/performance.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module src/mcp-server/transports/auth/core/authUtils
|
|
5
5
|
*/
|
|
6
6
|
import { config } from '../../../../config/index.js';
|
|
7
|
-
import { authContext } from '
|
|
7
|
+
import { authContext } from './authContext.js';
|
|
8
8
|
import { forbidden, unauthorized } from '../../../../types-global/errors.js';
|
|
9
9
|
import { logger } from '../../../../utils/internal/logger.js';
|
|
10
10
|
import { requestContextService, withExtra, } from '../../../../utils/internal/requestContext.js';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module src/mcp-server/transports/auth/lib/claimParser
|
|
7
7
|
*/
|
|
8
8
|
import type { JWTPayload } from 'jose';
|
|
9
|
-
import type { AuthInfo } from '
|
|
9
|
+
import type { AuthInfo } from './authTypes.js';
|
|
10
10
|
/**
|
|
11
11
|
* Builds an {@link AuthInfo} from a raw token string and decoded JWT payload.
|
|
12
12
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* interchangeably by the core authentication middleware.
|
|
6
6
|
* @module src/mcp-server/transports/auth/strategies/AuthStrategy
|
|
7
7
|
*/
|
|
8
|
-
import type { AuthInfo } from '
|
|
8
|
+
import type { AuthInfo } from '../lib/authTypes.js';
|
|
9
9
|
export interface AuthStrategy {
|
|
10
10
|
/**
|
|
11
11
|
* Verifies an authentication token.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { config as ConfigType } from '../../../../config/index.js';
|
|
2
|
-
import type { AuthInfo } from '
|
|
3
|
-
import type { AuthStrategy } from '
|
|
2
|
+
import type { AuthInfo } from '../lib/authTypes.js';
|
|
3
|
+
import type { AuthStrategy } from './authStrategy.js';
|
|
4
4
|
import type { logger as LoggerType } from '../../../../utils/internal/logger.js';
|
|
5
5
|
export declare class JwtStrategy implements AuthStrategy {
|
|
6
6
|
private config;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module src/mcp-server/transports/auth/strategies/JwtStrategy
|
|
7
7
|
*/
|
|
8
8
|
import { jwtVerify } from 'jose';
|
|
9
|
-
import { buildAuthInfoFromClaims, handleJoseVerifyError, } from '
|
|
9
|
+
import { buildAuthInfoFromClaims, handleJoseVerifyError, } from '../lib/claimParser.js';
|
|
10
10
|
import { configurationError } from '../../../../types-global/errors.js';
|
|
11
11
|
import { requestContextService, withExtra } from '../../../../utils/internal/requestContext.js';
|
|
12
12
|
export class JwtStrategy {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { config as ConfigType } from '../../../../config/index.js';
|
|
2
|
-
import type { AuthInfo } from '
|
|
3
|
-
import type { AuthStrategy } from '
|
|
2
|
+
import type { AuthInfo } from '../lib/authTypes.js';
|
|
3
|
+
import type { AuthStrategy } from './authStrategy.js';
|
|
4
4
|
import type { logger as LoggerType } from '../../../../utils/internal/logger.js';
|
|
5
5
|
export declare class OauthStrategy implements AuthStrategy {
|
|
6
6
|
private config;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @module src/mcp-server/transports/auth/strategies/OauthStrategy
|
|
6
6
|
*/
|
|
7
7
|
import { createRemoteJWKSet, jwtVerify } from 'jose';
|
|
8
|
-
import { buildAuthInfoFromClaims, handleJoseVerifyError, } from '
|
|
8
|
+
import { buildAuthInfoFromClaims, handleJoseVerifyError, } from '../lib/claimParser.js';
|
|
9
9
|
import { configurationError, forbidden, serviceUnavailable } from '../../../../types-global/errors.js';
|
|
10
10
|
import { requestContextService, withExtra } from '../../../../utils/internal/requestContext.js';
|
|
11
11
|
export class OauthStrategy {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from 'hono';
|
|
2
|
-
import type { HonoNodeBindings } from '
|
|
2
|
+
import type { HonoNodeBindings } from './httpTypes.js';
|
|
3
3
|
/**
|
|
4
4
|
* A centralized error handling middleware for Hono.
|
|
5
5
|
* This function is registered with `app.onError()` and will catch any errors
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { type ServerType } from '@hono/node-server';
|
|
9
9
|
import type { ServerEventBus } from '@modelcontextprotocol/server';
|
|
10
10
|
import type { ServerManifest } from '../../../core/serverManifest.js';
|
|
11
|
-
import type { FrameworkServerFactory } from '
|
|
11
|
+
import type { FrameworkServerFactory } from '../../types.js';
|
|
12
12
|
import { type RequestContext } from '../../../utils/internal/requestContext.js';
|
|
13
13
|
/**
|
|
14
14
|
* Handle returned by {@link startHttpTransport} bundling the HTTP server
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import http from 'node:http';
|
|
9
9
|
import { serve } from '@hono/node-server';
|
|
10
10
|
import { config } from '../../../config/index.js';
|
|
11
|
-
import { createHttpApp } from '
|
|
11
|
+
import { createHttpApp } from './httpTransport.js';
|
|
12
12
|
import { logger } from '../../../utils/internal/logger.js';
|
|
13
13
|
import { withExtra } from '../../../utils/internal/requestContext.js';
|
|
14
14
|
import { logStartupBanner } from '../../../utils/internal/startupBanner.js';
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
import { type McpHttpHandler, type ServerEventBus } from '@modelcontextprotocol/server';
|
|
25
25
|
import { Hono } from 'hono';
|
|
26
26
|
import type { ServerManifest } from '../../../core/serverManifest.js';
|
|
27
|
-
import type { HonoNodeBindings } from '
|
|
28
|
-
import { SessionStore } from '
|
|
29
|
-
import { type FrameworkServerFactory } from '
|
|
27
|
+
import type { HonoNodeBindings } from './httpTypes.js';
|
|
28
|
+
import { SessionStore } from './sessionStore.js';
|
|
29
|
+
import { type FrameworkServerFactory } from '../../types.js';
|
|
30
30
|
import { type RequestContext } from '../../../utils/internal/requestContext.js';
|
|
31
31
|
/**
|
|
32
32
|
* Creates a Hono HTTP application for the MCP server.
|
|
@@ -25,18 +25,18 @@ import { createMcpHandler, isJsonContentType, isLegacyRequest, WebStandardStream
|
|
|
25
25
|
import { Hono } from 'hono';
|
|
26
26
|
import { cors } from 'hono/cors';
|
|
27
27
|
import { config } from '../../../config/index.js';
|
|
28
|
-
import { createAuthStrategy } from '
|
|
29
|
-
import { createAuthMiddleware } from '
|
|
30
|
-
import { authContext } from '
|
|
31
|
-
import { createBoundedEventStore } from '
|
|
32
|
-
import { httpErrorHandler } from '
|
|
33
|
-
import { createLandingPageHandler } from '
|
|
34
|
-
import { protectedResourceMetadataHandler } from '
|
|
35
|
-
import { createRobotsTxtHandler } from '
|
|
36
|
-
import { createServerCardHandler } from '
|
|
37
|
-
import { generateSecureSessionId } from '
|
|
38
|
-
import { closeConnection, SessionStore, } from '
|
|
39
|
-
import { resolveSessionMode } from '
|
|
28
|
+
import { createAuthStrategy } from '../auth/authFactory.js';
|
|
29
|
+
import { createAuthMiddleware } from '../auth/authMiddleware.js';
|
|
30
|
+
import { authContext } from '../auth/lib/authContext.js';
|
|
31
|
+
import { createBoundedEventStore } from './eventStore.js';
|
|
32
|
+
import { httpErrorHandler } from './httpErrorHandler.js';
|
|
33
|
+
import { createLandingPageHandler } from './landing-page/index.js';
|
|
34
|
+
import { protectedResourceMetadataHandler } from './protectedResourceMetadata.js';
|
|
35
|
+
import { createRobotsTxtHandler } from './robotsTxt.js';
|
|
36
|
+
import { createServerCardHandler } from './serverCard.js';
|
|
37
|
+
import { generateSecureSessionId } from './sessionIdUtils.js';
|
|
38
|
+
import { closeConnection, SessionStore, } from './sessionStore.js';
|
|
39
|
+
import { resolveSessionMode } from '../../types.js';
|
|
40
40
|
import { logger } from '../../../utils/internal/logger.js';
|
|
41
41
|
import { requestContextService, withExtra, } from '../../../utils/internal/requestContext.js';
|
|
42
42
|
import { createObservableGauge } from '../../../utils/telemetry/metrics.js';
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { Context } from 'hono';
|
|
10
10
|
import type { ServerManifest } from '../../../../core/serverManifest.js';
|
|
11
|
-
import type { AuthStrategy } from '
|
|
11
|
+
import type { AuthStrategy } from '../../auth/strategies/authStrategy.js';
|
|
12
12
|
/**
|
|
13
13
|
* Factory for the `GET /` route handler.
|
|
14
14
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* @see {@link https://modelcontextprotocol.io/specification/2026-07-28/basic/transports | MCP Transports}
|
|
15
15
|
* @module src/mcp-server/transports/http/sessionStore
|
|
16
16
|
*/
|
|
17
|
-
import { validateSessionIdFormat } from '
|
|
17
|
+
import { validateSessionIdFormat } from './sessionIdUtils.js';
|
|
18
18
|
import { invalidParams, serviceUnavailable } from '../../../types-global/errors.js';
|
|
19
19
|
import { logger } from '../../../utils/internal/logger.js';
|
|
20
20
|
import { requestContextService, withExtra } from '../../../utils/internal/requestContext.js';
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import type { ServerEventBus } from '@modelcontextprotocol/server';
|
|
6
6
|
import type { AppConfig as AppConfigType } from '../../config/index.js';
|
|
7
7
|
import type { ServerManifest } from '../../core/serverManifest.js';
|
|
8
|
-
import type { TransportServer } from '
|
|
9
|
-
import type { FrameworkServerFactory } from '
|
|
8
|
+
import type { TransportServer } from './ITransport.js';
|
|
9
|
+
import type { FrameworkServerFactory } from '../types.js';
|
|
10
10
|
import type { logger as LoggerType } from '../../utils/internal/logger.js';
|
|
11
11
|
export declare class TransportManager {
|
|
12
12
|
private config;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HeartbeatMonitor } from '
|
|
2
|
-
import { startHttpTransport } from '
|
|
3
|
-
import { startStdioTransport, stopStdioTransport, } from '
|
|
1
|
+
import { HeartbeatMonitor } from './heartbeat.js';
|
|
2
|
+
import { startHttpTransport } from './http/httpServer.js';
|
|
3
|
+
import { startStdioTransport, stopStdioTransport, } from './stdio/stdioTransport.js';
|
|
4
4
|
import { requestContextService } from '../../utils/internal/requestContext.js';
|
|
5
5
|
export class TransportManager {
|
|
6
6
|
config;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChatCompletion, ChatCompletionChunk } from 'openai/resources/chat/completions';
|
|
2
2
|
import type { Stream } from 'openai/streaming';
|
|
3
3
|
import type { config as ConfigType } from '../../../config/index.js';
|
|
4
|
-
import type { ILlmProvider, OpenRouterChatParams } from '
|
|
4
|
+
import type { ILlmProvider, OpenRouterChatParams } from '../core/ILlmProvider.js';
|
|
5
5
|
import type { logger as LoggerType } from '../../../utils/internal/logger.js';
|
|
6
6
|
import { type RequestContext } from '../../../utils/internal/requestContext.js';
|
|
7
7
|
import type { RateLimiter } from '../../../utils/security/rateLimiter.js';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* provider via dependency injection.
|
|
6
6
|
* @module src/storage/core/StorageService
|
|
7
7
|
*/
|
|
8
|
-
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '
|
|
8
|
+
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from './IStorageProvider.js';
|
|
9
9
|
import { type RequestContext } from '../../utils/internal/requestContext.js';
|
|
10
10
|
export declare class StorageService {
|
|
11
11
|
private provider;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* provider via dependency injection.
|
|
6
6
|
* @module src/storage/core/StorageService
|
|
7
7
|
*/
|
|
8
|
-
import { validateBatchEntries, validateBatchKeys, validateKey, validateListOptions, validatePrefix, validateStorageOptions, validateTenantId, } from '
|
|
8
|
+
import { validateBatchEntries, validateBatchKeys, validateKey, validateListOptions, validatePrefix, validateStorageOptions, validateTenantId, } from './storageValidation.js';
|
|
9
9
|
import { JsonRpcErrorCode, McpError } from '../../types-global/errors.js';
|
|
10
10
|
import { logger } from '../../utils/internal/logger.js';
|
|
11
11
|
import { nowMs } from '../../utils/internal/performance.js';
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import type { D1Database, KVNamespace, R2Bucket } from '@cloudflare/workers-types';
|
|
9
9
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
10
10
|
import type { AppConfig } from '../../config/index.js';
|
|
11
|
-
import type { IStorageProvider } from '
|
|
12
|
-
import type { Database } from '
|
|
11
|
+
import type { IStorageProvider } from './IStorageProvider.js';
|
|
12
|
+
import type { Database } from '../providers/supabase/supabase.types.js';
|
|
13
13
|
/**
|
|
14
14
|
* Optional dependencies for storage provider creation.
|
|
15
15
|
* Allows pre-resolved dependencies to be passed in, useful for testing
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { D1Provider } from '
|
|
2
|
-
import { KvProvider } from '
|
|
3
|
-
import { R2Provider } from '
|
|
4
|
-
import { FileSystemProvider } from '
|
|
5
|
-
import { InMemoryProvider } from '
|
|
6
|
-
import { SupabaseProvider } from '
|
|
1
|
+
import { D1Provider } from '../providers/cloudflare/d1Provider.js';
|
|
2
|
+
import { KvProvider } from '../providers/cloudflare/kvProvider.js';
|
|
3
|
+
import { R2Provider } from '../providers/cloudflare/r2Provider.js';
|
|
4
|
+
import { FileSystemProvider } from '../providers/fileSystem/fileSystemProvider.js';
|
|
5
|
+
import { InMemoryProvider } from '../providers/inMemory/inMemoryProvider.js';
|
|
6
|
+
import { SupabaseProvider } from '../providers/supabase/supabaseProvider.js';
|
|
7
7
|
import { configurationError } from '../../types-global/errors.js';
|
|
8
8
|
import { logger } from '../../utils/internal/logger.js';
|
|
9
9
|
import { requestContextService } from '../../utils/internal/requestContext.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageValidation.d.ts","sourceRoot":"","sources":["../../../src/storage/core/storageValidation.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,oCAAoC,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"storageValidation.d.ts","sourceRoot":"","sources":["../../../src/storage/core/storageValidation.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,oCAAoC,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA2CzE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAqChF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CA4BtE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAyC5E;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,OAAO,EAAE,cAAc,GACtB,IAAI,CA2BN;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,YAAY,GAAG,SAAS,EACnC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,IAAI,MAAM,EAAE,CAO1B;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,OAAO,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAOzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,OAAO,EAAE,cAAc,GACtB,IAAI,CA+DN;AA0CD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKtE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CAuD9F"}
|
|
@@ -25,9 +25,10 @@ import { logger } from '../../utils/internal/logger.js';
|
|
|
25
25
|
import { withExtra } from '../../utils/internal/requestContext.js';
|
|
26
26
|
/**
|
|
27
27
|
* Per-process HMAC key for cursor integrity. Does not need to survive
|
|
28
|
-
* restarts: cursors are ephemeral pagination tokens.
|
|
28
|
+
* restarts: cursors are ephemeral pagination tokens. Initialized on first use
|
|
29
|
+
* because Workers forbid random generation during module evaluation (#406).
|
|
29
30
|
*/
|
|
30
|
-
|
|
31
|
+
let cursorHmacKey;
|
|
31
32
|
/**
|
|
32
33
|
* Maximum length for tenant IDs and keys to prevent abuse.
|
|
33
34
|
* These constants are security-critical and must not be modified at runtime.
|
|
@@ -317,7 +318,8 @@ const CURSOR_HMAC_ALGO = 'sha256';
|
|
|
317
318
|
const CURSOR_HMAC_BYTES = 16; // 128-bit truncated tag — sufficient for pagination tokens
|
|
318
319
|
/** Computes a truncated HMAC tag for the given payload string. */
|
|
319
320
|
function signCursor(payload) {
|
|
320
|
-
|
|
321
|
+
cursorHmacKey ??= randomBytes(32);
|
|
322
|
+
const mac = createHmac(CURSOR_HMAC_ALGO, cursorHmacKey)
|
|
321
323
|
.update(payload)
|
|
322
324
|
.digest()
|
|
323
325
|
.subarray(0, CURSOR_HMAC_BYTES);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageValidation.js","sourceRoot":"","sources":["../../../src/storage/core/storageValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAuB,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAGpF
|
|
1
|
+
{"version":3,"file":"storageValidation.js","sourceRoot":"","sources":["../../../src/storage/core/storageValidation.ts"],"names":[],"mappings":"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C,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC;YAC1E,MAAM,aAAa,CAAC,wBAAwB,EAAE;gBAC5C,GAAG,OAAO;gBACV,SAAS,EAAE,cAAc;aAC1B,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;YACxB,MAAM,aAAa,CAAC,gEAAgE,EAAE;gBACpF,GAAG,OAAO;gBACV,SAAS,EAAE,cAAc;aAC1B,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC,CAAC,CAAC;IAChB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;QACD,gEAAgE;QAChE,MAAM,CAAC,OAAO,CAAC,yBAAyB,EAAE;YACxC,GAAG,SAAS,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACtF,SAAS,EAAE,cAAc;SAC1B,CAAC,CAAC;QACH,MAAM,aAAa,CAAC,8DAA8D,EAAE;YAClF,GAAG,OAAO;YACV,SAAS,EAAE,cAAc;SAC1B,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module src/storage/providers/cloudflare/d1Provider
|
|
5
5
|
*/
|
|
6
6
|
import type { D1Database } from '@cloudflare/workers-types';
|
|
7
|
-
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '
|
|
7
|
+
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '../../core/IStorageProvider.js';
|
|
8
8
|
import { type RequestContext } from '../../../utils/internal/requestContext.js';
|
|
9
9
|
/**
|
|
10
10
|
* Cloudflare D1 storage provider implementation.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decodeCursor, encodeCursor } from '
|
|
1
|
+
import { decodeCursor, encodeCursor } from '../../core/storageValidation.js';
|
|
2
2
|
import { configurationError, invalidParams, JsonRpcErrorCode, McpError, } from '../../../types-global/errors.js';
|
|
3
3
|
import { ErrorHandler } from '../../../utils/internal/error-handler/errorHandler.js';
|
|
4
4
|
import { logger } from '../../../utils/internal/logger.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @module src/storage/providers/cloudflare/kvProvider
|
|
4
4
|
*/
|
|
5
5
|
import type { KVNamespace } from '@cloudflare/workers-types';
|
|
6
|
-
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '
|
|
6
|
+
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '../../core/IStorageProvider.js';
|
|
7
7
|
import { type RequestContext } from '../../../utils/internal/requestContext.js';
|
|
8
8
|
export declare class KvProvider implements IStorageProvider {
|
|
9
9
|
private readonly kv;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decodeCursor, encodeCursor } from '
|
|
1
|
+
import { decodeCursor, encodeCursor } from '../../core/storageValidation.js';
|
|
2
2
|
import { configurationError, JsonRpcErrorCode, McpError } from '../../../types-global/errors.js';
|
|
3
3
|
import { ErrorHandler } from '../../../utils/internal/error-handler/errorHandler.js';
|
|
4
4
|
import { logger } from '../../../utils/internal/logger.js';
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @module src/storage/providers/cloudflare/r2Provider
|
|
9
9
|
*/
|
|
10
10
|
import type { R2Bucket } from '@cloudflare/workers-types';
|
|
11
|
-
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '
|
|
11
|
+
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '../../core/IStorageProvider.js';
|
|
12
12
|
import { type RequestContext } from '../../../utils/internal/requestContext.js';
|
|
13
13
|
export declare class R2Provider implements IStorageProvider {
|
|
14
14
|
private readonly bucket;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decodeCursor, encodeCursor } from '
|
|
1
|
+
import { decodeCursor, encodeCursor } from '../../core/storageValidation.js';
|
|
2
2
|
import { configurationError, JsonRpcErrorCode, McpError } from '../../../types-global/errors.js';
|
|
3
3
|
import { ErrorHandler } from '../../../utils/internal/error-handler/errorHandler.js';
|
|
4
4
|
import { logger } from '../../../utils/internal/logger.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '
|
|
1
|
+
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '../../core/IStorageProvider.js';
|
|
2
2
|
import type { RequestContext } from '../../../utils/internal/requestContext.js';
|
|
3
3
|
export declare class FileSystemProvider implements IStorageProvider {
|
|
4
4
|
private readonly storagePath;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import { existsSync, mkdirSync } from 'node:fs';
|
|
13
13
|
import { readdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
14
14
|
import path from 'node:path';
|
|
15
|
-
import { decodeCursor, encodeCursor, validateTenantId } from '
|
|
15
|
+
import { decodeCursor, encodeCursor, validateTenantId } from '../../core/storageValidation.js';
|
|
16
16
|
import { configurationError, JsonRpcErrorCode, McpError, validationError, } from '../../../types-global/errors.js';
|
|
17
17
|
import { ErrorHandler } from '../../../utils/internal/error-handler/errorHandler.js';
|
|
18
18
|
import { sanitization } from '../../../utils/security/sanitization.js';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* to prevent unbounded memory growth.
|
|
6
6
|
* @module src/storage/providers/inMemory/inMemoryProvider
|
|
7
7
|
*/
|
|
8
|
-
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '
|
|
8
|
+
import type { IStorageProvider, ListOptions, ListResult, StorageOptions } from '../../core/IStorageProvider.js';
|
|
9
9
|
import { type RequestContext } from '../../../utils/internal/requestContext.js';
|
|
10
10
|
/** Configuration options for the in-memory storage provider. */
|
|
11
11
|
export interface InMemoryProviderOptions {
|
|
@@ -34,6 +34,8 @@ export declare class InMemoryProvider implements IStorageProvider {
|
|
|
34
34
|
* If still at capacity after sweep, throws.
|
|
35
35
|
*/
|
|
36
36
|
private ensureCapacity;
|
|
37
|
+
/** Check a capacity snapshot without sweeping or invalidating a batch delta. */
|
|
38
|
+
private assertCapacity;
|
|
37
39
|
get<T>(tenantId: string, key: string, context: RequestContext): Promise<T | null>;
|
|
38
40
|
set(tenantId: string, key: string, value: unknown, context: RequestContext, options?: StorageOptions): Promise<void>;
|
|
39
41
|
delete(tenantId: string, key: string, context: RequestContext): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inMemoryProvider.d.ts","sourceRoot":"","sources":["../../../../src/storage/providers/inMemory/inMemoryProvider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,cAAc,EACf,MAAM,oCAAoC,CAAC;AAI5C,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,oCAAoC,CAAC;AAKpF,gEAAgE;AAChE,MAAM,WAAW,uBAAuB;IACtC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAOD,qBAAa,gBAAiB,YAAW,gBAAgB;IACvD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsD;IAC5E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,UAAU,CAAK;IAEvB,YAAY,OAAO,CAAC,EAAE,uBAAuB,EAM5C;IAED,8DAA8D;IAC9D,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,OAAO,CAAC,sBAAsB;IAQ9B,2FAA2F;IAC3F,OAAO,CAAC,YAAY;IAkBpB;;;OAGG;IACH,OAAO,CAAC,cAAc;
|
|
1
|
+
{"version":3,"file":"inMemoryProvider.d.ts","sourceRoot":"","sources":["../../../../src/storage/providers/inMemory/inMemoryProvider.ts"],"names":[],"mappings":"AAA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AAC,UAAU,CAAC,CAyDrB;IAEK,OAAO,CAAC,CAAC,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAwBzB;IAGK,OAAO,CACX,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC,CAoCf;IAEK,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAoB3F;IAED,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAShE;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decodeCursor, encodeCursor } from '
|
|
1
|
+
import { decodeCursor, encodeCursor } from '../../core/storageValidation.js';
|
|
2
2
|
import { configurationError, JsonRpcErrorCode, McpError } from '../../../types-global/errors.js';
|
|
3
3
|
import { logger } from '../../../utils/internal/logger.js';
|
|
4
4
|
import { withExtra } from '../../../utils/internal/requestContext.js';
|
|
@@ -49,13 +49,17 @@ export class InMemoryProvider {
|
|
|
49
49
|
* Ensures capacity for a new entry. If at limit, runs a TTL sweep first.
|
|
50
50
|
* If still at capacity after sweep, throws.
|
|
51
51
|
*/
|
|
52
|
-
ensureCapacity(
|
|
53
|
-
if (this.entryCount
|
|
52
|
+
ensureCapacity() {
|
|
53
|
+
if (this.entryCount < this.maxEntries)
|
|
54
54
|
return;
|
|
55
55
|
const reclaimed = this.sweepExpired();
|
|
56
56
|
if (reclaimed > 0) {
|
|
57
57
|
logger.debug(`[InMemoryProvider] TTL sweep reclaimed ${reclaimed} expired entries`);
|
|
58
58
|
}
|
|
59
|
+
this.assertCapacity(1);
|
|
60
|
+
}
|
|
61
|
+
/** Check a capacity snapshot without sweeping or invalidating a batch delta. */
|
|
62
|
+
assertCapacity(additionalEntries) {
|
|
59
63
|
if (this.entryCount + additionalEntries > this.maxEntries) {
|
|
60
64
|
throw new McpError(JsonRpcErrorCode.InternalError, `In-memory storage capacity exceeded (max: ${this.maxEntries}). ` +
|
|
61
65
|
'Consider increasing maxEntries, adding TTLs to entries, or switching to a persistent provider.');
|
|
@@ -83,12 +87,12 @@ export class InMemoryProvider {
|
|
|
83
87
|
}
|
|
84
88
|
set(tenantId, key, value, context, options) {
|
|
85
89
|
logger.debug(`[InMemoryProvider] Setting key: ${key} for tenant: ${tenantId}`, context);
|
|
86
|
-
|
|
87
|
-
const isNew = !tenantStore?.has(key);
|
|
90
|
+
const isNew = !this.store.get(tenantId)?.has(key);
|
|
88
91
|
if (isNew) {
|
|
89
92
|
this.ensureCapacity();
|
|
90
93
|
}
|
|
91
|
-
|
|
94
|
+
// A capacity sweep may have removed the target tenant’s last entry.
|
|
95
|
+
const tenantStore = this.getOrCreateTenantStore(tenantId);
|
|
92
96
|
// Fix: Check for undefined instead of truthy to handle ttl=0 correctly
|
|
93
97
|
const expiresAt = options?.ttl !== undefined ? Date.now() + options.ttl * 1000 : undefined;
|
|
94
98
|
tenantStore.set(key, {
|
|
@@ -199,7 +203,7 @@ export class InMemoryProvider {
|
|
|
199
203
|
newEntryCount++;
|
|
200
204
|
}
|
|
201
205
|
// Preflight the complete batch so capacity failures cannot partially commit.
|
|
202
|
-
this.
|
|
206
|
+
this.assertCapacity(newEntryCount);
|
|
203
207
|
tenantStore ??= this.getOrCreateTenantStore(tenantId);
|
|
204
208
|
const expiresAt = options?.ttl !== undefined ? Date.now() + options.ttl * 1000 : undefined;
|
|
205
209
|
for (const [key, value] of entries) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inMemoryProvider.js","sourceRoot":"","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