@sylphx/lens-server 2.4.0 → 2.4.1

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
@@ -1179,13 +1179,7 @@ function createHandler(server, options = {}) {
1179
1179
  return result;
1180
1180
  }
1181
1181
  // src/handlers/framework.ts
1182
- import { firstValueFrom as firstValueFrom2, isObservable } from "@sylphx/lens-core";
1183
- async function resolveExecuteResult(result) {
1184
- if (isObservable(result)) {
1185
- return firstValueFrom2(result);
1186
- }
1187
- return result;
1188
- }
1182
+ import { firstValueFrom as firstValueFrom2 } from "@sylphx/lens-core";
1189
1183
  function createServerClientProxy(server) {
1190
1184
  function createProxy(path) {
1191
1185
  return new Proxy(() => {}, {
@@ -1199,7 +1193,7 @@ function createServerClientProxy(server) {
1199
1193
  },
1200
1194
  async apply(_, __, args) {
1201
1195
  const input = args[0];
1202
- const result = await resolveExecuteResult(server.execute({ path, input }));
1196
+ const result = await firstValueFrom2(server.execute({ path, input }));
1203
1197
  if (result.error) {
1204
1198
  throw result.error;
1205
1199
  }
@@ -1213,7 +1207,7 @@ async function handleWebQuery(server, path, url) {
1213
1207
  try {
1214
1208
  const inputParam = url.searchParams.get("input");
1215
1209
  const input = inputParam ? JSON.parse(inputParam) : undefined;
1216
- const result = await resolveExecuteResult(server.execute({ path, input }));
1210
+ const result = await firstValueFrom2(server.execute({ path, input }));
1217
1211
  if (result.error) {
1218
1212
  return Response.json({ error: result.error.message }, { status: 400 });
1219
1213
  }
@@ -1226,7 +1220,7 @@ async function handleWebMutation(server, path, request) {
1226
1220
  try {
1227
1221
  const body = await request.json();
1228
1222
  const input = body.input;
1229
- const result = await resolveExecuteResult(server.execute({ path, input }));
1223
+ const result = await firstValueFrom2(server.execute({ path, input }));
1230
1224
  if (result.error) {
1231
1225
  return Response.json({ error: result.error.message }, { status: 400 });
1232
1226
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sylphx/lens-server",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Server runtime for Lens API framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -37,21 +37,8 @@
37
37
  * ```
38
38
  */
39
39
 
40
- import { firstValueFrom, isObservable } from "@sylphx/lens-core";
40
+ import { firstValueFrom } from "@sylphx/lens-core";
41
41
  import type { LensServer } from "../server/create.js";
42
- import type { LensResult } from "../server/types.js";
43
-
44
- /**
45
- * Helper to resolve server.execute() result which may be Observable or Promise.
46
- * This provides backwards compatibility for test mocks that return Promises.
47
- */
48
- async function resolveExecuteResult<T>(result: unknown): Promise<LensResult<T>> {
49
- if (isObservable<LensResult<T>>(result)) {
50
- return firstValueFrom(result);
51
- }
52
- // Handle Promise or direct value (for backwards compatibility with test mocks)
53
- return result as Promise<LensResult<T>>;
54
- }
55
42
 
56
43
  // =============================================================================
57
44
  // Server Client Proxy
@@ -88,7 +75,7 @@ export function createServerClientProxy(server: LensServer): unknown {
88
75
  },
89
76
  async apply(_, __, args) {
90
77
  const input = args[0];
91
- const result = await resolveExecuteResult(server.execute({ path, input }));
78
+ const result = await firstValueFrom(server.execute({ path, input }));
92
79
 
93
80
  if (result.error) {
94
81
  throw result.error;
@@ -126,7 +113,7 @@ export async function handleWebQuery(
126
113
  const inputParam = url.searchParams.get("input");
127
114
  const input = inputParam ? JSON.parse(inputParam) : undefined;
128
115
 
129
- const result = await resolveExecuteResult(server.execute({ path, input }));
116
+ const result = await firstValueFrom(server.execute({ path, input }));
130
117
 
131
118
  if (result.error) {
132
119
  return Response.json({ error: result.error.message }, { status: 400 });
@@ -161,7 +148,7 @@ export async function handleWebMutation(
161
148
  const body = (await request.json()) as { input?: unknown };
162
149
  const input = body.input;
163
150
 
164
- const result = await resolveExecuteResult(server.execute({ path, input }));
151
+ const result = await firstValueFrom(server.execute({ path, input }));
165
152
 
166
153
  if (result.error) {
167
154
  return Response.json({ error: result.error.message }, { status: 400 });