diff --git a/components/procore/actions/create-incident/create-incident.mjs b/components/procore/actions/create-incident/create-incident.mjs new file mode 100644 index 0000000000000..fc2070a593423 --- /dev/null +++ b/components/procore/actions/create-incident/create-incident.mjs @@ -0,0 +1,103 @@ +import app from "../../procore.app.mjs"; + +export default { + key: "procore-create-incident", + name: "Create Incident", + description: "Create a new incident. [See the documentation](https://developers.procore.com/reference/rest/incidents?version=latest#create-incident).", + version: "0.0.1", + type: "action", + props: { + app, + companyId: { + propDefinition: [ + app, + "companyId", + ], + }, + projectId: { + optional: false, + propDefinition: [ + app, + "projectId", + ({ companyId }) => ({ + companyId, + }), + ], + }, + title: { + type: "string", + label: "Title", + description: "Incident Title", + }, + eventDate: { + type: "string", + label: "Event Date", + description: "The date and time when the incident occurred, in ISO 8601 format. If the time is unknown, use `00:00` project time converted to UTC (e.g., `2025-04-01T00:00:00Z`).", + }, + description: { + type: "string", + label: "Description", + description: "Description of the Incident", + optional: true, + }, + isPrivate: { + type: "boolean", + label: "Private", + description: "Indicates whether an Incident is private", + optional: true, + }, + recordable: { + type: "boolean", + label: "Recordable", + description: "Indicates whether an Incident is recordable", + optional: true, + }, + timeUnknown: { + type: "boolean", + label: "Time Unknown", + description: "Indicates whether the time of the Incident occurrence is unknown", + optional: true, + }, + }, + methods: { + createIncident({ + projectId, ...args + } = {}) { + return this.app.post({ + path: `/projects/${projectId}/incidents`, + ...args, + }); + }, + }, + async run({ $ }) { + const { + createIncident, + companyId, + projectId, + title, + description, + eventDate, + isPrivate, + recordable, + timeUnknown, + } = this; + + const response = await createIncident({ + $, + companyId, + projectId, + data: { + incident: { + title, + description, + event_date: eventDate, + private: isPrivate, + recordable, + time_unknown: timeUnknown, + }, + }, + }); + $.export("$summary", `Successfully created incident with ID \`${response.id}\`.`); + return response; + }, +}; diff --git a/components/procore/actions/create-manpower-log/create-manpower-log.mjs b/components/procore/actions/create-manpower-log/create-manpower-log.mjs new file mode 100644 index 0000000000000..674419c8f42dc --- /dev/null +++ b/components/procore/actions/create-manpower-log/create-manpower-log.mjs @@ -0,0 +1,113 @@ +import app from "../../procore.app.mjs"; + +export default { + key: "procore-create-manpower-log", + name: "Create Manpower Log", + description: "Create a new manpower log. [See the documentation](https://developers.procore.com/reference/rest/manpower-logs?version=latest#create-manpower-log).", + version: "0.0.1", + type: "action", + props: { + app, + companyId: { + propDefinition: [ + app, + "companyId", + ], + }, + projectId: { + optional: false, + propDefinition: [ + app, + "projectId", + ({ companyId }) => ({ + companyId, + }), + ], + }, + notes: { + type: "string", + label: "Notes", + description: "The notes for the record", + }, + datetime: { + type: "string", + label: "Datetime", + description: "The datetime of the record. Eg. `2025-04-01T00:00:00Z`.", + optional: true, + }, + numWorkers: { + type: "integer", + label: "Number Of Workers", + description: "The number of workers", + optional: true, + }, + numHours: { + type: "string", + label: "Number Of Hours", + description: "The number of hours for each worker", + optional: true, + }, + userId: { + propDefinition: [ + app, + "userId", + ({ companyId }) => ({ + companyId, + }), + ], + }, + locationId: { + propDefinition: [ + app, + "locationId", + ({ + companyId, projectId, + }) => ({ + companyId, + projectId, + }), + ], + }, + }, + methods: { + createManpowerLog({ + projectId, ...args + } = {}) { + return this.app.post({ + path: `/projects/${projectId}/manpower_logs`, + ...args, + }); + }, + }, + async run({ $ }) { + const { + createManpowerLog, + companyId, + projectId, + datetime, + notes, + numWorkers, + numHours, + userId, + locationId, + } = this; + + const response = await createManpowerLog({ + $, + companyId, + projectId, + data: { + manpower_log: { + datetime, + notes, + num_workers: numWorkers, + num_hours: numHours, + user_id: userId, + location_id: locationId, + }, + }, + }); + $.export("$summary", `Successfully created manpower log with ID \`${response.id}\`.`); + return response; + }, +}; diff --git a/components/procore/actions/create-rfi/create-rfi.mjs b/components/procore/actions/create-rfi/create-rfi.mjs new file mode 100644 index 0000000000000..22174f083af8a --- /dev/null +++ b/components/procore/actions/create-rfi/create-rfi.mjs @@ -0,0 +1,135 @@ +import app from "../../procore.app.mjs"; + +export default { + key: "procore-create-rfi", + name: "Create RFI", + description: "Create a new RFI. [See the documentation](https://developers.procore.com/reference/rest/rfis?version=latest#create-rfi).", + version: "0.0.1", + type: "action", + props: { + app, + companyId: { + propDefinition: [ + app, + "companyId", + ], + }, + projectId: { + optional: false, + propDefinition: [ + app, + "projectId", + ({ companyId }) => ({ + companyId, + }), + ], + }, + subject: { + type: "string", + label: "Subject", + description: "The Subject of the RFI", + }, + questionBody: { + type: "string", + label: "Question Body", + description: "The Body of the Question", + }, + rfiManagerId: { + propDefinition: [ + app, + "rfiPotentialManagerId", + ({ + companyId, projectId, + }) => ({ + companyId, + projectId, + }), + ], + }, + assigneIds: { + type: "string[]", + label: "Assignee IDs", + description: "The Assignee IDs of the RFI", + optional: false, + propDefinition: [ + app, + "potentialAssigneeId", + ({ + companyId, projectId, + }) => ({ + companyId, + projectId, + }), + ], + }, + reference: { + type: "string", + label: "Reference", + description: "The Reference of the RFI", + optional: true, + }, + isPrivate: { + type: "boolean", + label: "Private", + description: "Whether the RFI is private or not", + optional: true, + }, + locationId: { + propDefinition: [ + app, + "locationId", + ({ + companyId, projectId, + }) => ({ + companyId, + projectId, + }), + ], + }, + }, + methods: { + createRfi({ + projectId, ...args + } = {}) { + return this.app.post({ + path: `/projects/${projectId}/rfis`, + ...args, + }); + }, + }, + async run({ $ }) { + const { + createRfi, + companyId, + projectId, + subject, + questionBody, + rfiManagerId, + assigneIds, + reference, + isPrivate, + locationId, + } = this; + + const response = await createRfi({ + $, + companyId, + projectId, + data: { + rfi: { + subject, + question: { + body: questionBody, + }, + rfi_manager_id: rfiManagerId, + reference, + private: isPrivate, + location_id: locationId, + assignee_ids: assigneIds, + }, + }, + }); + $.export("$summary", `Successfully created RFI with ID \`${response.id}\`.`); + return response; + }, +}; diff --git a/components/procore/actions/create-submittal/create-submittal.mjs b/components/procore/actions/create-submittal/create-submittal.mjs new file mode 100644 index 0000000000000..0a3ae2ea31f1a --- /dev/null +++ b/components/procore/actions/create-submittal/create-submittal.mjs @@ -0,0 +1,119 @@ +import constants from "../../common/constants.mjs"; +import app from "../../procore.app.mjs"; + +export default { + key: "procore-create-submittal", + name: "Create Submittal", + description: "Create a new submittal. [See the documentation](https://developers.procore.com/reference/rest/submittals?version=latest#create-submittal).", + version: "0.0.1", + type: "action", + props: { + app, + companyId: { + propDefinition: [ + app, + "companyId", + ], + }, + projectId: { + optional: false, + propDefinition: [ + app, + "projectId", + ({ companyId }) => ({ + companyId, + }), + ], + }, + number: { + type: "string", + label: "Number", + description: "The Number of the Submittal", + }, + description: { + type: "string", + label: "Description", + description: "The Description of the Submittal", + optional: true, + }, + title: { + type: "string", + label: "Title", + description: "The Title of the Submittal", + optional: true, + }, + type: { + type: "string", + label: "Type", + description: "The Submittal Type of the Submittal", + optional: true, + }, + isPrivate: { + type: "boolean", + label: "Private", + description: "Whether the Submittal is Private or not", + optional: true, + }, + revision: { + type: "string", + label: "Revision", + description: "The Revision of the Submittal", + optional: true, + }, + locationId: { + propDefinition: [ + app, + "locationId", + ({ + companyId, projectId, + }) => ({ + companyId, + projectId, + }), + ], + }, + }, + methods: { + createSubmittal({ + projectId, ...args + } = {}) { + return this.app.post({ + versionPath: constants.VERSION_PATH.V1_1, + path: `/projects/${projectId}/submittals`, + ...args, + }); + }, + }, + async run({ $ }) { + const { + createSubmittal, + companyId, + projectId, + number, + description, + title, + type, + isPrivate, + revision, + locationId, + } = this; + const response = await createSubmittal({ + $, + companyId, + projectId, + data: { + submittal: { + number, + description, + title, + type, + private: isPrivate, + revision, + location_id: locationId, + }, + }, + }); + $.export("$summary", `Successfully created submittal with ID \`${response.id}\`.`); + return response; + }, +}; diff --git a/components/procore/actions/create-timesheet/create-timesheet.mjs b/components/procore/actions/create-timesheet/create-timesheet.mjs new file mode 100644 index 0000000000000..106f295fd0789 --- /dev/null +++ b/components/procore/actions/create-timesheet/create-timesheet.mjs @@ -0,0 +1,64 @@ +import app from "../../procore.app.mjs"; + +export default { + key: "procore-create-timesheet", + name: "Create Timesheet", + description: "Create a new timesheet. [See the documentation](https://developers.procore.com/reference/rest/timesheets?version=latest#create-timesheet).", + version: "0.0.1", + type: "action", + props: { + app, + companyId: { + propDefinition: [ + app, + "companyId", + ], + }, + projectId: { + optional: false, + propDefinition: [ + app, + "projectId", + ({ companyId }) => ({ + companyId, + }), + ], + }, + date: { + type: "string", + label: "Date", + description: "The date of the timesheet. Eg. `2025-04-01`.", + }, + }, + methods: { + createTimesheet({ + projectId, ...args + }) { + return this.app.post({ + path: `/projects/${projectId}/timesheets`, + ...args, + }); + }, + }, + async run({ $ }) { + const { + createTimesheet, + companyId, + projectId, + date, + } = this; + + const response = await createTimesheet({ + $, + companyId, + projectId, + data: { + timesheet: { + date, + }, + }, + }); + $.export("$summary", `Successfully created timesheet with ID \`${response.id}\`.`); + return response; + }, +}; diff --git a/components/procore/common/constants.mjs b/components/procore/common/constants.mjs new file mode 100644 index 0000000000000..e51fabbfd935b --- /dev/null +++ b/components/procore/common/constants.mjs @@ -0,0 +1,53 @@ +const ENV_PLACEHOLDER = "{env}"; +const VERSION_PLACEHOLDER = "{version}"; +const ENVIRONMENT = { + PRODUCTION: "api", + SANDBOX: "sandbox", +}; +const BASE_URL = `https://${ENV_PLACEHOLDER}.procore.com/rest${VERSION_PLACEHOLDER}`; + +const VERSION_PATH = { + DEFAULT: "/v1.0", + V1_1: "/v1.1", + V1_3: "/v1.3", + V2: "/v2.0", +}; + +const EVENT_TYPE = { + CREATE: { + label: "Create", + value: "create", + }, + UPDATE: { + label: "Update", + value: "update", + }, + DELETE: { + label: "Delete", + value: "delete", + }, +}; + +const DEFAULT_LIMIT = 100; +const DEFAULT_MAX = 1000; +const WEBHOOK_HOOK_ID = "webhookHookId"; +const WEBHOOK_TRIGGER_IDS = "webhookTriggerIds"; +const TOKEN = "token"; +const IS_FIRST_RUN = "isFirstRun"; +const LAST_DATE_AT = "lastDateAt"; + +export default { + ENV_PLACEHOLDER, + VERSION_PLACEHOLDER, + ENVIRONMENT, + BASE_URL, + VERSION_PATH, + EVENT_TYPE, + DEFAULT_LIMIT, + DEFAULT_MAX, + WEBHOOK_HOOK_ID, + WEBHOOK_TRIGGER_IDS, + TOKEN, + IS_FIRST_RUN, + LAST_DATE_AT, +}; diff --git a/components/procore/common/resource-names.mjs b/components/procore/common/resource-names.mjs new file mode 100644 index 0000000000000..c5d985bc45475 --- /dev/null +++ b/components/procore/common/resource-names.mjs @@ -0,0 +1,123 @@ +// This list comes from the Procore API documentation. +// https://developers.procore.com/documentation/webhooks-api an you can find it as a CSV file in the Procore API documentation here https://developers.procore.com/assets/static/webhook-resources.csv +export default { + BUDGET_LINE_ITEMS: "Budget Line Items", + BUDGET_MODIFICATIONS: "Budget Modifications", + BUDGET_CHANGES: "Budget Changes", + BUDGET_CHANGE_ADJUSTMENTS: "Budget Change Adjustments", + BUDGET_CHANGE_ADJUSTMENT_LINE_ITEMS: "Budget Change Adjustment Line Items", + BUDGET_CHANGE_PRODUCTION_QUANTITIES: "Budget Change Production Quantities", + BUDGET_VIEW_SNAPSHOTS: "Budget View Snapshots", + CHANGE_EVENTS: "Change Events", + CHANGE_EVENT_LINE_ITEMS: "Change Event Line Items", + CHANGE_ORDER_PACKAGES: "Change Order Packages", + CHANGE_ORDER_REQUESTS: "Change Order Requests", + POTENTIAL_CHANGE_ORDER_LINE_ITEMS: "Potential Change Order Line Items", + POTENTIAL_CHANGE_ORDERS: "Potential Change Orders", + CONTRACT_PAYMENTS: "Contract Payments", + DRAW_REQUESTS: "Draw Requests", + PURCHASE_ORDER_CONTRACT_LINE_ITEMS: "Purchase Order Contract Line Items", + PURCHASE_ORDER_CONTRACTS: "Purchase Order Contracts", + RFQ_QUOTES: "RFQ Quotes", + RFQ_RESPONSES: "RFQ Responses", + RFQS: "RFQs", + WORK_ORDER_CONTRACT_LINE_ITEMS: "Work Order Contract Line Items", + WORK_ORDER_CONTRACTS: "Work Order Contracts", + DIRECT_COST_LINE_ITEMS: "Direct Cost Line Items", + DIRECT_COSTS: "Direct Costs", + PAYMENT_APPLICATIONS: "Payment Applications", + PRIME_CONTRACT_LINE_ITEMS: "Prime Contract Line Items", + PRIME_CONTRACTS: "Prime Contracts", + COST_CODES: "Cost Codes", + SUB_JOBS: "Sub Jobs", + LOCATIONS: "Locations", + PROJECT_DATES: "Project Dates", + PROJECT_INSURANCES: "Project Insurances", + PROJECT_USERS: "Project Users", + PROJECT_VENDORS: "Project Vendors", + FILE_VERSIONS: "File Versions", + PROJECT_FILE_VERSIONS: "Project File Versions", + PROJECT_FILES: "Project Files", + PROJECT_FOLDERS: "Project Folders", + TASK_ITEMS: "Task Items", + EQUIPMENT_LOGS: "Equipment Logs", + TIMECARD_ENTRIES: "Timecard Entries", + COORDINATION_ISSUE_ACTIVITIES: "Coordination Issue Activities", + COORDINATION_ISSUES: "Coordination Issues", + ACCIDENT_LOGS: "Accident Logs", + CALL_LOGS: "Call Logs", + DAILY_CONSTRUCTION_REPORT_LOGS: "Daily Construction Report Logs", + DAILY_LOG_ENTRIES: "Daily Log/Entries", + DAILY_LOGS: "Daily Logs", + DELIVERY_LOGS: "Delivery Logs", + DUMPSTER_LOGS: "Dumpster Logs", + INSPECTION_LOGS: "Inspection Logs", + MANPOWER_LOGS: "Manpower Logs", + NOTES_LOGS: "Notes Logs", + PLAN_REVISION_LOGS: "Plan Revision Logs", + PRODUCTIVITY_LOGS: "Productivity Logs", + QUANTITY_LOGS: "Quantity Logs", + SAFETY_VIOLATION_LOGS: "Safety Violation Logs", + VISITOR_LOGS: "Visitor Logs", + WASTE_LOGS: "Waste Logs", + WEATHER_LOGS: "Weather Logs", + WORK_LOGS: "Work Logs", + DRAWING_AREAS: "Drawing Areas", + DRAWING_SETS: "Drawing Sets", + DRAWING_UPLOADS: "Drawing Uploads", + DRAWINGS: "Drawings", + MARKUP_LAYERS: "Markup Layers", + PDF_DOWNLOAD_PAGES: "Pdf Download Pages", + GENERIC_TOOL_ITEMS: "Generic Tool Items", + SITE_INSTRUCTIONS: "Site Instructions", + MEETING_ATTENDEES: "Meeting Attendees", + MEETING_CATEGORIES: "Meeting Categories", + MEETING_TOPICS: "Meeting Topics", + MEETINGS: "Meetings", + BIM_FILE_EXTRATIONS: "Bim File Extractions", + BIM_MODEL_REVISIONS: "Bim Model Revisions", + BIM_MODELS: "Bim Models", + IMAGE_CATEGORIES: "Image Categories", + IMAGES: "Images", + TASKS: "Tasks", + TODOS: "ToDos", + RFI_REPLIES: "RFI Replies", + RFIS: "RFIs", + SPECIFICATION_SECTION_DIVISIONS: "Specification Section Divisions", + SPECIFICATION_SECTION_REVISIONS: "Specification Section Revisions", + SPECIFICATION_SECTIONS: "Specification Sections", + SPECIFICATION_SETS: "Specification Sets", + SUBMITTAL_PACKAGES: "Submittal Packages", + SUBMITTALS: "Submittals", + FORMS: "Forms", + INCIDENTS: "Incidents", + INSPECTION_CHECKLISTS: "Inspection Checklists", + OBSERVATION_ITEM_RESPONSE_LOGS: "Observation Item Response Logs", + OBSERVATION_ITEMS: "Observation Items", + PUNCH_ITEMS: "Punch Items", + CHANGE_TYPES: "Change Types", + CHANGE_ORDER_CHANGE_REASONS: "Change Order Change Reasons", + LINE_ITEM_TYPES: "Line Item Types", + ERP_REQUESTS: "ERP Requests", + OFFICES: "Offices", + PROGRAMS: "Programs", + PROJECT_BID_TYPES: "Project Bid Types", + PROJECT_OWNER_TYPES: "Project Owner Types", + PROJECT_REGIONS: "Project Regions", + PROJECT_STAGES: "Project Stages", + PROJECT_TYPES: "Project Types", + TRADES: "Trades", + COMPANY_INSURANCES: "Company Insurances", + COMPANY_USERS: "Company Users", + COMPANY_VENDORS: "Company Vendors", + COMPANY_FILE_VERSIONS: "Company File Versions", + COMPANY_FILES: "Company Files", + COMPANY_FOLDERS: "Company Folders", + STANDARD_COST_CODE_LISTS: "Standard Cost Code Lists", + STANDARD_COST_CODES: "Standard Cost Codes", + PROJECTS: "Projects", + DEPARTMENTS: "Departments", + BIDS: "Bids", + TIMECARD_TIME_TYPES: "Timecard Time Types", + FORM_TEMPLATES: "Form Templates", +}; diff --git a/components/procore/common/utils.mjs b/components/procore/common/utils.mjs new file mode 100644 index 0000000000000..de7ee6c4a4692 --- /dev/null +++ b/components/procore/common/utils.mjs @@ -0,0 +1,17 @@ +async function iterate(iterations) { + const items = []; + for await (const item of iterations) { + items.push(item); + } + return items; +} + +function getNestedProperty(obj, propertyString) { + const properties = propertyString.split("."); + return properties.reduce((prev, curr) => prev?.[curr], obj); +} + +export default { + iterate, + getNestedProperty, +}; diff --git a/components/procore/package.json b/components/procore/package.json index 1efa3bc9281dc..1e2ad7e607c29 100644 --- a/components/procore/package.json +++ b/components/procore/package.json @@ -1,21 +1,19 @@ { "name": "@pipedream/procore", - "version": "0.0.4", + "version": "0.1.0", "description": "Pipedream Procore (OAuth) Components", - "main": "procore.app.js", + "main": "procore.app.mjs", "keywords": [ "pipedream", "procore" ], - "files": [ - "dist" - ], "homepage": "https://pipedream.com/apps/procore", "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.1.1" + "@pipedream/platform": "^3.0.3", + "uuid": "^11.1.0" } } diff --git a/components/procore/procore.app.js b/components/procore/procore.app.js deleted file mode 100644 index cc93e0cd816a5..0000000000000 --- a/components/procore/procore.app.js +++ /dev/null @@ -1,278 +0,0 @@ -const axios = require("axios"); -const eventTypes = [ - { - label: "Create", - value: "create", - }, - { - label: "Update", - value: "update", - }, - { - label: "Delete", - value: "delete", - }, -]; -const resourceNames = [ - "Budget View Snapshots", - "Change Events", - "Change Order Packages", - "Projects", - "Prime Contracts", - "Purchase Order Contracts", - "RFIs", - "Submittals", -]; - -module.exports = { - type: "app", - app: "procore", - propDefinitions: { - company: { - type: "integer", - label: "Company", - description: "Select the company to watch for changes in.", - async options({ prevContext }) { - const limit = 100; - const { offset = 0 } = prevContext; - const results = await this.listCompanies(limit, offset); - const options = results.map((c) => ({ - label: c.name, - value: c.id, - })); - return { - options, - context: { - limit, - offset: offset + limit, - }, - }; - }, - }, - project: { - type: "integer", - label: "Project", - description: - "Select the project to watch for changes in. Leave blank for company-level resources (eg. Projects).", - optional: true, - async options({ - prevContext, company, - }) { - const limit = 100; - const { offset = 0 } = prevContext; - const results = await this.listProjects(company, limit, offset); - const options = results.map((p) => ({ - label: p.name, - value: p.id, - })); - return { - options, - context: { - limit, - offset: offset + limit, - company, - }, - }; - }, - }, - resourceName: { - type: "string", - label: "Resource", - description: "The type of resource on which to trigger events.", - options: resourceNames, - }, - eventTypes: { - type: "string[]", - label: "Event Type", - description: "Only events of the selected event type will be emitted.", - options: eventTypes, - }, - }, - methods: { - getEventTypes() { - return eventTypes.map(({ value }) => value); - }, - _getBaseUrl() { - return "https://api.procore.com/rest/v1.0"; - }, - _getHeaders(companyId = null) { - let headers = { - Authorization: `Bearer ${this.$auth.oauth_access_token}`, - }; - if (companyId) headers["Procore-Company-Id"] = companyId; - return headers; - }, - async _makeRequest( - method, - endpoint, - companyId = null, - params = null, - data = null, - ) { - const config = { - method, - url: `${this._getBaseUrl()}/${endpoint}`, - headers: this._getHeaders(companyId), - }; - if (params) config.params = params; - else if (data) config.data = data; - return (await axios(config)).data; - }, - async createHook(destinationUrl, companyId, projectId) { - const data = { - hook: { - api_version: "v1.0", - destination_url: destinationUrl, - }, - }; - if (projectId) data.project_id = projectId; - else if (companyId) data.company_id = companyId; - return await this._makeRequest( - "POST", - "webhooks/hooks", - companyId, - null, - data, - ); - }, - async createHookTrigger( - hookId, - companyId, - projectId, - resourceName, - eventType, - ) { - const data = { - api_version: "v1.0", - trigger: { - resource_name: resourceName, - event_type: eventType, - }, - }; - if (projectId) data.project_id = projectId; - else if (companyId) data.company_id = companyId; - return await this._makeRequest( - "POST", - `webhooks/hooks/${hookId}/triggers`, - companyId, - null, - data, - ); - }, - async deleteHook(id, companyId, projectId) { - const params = projectId - ? { - project_id: projectId, - } - : { - company_id: companyId, - }; - return await this._makeRequest( - "DELETE", - `webhooks/hooks/${id}`, - companyId, - params, - ); - }, - async deleteHookTrigger(hookId, triggerId, companyId, projectId) { - const params = projectId - ? { - project_id: projectId, - } - : { - company_id: companyId, - }; - return await this._makeRequest( - "DELETE", - `webhooks/hooks/${hookId}/triggers/${triggerId}`, - companyId, - params, - ); - }, - async listCompanies(perPage, page) { - return await this._makeRequest("GET", "companies", null, { - per_page: perPage, - page, - }); - }, - async listProjects(companyId, perPage, page) { - return await this._makeRequest("GET", "projects", companyId, { - company_id: companyId, - per_page: perPage, - page, - }); - }, - async getBudgetViewSnapshot( - companyId, - projectId, - budgetViewSnapshotId, - perPage, - page, - ) { - return await this._makeRequest( - "GET", - `budget_view_snapshots/${budgetViewSnapshotId}/detail_rows`, - companyId, - { - project_id: projectId, - per_page: perPage, - page, - }, - ); - }, - async getChangeEvent(companyId, projectId, changeEventId) { - return await this._makeRequest( - "GET", - `change_events/${changeEventId}`, - companyId, - { - project_id: projectId, - }, - ); - }, - async getChangeOrderPackage(companyId, projectId, changeOrderPackageId) { - return await this._makeRequest( - "GET", - `change_order_packages/${changeOrderPackageId}`, - companyId, - { - project_id: projectId, - }, - ); - }, - async getPrimeContract(companyId, projectId, primeContractId) { - return await this._makeRequest( - "GET", - `prime_contract/${primeContractId}`, - companyId, - { - project_id: projectId, - }, - ); - }, - async getPurchaseOrder(companyId, projectId, poId) { - return await this._makeRequest( - "GET", - `purchase_order_contracts/${poId}`, - companyId, - { - project_id: projectId, - }, - ); - }, - async getRFI(companyId, projectId, rfiId) { - return await this._makeRequest( - "GET", - `projects/${projectId}/rfis/${rfiId}`, - companyId, - ); - }, - async getSubmittal(companyId, projectId, submittalId) { - return await this._makeRequest( - "GET", - `projects/${projectId}/submittals/${submittalId}`, - companyId, - ); - }, - }, -}; diff --git a/components/procore/procore.app.mjs b/components/procore/procore.app.mjs new file mode 100644 index 0000000000000..b4cc843fafc84 --- /dev/null +++ b/components/procore/procore.app.mjs @@ -0,0 +1,386 @@ +import { axios } from "@pipedream/platform"; +import constants from "./common/constants.mjs"; +import resourceNames from "./common/resource-names.mjs"; +import utils from "./common/utils.mjs"; + +export default { + type: "app", + app: "procore", + propDefinitions: { + companyId: { + type: "integer", + label: "Company ID", + description: "Select the company to watch for changes in.", + async options({ page }) { + const results = await this.listCompanies({ + params: { + per_page: constants.DEFAULT_LIMIT, + page: page + 1, + }, + }); + return results.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + projectId: { + type: "integer", + label: "Project ID", + description: + "Select the project to watch for changes in", + optional: true, + async options({ + companyId, page, + }) { + if (!companyId) { + return []; + } + const results = await this.listProjects({ + companyId, + params: { + company_id: companyId, + per_page: constants.DEFAULT_LIMIT, + page: page + 1, + }, + }); + return results.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + resourceName: { + type: "string", + label: "Resource", + description: "The type of resource on which to trigger events.", + options: Object.values(resourceNames), + }, + eventTypes: { + type: "string[]", + label: "Event Type", + description: "Only events of the selected event type will be emitted.", + options: Object.values(constants.EVENT_TYPE), + }, + locationId: { + type: "integer", + label: "Location ID", + description: "The ID of the location", + optional: true, + async options({ + companyId, projectId, page, + }) { + if (!companyId || !projectId) { + return []; + } + const results = await this.listLocations({ + companyId, + projectId, + params: { + per_page: constants.DEFAULT_LIMIT, + page: page + 1, + }, + }); + return results.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + userId: { + type: "integer", + label: "User ID", + description: "The ID of the user", + optional: true, + async options({ + companyId, page, + }) { + if (!companyId) { + return []; + } + const results = await this.listUsers({ + companyId, + params: { + view: "normal", + per_page: constants.DEFAULT_LIMIT, + page: page + 1, + }, + }); + return results.map(({ + id: value, first_name: firstName, last_name: lastName, + }) => ({ + label: `${firstName} ${lastName}`, + value, + })); + }, + }, + rfiPotentialManagerId: { + type: "integer", + label: "RFI Potential Manager ID", + description: "The ID of the potential RFI manager", + async options({ + companyId, projectId, page, + }) { + const results = await this.listPotentialRfiManagers({ + companyId, + projectId, + params: { + per_page: constants.DEFAULT_LIMIT, + page: page + 1, + }, + }); + return results.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + potentialAssigneeId: { + type: "integer", + label: "Potential Assignee ID", + description: "The ID of the potential assignee", + async options({ + companyId, projectId, page, + }) { + if (!companyId || !projectId) { + return []; + } + const results = await this.listPotentialAssignees({ + companyId, + projectId, + params: { + per_page: constants.DEFAULT_LIMIT, + page: page + 1, + }, + }); + return results.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + }, + methods: { + getEnvironment() { + return constants.ENVIRONMENT.PRODUCTION; + }, + getAccessToken() { + return this.$auth.oauth_access_token; + }, + getUrl(path, versionPath = constants.VERSION_PATH.DEFAULT) { + const env = this.getEnvironment(); + const baseUrl = constants.BASE_URL + .replace( + constants.ENV_PLACEHOLDER, + env, + ) + .replace( + constants.VERSION_PLACEHOLDER, + versionPath, + ); + return `${baseUrl}${path}`; + }, + getHeaders(headers, companyId) { + return { + ...headers, + "Content-Type": "application/json", + "Authorization": `Bearer ${this.getAccessToken()}`, + ...(companyId && { + "Procore-Company-Id": companyId, + }), + }; + }, + makeRequest({ + $ = this, path, headers, versionPath, companyId, ...args + } = {}) { + return axios($, { + ...args, + url: this.getUrl(path, versionPath), + headers: this.getHeaders(headers, companyId), + }); + }, + post(args = {}) { + return this.makeRequest({ + method: "POST", + ...args, + }); + }, + delete(args = {}) { + return this.makeRequest({ + method: "DELETE", + ...args, + }); + }, + listCompanies(args = {}) { + return this.makeRequest({ + path: "/companies", + ...args, + }); + }, + listProjects(args = {}) { + return this.makeRequest({ + versionPath: constants.VERSION_PATH.V1_1, + path: "/projects", + ...args, + }); + }, + getBudgetViewSnapshot({ + budgetViewSnapshotId, ...args + } = {}) { + return this.makeRequest({ + path: `/budget_view_snapshots/${budgetViewSnapshotId}/detail_rows`, + ...args, + }); + }, + getChangeEvent({ + changeEventId, ...args + } = {}) { + return this.makeRequest({ + versionPath: constants.VERSION_PATH.V1_1, + path: `/change_events/${changeEventId}`, + ...args, + }); + }, + getChangeOrderPackage({ + changeOrderPackageId, ...args + } = {}) { + return this.makeRequest({ + path: `/change_order_packages/${changeOrderPackageId}`, + ...args, + }); + }, + getPrimeContract({ + primeContractId, ...args + } = {}) { + return this.makeRequest({ + path: `/prime_contract/${primeContractId}`, + ...args, + }); + }, + getPurchaseOrderContract({ + purchaseOrderContractId, ...args + } = {}) { + return this.makeRequest({ + path: `/purchase_order_contracts/${purchaseOrderContractId}`, + ...args, + }); + }, + getRFI({ + projectId, rfiId, ...args + } = {}) { + return this.makeRequest({ + path: `/projects/${projectId}/rfis/${rfiId}`, + ...args, + }); + }, + getSubmittal({ + projectId, submittalId, ...args + } = {}) { + return this.makeRequest({ + versionPath: constants.VERSION_PATH.V1_1, + path: `/projects/${projectId}/submittals/${submittalId}`, + ...args, + }); + }, + getTimecardEntry({ + timecardEntryId, ...args + } = {}) { + return this.makeRequest({ + path: `/timecard_entries/${timecardEntryId}`, + ...args, + }); + }, + listLocations({ + projectId, ...args + } = {}) { + return this.makeRequest({ + path: `/projects/${projectId}/locations`, + ...args, + }); + }, + listUsers({ + companyId, ...args + } = {}) { + return this.makeRequest({ + companyId, + versionPath: constants.VERSION_PATH.V1_3, + path: `/companies/${companyId}/users`, + ...args, + }); + }, + listPotentialRfiManagers({ + projectId, ...args + } = {}) { + return this.makeRequest({ + path: `/projects/${projectId}/rfis/potential_rfi_managers`, + ...args, + }); + }, + listPotentialAssignees({ + projectId, ...args + } = {}) { + return this.makeRequest({ + path: `/projects/${projectId}/rfis/potential_assignees`, + ...args, + }); + }, + async *getIterations({ + resourcesFn, resourcesFnArgs, resourceName, + max = constants.DEFAULT_MAX, + }) { + let page = 1; + let resourcesCount = 0; + + while (true) { + const response = + await resourcesFn({ + ...resourcesFnArgs, + params: { + ...resourcesFnArgs?.params, + page, + per_page: constants.DEFAULT_LIMIT, + }, + }); + + const nextResources = resourceName + ? utils.getNestedProperty(response, resourceName) + : response; + + if (!nextResources?.length) { + console.log("No more resources found"); + return; + } + + for (const resource of nextResources) { + yield resource; + resourcesCount += 1; + + if (resourcesCount >= max) { + console.log("Reached max resources"); + return; + } + } + + if (nextResources.length < constants.DEFAULT_LIMIT) { + console.log("No next page found"); + return; + } + + page += 1; + } + }, + paginate(args = {}) { + return utils.iterate(this.getIterations(args)); + }, + }, +}; diff --git a/components/procore/sources/budget-snapshot/budget-snapshot.js b/components/procore/sources/budget-snapshot/budget-snapshot.js deleted file mode 100644 index 94e8006ee8ab3..0000000000000 --- a/components/procore/sources/budget-snapshot/budget-snapshot.js +++ /dev/null @@ -1,54 +0,0 @@ -const common = require("../common.js"); - -module.exports = { - ...common, - name: "Budget Snapshot Event (Instant)", - key: "procore-budget-snapshot", - description: - "Emits an event each time a Budget Snapshot is created, updated, or deleted in a project.", - version: "0.0.2", - type: "source", - methods: { - ...common.methods, - getResourceName() { - return "Budget View Snapshots"; - }, - async getDataToEmit(body) { - const { resource_id: resourceId } = body; - const limit = 100; - let offset = 0; - let total = limit; - let snapshotRows = []; - while (total == limit) { - const resource = await this.procore.getBudgetViewSnapshot( - this.company, - this.project, - resourceId, - limit, - offset, - ); - snapshotRows = snapshotRows.concat(resource); - total = resource.length; - offset += limit; - } - return { - ...body, - snapshotRows, - }; - }, - getMeta(body) { - const { - id, - event_type: eventType, - resource_id: resourceId, - timestamp, - } = body; - const ts = new Date(timestamp).getTime(); - return { - id, - summary: `${eventType} Budget Snapshot ID:${resourceId}`, - ts, - }; - }, - }, -}; diff --git a/components/procore/sources/commitment-change-order/commitment-change-order.js b/components/procore/sources/commitment-change-order/commitment-change-order.js deleted file mode 100644 index 96fcb439947db..0000000000000 --- a/components/procore/sources/commitment-change-order/commitment-change-order.js +++ /dev/null @@ -1,43 +0,0 @@ -const common = require("../common.js"); - -module.exports = { - ...common, - name: "Commitment Change Order Event (Instant)", - key: "procore-commitment-change-order", - description: - "Emits an event each time a Commitment Change Order is created, updated, or deleted in a project.", - version: "0.0.2", - type: "source", - methods: { - ...common.methods, - getResourceName() { - return "Change Events"; - }, - async getDataToEmit(body) { - const { resource_id: resourceId } = body; - const resource = await this.procore.getChangeEvent( - this.company, - this.project, - resourceId, - ); - return { - ...body, - resource, - }; - }, - getMeta(body) { - const { - id, - event_type: eventType, - resource_id: resourceId, - timestamp, - } = body; - const ts = new Date(timestamp).getTime(); - return { - id, - summary: `${eventType} Change Order ID:${resourceId}`, - ts, - }; - }, - }, -}; diff --git a/components/procore/sources/common.js b/components/procore/sources/common.js deleted file mode 100644 index 81daec25cc539..0000000000000 --- a/components/procore/sources/common.js +++ /dev/null @@ -1,84 +0,0 @@ -const procore = require("../procore.app.js"); - -module.exports = { - dedupe: "unique", - props: { - procore, - db: "$.service.db", - http: "$.interface.http", - company: { - propDefinition: [ - procore, - "company", - ], - }, - project: { - propDefinition: [ - procore, - "project", - (c) => ({ - company: c.company, - }), - ], - }, - }, - methods: { - getComponentEventTypes() { - return this.procore.getEventTypes(); - }, - getResourceName() { - throw new Error("getResourceName is not implemented"); - }, - }, - hooks: { - async activate() { - const hook = await this.procore.createHook( - this.http.endpoint, - this.company, - this.project, - ); - this.db.set("hookId", hook.id); - // create hook triggers - const eventTypes = this.getComponentEventTypes(); - const resourceName = this.getResourceName(); - const triggerIds = []; - for (const eventType of eventTypes) { - const trigger = await this.procore.createHookTrigger( - hook.id, - this.company, - this.project, - resourceName, - eventType, - ); - triggerIds.push(trigger.id); - } - this.db.set("triggerIds", triggerIds); - }, - async deactivate() { - const hookId = this.db.get("hookId"); - const triggerIds = this.db.get("triggerIds"); - // delete hook triggers - for (const triggerId of triggerIds) { - await this.procore.deleteHookTrigger( - hookId, - triggerId, - this.company, - this.project, - ); - } - // delete hook - await this.procore.deleteHook(hookId, this.company, this.project); - }, - }, - async run(event) { - const { body } = event; - if (!body) { - return; - } - - const dataToEmit = await this.getDataToEmit(body); - const meta = this.getMeta(dataToEmit); - - this.$emit(dataToEmit, meta); - }, -}; diff --git a/components/procore/sources/common/webhook.mjs b/components/procore/sources/common/webhook.mjs new file mode 100644 index 0000000000000..e6a349af32165 --- /dev/null +++ b/components/procore/sources/common/webhook.mjs @@ -0,0 +1,211 @@ +import { v4 as uuid } from "uuid"; +import { ConfigurationError } from "@pipedream/platform"; +import app from "../../procore.app.mjs"; +import constants from "../../common/constants.mjs"; + +export default { + props: { + app, + db: "$.service.db", + http: { + type: "$.interface.http", + customResponse: true, + }, + companyId: { + propDefinition: [ + app, + "companyId", + ], + }, + projectId: { + optional: false, + propDefinition: [ + app, + "projectId", + ({ companyId }) => ({ + companyId, + }), + ], + }, + eventTypes: { + propDefinition: [ + app, + "eventTypes", + ], + }, + }, + hooks: { + async activate() { + const { + companyId, + projectId, + eventTypes, + createWebhooksHook, + bulkCreateWebhooksTriggers, + getResourceName, + http: { endpoint: destinationUrl }, + setToken, + setWebhookHookId, + setWebhookTriggerIds, + } = this; + + const id = uuid(); + const token = Buffer.from(id).toString("base64"); + + const hookResponse = + await createWebhooksHook({ + companyId, + data: { + project_id: projectId, + hook: { + api_version: "v2", + destination_url: destinationUrl, + namespace: "pipedream", + destination_headers: { + Authorization: `Bearer ${token}`, + }, + }, + }, + }); + + setToken(token); + setWebhookHookId(hookResponse.id); + + const triggers = eventTypes.map((eventType) => ({ + resource_name: getResourceName(), + event_type: eventType, + })); + + const triggerResponses = await bulkCreateWebhooksTriggers({ + companyId, + hookId: hookResponse.id, + data: { + project_id: projectId, + api_version: "v2", + triggers, + }, + }); + + setWebhookTriggerIds(triggerResponses?.success.map(({ id }) => id)); + + }, + async deactivate() { + const { + deleteWebhooksHook, + bulkDeleteWebhooksTriggers, + getWebhookHookId, + getWebhookTriggerIds, + companyId, + projectId, + } = this; + + const hookId = getWebhookHookId(); + const triggerIds = getWebhookTriggerIds(); + + await bulkDeleteWebhooksTriggers({ + companyId, + hookId, + data: { + project_id: projectId, + triggers: triggerIds, + }, + }); + + await deleteWebhooksHook({ + hookId, + companyId, + params: { + project_id: projectId, + }, + }); + }, + }, + methods: { + generateMeta() { + throw new ConfigurationError("generateMeta is not implemented"); + }, + setToken(value) { + this.db.set(constants.TOKEN, value); + }, + getToken() { + return this.db.get(constants.TOKEN); + }, + setWebhookHookId(value) { + this.db.set(constants.WEBHOOK_HOOK_ID, value); + }, + getWebhookHookId() { + return this.db.get(constants.WEBHOOK_HOOK_ID); + }, + setWebhookTriggerIds(values) { + this.db.set(constants.WEBHOOK_TRIGGER_IDS, values); + }, + getWebhookTriggerIds() { + return this.db.get(constants.WEBHOOK_TRIGGER_IDS); + }, + getResourceName() { + throw new ConfigurationError("getResourceName is not implemented"); + }, + createWebhooksHook(args = {}) { + return this.app.post({ + debug: true, + path: "/webhooks/hooks", + ...args, + }); + }, + deleteWebhooksHook({ + hookId, ...args + } = {}) { + return this.app.delete({ + debug: true, + path: `/webhooks/hooks/${hookId}`, + ...args, + }); + }, + bulkCreateWebhooksTriggers({ + hookId, ...args + } = {}) { + return this.app.post({ + debug: true, + path: `/webhooks/hooks/${hookId}/triggers/bulk`, + ...args, + }); + }, + bulkDeleteWebhooksTriggers({ + hookId, ...args + } = {}) { + return this.app.delete({ + debug: true, + path: `/webhooks/hooks/${hookId}/triggers/bulk`, + ...args, + }); + }, + async getDataToEmit(body) { + return body; + }, + isResourceRelevant(resource) { + return this.getResourceName() === resource.resource_name; + }, + processResource(resource) { + if (this.isResourceRelevant(resource)) { + this.$emit(resource, this.generateMeta(resource)); + } + }, + }, + async run({ + body, headers: { authorization }, + }) { + const token = this.getToken(); + if (authorization !== `Bearer ${token}`) { + console.log("Authorization header does not match the expected token"); + return this.http.respond({ + status: 401, + }); + } + this.http.respond({ + status: 200, + }); + + const resource = await this.getDataToEmit(body); + this.processResource(resource); + }, +}; diff --git a/components/procore/sources/new-budget-snapshot-event-instant/new-budget-snapshot-event-instant.mjs b/components/procore/sources/new-budget-snapshot-event-instant/new-budget-snapshot-event-instant.mjs new file mode 100644 index 0000000000000..ddb59898222cb --- /dev/null +++ b/components/procore/sources/new-budget-snapshot-event-instant/new-budget-snapshot-event-instant.mjs @@ -0,0 +1,55 @@ +import common from "../common/webhook.mjs"; +import resourceNames from "../../common/resource-names.mjs"; + +export default { + ...common, + name: "New Budget Snapshot Event (Instant)", + key: "procore-new-budget-snapshot-event-instant", + description: "Emit new event when a new budget snapshot event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", + type: "source", + methods: { + ...common.methods, + getResourceName() { + return resourceNames.BUDGET_VIEW_SNAPSHOTS; + }, + async getDataToEmit(body) { + const { + app, + companyId, + } = this; + const { + resource_id: budgetViewSnapshotId, + project_id: projectId, + } = body; + + try { + const snapshotRows = await app.paginate({ + resourcesFn: app.getBudgetViewSnapshot, + resourcesFnArgs: { + companyId, + budgetViewSnapshotId, + params: { + project_id: projectId, + }, + }, + }); + + return { + ...body, + snapshotRows, + }; + } catch (error) { + console.log(error.message || error); + return body; + } + }, + generateMeta(body) { + return { + id: body.id, + summary: `New Budget Snapshot Event: ${body.resource_id}`, + ts: new Date(body.timestamp).getTime(), + }; + }, + }, +}; diff --git a/components/procore/sources/new-change-order-package-event-instant/new-change-order-package-event-instant.mjs b/components/procore/sources/new-change-order-package-event-instant/new-change-order-package-event-instant.mjs new file mode 100644 index 0000000000000..b4f69fb2ceaec --- /dev/null +++ b/components/procore/sources/new-change-order-package-event-instant/new-change-order-package-event-instant.mjs @@ -0,0 +1,52 @@ +import common from "../common/webhook.mjs"; +import resourceNames from "../../common/resource-names.mjs"; + +export default { + ...common, + name: "New Change Order Package Event (Instant)", + key: "procore-new-change-order-package-event-instant", + description: "Emit new event when a new change order package event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", + type: "source", + methods: { + ...common.methods, + getResourceName() { + return resourceNames.CHANGE_ORDER_PACKAGES; + }, + async getDataToEmit(body) { + const { + app, + companyId, + } = this; + const { + resource_id: changeOrderPackageId, + project_id: projectId, + } = body; + + try { + const resource = await app.getChangeOrderPackage({ + companyId, + changeOrderPackageId, + params: { + project_id: projectId, + }, + }); + + return { + ...body, + resource, + }; + } catch (error) { + console.log(error.message || error); + return body; + } + }, + generateMeta(body) { + return { + id: body.id, + summary: `New Change Order Package Event: ${body.resource_id}`, + ts: new Date(body.timestamp).getTime(), + }; + }, + }, +}; diff --git a/components/procore/sources/new-commitment-change-order-event-instant/new-commitment-change-order-event-instant.mjs b/components/procore/sources/new-commitment-change-order-event-instant/new-commitment-change-order-event-instant.mjs new file mode 100644 index 0000000000000..ddb4bccc39a92 --- /dev/null +++ b/components/procore/sources/new-commitment-change-order-event-instant/new-commitment-change-order-event-instant.mjs @@ -0,0 +1,51 @@ +import common from "../common/webhook.mjs"; +import resourceNames from "../../common/resource-names.mjs"; + +export default { + ...common, + name: "New Commitment Change Order Event (Instant)", + key: "procore-new-commitment-change-order-event-instant", + description: "Emit new event when a new commitment change order event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", + type: "source", + methods: { + ...common.methods, + getResourceName() { + return resourceNames.CHANGE_EVENTS; + }, + async getDataToEmit(body) { + const { + app, + companyId, + } = this; + const { + resource_id: changeEventId, + project_id: projectId, + } = body; + + try { + const resource = await app.getChangeEvent({ + companyId, + changeEventId, + params: { + project_id: projectId, + }, + }); + return { + ...body, + resource, + }; + } catch (error) { + console.log(error.message || error); + return body; + } + }, + generateMeta(body) { + return { + id: body.id, + summary: `New Commitment Change Order Event: ${body.resource_id}`, + ts: new Date(body.timestamp).getTime(), + }; + }, + }, +}; diff --git a/components/procore/sources/new-event-instant/new-event-instant.mjs b/components/procore/sources/new-event-instant/new-event-instant.mjs new file mode 100644 index 0000000000000..92def7eaf0ea3 --- /dev/null +++ b/components/procore/sources/new-event-instant/new-event-instant.mjs @@ -0,0 +1,32 @@ +import common from "../common/webhook.mjs"; + +export default { + ...common, + name: "New Event (Instant)", + key: "procore-new-event-instant", + description: "Emit new event depending on the resource name selected. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", + type: "source", + props: { + ...common.props, + resourceName: { + propDefinition: [ + common.props.app, + "resourceName", + ], + }, + }, + methods: { + ...common.methods, + getResourceName() { + return this.resourceName; + }, + generateMeta(body) { + return { + id: body.id, + summary: `New Event: ${body.event_type}`, + ts: new Date(body.timestamp).getTime(), + }; + }, + }, +}; diff --git a/components/procore/sources/new-event/new-event.js b/components/procore/sources/new-event/new-event.js deleted file mode 100644 index 2fa9417e3ec84..0000000000000 --- a/components/procore/sources/new-event/new-event.js +++ /dev/null @@ -1,52 +0,0 @@ -const procore = require("../../procore.app.js"); -const common = require("../common.js"); - -module.exports = { - ...common, - name: "New Event (Instant)", - key: "procore-new-event", - description: "Emits an event for each webhook notification.", - version: "0.0.2", - type: "source", - props: { - ...common.props, - resourceName: { - propDefinition: [ - procore, - "resourceName", - ], - }, - eventTypes: { - propDefinition: [ - procore, - "eventTypes", - ], - }, - }, - methods: { - ...common.methods, - getComponentEventTypes() { - return this.eventTypes; - }, - getResourceName() { - return this.resourceName; - }, - async getDataToEmit(body) { - return body; - }, - getMeta(body) { - const { - id, - event_type: eventType, - resource_name: resourceName, - timestamp, - } = body; - const ts = new Date(timestamp).getTime(); - return { - id, - summary: `${eventType} ${resourceName}`, - ts, - }; - }, - }, -}; diff --git a/components/procore/sources/new-prime-contract-event-instant/new-prime-contract-event-instant.mjs b/components/procore/sources/new-prime-contract-event-instant/new-prime-contract-event-instant.mjs new file mode 100644 index 0000000000000..846d12a659cf9 --- /dev/null +++ b/components/procore/sources/new-prime-contract-event-instant/new-prime-contract-event-instant.mjs @@ -0,0 +1,52 @@ +import common from "../common/webhook.mjs"; +import resourceNames from "../../common/resource-names.mjs"; + +export default { + ...common, + name: "New Prime Contract Event (Instant)", + key: "procore-new-prime-contract-event-instant", + description: "Emit new event when a new prime contract event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", + type: "source", + methods: { + ...common.methods, + getResourceName() { + return resourceNames.PRIME_CONTRACTS; + }, + async getDataToEmit(body) { + const { + app, + companyId, + } = this; + const { + resource_id: primeContractId, + project_id: projectId, + } = body; + + try { + const resource = await app.getPrimeContract({ + companyId, + primeContractId, + params: { + project_id: projectId, + }, + }); + return { + ...body, + resource, + }; + } catch (error) { + console.log(error.message || error); + return body; + } + }, + generateMeta(body) { + return { + id: body.id, + summary: `New Prime Contract Event: ${body.resource_id}`, + ts: new Date(body.timestamp).getTime(), + }; + }, + }, +}; + diff --git a/components/procore/sources/new-purchase-order-event-instant/new-purchase-order-event-instant.mjs b/components/procore/sources/new-purchase-order-event-instant/new-purchase-order-event-instant.mjs new file mode 100644 index 0000000000000..2f86ff3b66843 --- /dev/null +++ b/components/procore/sources/new-purchase-order-event-instant/new-purchase-order-event-instant.mjs @@ -0,0 +1,51 @@ +import common from "../common/webhook.mjs"; +import resourceNames from "../../common/resource-names.mjs"; + +export default { + ...common, + name: "New Purchase Order Event (Instant)", + key: "procore-new-purchase-order-event-instant", + description: "Emit new event when a new purchase order event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", + type: "source", + methods: { + ...common.methods, + getResourceName() { + return resourceNames.PURCHASE_ORDER_CONTRACTS; + }, + async getDataToEmit(body) { + const { + app, + companyId, + } = this; + const { + resource_id: purchaseOrderContractId, + project_id: projectId, + } = body; + + try { + const resource = await app.getPurchaseOrderContract({ + companyId, + purchaseOrderContractId, + params: { + project_id: projectId, + }, + }); + return { + ...body, + resource, + }; + } catch (error) { + console.log(error.message || error); + return body; + } + }, + generateMeta(body) { + return { + id: body.id, + summary: `New Purchase Order Event: ${body.resource_id}`, + ts: new Date(body.timestamp).getTime(), + }; + }, + }, +}; diff --git a/components/procore/sources/new-rfi-event-instant/new-rfi-event-instant.mjs b/components/procore/sources/new-rfi-event-instant/new-rfi-event-instant.mjs new file mode 100644 index 0000000000000..72a0b0141ee5c --- /dev/null +++ b/components/procore/sources/new-rfi-event-instant/new-rfi-event-instant.mjs @@ -0,0 +1,49 @@ +import common from "../common/webhook.mjs"; +import resourceNames from "../../common/resource-names.mjs"; + +export default { + ...common, + name: "New RFI Event (Instant)", + key: "procore-new-rfi-event-instant", + description: "Emit new event when a new RFI event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", + type: "source", + methods: { + ...common.methods, + getResourceName() { + return resourceNames.RFIS; + }, + async getDataToEmit(body) { + const { + app, + companyId, + } = this; + const { + resource_id: rfiId, + project_id: projectId, + } = body; + + try { + const resource = await app.getRFI({ + companyId, + projectId, + rfiId, + }); + return { + ...body, + resource, + }; + } catch (error) { + console.log(error.message || error); + return body; + } + }, + generateMeta(body) { + return { + id: body.id, + summary: `New RFI Event: ${body.resource_id}`, + ts: new Date(body.timestamp).getTime(), + }; + }, + }, +}; diff --git a/components/procore/sources/new-submittal-event-instant/new-submittal-event-instant.mjs b/components/procore/sources/new-submittal-event-instant/new-submittal-event-instant.mjs new file mode 100644 index 0000000000000..05164ee3775fa --- /dev/null +++ b/components/procore/sources/new-submittal-event-instant/new-submittal-event-instant.mjs @@ -0,0 +1,49 @@ +import common from "../common/webhook.mjs"; +import resourceNames from "../../common/resource-names.mjs"; + +export default { + ...common, + name: "New Submittal Event (Instant)", + key: "procore-new-submittal-event-instant", + description: "Emit new event when a new submittal event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", + type: "source", + methods: { + ...common.methods, + getResourceName() { + return resourceNames.SUBMITTALS; + }, + async getDataToEmit(body) { + const { + app, + companyId, + } = this; + const { + resource_id: submittalId, + project_id: projectId, + } = body; + + try { + const resource = await app.getSubmittal({ + companyId, + projectId, + submittalId, + }); + return { + ...body, + resource, + }; + } catch (error) { + console.log(error.message || error); + return body; + } + }, + generateMeta(body) { + return { + id: body.id, + summary: `New Submittal Event: ${body.resource_id}`, + ts: new Date(body.timestamp).getTime(), + }; + }, + }, +}; diff --git a/components/procore/sources/new-timecard-entry-event-instant/new-timecard-entry-event-instant.mjs b/components/procore/sources/new-timecard-entry-event-instant/new-timecard-entry-event-instant.mjs new file mode 100644 index 0000000000000..818a7b542a6c9 --- /dev/null +++ b/components/procore/sources/new-timecard-entry-event-instant/new-timecard-entry-event-instant.mjs @@ -0,0 +1,51 @@ +import common from "../common/webhook.mjs"; +import resourceNames from "../../common/resource-names.mjs"; + +export default { + ...common, + name: "New Timecard Entry Event (Instant)", + key: "procore-new-timecard-entry-event-instant", + description: "Emit new event when a new timecard entry is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", + type: "source", + methods: { + ...common.methods, + getResourceName() { + return resourceNames.TIMECARD_ENTRIES; + }, + async getDataToEmit(body) { + const { + app, + companyId, + } = this; + const { + resource_id: timecardEntryId, + project_id: projectId, + } = body; + + try { + const resource = await app.getTimecardEntry({ + companyId, + timecardEntryId, + params: { + project_id: projectId, + }, + }); + return { + ...body, + resource, + }; + } catch (error) { + console.log(error.message || error); + return body; + } + }, + generateMeta(body) { + return { + id: body.id, + summary: `New Timecard Entry Event: ${body.resource_id}`, + ts: new Date(body.timestamp).getTime(), + }; + }, + }, +}; diff --git a/components/procore/sources/prime-contract-change-order/prime-contract-change-order.js b/components/procore/sources/prime-contract-change-order/prime-contract-change-order.js deleted file mode 100644 index 0a93f6b5790c0..0000000000000 --- a/components/procore/sources/prime-contract-change-order/prime-contract-change-order.js +++ /dev/null @@ -1,43 +0,0 @@ -const common = require("../common.js"); - -module.exports = { - ...common, - name: "Prime Contract Change Order Event (Instant)", - key: "procore-prime-contract-change-order", - description: - "Emits an event each time a Prime Contract Change Order is created, updated, or deleted in a project.", - version: "0.0.2", - type: "source", - methods: { - ...common.methods, - getResourceName() { - return "Change Order Packages"; - }, - async getDataToEmit(body) { - const { resource_id: resourceId } = body; - const resource = await this.procore.getChangeOrderPackage( - this.company, - this.project, - resourceId, - ); - return { - ...body, - resource, - }; - }, - getMeta(body) { - const { - id, - event_type: eventType, - resource_id: resourceId, - timestamp, - } = body; - const ts = new Date(timestamp).getTime(); - return { - id, - summary: `${eventType} Change Order ID:${resourceId}`, - ts, - }; - }, - }, -}; diff --git a/components/procore/sources/prime-contract/prime-contract.js b/components/procore/sources/prime-contract/prime-contract.js deleted file mode 100644 index 056bfec742887..0000000000000 --- a/components/procore/sources/prime-contract/prime-contract.js +++ /dev/null @@ -1,41 +0,0 @@ -const common = require("../common.js"); - -module.exports = { - ...common, - name: "Prime Contract Event(Instant)", - key: "procore-prime-contract", - description: - "Emits an event each time a Prime Contract is created, updated, or deleted in a project.", - version: "0.0.2", - type: "source", - methods: { - ...common.methods, - getResourceName() { - return "Prime Contracts"; - }, - async getDataToEmit(body) { - const { resource_id: resourceId } = body; - const resource = await this.procore.getPrimeContract( - this.company, - this.project, - resourceId, - ); - return { - ...body, - resource, - }; - }, - getMeta({ - id, event_type, timestamp, resource, - }) { - const { title } = resource; - const eventType = event_type; - const ts = new Date(timestamp).getTime(); - return { - id, - summary: `${eventType} ${title}`, - ts, - }; - }, - }, -}; diff --git a/components/procore/sources/purchase-order/purchase-order.js b/components/procore/sources/purchase-order/purchase-order.js deleted file mode 100644 index 33ef713088aea..0000000000000 --- a/components/procore/sources/purchase-order/purchase-order.js +++ /dev/null @@ -1,46 +0,0 @@ -const common = require("../common.js"); - -module.exports = { - ...common, - name: "Purchase Order Event (Instant)", - key: "procore-purchase-order", - description: - "Emits an event each time a Purchase Order is created, updated, or deleted in a project.", - version: "0.0.2", - type: "source", - methods: { - ...common.methods, - getResourceName() { - return "Purchase Order Contracts"; - }, - async getDataToEmit(body) { - const { resource_id: resourceId } = body; - const resource = await this.procore.getPurchaseOrder( - this.company, - this.project, - resourceId, - ); - return { - ...body, - resource, - }; - }, - getMeta({ - id, event_type, timestamp, resource, - }) { - const { - title, id: purchaseOrderId, - } = resource; - const eventType = event_type; - const summary = title - ? `${eventType} ${title}` - : `${eventType} Purchase Order ID:${purchaseOrderId}`; - const ts = new Date(timestamp).getTime(); - return { - id, - summary, - ts, - }; - }, - }, -}; diff --git a/components/procore/sources/rfi/rfi.js b/components/procore/sources/rfi/rfi.js deleted file mode 100644 index 1d8662de3529f..0000000000000 --- a/components/procore/sources/rfi/rfi.js +++ /dev/null @@ -1,41 +0,0 @@ -const common = require("../common.js"); - -module.exports = { - ...common, - name: "RFI Event (Instant)", - key: "procore-rfi", - description: - "Emits an event each time a RFI is created, updated, or deleted in a project.", - version: "0.0.2", - type: "source", - methods: { - ...common.methods, - getResourceName() { - return "RFIs"; - }, - async getDataToEmit(body) { - const { resource_id: resourceId } = body; - const resource = await this.procore.getRFI( - this.company, - this.project, - resourceId, - ); - return { - ...body, - resource, - }; - }, - getMeta({ - id, event_type, timestamp, resource, - }) { - const { subject } = resource; - const eventType = event_type; - const ts = new Date(timestamp).getTime(); - return { - id, - summary: `${eventType} ${subject}`, - ts, - }; - }, - }, -}; diff --git a/components/procore/sources/submittal/submittal.js b/components/procore/sources/submittal/submittal.js deleted file mode 100644 index d70fb49af3012..0000000000000 --- a/components/procore/sources/submittal/submittal.js +++ /dev/null @@ -1,46 +0,0 @@ -const common = require("../common.js"); - -module.exports = { - ...common, - name: "Submittal Event (Instant)", - key: "procore-submittal", - description: - "Emits an event each time a Submittal is created, updated, or deleted in a project.", - version: "0.0.2", - type: "source", - methods: { - ...common.methods, - getResourceName() { - return "Submittals"; - }, - async getDataToEmit(body) { - const { resource_id: resourceId } = body; - const resource = await this.procore.getSubmittal( - this.company, - this.project, - resourceId, - ); - return { - ...body, - resource, - }; - }, - getMeta({ - id, event_type, timestamp, resource, - }) { - const { - title, id: submittalId, - } = resource; - const eventType = event_type; - const summary = title - ? `${eventType} ${title}` - : `${eventType} Submittal ID:${submittalId}`; - const ts = new Date(timestamp).getTime(); - return { - id, - summary, - ts, - }; - }, - }, -}; diff --git a/components/procore_sandbox/actions/create-incident/create-incident.mjs b/components/procore_sandbox/actions/create-incident/create-incident.mjs new file mode 100644 index 0000000000000..15f61d1bdc50b --- /dev/null +++ b/components/procore_sandbox/actions/create-incident/create-incident.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/actions/create-incident/create-incident.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-create-incident", + description: "Create a new incident. [See the documentation](https://developers.procore.com/reference/rest/incidents?version=latest#create-incident).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/actions/create-manpower-log/create-manpower-log.mjs b/components/procore_sandbox/actions/create-manpower-log/create-manpower-log.mjs new file mode 100644 index 0000000000000..92e030c054ba8 --- /dev/null +++ b/components/procore_sandbox/actions/create-manpower-log/create-manpower-log.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/actions/create-manpower-log/create-manpower-log.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-create-manpower-log", + description: "Create a new manpower log. [See the documentation](https://developers.procore.com/reference/rest/manpower-logs?version=latest#create-manpower-log).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/actions/create-rfi/create-rfi.mjs b/components/procore_sandbox/actions/create-rfi/create-rfi.mjs new file mode 100644 index 0000000000000..7ff6e7c087bba --- /dev/null +++ b/components/procore_sandbox/actions/create-rfi/create-rfi.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/actions/create-rfi/create-rfi.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-create-rfi", + description: "Create a new RFI. [See the documentation](https://developers.procore.com/reference/rest/rfis?version=latest#create-rfi).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/actions/create-submittal/create-submittal.mjs b/components/procore_sandbox/actions/create-submittal/create-submittal.mjs new file mode 100644 index 0000000000000..b062fae4fe080 --- /dev/null +++ b/components/procore_sandbox/actions/create-submittal/create-submittal.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/actions/create-submittal/create-submittal.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-create-submittal", + description: "Create a new submittal. [See the documentation](https://developers.procore.com/reference/rest/submittals?version=latest#create-submittal).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/actions/create-timesheet/create-timesheet.mjs b/components/procore_sandbox/actions/create-timesheet/create-timesheet.mjs new file mode 100644 index 0000000000000..9d6ff5912a8df --- /dev/null +++ b/components/procore_sandbox/actions/create-timesheet/create-timesheet.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/actions/create-timesheet/create-timesheet.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-create-timesheet", + description: "Create a new timesheet. [See the documentation](https://developers.procore.com/reference/rest/timesheets?version=latest#create-timesheet).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/common/utils.mjs b/components/procore_sandbox/common/utils.mjs new file mode 100644 index 0000000000000..326a7216e733c --- /dev/null +++ b/components/procore_sandbox/common/utils.mjs @@ -0,0 +1,55 @@ +import app from "../procore_sandbox.app.mjs"; + +function buildPropDefinitions({ + app = {}, props = {}, +}) { + return Object.entries(props) + .reduce((newProps, [ + key, + prop, + ]) => { + if (!prop.propDefinition) { + return { + ...newProps, + [key]: prop, + }; + } + + const [ + , ...propDefinitionItems + ] = prop.propDefinition; + + return { + ...newProps, + [key]: { + ...prop, + propDefinition: [ + app, + ...propDefinitionItems, + ], + }, + }; + }, {}); +} + +function getAppProps(component = {}) { + const { + // eslint-disable-next-line no-unused-vars + app: procore, + ...otherProps + } = component.props; + return { + props: { + app, + ...buildPropDefinitions({ + app, + props: otherProps, + }), + }, + }; +} + +export default { + buildPropDefinitions, + getAppProps, +}; diff --git a/components/procore_sandbox/package.json b/components/procore_sandbox/package.json index 9959a0d543bee..d50ff001797d3 100644 --- a/components/procore_sandbox/package.json +++ b/components/procore_sandbox/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/procore_sandbox", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Procore Sandbox Components", "main": "procore_sandbox.app.mjs", "keywords": [ diff --git a/components/procore_sandbox/procore_sandbox.app.mjs b/components/procore_sandbox/procore_sandbox.app.mjs index 45ee90e282c69..45a18b7aee753 100644 --- a/components/procore_sandbox/procore_sandbox.app.mjs +++ b/components/procore_sandbox/procore_sandbox.app.mjs @@ -1,11 +1,13 @@ +import procore from "../procore/procore.app.mjs"; +import constants from "../procore/common/constants.mjs"; + export default { - type: "app", + ...procore, app: "procore_sandbox", - propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + ...procore.methods, + getEnvironment() { + return constants.ENVIRONMENT.SANDBOX; }, }, -}; \ No newline at end of file +}; diff --git a/components/procore_sandbox/sources/new-budget-snapshot-event-instant/new-budget-snapshot-event-instant.mjs b/components/procore_sandbox/sources/new-budget-snapshot-event-instant/new-budget-snapshot-event-instant.mjs new file mode 100644 index 0000000000000..9f891b2ab4de8 --- /dev/null +++ b/components/procore_sandbox/sources/new-budget-snapshot-event-instant/new-budget-snapshot-event-instant.mjs @@ -0,0 +1,14 @@ +import component from "../../../procore/sources/new-budget-snapshot-event-instant/new-budget-snapshot-event-instant.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-new-budget-snapshot-event-instant", + description: "Emit new event when a new budget snapshot event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", +}; + diff --git a/components/procore_sandbox/sources/new-change-order-package-event-instant/new-change-order-package-event-instant.mjs b/components/procore_sandbox/sources/new-change-order-package-event-instant/new-change-order-package-event-instant.mjs new file mode 100644 index 0000000000000..7098876618b8a --- /dev/null +++ b/components/procore_sandbox/sources/new-change-order-package-event-instant/new-change-order-package-event-instant.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/sources/new-change-order-package-event-instant/new-change-order-package-event-instant.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-new-change-order-package-event-instant", + description: "Emit new event when a new change order package event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/sources/new-commitment-change-order-event-instant/new-commitment-change-order-event-instant.mjs b/components/procore_sandbox/sources/new-commitment-change-order-event-instant/new-commitment-change-order-event-instant.mjs new file mode 100644 index 0000000000000..5a25fd65c80ad --- /dev/null +++ b/components/procore_sandbox/sources/new-commitment-change-order-event-instant/new-commitment-change-order-event-instant.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/sources/new-commitment-change-order-event-instant/new-commitment-change-order-event-instant.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-new-commitment-change-order-event-instant", + description: "Emit new event when a new commitment change order event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/sources/new-event-instant/new-event-instant.mjs b/components/procore_sandbox/sources/new-event-instant/new-event-instant.mjs new file mode 100644 index 0000000000000..a0827a58ae035 --- /dev/null +++ b/components/procore_sandbox/sources/new-event-instant/new-event-instant.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/sources/new-event-instant/new-event-instant.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-new-event-instant", + description: "Emit new event depending on the resource name selected. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/sources/new-prime-contract-event-instant/new-prime-contract-event-instant.mjs b/components/procore_sandbox/sources/new-prime-contract-event-instant/new-prime-contract-event-instant.mjs new file mode 100644 index 0000000000000..e9e5c06e54066 --- /dev/null +++ b/components/procore_sandbox/sources/new-prime-contract-event-instant/new-prime-contract-event-instant.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/sources/new-prime-contract-event-instant/new-prime-contract-event-instant.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-new-prime-contract-event-instant", + description: "Emit new event when a new prime contract event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/sources/new-purchase-order-event-instant/new-purchase-order-event-instant.mjs b/components/procore_sandbox/sources/new-purchase-order-event-instant/new-purchase-order-event-instant.mjs new file mode 100644 index 0000000000000..ff59388f0a539 --- /dev/null +++ b/components/procore_sandbox/sources/new-purchase-order-event-instant/new-purchase-order-event-instant.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/sources/new-purchase-order-event-instant/new-purchase-order-event-instant.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-new-purchase-order-event-instant", + description: "Emit new event when a new purchase order event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/sources/new-rfi-event-instant/new-rfi-event-instant.mjs b/components/procore_sandbox/sources/new-rfi-event-instant/new-rfi-event-instant.mjs new file mode 100644 index 0000000000000..331a39ce644a5 --- /dev/null +++ b/components/procore_sandbox/sources/new-rfi-event-instant/new-rfi-event-instant.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/sources/new-rfi-event-instant/new-rfi-event-instant.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-new-rfi-event-instant", + description: "Emit new event when a new RFI event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/sources/new-submittal-event-instant/new-submittal-event-instant.mjs b/components/procore_sandbox/sources/new-submittal-event-instant/new-submittal-event-instant.mjs new file mode 100644 index 0000000000000..58c49db357525 --- /dev/null +++ b/components/procore_sandbox/sources/new-submittal-event-instant/new-submittal-event-instant.mjs @@ -0,0 +1,13 @@ +import component from "../../../procore/sources/new-submittal-event-instant/new-submittal-event-instant.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-new-submittal-event-instant", + description: "Emit new event when a new submittal event is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", +}; diff --git a/components/procore_sandbox/sources/new-timecard-entry-event-instant/new-timecard-entry-event-instant.mjs b/components/procore_sandbox/sources/new-timecard-entry-event-instant/new-timecard-entry-event-instant.mjs new file mode 100644 index 0000000000000..457afd3ea3ed1 --- /dev/null +++ b/components/procore_sandbox/sources/new-timecard-entry-event-instant/new-timecard-entry-event-instant.mjs @@ -0,0 +1,14 @@ +import component from "../../../procore/sources/new-timecard-entry-event-instant/new-timecard-entry-event-instant.mjs"; +import utils from "../../common/utils.mjs"; + +/* eslint-disable pipedream/required-properties-type */ +/* eslint-disable pipedream/required-properties-name */ + +export default { + ...component, + ...utils.getAppProps(component), + key: "procore_sandbox-new-timecard-entry-event-instant", + description: "Emit new event when a new timecard entry is created. [See the documentation](https://developers.procore.com/reference/rest/hooks?version=latest).", + version: "0.0.1", +}; + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7d607847ae043..f732f3bdf4a7f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9899,8 +9899,11 @@ importers: components/procore: dependencies: '@pipedream/platform': - specifier: ^1.1.1 - version: 1.6.6 + specifier: ^3.0.3 + version: 3.0.3 + uuid: + specifier: ^11.1.0 + version: 11.1.0 components/procore_sandbox: {} @@ -34309,8 +34312,6 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) - transitivePeerDependencies: - - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: