diff --git a/src/components/ColumnModals/ColumnConfigModal/DefaultValueInput.tsx b/src/components/ColumnModals/ColumnConfigModal/DefaultValueInput.tsx index 659ca831..5146c387 100644 --- a/src/components/ColumnModals/ColumnConfigModal/DefaultValueInput.tsx +++ b/src/components/ColumnModals/ColumnConfigModal/DefaultValueInput.tsx @@ -53,15 +53,17 @@ function CodeEditor({ type, column, handleChange }: ICodeEditorProps) { } else if (column.config?.defaultValue?.dynamicValueFn) { dynamicValueFn = column.config?.defaultValue?.dynamicValueFn; } else if (column.config?.defaultValue?.script) { - dynamicValueFn = `const dynamicValueFn : DefaultValue = async ({row,ref,db,storage,auth,logging})=>{ + dynamicValueFn = `const dynamicValueFn: DefaultValue = async ({row,ref,db,storage,auth,logging})=>{ // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("dynamicValueFn started") ${column.config?.defaultValue.script} // WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY }`; } else { - dynamicValueFn = `const dynamicValueFn : DefaultValue = async ({row,ref,db,storage,auth,logging})=>{ + dynamicValueFn = `const dynamicValueFn: DefaultValue = async ({row,ref,db,storage,auth,logging})=>{ // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("dynamicValueFn started") // Example: generate random hex color // const color = "#" + Math.floor(Math.random() * 16777215).toString(16); diff --git a/src/components/TableModals/ExtensionsModal/utils.ts b/src/components/TableModals/ExtensionsModal/utils.ts index 6fe636cf..30974b44 100644 --- a/src/components/TableModals/ExtensionsModal/utils.ts +++ b/src/components/TableModals/ExtensionsModal/utils.ts @@ -63,6 +63,7 @@ export const triggerTypes: ExtensionTrigger[] = ["create", "update", "delete"]; const extensionBodyTemplate = { task: `const extensionBody: TaskBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("extensionBody started") // Task Extension is very flexible, you can do anything. // From updating other documents in your database, to making an api request to 3rd party service. @@ -90,7 +91,8 @@ const extensionBodyTemplate = { }`, docSync: `const extensionBody: DocSyncBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY - + logging.log("extensionBody started") + return ({ fieldsToSync: [], // a list of string of column names row: row, // object of data to sync, usually the row itself @@ -100,6 +102,7 @@ const extensionBodyTemplate = { }`, historySnapshot: `const extensionBody: HistorySnapshotBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("extensionBody started") return ({ trackedFields: [], // a list of string of column names @@ -109,6 +112,7 @@ const extensionBodyTemplate = { }`, algoliaIndex: `const extensionBody: AlgoliaIndexBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("extensionBody started") return ({ fieldsToSync: [], // a list of string of column names @@ -120,7 +124,8 @@ const extensionBodyTemplate = { }`, meiliIndex: `const extensionBody: MeiliIndexBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY - + logging.log("extensionBody started") + return({ fieldsToSync: [], // a list of string of column names row: row, // object of data to sync, usually the row itself @@ -131,7 +136,8 @@ const extensionBodyTemplate = { }`, bigqueryIndex: `const extensionBody: BigqueryIndexBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY - + logging.log("extensionBody started") + return ({ fieldsToSync: [], // a list of string of column names row: row, // object of data to sync, usually the row itself @@ -142,6 +148,7 @@ const extensionBodyTemplate = { }`, slackMessage: `const extensionBody: SlackMessageBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("extensionBody started") return ({ channels: [], // a list of slack channel IDs in string @@ -153,6 +160,7 @@ const extensionBodyTemplate = { }`, sendgridEmail: `const extensionBody: SendgridEmailBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("extensionBody started") return ({ from: "Name", // send from field @@ -174,6 +182,7 @@ const extensionBodyTemplate = { }`, apiCall: `const extensionBody: ApiCallBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("extensionBody started") return ({ body: "", @@ -185,6 +194,7 @@ const extensionBodyTemplate = { }`, twilioMessage: `const extensionBody: TwilioMessageBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("extensionBody started") // Setup twilio secret key: https://docs.rowy.io/extensions/twilio-message#secret-manager-setup // Add any code here to customize your message or dynamically get the from/to numbers @@ -197,6 +207,7 @@ const extensionBodyTemplate = { }`, pushNotification: `const extensionBody: PushNotificationBody = async({row, db, change, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("extensionBody started") // You can use FCM token from the row or from the user document in the database // const FCMtoken = row.FCMtoken @@ -248,6 +259,7 @@ export function emptyExtensionObject( trackedFields: [], conditions: `const condition: Condition = async({row, change, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("condition started") return true; // WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY diff --git a/src/components/TableModals/WebhooksModal/Schemas/basic.tsx b/src/components/TableModals/WebhooksModal/Schemas/basic.tsx index 6c7ab3de..dfd6f74d 100644 --- a/src/components/TableModals/WebhooksModal/Schemas/basic.tsx +++ b/src/components/TableModals/WebhooksModal/Schemas/basic.tsx @@ -66,7 +66,8 @@ export const webhookBasic = { table: TableSettings ) => `const basicParser: Parser = async({req, db, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY - + logging.log("basicParser started") + // Optionally return an object to be added as a new row to the table // Example: add the webhook body as row const {body} = req; @@ -91,6 +92,7 @@ export const webhookBasic = { table: TableSettings ) => `const condition: Condition = async({ref, req, db, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("condition started") return true; // WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY diff --git a/src/components/TableModals/WebhooksModal/Schemas/sendgrid.tsx b/src/components/TableModals/WebhooksModal/Schemas/sendgrid.tsx index bafa321a..4330e54f 100644 --- a/src/components/TableModals/WebhooksModal/Schemas/sendgrid.tsx +++ b/src/components/TableModals/WebhooksModal/Schemas/sendgrid.tsx @@ -15,6 +15,7 @@ export const webhookSendgrid = { table: TableSettings ) => `const sendgridParser: Parser = async ({ req, db, ref, logging }) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("sendgridParser started") const { body } = req const eventHandler = async (sgEvent) => { @@ -41,6 +42,7 @@ export const webhookSendgrid = { table: TableSettings ) => `const condition: Condition = async({ref, req, db, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("condition started") return true; // WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY diff --git a/src/components/TableModals/WebhooksModal/Schemas/stripe.tsx b/src/components/TableModals/WebhooksModal/Schemas/stripe.tsx index e77e1df7..bd088745 100644 --- a/src/components/TableModals/WebhooksModal/Schemas/stripe.tsx +++ b/src/components/TableModals/WebhooksModal/Schemas/stripe.tsx @@ -17,8 +17,9 @@ export const webhookStripe = { extraLibs: null, template: ( table: TableSettings - ) => `const sendgridParser: Parser = async ({ req, db, ref, logging }) => { + ) => `const stripeParser: Parser = async ({ req, db, ref, logging }) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("stripeParser started") const event = req.body switch (event.type) { @@ -39,6 +40,7 @@ export const webhookStripe = { table: TableSettings ) => `const condition: Condition = async({ref, req, db, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("condition started") return true; // WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY diff --git a/src/components/TableModals/WebhooksModal/Schemas/typeform.tsx b/src/components/TableModals/WebhooksModal/Schemas/typeform.tsx index bf42b781..922145f6 100644 --- a/src/components/TableModals/WebhooksModal/Schemas/typeform.tsx +++ b/src/components/TableModals/WebhooksModal/Schemas/typeform.tsx @@ -15,6 +15,7 @@ export const webhookTypeform = { table: TableSettings ) => `const typeformParser: Parser = async({req, db, ref, logging}) =>{ // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("typeformParser started") // This reduces the form submission into a single object of key value pairs // Example: {name: "John", age: 20} @@ -73,6 +74,7 @@ export const webhookTypeform = { table: TableSettings ) => `const condition: Condition = async({ref, req, db, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("condition started") return true; // WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY diff --git a/src/components/TableModals/WebhooksModal/Schemas/webform.tsx b/src/components/TableModals/WebhooksModal/Schemas/webform.tsx index abad9c29..e8d89884 100644 --- a/src/components/TableModals/WebhooksModal/Schemas/webform.tsx +++ b/src/components/TableModals/WebhooksModal/Schemas/webform.tsx @@ -16,6 +16,7 @@ export const webhook = { table: TableSettings ) => `const formParser: Parser = async({req, db, ref, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("formParser started") // Optionally return an object to be added as a new row to the table // Example: add the webhook body as row @@ -41,6 +42,7 @@ export const webhook = { table: TableSettings ) => `const condition: Condition = async({ref, req, db, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("condition started") return true; // WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY diff --git a/src/components/fields/Action/templates.ts b/src/components/fields/Action/templates.ts index 9d8779c8..c16ff361 100644 --- a/src/components/fields/Action/templates.ts +++ b/src/components/fields/Action/templates.ts @@ -1,5 +1,6 @@ export const RUN_ACTION_TEMPLATE = `const action:Action = async ({row,ref,db,storage,auth,actionParams,user,logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("action started") // Example: /* @@ -30,6 +31,7 @@ export const RUN_ACTION_TEMPLATE = `const action:Action = async ({row,ref,db,sto export const UNDO_ACTION_TEMPLATE = `const action : Action = async ({row,ref,db,storage,auth,actionParams,user,logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("action started") // Example: /* diff --git a/src/components/fields/Connector/utils.ts b/src/components/fields/Connector/utils.ts index a9668ccb..a86eec0b 100644 --- a/src/components/fields/Connector/utils.ts +++ b/src/components/fields/Connector/utils.ts @@ -13,6 +13,7 @@ export const replacer = (data: any) => (m: string, key: string) => { export const baseFunction = `const connectorFn: Connector = async ({query, row, user, logging}) => { // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("connectorFn started") return []; // WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY diff --git a/src/components/fields/Derivative/Settings.tsx b/src/components/fields/Derivative/Settings.tsx index 14cbd393..f5bb5176 100644 --- a/src/components/fields/Derivative/Settings.tsx +++ b/src/components/fields/Derivative/Settings.tsx @@ -66,13 +66,15 @@ export default function Settings({ ? config.derivativeFn : config?.script ? `const derivative:Derivative = async ({row,ref,db,storage,auth,logging})=>{ - // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY - + // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("derivative started") + ${config.script.replace(/utilFns.getSecret/g, "rowy.secrets.get")} // WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY }` : `const derivative:Derivative = async ({row,ref,db,storage,auth,logging})=>{ // WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY + logging.log("derivative started") // Example: // const sum = row.a + row.b;