const genDynamoEvent = (correlationIDs = {}) => { const event = _.cloneDeep(dynamo) const data = { '__context__': correlationIDs } const record = event.Records[0] const unmarshalledNewImage = dynamoDbClient.Converter.unmarshall(record.dynamodb.NewImage) const newImage = Object.assign(unmarshalledNewImage, data) record.dynamodb.NewImage = dynamoDbClient.Converter.marshall(newImage) return event }
function writeSimple (ps, type, data) { if (typeof data === 'undefined') { throw new Error( "Serialisation of JS 'undefined' type is not supported by d-bus" ); } if (data === null) { throw new Error('Serialisation of null value is not supported by d-bus'); } if (Buffer.isBuffer(data)) data = data.toString(); // encoding? if (stringTypes.indexOf(type) !== -1 && typeof data !== 'string') { throw new Error( `Expected string or buffer argument, got ${JSON.stringify( data )} of type '${type}'` ); } var simpleMarshaller = Marshallers.MakeSimpleMarshaller(type); simpleMarshaller.marshall(ps, data); return ps; }
function marshallMessage (msg) { // XXX The connection accepts a message body in plain js format and converts // it to the marshaller format for writing. These two formats should be // unified. const { signature = '', body = [] } = msg; const signatureTree = parseSignature(signature); if (signatureTree.length !== body.length) { throw new Error(`Expected ${signatureTree.length} body elements for signature '${signature}' (got ${body.length})`); } const marshallerBody = []; for (let i = 0; i < body.length; ++i) { if (signatureTree[i].type === 'v') { if (body[i].constructor !== Variant) { throw new Error(`Expected a Variant() argument for position ${i + 1} (value='${body[i]}')`); } marshallerBody.push(jsToMarshalFmt(body[i].signature, body[i].value)); } else { marshallerBody.push(jsToMarshalFmt(signatureTree[i], body[i])[1]); } } msg.signature = signature; msg.body = marshallerBody; return message.marshall(msg); }
.then(data => { data.Items.forEach(item => { if (cli.flags.marshall) { item = AWS.DynamoDB.Converter.unmarshall(item);
marshalledTypes[idx] = marshaller.type; return marshaller.marshall(subMessage);
let marshaller = this.getForkedActorReferenceMarshaller(); return marshaller.marshall(value) .then(marshalledValue => { memo[key] = marshalledValue;
const genDynamoEvent = (correlationIDs = {}) => { const event = _.cloneDeep(dynamo) const data = { '__context__': correlationIDs } const record = event.Records[0] const unmarshalledNewImage = dynamoDbClient.Converter.unmarshall(record.dynamodb.NewImage) const newImage = Object.assign(unmarshalledNewImage, data) record.dynamodb.NewImage = dynamoDbClient.Converter.marshall(newImage) return event }