|
@@ -101,6 +101,7 @@ const outputSchema = {
|
|
|
type: 'object',
|
|
type: 'object',
|
|
|
properties: {
|
|
properties: {
|
|
|
url: { type: 'string', description: 'Resolved request URL after interpolation' },
|
|
url: { type: 'string', description: 'Resolved request URL after interpolation' },
|
|
|
|
|
+ checksum: { type: 'string', description: 'SHA-256 content hash (binary mode only)' },
|
|
|
statusCode: { type: 'number' },
|
|
statusCode: { type: 'number' },
|
|
|
headers: { type: 'object' },
|
|
headers: { type: 'object' },
|
|
|
body: { type: 'any' },
|
|
body: { type: 'any' },
|
|
@@ -113,7 +114,8 @@ const outputSchema = {
|
|
|
data: { type: 'string', description: 'Base64-encoded content' },
|
|
data: { type: 'string', description: 'Base64-encoded content' },
|
|
|
mimeType: { type: 'string' },
|
|
mimeType: { type: 'string' },
|
|
|
filename: { type: 'string' },
|
|
filename: { type: 'string' },
|
|
|
- size: { type: 'number' }
|
|
|
|
|
|
|
+ size: { type: 'number' },
|
|
|
|
|
+ checksum: { type: 'string', description: 'SHA-256 of the base64 payload' }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
storage: {
|
|
storage: {
|
|
@@ -312,14 +314,21 @@ async function execute(config, input, context) {
|
|
|
const filename = extractFilename(responseHeaders, url);
|
|
const filename = extractFilename(responseHeaders, url);
|
|
|
const mimeType = contentType.split(';')[0].trim() || 'application/octet-stream';
|
|
const mimeType = contentType.split(';')[0].trim() || 'application/octet-stream';
|
|
|
|
|
|
|
|
|
|
+ // Content hash of the payload, so downstream nodes can deduplicate without
|
|
|
|
|
+ // re-hashing the image themselves.
|
|
|
|
|
+ const contentHash = smartbotic.utils.sha256(base64Data);
|
|
|
|
|
+
|
|
|
const fileObject = {
|
|
const fileObject = {
|
|
|
type: 'binary',
|
|
type: 'binary',
|
|
|
data: base64Data,
|
|
data: base64Data,
|
|
|
mimeType: mimeType,
|
|
mimeType: mimeType,
|
|
|
filename: filename,
|
|
filename: filename,
|
|
|
- size: byteLength
|
|
|
|
|
|
|
+ size: byteLength,
|
|
|
|
|
+ checksum: contentHash
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ result.checksum = contentHash;
|
|
|
|
|
+
|
|
|
result.file = fileObject;
|
|
result.file = fileObject;
|
|
|
result.body = null; // Don't include raw body for binary
|
|
result.body = null; // Don't include raw body for binary
|
|
|
|
|
|
|
@@ -329,7 +338,7 @@ async function execute(config, input, context) {
|
|
|
const ttlHours = config.downloadTtlHours || 0;
|
|
const ttlHours = config.downloadTtlHours || 0;
|
|
|
const ttlMs = ttlHours > 0 ? ttlHours * 60 * 60 * 1000 : 0;
|
|
const ttlMs = ttlHours > 0 ? ttlHours * 60 * 60 * 1000 : 0;
|
|
|
|
|
|
|
|
- const checksum = smartbotic.utils.sha256(base64Data);
|
|
|
|
|
|
|
+ const checksum = contentHash;
|
|
|
|
|
|
|
|
const storageDoc = {
|
|
const storageDoc = {
|
|
|
filename: filename,
|
|
filename: filename,
|