Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import taleez from "../../taleez.app.mjs";

export default {
key: "taleez-add-candidate-to-job",
name: "Add Candidate to Job",
description: "Links an existing candidate to a job offer. [See the documentation](https://api.taleez.com/swagger-ui/index.html#/jobs/addCandidate_1)",
version: "0.0.1",
type: "action",
props: {
taleez,
candidateId: {
propDefinition: [
taleez,
"candidateId",
],
},
jobId: {
propDefinition: [
taleez,
"jobId",
],
},
},
async run({ $ }) {
const response = await this.taleez.linkCandidateToJob({
$,
jobId: this.jobId,
data: {
ids: [
this.candidateId,
],
},
});
$.export("$summary", `Linked candidate ${this.candidateId} to job ${this.jobId} successfully`);
return response;
},
};
60 changes: 60 additions & 0 deletions components/taleez/actions/create-candidate/create-candidate.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import taleez from "../../taleez.app.mjs";

export default {
key: "taleez-create-candidate",
name: "Create Candidate",
description: "Creates a new candidate in Taleez. [See the documentation](https://api.taleez.com/swagger-ui/index.html#/candidates/create_1)",
version: "0.0.1",
type: "action",
props: {
taleez,
firstName: {
type: "string",
label: "First Name",
description: "First name of the candidate",
},
lastName: {
type: "string",
label: "Last Name",
description: "Last name of the candidate",
},
email: {
type: "string",
label: "Email",
description: "Candidate email address. Must be unique in your company",
},
phone: {
type: "string",
label: "Phone",
description: "Candidate phone (formats : 0611223344, +33611223344, 00336112233). Ignored if not valid.",
optional: true,
},
unitId: {
propDefinition: [
taleez,
"unitId",
],
},
recruiterId: {
propDefinition: [
taleez,
"recruiterId",
],
},
},
async run({ $ }) {
const response = await this.taleez.createCandidate({
$,
data: {
firstName: this.firstName,
lastName: this.lastName,
mail: this.email,
phone: this.phone,
unitId: this.unitId,
recruiterId: this.recruiterId,
},
});
$.export("$summary", `Created candidate ${this.firstName} ${this.lastName} successfully`);
return response;
},
};
74 changes: 74 additions & 0 deletions components/taleez/actions/list-jobs/list-jobs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import taleez from "../../taleez.app.mjs";

export default {
key: "taleez-list-jobs",
name: "List Jobs",
description: "Retrieves a list of jobs in your company. [See the documentation](https://api.taleez.com/swagger-ui/index.html#/jobs/list_3)",
version: "0.0.1",
type: "action",
props: {
taleez,
unitId: {
propDefinition: [
taleez,
"unitId",
],
},
status: {
propDefinition: [
taleez,
"status",
],
},
contract: {
propDefinition: [
taleez,
"contract",
],
},
city: {
propDefinition: [
taleez,
"city",
],
},
companyLabel: {
propDefinition: [
taleez,
"companyLabel",
],
},
tag: {
propDefinition: [
taleez,
"tag",
],
},
maxResults: {
type: "integer",
label: "Max Results",
description: "The maximum number of jobs to retrieve. Default: `100`",
optional: true,
},
},
async run({ $ }) {
const { list: jobs } = await this.taleez.listJobs({
$,
params: {
unitId: this.unitId,
status: this.status,
contract: this.contract,
city: this.city,
companyLabel: this.companyLabel,
tag: this.tag,
pageSize: this.maxResults,
withDetails: true,
withProps: true,
},
});
$.export("$summary", `Successfully retrieved ${jobs?.length} job${jobs?.length === 1
? ""
: "s"}`);
return jobs;
},
};
7 changes: 5 additions & 2 deletions components/taleez/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/taleez",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Taleez Components",
"main": "taleez.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"
}
}
}
72 changes: 72 additions & 0 deletions components/taleez/sources/common/base.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import taleez from "../../taleez.app.mjs";
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";

export default {
props: {
taleez,
db: "$.service.db",
timer: {
type: "$.interface.timer",
default: {
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},
},
methods: {
_getLastTs() {
return this.db.get("lastTs") || 0;
},
_setLastTs(lastTs) {
this.db.set("lastTs", lastTs);
},
emitEvent(item) {
const meta = this.generateMeta(item);
this.$emit(item, meta);
},
async processEvent(max) {
const lastTs = this._getLastTs();
let maxTs = lastTs;
const tsField = this.getTsField();

const results = this.taleez.paginate({
fn: this.getResourceFn(),
args: this.getArgs(),
max,
});

for await (const item of results) {
if (tsField) {
const ts = item[tsField];
if (ts > lastTs) {
this.emitEvent(item);
maxTs = Math.max(ts, maxTs);
}
} else {
this.emitEvent(item);
}
}

this._setLastTs(maxTs);
},
getArgs() {
return {};
},
getTsField() {
return undefined;
},
getResourceFn() {
throw new Error("getResourceFn is not implemented");
},
generateMeta() {
throw new Error("generateMeta is not implemented");
},
},
hooks: {
async deploy() {
await this.processEvent(25);
},
},
async run() {
await this.processEvent();
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import common from "../common/base.mjs";

export default {
...common,
key: "taleez-new-candidate-created",
name: "New Candidate Created",
description: "Emit new event when a candidate is added in Taleez. [See the documentation](https://api.taleez.com/swagger-ui/index.html#/candidates/list_4)",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
getResourceFn() {
return this.taleez.listCandidates;
},
getArgs() {
return {
params: {
withProps: true,
},
};
},
getTsField() {
return "dateCreation";
},
generateMeta(candidate) {
return {
id: candidate.id,
summary: `New Candidate: ${candidate.firstName} ${candidate.lastName}`,
ts: candidate.dateCreation,
};
},
},
};
75 changes: 75 additions & 0 deletions components/taleez/sources/new-job-listed/new-job-listed.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import common from "../common/base.mjs";

export default {
...common,
key: "taleez-new-job-listed",
name: "New Job Listing Created",
description: "Emit new event when a job listing is created in Taleez. [See the documentation](https://api.taleez.com/swagger-ui/index.html#/jobs/list_3)",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
...common.props,
unitId: {
propDefinition: [
common.props.taleez,
"unitId",
],
},
status: {
propDefinition: [
common.props.taleez,
"status",
],
},
contract: {
propDefinition: [
common.props.taleez,
"contract",
],
},
city: {
propDefinition: [
common.props.taleez,
"city",
],
},
companyLabel: {
propDefinition: [
common.props.taleez,
"companyLabel",
],
},
tag: {
propDefinition: [
common.props.taleez,
"tag",
],
},
},
methods: {
...common.methods,
getResourceFn() {
return this.taleez.listJobs;
},
getArgs() {
return {
unitId: this.unitId,
status: this.status,
contract: this.contract,
city: this.city,
companyLabel: this.companyLabel,
tag: this.tag,
withDetails: true,
withProps: true,
};
},
generateMeta(job) {
return {
id: job.id,
summary: `New Job: ${job.label}`,
ts: job.dateCreation,
};
},
},
};
Loading
Loading