Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
let expect = require('chai').expect;
let datafire = require('datafire');
let http = require('../integrations/manual/http');
let echo = new datafire.Action({
handler: (input, context) => {
return context.request;
}
})
let target = new datafire.Project({
paths: {
'/foo': {
get: {
action: {
handler: i => 'foo',
}
}
},
'/body': {
patch: {
if (inputParam.schema) inputSchema.allOf = [inputParam.schema];
(op.parameters || []).forEach(p => {
if (p.name !== 'Action' && p.name !== 'Version' && p.name !== 'body' && !p.name.startsWith('X-')) {
inputSchema.properties[maybeCamelCase(p.name)] = {type: p.type};
if (p.required) {
inputSchema.required = inputSchema.required || [];
inputSchema.required.push(p.name);
}
}
})
function getSchema(schema) {
if (!schema) return;
return Object.assign({definitions: openapi.definitions}, schema);
}
integ.addAction(actionID, new datafire.Action({
inputSchema: getSchema(inputSchema),
outputSchema: getSchema(response.schema),
handler: (input, context) => {
let lib = new aws[SDK_ID](Object.assign({
version: openapi.info.version,
}, context.accounts[INTEGRATION_ID]));
return lib[functionID](input).promise()
.then(data => {
return JSON.parse(JSON.stringify(data));
})
}
}));
}
}
if (inputParam.schema) inputSchema.allOf = [inputParam.schema];
(op.parameters || []).forEach(p => {
if (p.name !== 'Action' && p.name !== 'Version' && p.name !== 'body' && !p.name.startsWith('X-')) {
inputSchema.properties[maybeCamelCase(p.name)] = {type: p.type};
if (p.required) {
inputSchema.required = inputSchema.required || [];
inputSchema.required.push(p.name);
}
}
})
function getSchema(schema) {
if (!schema) return;
return Object.assign({definitions: openapi.definitions}, schema);
}
integ.addAction(actionID, new datafire.Action({
inputSchema: getSchema(inputSchema),
outputSchema: getSchema(response.schema),
handler: (input, context) => {
let lib = new aws[SDK_ID](Object.assign({
version: openapi.info.version,
}, context.accounts[INTEGRATION_ID]));
return lib[functionID](input).promise()
.then(data => {
return JSON.parse(JSON.stringify(data));
})
}
}));
}
}
if (inputParam.schema) inputSchema.allOf = [inputParam.schema];
(op.parameters || []).forEach(p => {
if (p.name !== 'Action' && p.name !== 'Version' && p.name !== 'body' && !p.name.startsWith('X-')) {
inputSchema.properties[maybeCamelCase(p.name)] = {type: p.type};
if (p.required) {
inputSchema.required = inputSchema.required || [];
inputSchema.required.push(p.name);
}
}
})
function getSchema(schema) {
if (!schema) return;
return Object.assign({definitions: openapi.definitions}, schema);
}
integ.addAction(actionID, new datafire.Action({
inputSchema: getSchema(inputSchema),
outputSchema: getSchema(response.schema),
handler: (input, context) => {
let lib = new aws[SDK_ID](Object.assign({
version: openapi.info.version,
}, context.accounts[INTEGRATION_ID]));
return lib[functionID](input).promise()
.then(data => {
return JSON.parse(JSON.stringify(data));
})
}
}));
}
}
if (inputParam.schema) inputSchema.allOf = [inputParam.schema];
(op.parameters || []).forEach(p => {
if (p.name !== 'Action' && p.name !== 'Version' && p.name !== 'body' && !p.name.startsWith('X-')) {
inputSchema.properties[maybeCamelCase(p.name)] = {type: p.type};
if (p.required) {
inputSchema.required = inputSchema.required || [];
inputSchema.required.push(p.name);
}
}
})
function getSchema(schema) {
if (!schema) return;
return Object.assign({definitions: openapi.definitions}, schema);
}
integ.addAction(actionID, new datafire.Action({
inputSchema: getSchema(inputSchema),
outputSchema: getSchema(response.schema),
handler: (input, context) => {
let lib = new aws[SDK_ID](Object.assign({
version: openapi.info.version,
}, context.accounts[INTEGRATION_ID]));
return lib[functionID](input).promise()
.then(data => {
return JSON.parse(JSON.stringify(data));
})
}
}));
}
}
if (inputParam.schema) inputSchema.allOf = [inputParam.schema];
(op.parameters || []).forEach(p => {
if (p.name !== 'Action' && p.name !== 'Version' && p.name !== 'body' && !p.name.startsWith('X-')) {
inputSchema.properties[maybeCamelCase(p.name)] = {type: p.type};
if (p.required) {
inputSchema.required = inputSchema.required || [];
inputSchema.required.push(p.name);
}
}
})
function getSchema(schema) {
if (!schema) return;
return Object.assign({definitions: openapi.definitions}, schema);
}
integ.addAction(actionID, new datafire.Action({
inputSchema: getSchema(inputSchema),
outputSchema: getSchema(response.schema),
handler: (input, context) => {
let lib = new aws[SDK_ID](Object.assign({
version: openapi.info.version,
}, context.accounts[INTEGRATION_ID]));
return lib[functionID](input).promise()
.then(data => {
return JSON.parse(JSON.stringify(data));
})
}
}));
}
}
"use strict";
let datafire = require('datafire');
var google_sheets = require('@datafire/google_sheets').actions;
module.exports = new datafire.Action({
description: "Creates a new item in the spreadsheet",
inputs: [{
title: "name",
type: "string",
maxLength: 100,
minLength: 1
}, {
title: "age",
type: "integer",
minimum: 0,
maximum: 200
}],
handler: (input, context) => {
return datafire.flow(context)
.then(_ => google_sheets.spreadsheets.values.append({
spreadsheetId: context.variables.spreadsheet_id,
"use strict";
let datafire = require('datafire');
let google_sheets = require('@datafire/google_sheets').actions;
let inputs = require('./create').inputs;
function getColumnLetter(idx) {
return String.fromCharCode(idx + 64);
}
const PAGE_SIZE = 10;
module.exports = new datafire.Action({
description: "",
handler: (input, context) => {
let startRow = 1;
let endRow = startRow + PAGE_SIZE - 1;
let startCol = 1;
let endCol = inputs.length;
return datafire.flow(context)
.then(_ => google_sheets.spreadsheets.values.get({
spreadsheetId: "15bv6kNNBkXp4SkuZ5eVh00E7nrEqHAu382aYp2sqUyA",
range: getColumnLetter(startCol) + startRow + ':' + getColumnLetter(endCol) + endRow,
}, context))
.then(data => {
return data.values.map((row, rowNum) => {
let obj = {id: rowNum + 1};
inputs.forEach((input, idx) => {
obj[input.title] = row[idx]
"use strict";
let datafire = require('datafire');
var google_sheets = require('@datafire/google_sheets').actions;
module.exports = new datafire.Action({
inputs: [{
title: "title",
type: "string"
}],
handler: (input, context) => {
return datafire.flow(context)
.then(_ => google_sheets.spreadsheets.create({
body: {
properties: {
title: input.title,
},
},
}, context))
},
});
"use strict";
let datafire = require('datafire');
let google_sheets = require('@datafire/google_sheets').actions;
let inputs = require('./create').inputs;
function getColumnLetter(idx) {
return String.fromCharCode(idx + 64);
}
const PAGE_SIZE = 10;
module.exports = new datafire.Action({
description: "",
handler: (input, context) => {
let startRow = 1;
let endRow = startRow + PAGE_SIZE - 1;
let startCol = 1;
let endCol = inputs.length;
return datafire.flow(context)
.then(_ => google_sheets.spreadsheets.values.get({
spreadsheetId: context.variables.spreadsheet_id,
range: getColumnLetter(startCol) + startRow + ':' + getColumnLetter(endCol) + endRow,
valueRenderOption: "UNFORMATTED_VALUE",
}, context))
.then(data => {
let rows = (data.values || []).map((row, rowNum) => {
let obj = {id: rowNum + 1};
inputs.forEach((input, idx) => {