<commit_before>console.log('Loading function');

var doc = require('dynamodb-doc');

var dynamo = new doc.DynamoDB();

exports.handler = function (event, context) {
    console.log('event:', JSON.stringify(event));
    console.log('context:', JSON.stringify(context));

    var events;

    switch (event.method) {
        case 'GET':
            events = event.query.events;
            break;
        case 'POST':
            events = event.body.events;
    }

    JSON.parse(events).forEach(function (action) {
            "use strict";
            var operation = action.operation;


            switch (operation) {
                case 'create':
                    action.payload.forEach(function (item) {
                        dynamo.putItem(
                            {
                                'TableName': 'Scream',
                                'Item': {
                                    'me': context.identity.cognitoIdentityId,
                                    'ref': item
                                }
                            }
                            , context.done);
                    });
                    break;
                case 'list':
                    dynamo.query(
                        {
                            'TableName': 'Scream',
                            'KeyConditionExpression': "me = :me",
                            'ExpressionAttributeValues': {
                                ':me': context.identity.cognitoIdentityId
                            }
                        }
                        , context.done);
                    break;
                default:
                    context.fail(new Error('Unrecognized operation "' + operation + '"'));
            }
        }
    );
};<commit_msg>Updating code version with what is deployed on Lambda.<commit_after>console.log('Loading function');

var doc = require('dynamodb-doc');

var dynamo = new doc.DynamoDB();

exports.handler = function (event, context) {
    console.log('event:', JSON.stringify(event));
    console.log('context:', JSON.stringify(context));

    var events;

    switch (event.method) {
        case 'GET':
            events = event.query.events;
            break;
        case 'POST':
            events = event.body.events;
    }

    JSON.parse(events).forEach(function (action) {
            "use strict";
            var operation = action.operation;

            action.payload.TableName = 'SuperFriend';

            switch (operation) {
                case 'create':
                    action.payload.forEach(function (contact) {
                        dynamo.putItem(
                            {
                                'TableName': 'SuperFriend',
                                'Item': {
                                    'me': context.identity.cognitoIdentityId,
                                    'friend': contact
                                }
                            }
                            , context.done);
                    });
                    break;
                case 'list':
                    dynamo.query(
                        {
                            'TableName': 'SuperFriend',
                            'KeyConditionExpression': "me = :me",
                            'ExpressionAttributeValues': {
                                ':me': context.identity.cognitoIdentityId
                            }
                        }
                        , context.done);
                    break;
                default:
                    context.fail(new Error('Unrecognized operation "' + operation + '"'));
            }
        }
    );
};
{'fraction_non_alphanumeric': 0.10259880887926368, 'fraction_numerical': 0.0, 'mean_word_length': 0.9519281563655573, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7224000', 'n_tokens_mistral': 852, 'n_tokens_neox': 799, 'n_words': 152}