-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] plecto #13237 #17366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Components] plecto #13237 #17366
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughA new Plecto integration is introduced, featuring an app definition with dynamic property fetching and API methods for managing registrations, data sources, and members. An action for creating a registration is added. The legacy TypeScript app file and a directory-specific Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CreateRegistrationAction
participant PlectoApp
participant PlectoAPI
User->>CreateRegistrationAction: Provide registration details
CreateRegistrationAction->>PlectoApp: Call createRegistration with details
PlectoApp->>PlectoAPI: POST /registrations with data
PlectoAPI-->>PlectoApp: Respond with registration ID
PlectoApp-->>CreateRegistrationAction: Return registration ID
CreateRegistrationAction-->>User: Show summary with registration ID
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/plecto/actions/create-registration/create-registration.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/plecto/plecto.app.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
components/plecto/.gitignore(0 hunks)components/plecto/actions/create-registration/create-registration.mjs(1 hunks)components/plecto/app/plecto.app.ts(0 hunks)components/plecto/plecto.app.mjs(1 hunks)
💤 Files with no reviewable changes (2)
- components/plecto/.gitignore
- components/plecto/app/plecto.app.ts
🧰 Additional context used
🧠 Learnings (2)
components/plecto/plecto.app.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.
components/plecto/actions/create-registration/create-registration.mjs (3)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
🔇 Additional comments (7)
components/plecto/plecto.app.mjs (4)
61-63: LGTM!The base URL method is correctly implemented.
64-80: LGTM!The generic request method is well-structured with proper authentication setup using basic auth.
82-100: LGTM!The API methods are correctly implemented with appropriate HTTP methods and endpoints.
11-19: Verify Plecto API response structureWe need to confirm that
getDataSources()andgetMembers()indeed return a top-level array of objects, not a wrapped object (e.g.{ data: […] }). The unauthenticated curl tests returned non-JSON HTML/error, so please:• Authenticate and fetch a sample JSON response for both endpoints.
• If the response is an array, no code change is needed.
• If the response is wrapped in adataproperty, update eachoptions()to:- const response = await this.getDataSources(); - return response.map(({ uuid, title }) => ({ value: uuid, label: title })); + const { data } = await this.getDataSources(); + return data.map(({ uuid, title }) => ({ value: uuid, label: title }));Repeat for
getMembers()(lines 25–33).components/plecto/actions/create-registration/create-registration.mjs (3)
3-8: LGTM!The action metadata is properly structured with appropriate key, name, description, version, and type.
9-47: LGTM!The prop definitions correctly reference the app's propDefinitions, ensuring consistency and reusability.
60-60: LGTM!The summary message format is correct and follows the established pattern from the learnings.
| async options() { | ||
| const response = await this.getMembers(); | ||
| return response.map(({ | ||
| uuid, name, | ||
| }) => ({ | ||
| value: uuid, | ||
| label: name, | ||
| })); | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add error handling to the options() function.
Similar to the dataSource prop, this async options function needs error handling.
async options() {
- const response = await this.getMembers();
- return response.map(({
- uuid, name,
- }) => ({
- value: uuid,
- label: name,
- }));
+ try {
+ const response = await this.getMembers();
+ return response.map(({
+ uuid, name,
+ }) => ({
+ value: uuid,
+ label: name,
+ }));
+ } catch (error) {
+ console.error("Failed to fetch members:", error);
+ return [];
+ }
},📝 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.
| async options() { | |
| const response = await this.getMembers(); | |
| return response.map(({ | |
| uuid, name, | |
| }) => ({ | |
| value: uuid, | |
| label: name, | |
| })); | |
| }, | |
| async options() { | |
| try { | |
| const response = await this.getMembers(); | |
| return response.map(({ | |
| uuid, name, | |
| }) => ({ | |
| value: uuid, | |
| label: name, | |
| })); | |
| } catch (error) { | |
| console.error("Failed to fetch members:", error); | |
| return []; | |
| } | |
| }, |
🤖 Prompt for AI Agents
In components/plecto/plecto.app.mjs around lines 25 to 33, the async options()
function lacks error handling which can cause unhandled promise rejections. Wrap
the await call to this.getMembers() in a try-catch block, and in the catch block
handle or log the error appropriately. Ensure the function returns a sensible
default or empty array if an error occurs to maintain stability.
| async options() { | ||
| const response = await this.getDataSources(); | ||
| return response.map(({ | ||
| uuid, title, | ||
| }) => ({ | ||
| value: uuid, | ||
| label: title, | ||
| })); | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add error handling to the options() function.
The async options function lacks error handling, which could cause the UI to break if the API request fails.
async options() {
- const response = await this.getDataSources();
- return response.map(({
- uuid, title,
- }) => ({
- value: uuid,
- label: title,
- }));
+ try {
+ const response = await this.getDataSources();
+ return response.map(({
+ uuid, title,
+ }) => ({
+ value: uuid,
+ label: title,
+ }));
+ } catch (error) {
+ console.error("Failed to fetch data sources:", error);
+ return [];
+ }
},📝 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.
| async options() { | |
| const response = await this.getDataSources(); | |
| return response.map(({ | |
| uuid, title, | |
| }) => ({ | |
| value: uuid, | |
| label: title, | |
| })); | |
| }, | |
| async options() { | |
| try { | |
| const response = await this.getDataSources(); | |
| return response.map(({ | |
| uuid, title, | |
| }) => ({ | |
| value: uuid, | |
| label: title, | |
| })); | |
| } catch (error) { | |
| console.error("Failed to fetch data sources:", error); | |
| return []; | |
| } | |
| }, |
🤖 Prompt for AI Agents
In components/plecto/plecto.app.mjs around lines 11 to 19, the async options()
function does not handle errors from the getDataSources() call, risking UI
breakage on failure. Add a try-catch block around the await
this.getDataSources() call to catch any errors, and handle them gracefully by
returning an empty array or a fallback value. This will prevent unhandled
promise rejections and keep the UI stable if the API request fails.
| data: { | ||
| "data_source": this.dataSource, | ||
| "member": this.member, | ||
| "external_id": this.externalId, | ||
| "date": this.date, | ||
| "Product Name": this.productName, | ||
| "Units Sold": this.unitsSold, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix inconsistent field naming in the data object.
The data object uses inconsistent naming conventions - some fields use snake_case while others use title case. This could cause API errors if the Plecto API expects consistent formatting.
Please verify the expected field format from the Plecto API documentation and apply consistent naming:
data: {
"data_source": this.dataSource,
"member": this.member,
"external_id": this.externalId,
"date": this.date,
- "Product Name": this.productName,
- "Units Sold": this.unitsSold,
+ "product_name": this.productName,
+ "units_sold": this.unitsSold,
},OR if the API expects title case for custom fields:
data: {
- "data_source": this.dataSource,
- "member": this.member,
- "external_id": this.externalId,
- "date": this.date,
+ "Data Source": this.dataSource,
+ "Member": this.member,
+ "External ID": this.externalId,
+ "Date": this.date,
"Product Name": this.productName,
"Units Sold": this.unitsSold,
},Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In components/plecto/actions/create-registration/create-registration.mjs around
lines 51 to 58, the data object has inconsistent field naming with a mix of
snake_case and title case. Check the Plecto API documentation to confirm the
expected naming convention for these fields. Then, update all keys in the data
object to use a consistent format, either all snake_case or all title case,
matching the API requirements to prevent errors.
💡 Verification agent
🧩 Analysis chain
Verify the Plecto API registration endpoint data format.
Please confirm the expected field names and structure for the registration creation endpoint to ensure the data mapping is correct.
🌐 Web query:
What are the required and optional fields for creating a registration in the Plecto API? What is the expected field naming convention (snake_case vs title case)?
💡 Result:
To create a registration in the Plecto API, certain fields are required while others are optional. The expected naming convention for fields is snake_case (all lowercase with underscores between words).
Required Fields in Plecto Registration
The following fields are required for creating a registration through the Plecto API:
- data_source: The UUID of the Plecto data source to which you are adding the registration. This is mandatory for identifying where the registration will be stored[1][2].
- Value: If your data source includes a custom field named "Value," this key must be present in the POST request. This is commonly the main metric or data point you are recording, but could vary if your data source uses a different custom field name[1].
- external_id: A unique ID for the registration. This is used to identify and, if needed, update or deduplicate registrations in Plecto[2][5].
- member_api_provider and member_api_id: These fields identify the employee related to the registration. They are required to link the data to a specific member in Plecto[2].
- member_name: Often included for human-readable identification of the member, but the documentation implies it's not strictly mandatory if you have the provider and ID[2].
Optional Fields
- date: The primary date of the registration in ISO 8601 format (e.g., "2022-12-31T10:22:55"). If not specified, Plecto will automatically use the current date and time at registration creation[1][2].
- Custom fields: Any additional fields you have defined in your Plecto data source can be added. These fields must match the names and types as configured in your Plecto dashboard[2][5].
Field Naming Convention
Plecto uses snake_case for all field names in its API. This means all letters are lowercase and words are separated by underscores (e.g., "data_source", "external_id")[2][3]. This convention matches standard API practices for clarity and consistency, and no field names should be in Title Case or CamelCase.
"Here's a list of field names, types and descriptions that make up Plecto's API data model:"
| data_source | string (UUID) |
| date | ISO 8601 with timestamp |
| member_api_provider | string |
| member_api_id | string |
| member_name | string |
| external_id | string |
| | |[2]
Example Registration Payload
{
"data_source": "your-data-source-uuid",
"external_id": "unique-registration-id",
"member_api_provider": "your-system-name",
"member_api_id": "employee-id-in-your-system",
"member_name": "Employee Name",
"date": "2025-06-30T18:00:00",
"Value": 100,
"custom_field_1": "custom_value"
}Summary:
- Always use snake_case for field names.
- Required: data_source, external_id, member_api_provider, member_api_id, and typically a metric field (e.g., Value).
- Optional: date, member_name, and any custom fields defined in your data source[1][2].
Citations:
- 1: https://docs.plecto.com/kb/guide/en/how-to-send-data-to-plectos-api-8jyWZ97bO9/Steps/2186713
- 2: https://docs.plecto.com/kb/guide/en/data-model-ogjh1WAsLY/Steps/2277499
- 3: https://en.wikipedia.org/wiki/Snake_case
- 4: https://amslaurea.unibo.it/id/eprint/28008/1/Tesi-magistrale_DEF_Matteo-Tamburini_973065.pdf
- 5: https://docs.plecto.com/kb/guide/en/data-sources-in-plecto-fYfRjgHA9z/Steps/2273078
- 6: https://docs.plecto.com/kb/guide/en/plecto-glossary-ygI2OeD3PK/Steps/2821493
- 7: https://www.quantconnect.com/announcements/16830/pep8-python-api-migration/
- 8: https://docs.plecto.com/kb/guide/en/scoro-aywf19Hsou/Steps/2386623
- 9: https://cloud.google.com/apis/design/naming_convention
- 10: https://titlecaseconverter.com/blog/which-title-case-style-should-you-use/
Ensure Plecto API registration payload uses correct snake_case fields
Please update the payload to match Plecto’s snake_case naming convention and include the required member identifiers:
• Replace the single "member" key with the two required fields:
– member_api_provider (e.g. your system name)
– member_api_id (the user’s ID in your system)
• Convert custom field names from Title Case/with spaces to snake_case, matching your data‐source definitions (e.g. "product_name", "units_sold").
• Confirm you still include the required metric field (often "Value" or your custom equivalent) if that isn’t one of these custom fields.
Proposed snippet:
data: {
- "data_source": this.dataSource,
- "member": this.member,
- "external_id": this.externalId,
- "date": this.date,
- "Product Name": this.productName,
- "Units Sold": this.unitsSold,
+ data_source: this.dataSource,
+ external_id: this.externalId,
+ member_api_provider: this.memberApiProvider,
+ member_api_id: this.memberApiId,
+ date: this.date,
+ product_name: this.productName,
+ units_sold: this.unitsSold,
},📝 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.
| data: { | |
| "data_source": this.dataSource, | |
| "member": this.member, | |
| "external_id": this.externalId, | |
| "date": this.date, | |
| "Product Name": this.productName, | |
| "Units Sold": this.unitsSold, | |
| }, | |
| data: { | |
| data_source: this.dataSource, | |
| external_id: this.externalId, | |
| member_api_provider: this.memberApiProvider, | |
| member_api_id: this.memberApiId, | |
| date: this.date, | |
| product_name: this.productName, | |
| units_sold: this.unitsSold, | |
| }, |
🤖 Prompt for AI Agents
In components/plecto/actions/create-registration/create-registration.mjs around
lines 51 to 58, the payload uses incorrect field names and structure for the
Plecto API. Replace the single "member" key with "member_api_provider" and
"member_api_id" to include required member identifiers. Change custom field
names from Title Case with spaces to snake_case, such as "product_name" and
"units_sold". Also, verify that the payload includes the required metric field
like "value" if it is not already present among these fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (3)
components/plecto/actions/create-registration/create-registration.mjs (1)
49-56: Fix API payload structure based on Plecto documentation.Based on previous verification of the Plecto API documentation, the payload structure needs corrections:
- The
memberfield should be split intomember_api_providerandmember_api_idas required by the API- All fields should use consistent snake_case naming
- Custom fields from
customFieldscould introduce inconsistent namingThe current implementation will likely fail with the Plecto API. Update the payload structure:
data: { - "data_source": this.dataSource, - "member": this.member, - "external_id": this.externalId, - "date": this.date, + data_source: this.dataSource, + member_api_provider: this.memberApiProvider, + member_api_id: this.memberApiId, + external_id: this.externalId, + date: this.date, ...customFields, },You'll also need to update the prop definitions in the app file to support
memberApiProviderandmemberApiIdinstead of the singlememberprop.components/plecto/plecto.app.mjs (2)
11-19: Add error handling to prevent UI breakage.The async options function lacks error handling, which could cause the UI to break if the API request fails.
async options() { + try { const response = await this.getDataSources(); return response.map(({ uuid, title, }) => ({ value: uuid, label: title, })); + } catch (error) { + console.error("Failed to fetch data sources:", error); + return []; + } },
25-33: Add error handling to prevent UI breakage.Similar to the dataSource prop, this async options function needs error handling.
async options() { + try { const response = await this.getMembers(); return response.map(({ uuid, name, }) => ({ value: uuid, label: name, })); + } catch (error) { + console.error("Failed to fetch members:", error); + return []; + } },
🧹 Nitpick comments (2)
components/plecto/plecto.app.mjs (2)
58-74: Add response data extraction to _makeRequest method.The method should extract the response data to match typical Pipedream patterns and handle different response structures:
async _makeRequest(opts = {}) { const { $ = this, path, auth, ...otherOpts } = opts; - return axios($, { + const response = await axios($, { ...otherOpts, url: this._baseUrl() + path, auth: { username: `${this.$auth.username}`, password: `${this.$auth.password}`, ...auth, }, }); + return response.data || response; },
83-94: Consider adding pagination support for list methods.The Plecto API likely supports pagination for list endpoints. Consider adding pagination parameters:
async getDataSources(args = {}) { return this._makeRequest({ path: "/datasources/", + params: { + limit: args.limit || 100, + offset: args.offset || 0, + ...args.params, + }, ...args, }); }, async getMembers(args = {}) { return this._makeRequest({ path: "/members/", + params: { + limit: args.limit || 100, + offset: args.offset || 0, + ...args.params, + }, ...args, }); },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
components/plecto/actions/create-registration/create-registration.mjs(1 hunks)components/plecto/package.json(1 hunks)components/plecto/plecto.app.mjs(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- components/plecto/package.json
🧰 Additional context used
🧠 Learnings (2)
components/plecto/plecto.app.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.
components/plecto/actions/create-registration/create-registration.mjs (4)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#14229
File: components/americommerce/actions/update-customer/update-customer.mjs:89-94
Timestamp: 2024-10-08T16:42:59.225Z
Learning: When defining boolean properties in AmeriCommerce components (e.g., in `update-customer.mjs`), ensure that the label and description are consistent and clearly indicate the intent, especially when using negations like "No Account", to avoid confusion.
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (3)
components/plecto/actions/create-registration/create-registration.mjs (3)
1-41: Action structure and props look well-defined.The action follows standard Pipedream patterns with proper prop definitions and version management.
43-45: JSON parsing logic is correct.Good defensive programming to handle both string and object inputs for customFields.
57-58: Summary message format follows best practices.The success message format is consistent with Pipedream conventions and includes relevant identifying information.
| member: { | ||
| type: "string", | ||
| label: "Member", | ||
| description: "ID of the member associated with this registration", | ||
| async options() { | ||
| const response = await this.getMembers(); | ||
| return response.map(({ | ||
| uuid, name, | ||
| }) => ({ | ||
| value: uuid, | ||
| label: name, | ||
| })); | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Update member prop to support Plecto API requirements.
Based on the Plecto API documentation, member identification requires separate member_api_provider and member_api_id fields rather than a single member field.
Consider splitting this into two separate props:
- member: {
- type: "string",
- label: "Member",
- description: "ID of the member associated with this registration",
- async options() {
- const response = await this.getMembers();
- return response.map(({
- uuid, name,
- }) => ({
- value: uuid,
- label: name,
- }));
- },
- },
+ memberApiProvider: {
+ type: "string",
+ label: "Member API Provider",
+ description: "The system name that provides the member ID",
+ },
+ memberApiId: {
+ type: "string",
+ label: "Member API ID",
+ description: "The member's ID in your system",
+ },Or keep the existing structure but update the action to map the selected member UUID to the required API format.
📝 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.
| member: { | |
| type: "string", | |
| label: "Member", | |
| description: "ID of the member associated with this registration", | |
| async options() { | |
| const response = await this.getMembers(); | |
| return response.map(({ | |
| uuid, name, | |
| }) => ({ | |
| value: uuid, | |
| label: name, | |
| })); | |
| }, | |
| }, | |
| memberApiProvider: { | |
| type: "string", | |
| label: "Member API Provider", | |
| description: "The system name that provides the member ID", | |
| }, | |
| memberApiId: { | |
| type: "string", | |
| label: "Member API ID", | |
| description: "The member's ID in your system", | |
| }, |
🤖 Prompt for AI Agents
In components/plecto/plecto.app.mjs around lines 21 to 34, the member property
currently uses a single field for member identification, but the Plecto API
requires separate fields for member_api_provider and member_api_id. To fix this,
either split the member property into two separate properties named
member_api_provider and member_api_id with appropriate types and options, or
update the existing member property and the related action logic to map the
selected member UUID into the required API format that includes both provider
and ID fields.
luancazarine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lcaresia, LGTM! Ready for QA!
WHY
Summary by CodeRabbit
New Features
Chores