@mono-labs/dev 0.1.262 → 0.1.265

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.
@@ -9,7 +9,7 @@ function synthesizeApiGatewayEvent(req) {
9
9
  const hasBody = req.method !== 'GET' && req.method !== 'HEAD';
10
10
  const body = hasBody ? (0, aws_event_synthesis_1.serializeBody)(req.body) : null;
11
11
  const queryParams = (0, aws_event_synthesis_1.extractQueryParams)(req.query);
12
- const { path, queryString } = (0, aws_event_synthesis_1.splitUrl)(req.originalUrl);
12
+ const { path, queryString } = (0, aws_event_synthesis_1.splitUrl)(req.url);
13
13
  const requestId = (0, aws_event_synthesis_1.generateRequestId)();
14
14
  const now = Date.now();
15
15
  return {
@@ -47,7 +47,7 @@ function synthesizeALBEvent(req) {
47
47
  const hasBody = req.method !== 'GET' && req.method !== 'HEAD';
48
48
  const body = hasBody ? (0, aws_event_synthesis_1.serializeBody)(req.body) : null;
49
49
  const queryParams = (0, aws_event_synthesis_1.extractQueryParams)(req.query);
50
- const { path } = (0, aws_event_synthesis_1.splitUrl)(req.originalUrl);
50
+ const { path } = (0, aws_event_synthesis_1.splitUrl)(req.url);
51
51
  return {
52
52
  requestContext: {
53
53
  elb: {
@@ -50,7 +50,7 @@ class ConnectionRegistry {
50
50
  getConnectionsByOrgId(orgId) {
51
51
  const result = [];
52
52
  for (const [connId, ctx] of this.userContexts) {
53
- if (ctx.organizationId === orgId)
53
+ if (ctx.organizationId !== null && ctx.organizationId === orgId)
54
54
  result.push(connId);
55
55
  }
56
56
  return result;
@@ -124,7 +124,7 @@ function attachSocketAdapter(wss, config) {
124
124
  });
125
125
  const resolvedUserContext = userContext ?? connectionRegistry.getUserContext(connectionId) ?? {
126
126
  userId: 'anonymous',
127
- organizationId: 'anonymous',
127
+ organizationId: null,
128
128
  };
129
129
  const result = await actionRouter.route(connectionId, rawBody, postToConnection, requestContext, resolvedUserContext);
130
130
  // Send the handler result back to the sender
@@ -1,7 +1,7 @@
1
1
  /** User context attached to a WebSocket connection */
2
2
  export interface WebSocketUserContext {
3
3
  userId: string;
4
- organizationId: string;
4
+ organizationId: string | null;
5
5
  [key: string]: unknown;
6
6
  }
7
7
  /** Unique identifier for a WebSocket connection (mirrors API Gateway connectionId) */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/websocket/types.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,MAAM,WAAW,oBAAoB;IACpC,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB;AAED,sFAAsF;AACtF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AAEjC,6FAA6F;AAC7F,MAAM,MAAM,kBAAkB,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE7F,mEAAmE;AACnE,MAAM,WAAW,mBAAmB;IACnC,YAAY,EAAE,YAAY,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,SAAS,GAAG,YAAY,GAAG,SAAS,CAAA;CAC/C;AAED,wCAAwC;AACxC,MAAM,WAAW,oBAAoB;IACpC,YAAY,EAAE,YAAY,CAAA;IAC1B,cAAc,EAAE,mBAAmB,CAAA;IACnC,gBAAgB,EAAE,kBAAkB,CAAA;IACpC,WAAW,EAAE,oBAAoB,CAAA;CACjC;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED,2CAA2C;AAC3C,MAAM,MAAM,aAAa,GAAG,CAC3B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,oBAAoB,KACrB,OAAO,CAAC,mB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I,CAAC,CAAA;AAE/E,0BAA0B;AAC1B,MAAM,WAAW,WAAW;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,2CAA2C;AAC3C,MAAM,WAAW,mBAAmB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,cAAc,CAAC,EAAE,gBAAgB,CAAA;IACjC,iBAAiB,CAAC,EAAE,mBAAmB,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACtC,cAAc,CAAC,EAAE,aAAa,CAAA;IAC9B,YAAY,CAAC,EAAE,OAAO,iBAAiB,EAAE,YAAY,CAAA;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,WAAW,CAAA;CACnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/dev",
3
- "version": "0.1.262",
3
+ "version": "0.1.265",
4
4
  "type": "commonjs",
5
5
  "description": "Local development server and WebSocket adapter for mono-labs",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,7 @@ export function synthesizeApiGatewayEvent(req: Request): APIGatewayProxyEventV2
15
15
  const hasBody = req.method !== 'GET' && req.method !== 'HEAD'
16
16
  const body = hasBody ? serializeBody(req.body) : null
17
17
  const queryParams = extractQueryParams(req.query as Record<string, unknown>)
18
- const { path, queryString } = splitUrl(req.originalUrl)
18
+ const { path, queryString } = splitUrl(req.url)
19
19
  const requestId = generateRequestId()
20
20
  const now = Date.now()
21
21
 
@@ -55,7 +55,7 @@ export function synthesizeALBEvent(req: Request): ALBEvent {
55
55
  const hasBody = req.method !== 'GET' && req.method !== 'HEAD'
56
56
  const body = hasBody ? serializeBody(req.body) : null
57
57
  const queryParams = extractQueryParams(req.query as Record<string, unknown>)
58
- const { path } = splitUrl(req.originalUrl)
58
+ const { path } = splitUrl(req.url)
59
59
 
60
60
  return {
61
61
  requestContext: {
@@ -60,7 +60,7 @@ export class ConnectionRegistry {
60
60
  getConnectionsByOrgId(orgId: string): ConnectionId[] {
61
61
  const result: ConnectionId[] = []
62
62
  for (const [connId, ctx] of this.userContexts) {
63
- if (ctx.organizationId === orgId) result.push(connId)
63
+ if (ctx.organizationId !== null && ctx.organizationId === orgId) result.push(connId)
64
64
  }
65
65
  return result
66
66
  }
@@ -131,7 +131,7 @@ export function attachSocketAdapter(wss: WebSocketServer, config?: SocketAdapter
131
131
 
132
132
  const resolvedUserContext = userContext ?? connectionRegistry.getUserContext(connectionId) ?? {
133
133
  userId: 'anonymous',
134
- organizationId: 'anonymous',
134
+ organizationId: null,
135
135
  }
136
136
 
137
137
  const result = await actionRouter.route(connectionId, rawBody, postToConnection, requestContext, resolvedUserContext)
@@ -3,7 +3,7 @@ import type { WebSocket } from 'ws'
3
3
  /** User context attached to a WebSocket connection */
4
4
  export interface WebSocketUserContext {
5
5
  userId: string
6
- organizationId: string
6
+ organizationId: string | null
7
7
  [key: string]: unknown
8
8
  }
9
9