aa5d30a911
As title fixes "app add" and "app init" commands adds tests
36 lines
800 B
TypeScript
36 lines
800 B
TypeScript
import kebabCase from 'lodash.kebabcase';
|
|
import { v4 } from 'uuid';
|
|
|
|
export const getServerlessFunctionBaseFile = ({
|
|
name,
|
|
universalIdentifier = v4(),
|
|
}: {
|
|
name: string;
|
|
universalIdentifier?: string;
|
|
}) => {
|
|
const kebabCaseName = kebabCase(name);
|
|
|
|
return `import { type ServerlessFunctionConfig } from 'twenty-sdk/application';
|
|
|
|
export const main = async (params: {
|
|
a: string;
|
|
b: number;
|
|
}): Promise<{ message: string }> => {
|
|
const { a, b } = params;
|
|
|
|
// Rename the parameters and code below with your own logic
|
|
// This is just an example
|
|
const message = \`Hello, input: $\{a} and $\{b}\`;
|
|
|
|
return { message };
|
|
};
|
|
|
|
export const config: ServerlessFunctionConfig = {
|
|
universalIdentifier: '${universalIdentifier}',
|
|
name: '${kebabCaseName}',
|
|
timeoutSeconds: 5,
|
|
};
|
|
|
|
`;
|
|
};
|