meshy-node 0.1.4 → 0.1.5

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/main.cjs +27 -8
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # meshy-node
2
2
 
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
 
5
5
  This package contains the built Meshy standalone node runtime only.
6
6
  It intentionally excludes repository source files and TypeScript sources.
package/main.cjs CHANGED
@@ -32819,8 +32819,9 @@ var DEFAULT_NODE_REQUEST_TIMEOUT_MS = 1500;
32819
32819
  function getNodePublicEndpoint(node) {
32820
32820
  return node.devtunnelEndpoint ?? node.endpoint;
32821
32821
  }
32822
- function getNodeRequestEndpoints(node) {
32823
- return node.devtunnelEndpoint && node.devtunnelEndpoint !== node.endpoint ? [node.endpoint, node.devtunnelEndpoint] : [node.endpoint];
32822
+ function getNodeRequestEndpoints(node, options = {}) {
32823
+ const endpoints = options.preferPublicEndpoint ? [node.devtunnelEndpoint, node.endpoint] : [node.endpoint, node.devtunnelEndpoint];
32824
+ return endpoints.filter((endpoint, index, values) => typeof endpoint === "string" && endpoint.length > 0 && values.indexOf(endpoint) === index);
32824
32825
  }
32825
32826
  function createRequestSignal(signal, timeoutMs) {
32826
32827
  const controller = new AbortController();
@@ -32850,9 +32851,9 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_NODE_REQUEST_TIME
32850
32851
  cleanup();
32851
32852
  }
32852
32853
  }
32853
- async function fetchNodeWithFallback(node, path17, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace) {
32854
+ async function fetchNodeWithFallback(node, path17, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
32854
32855
  let lastError;
32855
- const endpoints = getNodeRequestEndpoints(node);
32856
+ const endpoints = getNodeRequestEndpoints(node, options);
32856
32857
  for (const [index, endpoint] of endpoints.entries()) {
32857
32858
  const attempt = index + 1;
32858
32859
  trace?.onAttempt?.({ attempt, endpoint, path: path17, timeoutMs, totalEndpoints: endpoints.length });
@@ -41861,7 +41862,14 @@ async function handlePreviewProxyRequest(manager, nodeRegistry, logger27, req, r
41861
41862
  }
41862
41863
  const previewLog = logger27.child("preview-proxy");
41863
41864
  const proxyPath = buildPreviewAssetProxyPath(previewRequest.token, previewRequest.requestedPath);
41864
- const { endpoint, response } = await fetchNodeWithFallback(node, proxyPath);
41865
+ const { endpoint, response } = await fetchNodeWithFallback(
41866
+ node,
41867
+ proxyPath,
41868
+ void 0,
41869
+ void 0,
41870
+ void 0,
41871
+ { preferPublicEndpoint: true }
41872
+ );
41865
41873
  previewLog.debug("proxying preview asset from assigned worker", {
41866
41874
  token: previewRequest.token,
41867
41875
  nodeId: session.nodeId,
@@ -42299,7 +42307,8 @@ async function maybeHandleRemoteNodeWorkDirRequest(req, res, nodeId) {
42299
42307
  proxyPath,
42300
42308
  void 0,
42301
42309
  NODE_WORKDIR_PROXY_TIMEOUT_MS,
42302
- createNodeWorkdirProxyTrace(log2, nodeId, proxyPath)
42310
+ createNodeWorkdirProxyTrace(log2, nodeId, proxyPath),
42311
+ { preferPublicEndpoint: true }
42303
42312
  );
42304
42313
  log2.debug("proxying node workdir request", {
42305
42314
  nodeId,
@@ -42689,7 +42698,10 @@ async function maybeHandleRemoteTaskOutputRequest(req, res, taskId, subPath, ini
42689
42698
  const { endpoint, response: proxyRes } = await fetchNodeWithFallback(
42690
42699
  node,
42691
42700
  proxyPath,
42692
- init
42701
+ init,
42702
+ void 0,
42703
+ void 0,
42704
+ { preferPublicEndpoint: true }
42693
42705
  );
42694
42706
  log2.debug("proxying task output request to worker node API", {
42695
42707
  taskId,
@@ -43067,7 +43079,14 @@ function createTaskRoutes() {
43067
43079
  if (node) {
43068
43080
  const proxyPath = `/api/tasks/${taskId}/logs?after=${after}`;
43069
43081
  try {
43070
- const { endpoint, response: proxyRes } = await fetchNodeWithFallback(node, proxyPath);
43082
+ const { endpoint, response: proxyRes } = await fetchNodeWithFallback(
43083
+ node,
43084
+ proxyPath,
43085
+ void 0,
43086
+ void 0,
43087
+ void 0,
43088
+ { preferPublicEndpoint: true }
43089
+ );
43071
43090
  const proxyUrl = `${endpoint}${proxyPath}`;
43072
43091
  log2.debug("proxying request", { url: proxyUrl });
43073
43092
  log2.debug("proxy response", { status: proxyRes.status });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meshy-node",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "description": "Standalone Meshy node package with bundled runtime and dashboard assets.",
6
6
  "type": "commonjs",