Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions components/liveswitch/actions/create-contact/create-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import app from "../../liveswitch.app.mjs";

export default {
key: "liveswitch-create-contact",
name: "Create Contact",
description: "Create a contact in LiveSwitch [See the documentation](https://developer.liveswitch.com/reference/post_v1-contacts)",
version: "0.0.1",
type: "action",
props: {
app,
phone: {
propDefinition: [
app,
"phone",
],
},
firstName: {
propDefinition: [
app,
"firstName",
],
},
lastName: {
propDefinition: [
app,
"lastName",
],
},
email: {
propDefinition: [
app,
"email",
],
},
},

async run({ $ }) {
const response = await this.app.createContact({
$,
data: {
phone: this.phone,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
},
});

$.export("$summary", `Successfully created Contact with ID: ${response.id}`);

return response;
},
Comment on lines +37 to +51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add error handling and input validation.

The current implementation could be more robust with:

  1. Error handling for API failures
  2. Input validation before making the API call
  3. Response validation before using response.id

Consider implementing these improvements:

 async run({ $ }) {
+  // Validate that at least one contact field is provided
+  if (!this.phone && !this.email && !this.firstName && !this.lastName) {
+    throw new Error('At least one contact field (phone, email, firstName, lastName) must be provided');
+  }
+
+  try {
     const response = await this.app.createContact({
       $,
       data: {
         phone: this.phone,
         firstName: this.firstName,
         lastName: this.lastName,
         email: this.email,
       },
     });
 
+    if (!response?.id) {
+      throw new Error('Invalid response: missing contact ID');
+    }
+
     $.export("$summary", `Successfully created Contact with ID: ${response.id}`);
 
     return response;
+  } catch (error) {
+    throw new Error(`Failed to create contact: ${error.message}`);
+  }
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async run({ $ }) {
const response = await this.app.createContact({
$,
data: {
phone: this.phone,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
},
});
$.export("$summary", `Successfully created Contact with ID: ${response.id}`);
return response;
},
async run({ $ }) {
// Validate that at least one contact field is provided
if (!this.phone && !this.email && !this.firstName && !this.lastName) {
throw new Error('At least one contact field (phone, email, firstName, lastName) must be provided');
}
try {
const response = await this.app.createContact({
$,
data: {
phone: this.phone,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
},
});
if (!response?.id) {
throw new Error('Invalid response: missing contact ID');
}
$.export("$summary", `Successfully created Contact with ID: ${response.id}`);
return response;
} catch (error) {
throw new Error(`Failed to create contact: ${error.message}`);
}
},

Comment on lines +37 to +51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add error handling and input validation.

The implementation is missing error handling and input validation. Consider these improvements:

Apply this diff to enhance the implementation:

   async run({ $ }) {
+    // Validate required fields
+    const requiredFields = {
+      phone: this.phone,
+      firstName: this.firstName,
+    };
+
+    const missingFields = Object.entries(requiredFields)
+      .filter(([_, value]) => !value)
+      .map(([key]) => key);
+
+    if (missingFields.length > 0) {
+      throw new Error(`Missing required fields: ${missingFields.join(', ')}`);
+    }
+
+    // Make API call with error handling
     const response = await this.app.createContact({
       $,
       data: {
         phone: this.phone,
         firstName: this.firstName,
         lastName: this.lastName,
         email: this.email,
       },
-    });
+    }).catch((error) => {
+      throw new Error(`Failed to create contact: ${error.message}`);
+    });
+
+    // Validate response
+    if (!response?.id) {
+      throw new Error('Invalid response: missing contact ID');
+    }

     $.export("$summary", `Successfully created Contact with ID: ${response.id}`);

     return response;
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async run({ $ }) {
const response = await this.app.createContact({
$,
data: {
phone: this.phone,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
},
});
$.export("$summary", `Successfully created Contact with ID: ${response.id}`);
return response;
},
async run({ $ }) {
// Validate required fields
const requiredFields = {
phone: this.phone,
firstName: this.firstName,
};
const missingFields = Object.entries(requiredFields)
.filter(([_, value]) => !value)
.map(([key]) => key);
if (missingFields.length > 0) {
throw new Error(`Missing required fields: ${missingFields.join(', ')}`);
}
// Make API call with error handling
const response = await this.app.createContact({
$,
data: {
phone: this.phone,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
},
}).catch((error) => {
throw new Error(`Failed to create contact: ${error.message}`);
});
// Validate response
if (!response?.id) {
throw new Error('Invalid response: missing contact ID');
}
$.export("$summary", `Successfully created Contact with ID: ${response.id}`);
return response;
},

};
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import app from "../../liveswitch.app.mjs";

export default {
key: "liveswitch-create-conversation",
name: "Create Conversation",
description: "Create a conversation in LiveSwitch [See the documentation](https://developer.liveswitch.com/reference/post_v1-conversations)",
version: "0.0.1",
type: "action",
props: {
app,
contactId: {
propDefinition: [
app,
"contactId",
],
},
message: {
propDefinition: [
app,
"message",
],
},
Comment on lines +11 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider enhancing props validation.

The contactId and message props could benefit from additional validation to ensure data quality.

Consider adding these validations:

 contactId: {
   propDefinition: [
     app,
     "contactId",
   ],
+  validation: {
+    required: true,
+    pattern: /^[a-zA-Z0-9-]+$/,
+  },
 },
 message: {
   propDefinition: [
     app,
     "message",
   ],
+  validation: {
+    required: true,
+    maxLength: 1000,
+  },
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
contactId: {
propDefinition: [
app,
"contactId",
],
},
message: {
propDefinition: [
app,
"message",
],
},
contactId: {
propDefinition: [
app,
"contactId",
],
validation: {
required: true,
pattern: /^[a-zA-Z0-9-]+$/,
},
},
message: {
propDefinition: [
app,
"message",
],
validation: {
required: true,
maxLength: 1000,
},
},

},

async run({ $ }) {
const response = await this.app.createConversation({
$,
data: {
contactId: this.contactId,
message: this.message,
},
});

$.export("$summary", `Successfully created Conversation with ID: ${response.id}`);

return response;
},
Comment on lines +25 to +37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add explicit error handling and response validation.

While the current implementation works, it could be more robust with explicit error handling and response validation.

Consider enhancing the implementation:

 async run({ $ }) {
+  if (!this.contactId || !this.message) {
+    throw new Error("Required parameters missing");
+  }
+
   const response = await this.app.createConversation({
     $,
     data: {
       contactId: this.contactId,
       message: this.message,
     },
   });
 
+  if (!response?.id) {
+    throw new Error("Invalid response from LiveSwitch API");
+  }
+
   $.export("$summary", `Successfully created Conversation with ID: ${response.id}`);
 
   return response;
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async run({ $ }) {
const response = await this.app.createConversation({
$,
data: {
contactId: this.contactId,
message: this.message,
},
});
$.export("$summary", `Successfully created Conversation with ID: ${response.id}`);
return response;
},
async run({ $ }) {
if (!this.contactId || !this.message) {
throw new Error("Required parameters missing");
}
const response = await this.app.createConversation({
$,
data: {
contactId: this.contactId,
message: this.message,
},
});
if (!response?.id) {
throw new Error("Invalid response from LiveSwitch API");
}
$.export("$summary", `Successfully created Conversation with ID: ${response.id}`);
return response;
},

};
59 changes: 59 additions & 0 deletions components/liveswitch/actions/update-contact/update-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import app from "../../liveswitch.app.mjs";

export default {
key: "liveswitch-update-contact",
name: "Update Contact",
description: "Update a contact in LiveSwitch [See the documentation](https://developer.liveswitch.com/reference/post_v1-contacts)",
version: "0.0.1",
type: "action",
props: {
app,
contactId: {
propDefinition: [
app,
"contactId",
],
},
phone: {
propDefinition: [
app,
"phone",
],
},
firstName: {
propDefinition: [
app,
"firstName",
],
},
lastName: {
propDefinition: [
app,
"lastName",
],
},
email: {
propDefinition: [
app,
"email",
],
},
},
Comment on lines +9 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add validation to ensure at least one field is provided for update

Currently, the action allows submission without any fields to update, which could result in unnecessary API calls. Consider adding validation to ensure at least one field (phone, firstName, lastName, or email) is provided.

   props: {
     app,
     contactId: {
       propDefinition: [
         app,
         "contactId",
       ],
+      required: true,
     },
     phone: {
       propDefinition: [
         app,
         "phone",
       ],
+      optional: true,
     },
     firstName: {
       propDefinition: [
         app,
         "firstName",
       ],
+      optional: true,
     },
     lastName: {
       propDefinition: [
         app,
         "lastName",
       ],
+      optional: true,
     },
     email: {
       propDefinition: [
         app,
         "email",
       ],
+      optional: true,
     },
   },

Then add validation in the run method:

   async run({ $ }) {
+    const updateFields = {
+      phone: this.phone,
+      firstName: this.firstName,
+      lastName: this.lastName,
+      email: this.email,
+    };
+    
+    if (!Object.values(updateFields).some(Boolean)) {
+      throw new Error("At least one field must be provided for update");
+    }
+
     const response = await this.app.updateContact({
       $,
       contactId: this.contactId,
-      data: {
-        phone: this.phone,
-        firstName: this.firstName,
-        lastName: this.lastName,
-        email: this.email,
-      },
+      data: updateFields,
     });

Committable suggestion was skipped due to low confidence.


async run({ $ }) {
const response = await this.app.updateContact({
$,
contactId: this.contactId,
data: {
phone: this.phone,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
},
});

$.export("$summary", `Successfully updated Contact with ID: ${this.contactId}`);

return response;
},
Comment on lines +43 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance error handling and summary message

The current implementation could benefit from:

  1. Explicit error handling for API failures
  2. A more informative success message that includes the updated fields
   async run({ $ }) {
+    const updateFields = {
+      phone: this.phone,
+      firstName: this.firstName,
+      lastName: this.lastName,
+      email: this.email,
+    };
+
+    const updatedFields = Object.entries(updateFields)
+      .filter(([, value]) => value !== undefined)
+      .map(([key]) => key)
+      .join(", ");
+
+    try {
       const response = await this.app.updateContact({
         $,
         contactId: this.contactId,
-        data: {
-          phone: this.phone,
-          firstName: this.firstName,
-          lastName: this.lastName,
-          email: this.email,
-        },
+        data: updateFields,
       });

-      $.export("$summary", `Successfully updated Contact with ID: ${this.contactId}`);
+      $.export("$summary", `Successfully updated Contact ID ${this.contactId} - Updated fields: ${updatedFields}`);

       return response;
+    } catch (error) {
+      throw new Error(`Failed to update contact: ${error.message}`);
+    }
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async run({ $ }) {
const response = await this.app.updateContact({
$,
contactId: this.contactId,
data: {
phone: this.phone,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
},
});
$.export("$summary", `Successfully updated Contact with ID: ${this.contactId}`);
return response;
},
async run({ $ }) {
const updateFields = {
phone: this.phone,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
};
const updatedFields = Object.entries(updateFields)
.filter(([, value]) => value !== undefined)
.map(([key]) => key)
.join(", ");
try {
const response = await this.app.updateContact({
$,
contactId: this.contactId,
data: updateFields,
});
$.export("$summary", `Successfully updated Contact ID ${this.contactId} - Updated fields: ${updatedFields}`);
return response;
} catch (error) {
throw new Error(`Failed to update contact: ${error.message}`);
}
},

};
103 changes: 98 additions & 5 deletions components/liveswitch/liveswitch.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,104 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "liveswitch",
propDefinitions: {},
propDefinitions: {
firstName: {
type: "string",
label: "First Name",
description: "Contact's first name",
optional: true,
},
lastName: {
type: "string",
label: "Last Name",
description: "Contact's last name",
optional: true,
},
email: {
type: "string",
label: "Email",
description: "Contact's email",
optional: true,
},
Comment on lines +19 to +24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add email format validation.

The email property should include format validation to ensure valid email addresses are provided.

 email: {
   type: "string",
   label: "Email",
   description: "Contact's email",
   optional: true,
+  pattern: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
+  patternDescription: "Please enter a valid email address (e.g., [email protected])",
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
email: {
type: "string",
label: "Email",
description: "Contact's email",
optional: true,
},
email: {
type: "string",
label: "Email",
description: "Contact's email",
optional: true,
pattern: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
patternDescription: "Please enter a valid email address (e.g., [email protected])",
},

phone: {
type: "string",
label: "Phone",
description: "Contact's phone number, i.e.: `+1 407-982-1211`",
},
Comment on lines +25 to +29
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add phone number format validation.

The phone property should include format validation to ensure consistent phone number format.

 phone: {
   type: "string",
   label: "Phone",
   description: "Contact's phone number, i.e.: `+1 407-982-1211`",
+  pattern: "^\\+[1-9]\\d{1,14}$",
+  patternDescription: "Please enter the phone number in E.164 format (e.g., +14079821211)",
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
phone: {
type: "string",
label: "Phone",
description: "Contact's phone number, i.e.: `+1 407-982-1211`",
},
phone: {
type: "string",
label: "Phone",
description: "Contact's phone number, i.e.: `+1 407-982-1211`",
pattern: "^\\+[1-9]\\d{1,14}$",
patternDescription: "Please enter the phone number in E.164 format (e.g., +14079821211)",
},

message: {
type: "string",
label: "Message",
description: "The contents of the text message the user will receive",
},
contactId: {
type: "string",
label: "Contact ID",
description: "Contact's ID",
async options() {
const response = await this.getContacts();
return response.map(({
id, firstName, lastName,
}) => ({
value: id,
label: `${firstName} ${lastName}`,
}));
},
},
Comment on lines +39 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Handle pagination in contactId options.

The options method should handle pagination to ensure all contacts are available for selection.

 async options() {
-  const response = await this.getContacts();
+  const contacts = [];
+  let page = 1;
+  while (true) {
+    const response = await this.getContacts({ params: { page, pageSize: 100 } });
+    if (!response.length) break;
+    contacts.push(...response);
+    page++;
+  }
   return response.map(({
     id, firstName, lastName,
   }) => ({
     value: id,
-    label: `${firstName} ${lastName}`,
+    label: [firstName, lastName].filter(Boolean).join(" ") || id,
   }));
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async options() {
const response = await this.getContacts();
return response.map(({
id, firstName, lastName,
}) => ({
value: id,
label: `${firstName} ${lastName}`,
}));
},
},
async options() {
const contacts = [];
let page = 1;
while (true) {
const response = await this.getContacts({ params: { page, pageSize: 100 } });
if (!response.length) break;
contacts.push(...response);
page++;
}
return contacts.map(({
id, firstName, lastName,
}) => ({
value: id,
label: [firstName, lastName].filter(Boolean).join(" ") || id,
}));
},
},

},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://public-api.production.liveswitch.com/v1";
},
Comment on lines +51 to +53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider making the API URL configurable.

The base URL should be configurable to support different environments (e.g., staging, production).

-_baseUrl() {
-  return "https://public-api.production.liveswitch.com/v1";
+_baseUrl() {
+  const BASE_URLS = {
+    production: "https://public-api.production.liveswitch.com/v1",
+    staging: "https://public-api.staging.liveswitch.com/v1",
+  };
+  return BASE_URLS[this.$auth.environment || "production"];
},

Committable suggestion was skipped due to low confidence.

async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
...headers,
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
},
});
},
Comment on lines +54 to +69
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance error handling in _makeRequest.

Add better error handling to provide more informative error messages.

 async _makeRequest(opts = {}) {
   const {
     $ = this,
     path,
     headers,
     ...otherOpts
   } = opts;
-  return axios($, {
-    ...otherOpts,
-    url: this._baseUrl() + path,
-    headers: {
-      ...headers,
-      Authorization: `Bearer ${this.$auth.oauth_access_token}`,
-    },
-  });
+  try {
+    const response = await axios($, {
+      ...otherOpts,
+      url: this._baseUrl() + path,
+      headers: {
+        ...headers,
+        Authorization: `Bearer ${this.$auth.oauth_access_token}`,
+      },
+    });
+    return response;
+  } catch (err) {
+    const statusCode = err.response?.status;
+    const message = err.response?.data?.message || err.message;
+    throw new Error(`LiveSwitch API request failed [${statusCode}]: ${message}`);
+  }
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
...headers,
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
},
});
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
try {
const response = await axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
...headers,
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
},
});
return response;
} catch (err) {
const statusCode = err.response?.status;
const message = err.response?.data?.message || err.message;
throw new Error(`LiveSwitch API request failed [${statusCode}]: ${message}`);
}
},

async createContact(args = {}) {
return this._makeRequest({
path: "/contacts",
method: "post",
...args,
});
},
Comment on lines +70 to +76
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add request payload validation in create/update methods.

The methods should validate required fields and data types before making the request.

 async createContact(args = {}) {
+  const { data } = args;
+  if (!data?.phone) {
+    throw new Error("Phone number is required");
+  }
   return this._makeRequest({
     path: "/contacts",
     method: "post",
     ...args,
   });
 },

 async updateContact({ contactId, ...args }) {
+  if (!contactId) {
+    throw new Error("Contact ID is required");
+  }
   return this._makeRequest({
     path: `/contacts/${contactId}`,
     method: "put",
     ...args,
   });
 },

 async createConversation(args = {}) {
+  const { data } = args;
+  if (!data?.contactId || !data?.message) {
+    throw new Error("Contact ID and message are required");
+  }
   return this._makeRequest({
     path: "/conversations",
     method: "post",
     ...args,
   });
 },

Also applies to: 77-85, 86-92

async updateContact({
contactId, ...args
}) {
return this._makeRequest({
path: `/contacts/${contactId}`,
method: "put",
...args,
});
},
async createConversation(args = {}) {
return this._makeRequest({
path: "/conversations",
method: "post",
...args,
});
},
async getContacts(args = {}) {
return this._makeRequest({
path: "/contacts",
params: {
page: 1,
pageSize: 100,
},
...args,
});
Comment on lines +93 to +101
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Improve response handling in getContacts.

The method should handle the response structure and return the contacts array.

 async getContacts(args = {}) {
-  return this._makeRequest({
+  const response = await this._makeRequest({
     path: "/contacts",
     params: {
       page: 1,
       pageSize: 100,
     },
     ...args,
   });
+  return response.data?.contacts || [];
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async getContacts(args = {}) {
return this._makeRequest({
path: "/contacts",
params: {
page: 1,
pageSize: 100,
},
...args,
});
async getContacts(args = {}) {
const response = await this._makeRequest({
path: "/contacts",
params: {
page: 1,
pageSize: 100,
},
...args,
});
return response.data?.contacts || [];
}

},
},
};
};
7 changes: 5 additions & 2 deletions components/liveswitch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/liveswitch",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream LiveSwitch Components",
"main": "liveswitch.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
Loading
Loading