@leanmcp/core 0.4.5 → 0.4.7-alpha.28.7306df7

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 LeanMCP Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 LeanMCP Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.mts CHANGED
@@ -382,15 +382,31 @@ declare function SchemaConstraint(constraints: {
382
382
  enum?: any[];
383
383
  description?: string;
384
384
  default?: any;
385
- items?: {
386
- type: string;
387
- description?: string;
388
- };
385
+ type?: string;
389
386
  }): PropertyDecorator;
390
387
  /**
391
- * Enhanced schema generator that includes constraints
388
+ * Enhanced schema generator that includes constraints.
389
+ * Uses pre-computed metadata (from leanmcp build) when available for fast startup.
390
+ * Falls back to ts-morph parsing in dev mode.
391
+ */
392
+ declare function classToJsonSchemaWithConstraints(classConstructor: new () => any, sourceFilePath?: string): any;
393
+
394
+ /**
395
+ * Register the source file path for an input class.
396
+ * This is called during decorator execution to capture the source location.
397
+ */
398
+ declare function registerClassSource(className: string, sourceFile: string): void;
399
+ /**
400
+ * Parse a TypeScript class and extract JSON Schema types for each property.
401
+ * Automatically detects array types like `string[]` and adds proper `items`.
402
+ *
403
+ * This is now SYNCHRONOUS for easier integration with existing code.
404
+ */
405
+ declare function parseClassTypesSync(classConstructor: new () => any, sourceFilePath?: string): Map<string, any>;
406
+ /**
407
+ * Clear the type cache (useful for hot reloading)
392
408
  */
393
- declare function classToJsonSchemaWithConstraints(classConstructor: new () => any): any;
409
+ declare function clearTypeCache(): void;
394
410
 
395
411
  /**
396
412
  * Input validation utilities for LeanMCP
@@ -969,4 +985,4 @@ declare class MCPServerRuntime {
969
985
  */
970
986
  declare function startMCPServer(options: MCPServerOptions): Promise<MCPServerRuntime>;
971
987
 
972
- export { Auth, type AuthErrorOptions, type AuthErrorResult, type AuthOptions, DEFAULT_TABLE_NAME, DEFAULT_TTL_SECONDS, Deprecated, DynamoDBSessionStore, type HTTPServerAuthOptions, type HTTPServerInput, type HTTPServerOptions, type ISessionStore, InMemorySessionStore, LeanMCPSessionProvider, type LeanMCPSessionProviderOptions, LogLevel, type LogPayload, Logger, type LoggerHandler, type LoggerOptions, MCPServer, type MCPServerConstructorOptions, type MCPServerFactory, type MCPServerOptions, MCPServerRuntime, Optional, Prompt, type PromptOptions, type ProtectedResourceMetadata, Render, Resource, type ResourceOptions, SchemaConstraint, type SecurityScheme, type SessionData, Tool, type ToolOptions, UI, UserEnvs, classToJsonSchema, classToJsonSchemaWithConstraints, createAuthError, createHTTPServer, createProtectedResourceMetadata, defaultLogger, extractBearerToken, getDecoratedMethods, getMethodMetadata, isAuthError, startMCPServer, validateNonEmpty, validatePath, validatePort, validateServiceName, validateUrl };
988
+ export { Auth, type AuthErrorOptions, type AuthErrorResult, type AuthOptions, DEFAULT_TABLE_NAME, DEFAULT_TTL_SECONDS, Deprecated, DynamoDBSessionStore, type HTTPServerAuthOptions, type HTTPServerInput, type HTTPServerOptions, type ISessionStore, InMemorySessionStore, LeanMCPSessionProvider, type LeanMCPSessionProviderOptions, LogLevel, type LogPayload, Logger, type LoggerHandler, type LoggerOptions, MCPServer, type MCPServerConstructorOptions, type MCPServerFactory, type MCPServerOptions, MCPServerRuntime, Optional, Prompt, type PromptOptions, type ProtectedResourceMetadata, Render, Resource, type ResourceOptions, SchemaConstraint, type SecurityScheme, type SessionData, Tool, type ToolOptions, UI, UserEnvs, classToJsonSchema, classToJsonSchemaWithConstraints, clearTypeCache, createAuthError, createHTTPServer, createProtectedResourceMetadata, defaultLogger, extractBearerToken, getDecoratedMethods, getMethodMetadata, isAuthError, parseClassTypesSync, registerClassSource, startMCPServer, validateNonEmpty, validatePath, validatePort, validateServiceName, validateUrl };
package/dist/index.d.ts CHANGED
@@ -382,15 +382,31 @@ declare function SchemaConstraint(constraints: {
382
382
  enum?: any[];
383
383
  description?: string;
384
384
  default?: any;
385
- items?: {
386
- type: string;
387
- description?: string;
388
- };
385
+ type?: string;
389
386
  }): PropertyDecorator;
390
387
  /**
391
- * Enhanced schema generator that includes constraints
388
+ * Enhanced schema generator that includes constraints.
389
+ * Uses pre-computed metadata (from leanmcp build) when available for fast startup.
390
+ * Falls back to ts-morph parsing in dev mode.
391
+ */
392
+ declare function classToJsonSchemaWithConstraints(classConstructor: new () => any, sourceFilePath?: string): any;
393
+
394
+ /**
395
+ * Register the source file path for an input class.
396
+ * This is called during decorator execution to capture the source location.
397
+ */
398
+ declare function registerClassSource(className: string, sourceFile: string): void;
399
+ /**
400
+ * Parse a TypeScript class and extract JSON Schema types for each property.
401
+ * Automatically detects array types like `string[]` and adds proper `items`.
402
+ *
403
+ * This is now SYNCHRONOUS for easier integration with existing code.
404
+ */
405
+ declare function parseClassTypesSync(classConstructor: new () => any, sourceFilePath?: string): Map<string, any>;
406
+ /**
407
+ * Clear the type cache (useful for hot reloading)
392
408
  */
393
- declare function classToJsonSchemaWithConstraints(classConstructor: new () => any): any;
409
+ declare function clearTypeCache(): void;
394
410
 
395
411
  /**
396
412
  * Input validation utilities for LeanMCP
@@ -969,4 +985,4 @@ declare class MCPServerRuntime {
969
985
  */
970
986
  declare function startMCPServer(options: MCPServerOptions): Promise<MCPServerRuntime>;
971
987
 
972
- export { Auth, type AuthErrorOptions, type AuthErrorResult, type AuthOptions, DEFAULT_TABLE_NAME, DEFAULT_TTL_SECONDS, Deprecated, DynamoDBSessionStore, type HTTPServerAuthOptions, type HTTPServerInput, type HTTPServerOptions, type ISessionStore, InMemorySessionStore, LeanMCPSessionProvider, type LeanMCPSessionProviderOptions, LogLevel, type LogPayload, Logger, type LoggerHandler, type LoggerOptions, MCPServer, type MCPServerConstructorOptions, type MCPServerFactory, type MCPServerOptions, MCPServerRuntime, Optional, Prompt, type PromptOptions, type ProtectedResourceMetadata, Render, Resource, type ResourceOptions, SchemaConstraint, type SecurityScheme, type SessionData, Tool, type ToolOptions, UI, UserEnvs, classToJsonSchema, classToJsonSchemaWithConstraints, createAuthError, createHTTPServer, createProtectedResourceMetadata, defaultLogger, extractBearerToken, getDecoratedMethods, getMethodMetadata, isAuthError, startMCPServer, validateNonEmpty, validatePath, validatePort, validateServiceName, validateUrl };
988
+ export { Auth, type AuthErrorOptions, type AuthErrorResult, type AuthOptions, DEFAULT_TABLE_NAME, DEFAULT_TTL_SECONDS, Deprecated, DynamoDBSessionStore, type HTTPServerAuthOptions, type HTTPServerInput, type HTTPServerOptions, type ISessionStore, InMemorySessionStore, LeanMCPSessionProvider, type LeanMCPSessionProviderOptions, LogLevel, type LogPayload, Logger, type LoggerHandler, type LoggerOptions, MCPServer, type MCPServerConstructorOptions, type MCPServerFactory, type MCPServerOptions, MCPServerRuntime, Optional, Prompt, type PromptOptions, type ProtectedResourceMetadata, Render, Resource, type ResourceOptions, SchemaConstraint, type SecurityScheme, type SessionData, Tool, type ToolOptions, UI, UserEnvs, classToJsonSchema, classToJsonSchemaWithConstraints, clearTypeCache, createAuthError, createHTTPServer, createProtectedResourceMetadata, defaultLogger, extractBearerToken, getDecoratedMethods, getMethodMetadata, isAuthError, parseClassTypesSync, registerClassSource, startMCPServer, validateNonEmpty, validatePath, validatePort, validateServiceName, validateUrl };