@coherentglobal/wasm-runner 0.0.65 → 0.0.67

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.
@@ -128,9 +128,9 @@ try {
128
128
 
129
129
  let isAsync = typeof instance._is_async === 'function' && instance._is_async(wb);
130
130
 
131
-
132
- const isMetadataSubSvc = req?.request_meta?.service_category && req?.request_meta?.service_category.split(',').some(c => c.toLowerCase() === 'metadata') && metadata !== undefined;
133
- const isFormSpecSubSvc = req?.request_meta?.service_category && req?.request_meta?.service_category.split(',').some(c => c.toLowerCase() === 'formspec') && formspec !== undefined;
131
+ const hasSubServices = req?.request_meta?.service_category && req?.request_meta?.service_category.split(',').map(d => d.toLowerCase())
132
+ const isMetadataSubSvc = hasSubServices.some(c => c === 'metadata') && metadata !== undefined;
133
+ const isFormSpecSubSvc = hasSubServices.some(c => c === 'formspec') && formspec !== undefined;
134
134
  const isAsyncCheck = isAsync === 1 || isAsync === true || isAsync === 'true'
135
135
 
136
136
  let result
@@ -156,15 +156,16 @@ try {
156
156
  result.response_data = {}
157
157
  }
158
158
  const imageOutputs = metadata.ImageOutputs.reduce( (prev, curr) => {
159
- if(!curr.ImageName) return prev
160
- prev[curr.ImageName] = curr.Base64Content
159
+ if(!curr?.ImageName) return prev
160
+ prev[curr.ImageName] = curr?.Base64Content || ""
161
161
  return prev
162
162
  }, {})
163
163
  const metadataOutput = {
164
164
  ...metadata?.Outputs,
165
- ...imageOutputs
165
+ ...imageOutputs,
166
+ ...result.response_data.outputs
166
167
  }
167
- result.response_data.outputs = Object.assign({}, result.response_data.outputs, metadataOutput);
168
+ result.response_data.outputs = Object.assign({}, metadataOutput);
168
169
  return rawString ? JSON.stringify(result) : result;
169
170
  }
170
171
 
@@ -204,15 +205,16 @@ try {
204
205
  result.response_data = {}
205
206
  }
206
207
  const imageOutputs = metadata.ImageOutputs.reduce( (prev, curr) => {
207
- if(!curr.ImageName) return prev
208
- prev[curr.ImageName] = curr.Base64Content
208
+ if(!curr?.ImageName) return prev
209
+ prev[curr.ImageName] = curr?.Base64Content || ""
209
210
  return prev
210
211
  }, {})
211
212
  const metadataOutput = {
212
213
  ...metadata?.Outputs,
213
- ...imageOutputs
214
+ ...imageOutputs,
215
+ ...result.response_data.outputs
214
216
  }
215
- result.response_data.outputs = Object.assign({}, result.response_data.outputs, metadataOutput);
217
+ result.response_data.outputs = Object.assign({}, metadataOutput);
216
218
  return rawString ? JSON.stringify(result) : result;
217
219
  }
218
220
 
@@ -252,15 +254,16 @@ try {
252
254
  result.response_data = {}
253
255
  }
254
256
  const imageOutputs = metadata.ImageOutputs.reduce( (prev, curr) => {
255
- if(!curr.ImageName) return prev
256
- prev[curr.ImageName] = curr.Base64Content
257
+ if(!curr?.ImageName) return prev
258
+ prev[curr.ImageName] = curr?.Base64Content || ""
257
259
  return prev
258
260
  }, {})
259
261
  const metadataOutput = {
260
262
  ...metadata?.Outputs,
261
- ...imageOutputs
263
+ ...imageOutputs,
264
+ ...result.response_data.outputs
262
265
  }
263
- result.response_data.outputs = Object.assign({}, result.response_data.outputs, metadataOutput);
266
+ result.response_data.outputs = Object.assign({}, metadataOutput);
264
267
  return rawString ? JSON.stringify(result) : result;
265
268
  }
266
269
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coherentglobal/wasm-runner",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "description": "Coherent WASM runner for Javascript and Node.js",
5
5
  "main": "dist/node.js",
6
6
  "browser": "dist/browser.js",