-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - workday #18022
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
Merged
Merged
New Components - workday #18022
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
components/workday/actions/change-business-title/change-business-title.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import workday from "../../workday.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "workday-change-business-title", | ||
| name: "Change Business Title", | ||
| description: "Change the business title of a worker. [See the documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#common/v1/post-/workers/-ID-/businessTitleChanges)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| workday, | ||
| workerId: { | ||
| propDefinition: [ | ||
| workday, | ||
| "workerId", | ||
| ], | ||
| }, | ||
| proposedBusinessTitle: { | ||
| type: "string", | ||
| label: "Proposed Business Title", | ||
| description: "The new business title for the worker", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.workday.changeBusinessTitle({ | ||
| $, | ||
| workerId: this.workerId, | ||
| data: { | ||
| proposedBusinessTitle: this.proposedBusinessTitle, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully changed business title for worker ${this.workerId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
60 changes: 60 additions & 0 deletions
60
components/workday/actions/create-job-change/create-job-change.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import workday from "../../workday.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "workday-create-job-change", | ||
| name: "Create Job Change", | ||
| description: "Create a job change for a worker. [See the documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#common/v1/post-/workers/-ID-/jobChanges)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| workday, | ||
| workerId: { | ||
| propDefinition: [ | ||
| workday, | ||
| "workerId", | ||
| ], | ||
| }, | ||
| supervisoryOrganizationId: { | ||
| propDefinition: [ | ||
| workday, | ||
| "supervisoryOrganizationId", | ||
| ], | ||
| }, | ||
| jobChangeReasonId: { | ||
| propDefinition: [ | ||
| workday, | ||
| "jobChangeReasonId", | ||
| ], | ||
| }, | ||
| moveManagersTeam: { | ||
| type: "boolean", | ||
| label: "Move Managers Team", | ||
| description: "Indicates whether teams reporting to the ~Manager~ moved with them during the Change Job Event", | ||
| optional: true, | ||
| }, | ||
| effective: { | ||
| type: "string", | ||
| label: "Effective", | ||
| description: "The date this business process takes effect. Example: `2025-08-09T07:00:00.000Z`", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.workday.createJobChange({ | ||
| $, | ||
| workerId: this.workerId, | ||
| data: { | ||
| supervisoryOrganization: { | ||
| id: this.supervisoryOrganizationId, | ||
| }, | ||
| jobChangeReason: { | ||
| id: this.jobChangeReasonId, | ||
| }, | ||
| moveManagersTeam: this.moveManagersTeam, | ||
| effective: this.effective, | ||
| }, | ||
| }); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $.export("$summary", `Successfully created job change for worker ${this.workerId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import workday from "../../workday.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "workday-get-worker", | ||
| name: "Get Worker", | ||
| description: "Get a worker. [See the documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#common/v1/get-/workers/-ID-)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| workday, | ||
| workerId: { | ||
| propDefinition: [ | ||
| workday, | ||
| "workerId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.workday.getWorker({ | ||
| $, | ||
| workerId: this.workerId, | ||
| }); | ||
| $.export("$summary", `Successfully fetched worker ${this.workerId}`); | ||
| return response; | ||
| }, | ||
| }; |
35 changes: 35 additions & 0 deletions
35
components/workday/actions/list-organization-types/list-organization-types.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import workday from "../../workday.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "workday-list-organization-types", | ||
| name: "List Organization Types", | ||
| description: "List organization types. [See the documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#common/v1/organizationTypes)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| workday, | ||
| maxResults: { | ||
| propDefinition: [ | ||
| workday, | ||
| "maxResults", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const results = this.workday.paginate({ | ||
| fn: this.workday.listOrganizationTypes, | ||
| args: { | ||
| $, | ||
| }, | ||
| max: this.maxResults, | ||
| }); | ||
|
|
||
| const data = []; | ||
| for await (const result of results) { | ||
| data.push(result); | ||
| } | ||
|
|
||
| $.export("$summary", `Successfully fetched ${data.length} organization types`); | ||
| return data; | ||
| }, | ||
| }; |
35 changes: 35 additions & 0 deletions
35
components/workday/actions/list-supervisory-organizations/list-supervisory-organizations.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import workday from "../../workday.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "workday-list-supervisory-organizations", | ||
| name: "List Supervisory Organizations", | ||
| description: "List supervisory organizations. [See the documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#common/v1/get-/supervisoryOrganizations)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| workday, | ||
| maxResults: { | ||
| propDefinition: [ | ||
| workday, | ||
| "maxResults", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const results = this.workday.paginate({ | ||
| fn: this.workday.listSupervisoryOrganizations, | ||
| args: { | ||
| $, | ||
| }, | ||
| max: this.maxResults, | ||
| }); | ||
|
|
||
| const data = []; | ||
| for await (const result of results) { | ||
| data.push(result); | ||
| } | ||
|
|
||
| $.export("$summary", `Successfully fetched ${data.length} supervisory organizations`); | ||
| return data; | ||
| }, | ||
| }; |
42 changes: 42 additions & 0 deletions
42
components/workday/actions/list-worker-payslips/list-worker-payslips.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import workday from "../../workday.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "workday-list-worker-payslips", | ||
| name: "List Worker Payslips", | ||
| description: "List the payslips for a worker. [See the documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#common/v1/get-/workers/-ID-/paySlips)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| workday, | ||
| workerId: { | ||
| propDefinition: [ | ||
| workday, | ||
| "workerId", | ||
| ], | ||
| }, | ||
| maxResults: { | ||
| propDefinition: [ | ||
| workday, | ||
| "maxResults", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const results = this.workday.paginate({ | ||
| fn: this.workday.listWorkerPayslips, | ||
| args: { | ||
| $, | ||
| workerId: this.workerId, | ||
| }, | ||
| max: this.maxResults, | ||
| }); | ||
|
|
||
| const data = []; | ||
| for await (const result of results) { | ||
| data.push(result); | ||
| } | ||
|
|
||
| $.export("$summary", `Successfully fetched ${data.length} payslips for worker ${this.workerId}`); | ||
| return data; | ||
| }, | ||
| }; |
44 changes: 44 additions & 0 deletions
44
components/workday/actions/search-workers/search-workers.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import workday from "../../workday.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "workday-search-workers", | ||
| name: "Search Workers", | ||
| description: "Retrieve a list of workers based on a search query. [See the documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#common/v1/get-/workers)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| workday, | ||
| search: { | ||
| type: "string", | ||
| label: "Search", | ||
| description: "The search query to use to filter workers", | ||
| optional: true, | ||
| }, | ||
| maxResults: { | ||
| propDefinition: [ | ||
| workday, | ||
| "maxResults", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const results = this.workday.paginate({ | ||
| fn: this.workday.listWorkers, | ||
| args: { | ||
| $, | ||
| params: { | ||
| search: this.search, | ||
| }, | ||
| }, | ||
| max: this.maxResults, | ||
| }); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const data = []; | ||
| for await (const result of results) { | ||
| data.push(result); | ||
| } | ||
|
|
||
| $.export("$summary", `Successfully fetched ${data.length} workers`); | ||
| return data; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/workday", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Workday Components", | ||
| "main": "workday.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.1.0" | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import workday from "../../workday.app.mjs"; | ||
| import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| props: { | ||
| workday, | ||
| db: "$.service.db", | ||
| timer: { | ||
| type: "$.interface.timer", | ||
| default: { | ||
| intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, | ||
| }, | ||
| }, | ||
| }, | ||
| methods: {}, | ||
| }; |
68 changes: 68 additions & 0 deletions
68
components/workday/sources/new-worker-created/new-worker-created.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import common from "../common/base-polling.mjs"; | ||
| import sampleEmit from "./test-event.mjs"; | ||
|
|
||
| export default { | ||
| ...common, | ||
| key: "workday-new-worker-created", | ||
| name: "New Worker Created", | ||
| description: "Emit new event for each new worker created in Workday. [See the documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#common/v1/get-/workers)", | ||
| version: "0.0.1", | ||
| type: "source", | ||
| dedupe: "unique", | ||
| methods: { | ||
| ...common.methods, | ||
| _getPreviousIds() { | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return this.db.get("previousIds") || {}; | ||
| }, | ||
| _setPreviousIds(ids) { | ||
| this.db.set("previousIds", ids); | ||
| }, | ||
| generateMeta(worker) { | ||
| return { | ||
| id: worker.id, | ||
| summary: `New worker created: ${worker.descriptor}`, | ||
| ts: Date.now(), | ||
| }; | ||
| }, | ||
| async processEvent(limit) { | ||
| const results = this.workday.paginate({ | ||
| fn: this.workday.listWorkers, | ||
| }); | ||
|
|
||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const previousIds = this._getPreviousIds(); | ||
| let workers = []; | ||
|
|
||
| for await (const worker of results) { | ||
| if (previousIds[worker.id]) { | ||
| continue; | ||
| } | ||
| workers.push(worker); | ||
| previousIds[worker.id] = true; | ||
| } | ||
|
|
||
| this._setPreviousIds(previousIds); | ||
|
|
||
| if (!workers?.length) { | ||
| return; | ||
| } | ||
|
|
||
| if (limit) { | ||
| workers = workers.slice(0, limit); | ||
| } | ||
|
|
||
| for (const worker of workers) { | ||
| const meta = this.generateMeta(worker); | ||
| this.$emit(worker, meta); | ||
| } | ||
| }, | ||
| }, | ||
| hooks: { | ||
| async deploy() { | ||
| await this.processEvent(25); | ||
| }, | ||
| }, | ||
| async run() { | ||
| await this.processEvent(); | ||
| }, | ||
| sampleEmit, | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.