Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions components/procore/actions/create-incident/create-incident.mjs
Original file line number Diff line number Diff line change
@@ -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;
},
};
113 changes: 113 additions & 0 deletions components/procore/actions/create-manpower-log/create-manpower-log.mjs
Original file line number Diff line number Diff line change
@@ -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;
},
};
135 changes: 135 additions & 0 deletions components/procore/actions/create-rfi/create-rfi.mjs
Original file line number Diff line number Diff line change
@@ -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;
},
};
Loading
Loading