-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New Components - smartymeet #12701
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
base: master
Are you sure you want to change the base?
New Components - smartymeet #12701
Conversation
WalkthroughThe update introduces new functionalities to the SmartyMeet package, including actions to create candidates and jobs, and retrieve job candidate analysis. It also adds constants and utilities to support these actions, while enhancing the app definition with new properties and methods, and a source component to emit events when a candidate analysis report is ready. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SmartyMeetApp
participant API
User->>SmartyMeetApp: Create Candidate with details
SmartyMeetApp->>API: Call create candidate API
API-->>SmartyMeetApp: Candidate created
SmartyMeetApp-->>User: Return success response
User->>SmartyMeetApp: Create Job with details
SmartyMeetApp->>API: Call create job API
API-->>SmartyMeetApp: Job created
SmartyMeetApp-->>User: Return success response
User->>SmartyMeetApp: Get Job Candidate Analysis
SmartyMeetApp->>API: Request candidate analysis
API-->>SmartyMeetApp: Return analysis data
SmartyMeetApp-->>User: Display analysis data
Assessment against linked issues
Possibly related issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
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
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
Files selected for processing (8)
- components/smartymeet/actions/create-candidate/create-candidate.mjs (1 hunks)
- components/smartymeet/actions/create-job/create-job.mjs (1 hunks)
- components/smartymeet/actions/get-job-candidate-analysis/get-job-candidate-analysis.mjs (1 hunks)
- components/smartymeet/common/constants.mjs (1 hunks)
- components/smartymeet/common/utils.mjs (1 hunks)
- components/smartymeet/package.json (2 hunks)
- components/smartymeet/smartymeet.app.mjs (1 hunks)
- components/smartymeet/sources/new-candidate-analysis-ready-instant/new-candidate-analysis-ready-instant.mjs (1 hunks)
Additional comments not posted (15)
components/smartymeet/package.json (2)
3-3
: Version update looks good.The version has been appropriately updated to "0.1.0" to reflect the new features.
15-16
: New dependency addition is appropriate.The addition of
@pipedream/platform
version "^3.0.0" is necessary for the new components.components/smartymeet/sources/new-candidate-analysis-ready-instant/new-candidate-analysis-ready-instant.mjs (6)
1-2
: Imports look good.The import statements for
crypto
andsmartymeet.app.mjs
are appropriate and necessary for the functionality.
5-10
: Key, name, description, version, type, and dedupe strategy look good.The key, name, description, version, type, and dedupe strategy are appropriate and correctly defined.
11-35
: Props look good.The props are well-defined and necessary for the functionality of the component.
37-43
: Methods look good.The methods
_getWebhookId
and_setWebhookId
are correctly defined and necessary for managing the webhook ID.
45-77
: Hooks look good.The hooks
deploy
,activate
, anddeactivate
are correctly defined and necessary for managing the lifecycle of the webhook.
79-106
: Run function looks good.The run function is correctly defined and necessary for handling incoming events and emitting the analysis report.
components/smartymeet/actions/create-job/create-job.mjs (3)
1-8
: Imports look good.The import statements for constants, utility functions, and the SmartyMeet app are appropriate and necessary for the functionality.
11-15
: Key, name, description, version, and type look good.The key, name, description, version, and type are appropriate and correctly defined.
16-110
: Props look good.The props are well-defined and necessary for the functionality of the action.
components/smartymeet/smartymeet.app.mjs (3)
1-1
: Import looks good.The import statement for
axios
from "@pipedream/platform" is appropriate and necessary for the functionality.
6-122
: Prop definitions look good.The prop definitions are well-defined and necessary for the functionality of the app.
124-202
: Methods look good.The methods are well-defined and necessary for the functionality of the app.
components/smartymeet/common/constants.mjs (1)
1-1634
: Constants look good.The constants are well-defined and necessary for the functionality of the app.
export const parseObject = (obj) => { | ||
if (!obj) return undefined; | ||
|
||
if (Array.isArray(obj)) { | ||
return obj.map((item) => { | ||
if (typeof item === "string") { | ||
try { | ||
return JSON.parse(item); | ||
} catch (e) { | ||
return item; | ||
} | ||
} | ||
return item; | ||
}); | ||
} | ||
if (typeof obj === "string") { | ||
try { | ||
return JSON.parse(obj); | ||
} catch (e) { | ||
return obj; | ||
} | ||
} | ||
return obj; | ||
}; |
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.
LGTM! Consider optimizing the function.
The parseObject
function is well-implemented with error handling. However, consider the following optimization for readability and performance:
export const parseObject = (obj) => {
if (!obj) return undefined;
const parseItem = (item) => {
if (typeof item === "string") {
try {
return JSON.parse(item);
} catch (e) {
return item;
}
}
return item;
};
if (Array.isArray(obj)) {
return obj.map(parseItem);
}
return parseItem(obj);
};
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.
export const parseObject = (obj) => { | |
if (!obj) return undefined; | |
if (Array.isArray(obj)) { | |
return obj.map((item) => { | |
if (typeof item === "string") { | |
try { | |
return JSON.parse(item); | |
} catch (e) { | |
return item; | |
} | |
} | |
return item; | |
}); | |
} | |
if (typeof obj === "string") { | |
try { | |
return JSON.parse(obj); | |
} catch (e) { | |
return obj; | |
} | |
} | |
return obj; | |
}; | |
export const parseObject = (obj) => { | |
if (!obj) return undefined; | |
const parseItem = (item) => { | |
if (typeof item === "string") { | |
try { | |
return JSON.parse(item); | |
} catch (e) { | |
return item; | |
} | |
} | |
return item; | |
}; | |
if (Array.isArray(obj)) { | |
return obj.map(parseItem); | |
} | |
return parseItem(obj); | |
}; |
import smartymeet from "../../smartymeet.app.mjs"; | ||
|
||
export default { | ||
key: "smartymeet-get-job-candidate-analysis", | ||
name: "Get Job Candidate Analysis", | ||
description: "Retrieves the analysis for a job candidate within SmartyMeet. [See the documentation](https://docs.smartymeet.com)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
smartymeet, | ||
jobId: { | ||
propDefinition: [ | ||
smartymeet, | ||
"jobId", | ||
], | ||
}, | ||
candidateId: { | ||
propDefinition: [ | ||
smartymeet, | ||
"candidateId", | ||
({ jobId }) => ({ | ||
jobId, | ||
}), | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.smartymeet.listCandidates({ | ||
$, | ||
jobId: this.jobId, | ||
}); | ||
|
||
const candidate = response.find((candidate) => `${candidate.shardId}:${candidate.contactId}` === this.candidateId); | ||
|
||
if (candidate) { | ||
$.export("$summary", `Successfully retrieved analysis for candidate with Id: ${this.candidateId}`); | ||
return candidate.jobs[0]; | ||
} | ||
$.export("$summary", `Candidate with Id: ${this.candidateId} not found.`); | ||
}, | ||
}; |
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.
LGTM! Consider improving the candidate search and error handling.
The action implementation is correct. However, consider the following improvements:
- Use a more descriptive variable name for the candidate search.
- Improve error handling by checking if the response contains candidates.
async run({ $ }) {
const response = await this.smartymeet.listCandidates({
$,
jobId: this.jobId,
});
if (!response || response.length === 0) {
$.export("$summary", `No candidates found for job Id: ${this.jobId}`);
return;
}
const candidate = response.find((c) => `${c.shardId}:${c.contactId}` === this.candidateId);
if (candidate) {
$.export("$summary", `Successfully retrieved analysis for candidate with Id: ${this.candidateId}`);
return candidate.jobs[0];
}
$.export("$summary", `Candidate with Id: ${this.candidateId} not found.`);
}
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.
import smartymeet from "../../smartymeet.app.mjs"; | |
export default { | |
key: "smartymeet-get-job-candidate-analysis", | |
name: "Get Job Candidate Analysis", | |
description: "Retrieves the analysis for a job candidate within SmartyMeet. [See the documentation](https://docs.smartymeet.com)", | |
version: "0.0.1", | |
type: "action", | |
props: { | |
smartymeet, | |
jobId: { | |
propDefinition: [ | |
smartymeet, | |
"jobId", | |
], | |
}, | |
candidateId: { | |
propDefinition: [ | |
smartymeet, | |
"candidateId", | |
({ jobId }) => ({ | |
jobId, | |
}), | |
], | |
}, | |
}, | |
async run({ $ }) { | |
const response = await this.smartymeet.listCandidates({ | |
$, | |
jobId: this.jobId, | |
}); | |
const candidate = response.find((candidate) => `${candidate.shardId}:${candidate.contactId}` === this.candidateId); | |
if (candidate) { | |
$.export("$summary", `Successfully retrieved analysis for candidate with Id: ${this.candidateId}`); | |
return candidate.jobs[0]; | |
} | |
$.export("$summary", `Candidate with Id: ${this.candidateId} not found.`); | |
}, | |
}; | |
import smartymeet from "../../smartymeet.app.mjs"; | |
export default { | |
key: "smartymeet-get-job-candidate-analysis", | |
name: "Get Job Candidate Analysis", | |
description: "Retrieves the analysis for a job candidate within SmartyMeet. [See the documentation](https://docs.smartymeet.com)", | |
version: "0.0.1", | |
type: "action", | |
props: { | |
smartymeet, | |
jobId: { | |
propDefinition: [ | |
smartymeet, | |
"jobId", | |
], | |
}, | |
candidateId: { | |
propDefinition: [ | |
smartymeet, | |
"candidateId", | |
({ jobId }) => ({ | |
jobId, | |
}), | |
], | |
}, | |
}, | |
async run({ $ }) { | |
const response = await this.smartymeet.listCandidates({ | |
$, | |
jobId: this.jobId, | |
}); | |
if (!response || response.length === 0) { | |
$.export("$summary", `No candidates found for job Id: ${this.jobId}`); | |
return; | |
} | |
const candidate = response.find((c) => `${c.shardId}:${c.contactId}` === this.candidateId); | |
if (candidate) { | |
$.export("$summary", `Successfully retrieved analysis for candidate with Id: ${this.candidateId}`); | |
return candidate.jobs[0]; | |
} | |
$.export("$summary", `Candidate with Id: ${this.candidateId} not found.`); | |
}, | |
}; |
import smartymeet from "../../smartymeet.app.mjs"; | ||
|
||
export default { | ||
key: "smartymeet-create-candidate", | ||
name: "Create Candidate", | ||
description: "Creates a new candidate profile in SmartyMeet. [See the documentation](https://docs.smartymeet.com/category/smartymeet-versioned-api)", | ||
version: "0.0.{{ts}}", | ||
type: "action", | ||
props: { | ||
smartymeet, | ||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "The candidate's name.", | ||
}, | ||
status: { | ||
type: "string", | ||
label: "Status", | ||
description: "The candidate's status.", | ||
options: [ | ||
"active", | ||
"rejected", | ||
"archived", | ||
"closed", | ||
], | ||
optional: true, | ||
}, | ||
phone: { | ||
type: "string", | ||
label: "Phone", | ||
description: "The candidate's phone.", | ||
optional: true, | ||
}, | ||
email: { | ||
type: "string", | ||
label: "Email", | ||
description: "The candidate's email.", | ||
optional: true, | ||
}, | ||
/* talentId: { | ||
propDefinition: [ | ||
smartymeet, | ||
"talentId", | ||
], | ||
}, */ | ||
jobId: { | ||
propDefinition: [ | ||
smartymeet, | ||
"jobId", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.smartymeet.createCandidate({ | ||
$, | ||
data: { | ||
type: "candidates", | ||
attributes: { | ||
name: this.name, | ||
status: this.status, | ||
phone: this.phone, | ||
email: this.email, | ||
}, | ||
relationships: { | ||
/* talents: { | ||
type: "talents", | ||
id: this.talentId, | ||
}, */ | ||
jobs: { | ||
type: "jobs", | ||
id: this.jobId, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully created candidate with Id: ${response.data.id}`); | ||
return response; | ||
}, | ||
}; |
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.
LGTM! Address commented-out code and improve error handling.
The action implementation is correct. However, consider the following improvements:
- Remove or address the commented-out code related to
talentId
. - Improve error handling by checking the response status.
async run({ $ }) {
const response = await this.smartymeet.createCandidate({
$,
data: {
type: "candidates",
attributes: {
name: this.name,
status: this.status,
phone: this.phone,
email: this.email,
},
relationships: {
jobs: {
type: "jobs",
id: this.jobId,
},
},
},
});
if (response && response.data && response.data.id) {
$.export("$summary", `Successfully created candidate with Id: ${response.data.id}`);
return response;
}
throw new Error("Failed to create candidate");
}
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.
import smartymeet from "../../smartymeet.app.mjs"; | |
export default { | |
key: "smartymeet-create-candidate", | |
name: "Create Candidate", | |
description: "Creates a new candidate profile in SmartyMeet. [See the documentation](https://docs.smartymeet.com/category/smartymeet-versioned-api)", | |
version: "0.0.{{ts}}", | |
type: "action", | |
props: { | |
smartymeet, | |
name: { | |
type: "string", | |
label: "Name", | |
description: "The candidate's name.", | |
}, | |
status: { | |
type: "string", | |
label: "Status", | |
description: "The candidate's status.", | |
options: [ | |
"active", | |
"rejected", | |
"archived", | |
"closed", | |
], | |
optional: true, | |
}, | |
phone: { | |
type: "string", | |
label: "Phone", | |
description: "The candidate's phone.", | |
optional: true, | |
}, | |
email: { | |
type: "string", | |
label: "Email", | |
description: "The candidate's email.", | |
optional: true, | |
}, | |
/* talentId: { | |
propDefinition: [ | |
smartymeet, | |
"talentId", | |
], | |
}, */ | |
jobId: { | |
propDefinition: [ | |
smartymeet, | |
"jobId", | |
], | |
}, | |
}, | |
async run({ $ }) { | |
const response = await this.smartymeet.createCandidate({ | |
$, | |
data: { | |
type: "candidates", | |
attributes: { | |
name: this.name, | |
status: this.status, | |
phone: this.phone, | |
email: this.email, | |
}, | |
relationships: { | |
/* talents: { | |
type: "talents", | |
id: this.talentId, | |
}, */ | |
jobs: { | |
type: "jobs", | |
id: this.jobId, | |
}, | |
}, | |
}, | |
}); | |
$.export("$summary", `Successfully created candidate with Id: ${response.data.id}`); | |
return response; | |
}, | |
}; | |
async run({ $ }) { | |
const response = await this.smartymeet.createCandidate({ | |
$, | |
data: { | |
type: "candidates", | |
attributes: { | |
name: this.name, | |
status: this.status, | |
phone: this.phone, | |
email: this.email, | |
}, | |
relationships: { | |
jobs: { | |
type: "jobs", | |
id: this.jobId, | |
}, | |
}, | |
}, | |
}); | |
if (response && response.data && response.data.id) { | |
$.export("$summary", `Successfully created candidate with Id: ${response.data.id}`); | |
return response; | |
} | |
throw new Error("Failed to create candidate"); | |
} |
async run({ $ }) { | ||
const response = await this.smartymeet.createJob({ | ||
$, | ||
data: { | ||
type: "jobs", | ||
attributes: { | ||
title: this.title, | ||
status: this.status, | ||
candidates: this.candidates, | ||
workplace: this.workplace, | ||
description: this.description, | ||
industry: this.industry, | ||
jobFunction: this.jobFunction, | ||
jobType: this.jobType, | ||
experience: this.experience, | ||
education: this.education, | ||
salary: { | ||
from: this.salaryFrom, | ||
to: this.salaryTo, | ||
}, | ||
currency: this.currency, | ||
keywords: parseObject(this.keywords), | ||
}, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully created job with title "${this.jobTitle}"`); | ||
return response; | ||
}, |
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 the summary message in the run function.
The summary message should use this.title
instead of this.jobTitle
.
- $.export("$summary", `Successfully created job with title "${this.jobTitle}"`);
+ $.export("$summary", `Successfully created job with title "${this.title}"`);
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 run({ $ }) { | |
const response = await this.smartymeet.createJob({ | |
$, | |
data: { | |
type: "jobs", | |
attributes: { | |
title: this.title, | |
status: this.status, | |
candidates: this.candidates, | |
workplace: this.workplace, | |
description: this.description, | |
industry: this.industry, | |
jobFunction: this.jobFunction, | |
jobType: this.jobType, | |
experience: this.experience, | |
education: this.education, | |
salary: { | |
from: this.salaryFrom, | |
to: this.salaryTo, | |
}, | |
currency: this.currency, | |
keywords: parseObject(this.keywords), | |
}, | |
}, | |
}); | |
$.export("$summary", `Successfully created job with title "${this.jobTitle}"`); | |
return response; | |
}, | |
$.export("$summary", `Successfully created job with title "${this.title}"`); |
Resolves #12679.
Summary by CodeRabbit
New Features
Enhancements
Documentation
@pipedream/platform
.Refactor