in knative-build/runtimes/javascript/platform/knative.js [113:164]
function preProcessInitData(initdata, valuedata, activationdata) {
DEBUG.functionStart();
try {
// Look for init data within the request (i.e., "stem cell" runtime, where code is injected by request)
if (typeof(initdata) !== "undefined") {
if (initdata.main && typeof initdata.main === 'string') {
valuedata.main = initdata.main;
}
if (initdata.code && typeof initdata.code === 'string') {
valuedata.code = initdata.code;
}
if (initdata.binary) {
if (typeof initdata.binary === 'boolean') {
valuedata.binary = initdata.binary;
} else {
throw ("Invalid Init. data; expected boolean for key 'binary'.");
}
}
if (initdata.raw) {
if (typeof initdata.raw === 'boolean') {
valuedata.raw = initdata.raw;
} else {
throw ("Invalid Init. data; expected boolean for key 'raw'.");
}
}
if (initdata.url && typeof initdata.url === 'string') {
valuedata.url = initdata.url;
}
// Action name is a special case, as we have a key collision on "name" between init. data and request
// param. data (as they both appear within "body.value") so we must save it to its final location
// as the default Action name as part of the activation data
if (initdata.name && typeof initdata.name === 'string') {
if (typeof (activationdata) !== "undefined") {
if (typeof (activationdata.action_name) === "undefined" ||
(typeof (activationdata.action_name) === "string" &&
activationdata.action_name.length === 0)) {
activationdata.action_name = initdata.name;
}
}
}
DEBUG.dumpObject(valuedata, "valuedata");
}
} catch(e){
console.error(e);
DEBUG.functionEndError(e.message);
throw("Unable to process Initialization data: " + e.message);
}
DEBUG.functionEnd();
}