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 +2 -2
- package/src/cli.js +1 -1
- package/src/string-shim.js +6 -3
package/package.json
CHANGED
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({
|
package/src/string-shim.js
CHANGED
|
@@ -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
|
|
128
|
+
${jwtToken ? `"Authorization": "Bearer ${jwtToken}",` : ''}
|
|
129
129
|
"Content-Type": contentType,
|
|
130
|
-
"x-workspace-id": "
|
|
131
|
-
"x-project-id": "
|
|
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
|
}
|