@jaypie/mcp 0.2.9 → 0.2.10

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/dist/index.js CHANGED
@@ -885,7 +885,7 @@ function listLlmProviders() {
885
885
  };
886
886
  }
887
887
 
888
- const BUILD_VERSION_STRING = "@jaypie/mcp@0.2.9#f022ac30"
888
+ const BUILD_VERSION_STRING = "@jaypie/mcp@0.2.10#138e7b8a"
889
889
  ;
890
890
  const __filename$1 = fileURLToPath(import.meta.url);
891
891
  const __dirname$1 = path.dirname(__filename$1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/mcp",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Jaypie MCP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,14 +61,14 @@ initClient({
61
61
  });
62
62
  ```
63
63
 
64
- ## FabricEntity Interface
64
+ ## StorableEntity Interface
65
65
 
66
- All entities must implement `FabricEntity`:
66
+ All entities must implement `StorableEntity`:
67
67
 
68
68
  ```typescript
69
- import type { FabricEntity } from "@jaypie/dynamodb";
69
+ import type { StorableEntity } from "@jaypie/dynamodb";
70
70
 
71
- interface MyRecord extends FabricEntity {
71
+ interface MyRecord extends StorableEntity {
72
72
  // Primary Key (required)
73
73
  model: string; // e.g., "record"
74
74
  id: string; // UUID
@@ -313,7 +313,7 @@ const result = await queryByOu({
313
313
  import { APEX, queryByOu } from "@jaypie/dynamodb";
314
314
 
315
315
  let startKey: Record<string, unknown> | undefined;
316
- const allItems: FabricEntity[] = [];
316
+ const allItems: StorableEntity[] = [];
317
317
 
318
318
  do {
319
319
  const { items, lastEvaluatedKey } = await queryByOu({
@@ -482,7 +482,7 @@ Export entities by model and organizational unit:
482
482
  import { APEX, exportEntities } from "@jaypie/dynamodb";
483
483
 
484
484
  const { entities, count } = await exportEntities("vocabulary", APEX);
485
- // entities: FabricEntity[] sorted by sequence ascending
485
+ // entities: StorableEntity[] sorted by sequence ascending
486
486
  // count: number of entities
487
487
 
488
488
  // With limit
@@ -517,7 +517,7 @@ interface SeedOptions {
517
517
  dryRun?: boolean; // Preview without writing (default: false)
518
518
  }
519
519
 
520
- interface ExportResult<T extends FabricEntity = FabricEntity> {
520
+ interface ExportResult<T extends StorableEntity = StorableEntity> {
521
521
  entities: T[]; // Exported entities
522
522
  count: number; // Number of entities
523
523
  }
@@ -542,6 +542,107 @@ import type {
542
542
  } from "jaypie";
543
543
  ```
544
544
 
545
+ ## Lambda Handlers
546
+
547
+ Create Lambda handlers from Express apps using `createLambdaHandler` and `createLambdaStreamHandler`. These functions wrap Express applications to run directly on AWS Lambda Function URLs without requiring a separate Lambda adapter library.
548
+
549
+ ### Buffered Handler
550
+
551
+ Use `createLambdaHandler` for standard Lambda responses where the entire response is buffered before sending.
552
+
553
+ ```typescript
554
+ import express from "express";
555
+ import { createLambdaHandler, expressHandler } from "jaypie";
556
+
557
+ const app = express();
558
+
559
+ app.get("/", expressHandler(async (req, res) => {
560
+ return { message: "Hello from Lambda!" };
561
+ }));
562
+
563
+ // Export for Lambda Function URL
564
+ export const handler = createLambdaHandler(app);
565
+ ```
566
+
567
+ ### Streaming Handler
568
+
569
+ Use `createLambdaStreamHandler` for Lambda response streaming, ideal for Server-Sent Events (SSE) and real-time updates.
570
+
571
+ ```typescript
572
+ import express from "express";
573
+ import { createLambdaStreamHandler, expressStreamHandler } from "jaypie";
574
+
575
+ const app = express();
576
+
577
+ app.get("/stream", expressStreamHandler(async (req, res) => {
578
+ res.write("event: message\ndata: {\"text\": \"Hello\"}\n\n");
579
+ res.write("event: message\ndata: {\"text\": \"World\"}\n\n");
580
+ }));
581
+
582
+ // Export for Lambda Function URL with streaming
583
+ export const handler = createLambdaStreamHandler(app);
584
+ ```
585
+
586
+ ### Combined Usage
587
+
588
+ A typical Lambda Express application with both buffered and streaming endpoints:
589
+
590
+ ```typescript
591
+ import express from "express";
592
+ import {
593
+ createLambdaHandler,
594
+ createLambdaStreamHandler,
595
+ expressHandler,
596
+ expressStreamHandler,
597
+ cors,
598
+ } from "jaypie";
599
+
600
+ const app = express();
601
+ app.use(express.json());
602
+ app.use(cors());
603
+
604
+ // Standard buffered route
605
+ app.get("/api/data", expressHandler(async (req, res) => {
606
+ return { data: "buffered response" };
607
+ }));
608
+
609
+ // SSE streaming route
610
+ app.get("/api/stream", expressStreamHandler(async (req, res) => {
611
+ for (let i = 0; i < 5; i++) {
612
+ res.write(`event: update\ndata: {"count": ${i}}\n\n`);
613
+ }
614
+ }));
615
+
616
+ // Choose handler based on your needs
617
+ // For buffered: export const handler = createLambdaHandler(app);
618
+ // For streaming: export const handler = createLambdaStreamHandler(app);
619
+ export const handler = createLambdaHandler(app);
620
+ ```
621
+
622
+ ### Lambda Context Access
623
+
624
+ Both handlers expose Lambda context on the request object:
625
+
626
+ ```typescript
627
+ app.get("/", expressHandler(async (req, res) => {
628
+ // Access Lambda context directly on request
629
+ const awsRequestId = (req as any)._lambdaContext?.awsRequestId;
630
+ return { requestId: awsRequestId };
631
+ }));
632
+ ```
633
+
634
+ ### TypeScript Types
635
+
636
+ ```typescript
637
+ import type {
638
+ LambdaHandler,
639
+ LambdaStreamHandler,
640
+ LambdaContext,
641
+ FunctionUrlEvent,
642
+ LambdaResponse,
643
+ } from "jaypie";
644
+ ```
645
+
545
646
  ## Invoke UUID Detection
546
647
 
547
648
  Use `getCurrentInvokeUuid` to get the current request ID. Automatically detects the environment (Lambda, Lambda Web Adapter, or local development).
@@ -9,10 +9,14 @@ Templates for creating an Express subpackage that runs on AWS Lambda in a Jaypie
9
9
  ## index.ts
10
10
 
11
11
  ```typescript
12
- import serverlessExpress from "@codegenie/serverless-express";
12
+ import { createLambdaHandler } from "jaypie";
13
13
  import app from "./src/app.js";
14
14
 
15
- export default serverlessExpress({ app });
15
+ // Lambda handler for Function URL
16
+ export const handler = createLambdaHandler(app);
17
+
18
+ // For streaming responses (SSE), use:
19
+ // export const handler = createLambdaStreamHandler(app);
16
20
 
17
21
  if (process.env.NODE_ENV === "development") {
18
22
  app.listen(8080);