vmlive 1.0.21 → 1.0.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vmlive",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "Local development VM for custom Serverless PaaS",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,4 +18,4 @@
18
18
  "devDependencies": {
19
19
  "vitest": "^3.2.4"
20
20
  }
21
- }
21
+ }
package/src/cli.js CHANGED
@@ -508,7 +508,7 @@ const runDev = async () => {
508
508
 
509
509
  config.functions.forEach(fn => {
510
510
  const relativeTarget = `./${fn.name}-out.mjs`;
511
- fs.writeFileSync(path.join(WORK_DIR, `${fn.name}-shim.mjs`), generateShim(relativeTarget, workspaceId, projectId, fn.name));
511
+ fs.writeFileSync(path.join(WORK_DIR, `${fn.name}-shim.mjs`), generateShim(relativeTarget, workspaceId, projectId, fn.name, jwtToken));
512
512
  });
513
513
 
514
514
  await mf.setOptions({
@@ -125,10 +125,10 @@ export default {
125
125
  const req = new Request(\`https://rpc.vm.codes/.internal/rpc/\${serviceName.toLowerCase()}/\${method}\`, {
126
126
  method: "POST",
127
127
  headers: {
128
- "Authorization": "Bearer \${jwtToken || 'local'}",
128
+ ${jwtToken ? `"Authorization": "Bearer ${jwtToken}",` : ''}
129
129
  "Content-Type": contentType,
130
- "x-workspace-id": "\${workspaceId}",
131
- "x-project-id": "\${projectId}"
130
+ "x-workspace-id": "${workspaceId}",
131
+ "x-project-id": "${projectId}"
132
132
  },
133
133
  body
134
134
  });
@@ -139,6 +139,9 @@ export default {
139
139
  if (res.headers.get("Content-Type")?.includes("text/event-stream")) {
140
140
  return res.body;
141
141
  }
142
+ if (serviceName === "AI" && method === "draw") {
143
+ return await res.arrayBuffer();
144
+ }
142
145
  return await res.json();
143
146
  }
144
147
  }