"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
async function sendData(request, settings, payloads) {
    const environment = settings.environment;
    const url = environment == 'prod'
        ? 'https://segment-intake.spiffy.ai/v1/intake'
        : 'https://segment-intake.dev.spiffy.ai/v1/intake';
    return request(url, {
        method: 'put',
        json: {
            payload: JSON.stringify(payloads)
        }
    });
}
const action = {
    title: 'Send',
    description: 'Send data to Spiffy.AI',
    defaultSubscription: 'type = "track" or type = "identify" or type = "page" or type = "screen" or type = "group"',
    fields: {
        payload: {
            label: 'Payload',
            description: 'The data to send to Spiffy.AI',
            type: 'object',
            required: true,
            default: { '@path': '$.' }
        },
        headers: {
            label: 'Headers',
            description: 'Header data to send to Spiffy. Format is Header key, Header value (optional).',
            type: 'object',
            defaultObjectUI: 'keyvalue:only'
        }
    },
    perform: async (request, { settings, payload }) => {
        return sendData(request, settings, [payload]);
    },
    performBatch: async (request, { settings, payload }) => {
        return sendData(request, settings, payload);
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map