Skip to content

Commit 233ece2

Browse files
authored
[Components] procore - new components (#15843)
1 parent ed81fb5 commit 233ece2

File tree

48 files changed

+2023
-745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2023
-745
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import app from "../../procore.app.mjs";
2+
3+
export default {
4+
key: "procore-create-incident",
5+
name: "Create Incident",
6+
description: "Create a new incident. [See the documentation](https://developers.procore.com/reference/rest/incidents?version=latest#create-incident).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
companyId: {
12+
propDefinition: [
13+
app,
14+
"companyId",
15+
],
16+
},
17+
projectId: {
18+
optional: false,
19+
propDefinition: [
20+
app,
21+
"projectId",
22+
({ companyId }) => ({
23+
companyId,
24+
}),
25+
],
26+
},
27+
title: {
28+
type: "string",
29+
label: "Title",
30+
description: "Incident Title",
31+
},
32+
eventDate: {
33+
type: "string",
34+
label: "Event Date",
35+
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`).",
36+
},
37+
description: {
38+
type: "string",
39+
label: "Description",
40+
description: "Description of the Incident",
41+
optional: true,
42+
},
43+
isPrivate: {
44+
type: "boolean",
45+
label: "Private",
46+
description: "Indicates whether an Incident is private",
47+
optional: true,
48+
},
49+
recordable: {
50+
type: "boolean",
51+
label: "Recordable",
52+
description: "Indicates whether an Incident is recordable",
53+
optional: true,
54+
},
55+
timeUnknown: {
56+
type: "boolean",
57+
label: "Time Unknown",
58+
description: "Indicates whether the time of the Incident occurrence is unknown",
59+
optional: true,
60+
},
61+
},
62+
methods: {
63+
createIncident({
64+
projectId, ...args
65+
} = {}) {
66+
return this.app.post({
67+
path: `/projects/${projectId}/incidents`,
68+
...args,
69+
});
70+
},
71+
},
72+
async run({ $ }) {
73+
const {
74+
createIncident,
75+
companyId,
76+
projectId,
77+
title,
78+
description,
79+
eventDate,
80+
isPrivate,
81+
recordable,
82+
timeUnknown,
83+
} = this;
84+
85+
const response = await createIncident({
86+
$,
87+
companyId,
88+
projectId,
89+
data: {
90+
incident: {
91+
title,
92+
description,
93+
event_date: eventDate,
94+
private: isPrivate,
95+
recordable,
96+
time_unknown: timeUnknown,
97+
},
98+
},
99+
});
100+
$.export("$summary", `Successfully created incident with ID \`${response.id}\`.`);
101+
return response;
102+
},
103+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import app from "../../procore.app.mjs";
2+
3+
export default {
4+
key: "procore-create-manpower-log",
5+
name: "Create Manpower Log",
6+
description: "Create a new manpower log. [See the documentation](https://developers.procore.com/reference/rest/manpower-logs?version=latest#create-manpower-log).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
companyId: {
12+
propDefinition: [
13+
app,
14+
"companyId",
15+
],
16+
},
17+
projectId: {
18+
optional: false,
19+
propDefinition: [
20+
app,
21+
"projectId",
22+
({ companyId }) => ({
23+
companyId,
24+
}),
25+
],
26+
},
27+
notes: {
28+
type: "string",
29+
label: "Notes",
30+
description: "The notes for the record",
31+
},
32+
datetime: {
33+
type: "string",
34+
label: "Datetime",
35+
description: "The datetime of the record. Eg. `2025-04-01T00:00:00Z`.",
36+
optional: true,
37+
},
38+
numWorkers: {
39+
type: "integer",
40+
label: "Number Of Workers",
41+
description: "The number of workers",
42+
optional: true,
43+
},
44+
numHours: {
45+
type: "string",
46+
label: "Number Of Hours",
47+
description: "The number of hours for each worker",
48+
optional: true,
49+
},
50+
userId: {
51+
propDefinition: [
52+
app,
53+
"userId",
54+
({ companyId }) => ({
55+
companyId,
56+
}),
57+
],
58+
},
59+
locationId: {
60+
propDefinition: [
61+
app,
62+
"locationId",
63+
({
64+
companyId, projectId,
65+
}) => ({
66+
companyId,
67+
projectId,
68+
}),
69+
],
70+
},
71+
},
72+
methods: {
73+
createManpowerLog({
74+
projectId, ...args
75+
} = {}) {
76+
return this.app.post({
77+
path: `/projects/${projectId}/manpower_logs`,
78+
...args,
79+
});
80+
},
81+
},
82+
async run({ $ }) {
83+
const {
84+
createManpowerLog,
85+
companyId,
86+
projectId,
87+
datetime,
88+
notes,
89+
numWorkers,
90+
numHours,
91+
userId,
92+
locationId,
93+
} = this;
94+
95+
const response = await createManpowerLog({
96+
$,
97+
companyId,
98+
projectId,
99+
data: {
100+
manpower_log: {
101+
datetime,
102+
notes,
103+
num_workers: numWorkers,
104+
num_hours: numHours,
105+
user_id: userId,
106+
location_id: locationId,
107+
},
108+
},
109+
});
110+
$.export("$summary", `Successfully created manpower log with ID \`${response.id}\`.`);
111+
return response;
112+
},
113+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
import app from "../../procore.app.mjs";
2+
3+
export default {
4+
key: "procore-create-rfi",
5+
name: "Create RFI",
6+
description: "Create a new RFI. [See the documentation](https://developers.procore.com/reference/rest/rfis?version=latest#create-rfi).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
companyId: {
12+
propDefinition: [
13+
app,
14+
"companyId",
15+
],
16+
},
17+
projectId: {
18+
optional: false,
19+
propDefinition: [
20+
app,
21+
"projectId",
22+
({ companyId }) => ({
23+
companyId,
24+
}),
25+
],
26+
},
27+
subject: {
28+
type: "string",
29+
label: "Subject",
30+
description: "The Subject of the RFI",
31+
},
32+
questionBody: {
33+
type: "string",
34+
label: "Question Body",
35+
description: "The Body of the Question",
36+
},
37+
rfiManagerId: {
38+
propDefinition: [
39+
app,
40+
"rfiPotentialManagerId",
41+
({
42+
companyId, projectId,
43+
}) => ({
44+
companyId,
45+
projectId,
46+
}),
47+
],
48+
},
49+
assigneIds: {
50+
type: "string[]",
51+
label: "Assignee IDs",
52+
description: "The Assignee IDs of the RFI",
53+
optional: false,
54+
propDefinition: [
55+
app,
56+
"potentialAssigneeId",
57+
({
58+
companyId, projectId,
59+
}) => ({
60+
companyId,
61+
projectId,
62+
}),
63+
],
64+
},
65+
reference: {
66+
type: "string",
67+
label: "Reference",
68+
description: "The Reference of the RFI",
69+
optional: true,
70+
},
71+
isPrivate: {
72+
type: "boolean",
73+
label: "Private",
74+
description: "Whether the RFI is private or not",
75+
optional: true,
76+
},
77+
locationId: {
78+
propDefinition: [
79+
app,
80+
"locationId",
81+
({
82+
companyId, projectId,
83+
}) => ({
84+
companyId,
85+
projectId,
86+
}),
87+
],
88+
},
89+
},
90+
methods: {
91+
createRfi({
92+
projectId, ...args
93+
} = {}) {
94+
return this.app.post({
95+
path: `/projects/${projectId}/rfis`,
96+
...args,
97+
});
98+
},
99+
},
100+
async run({ $ }) {
101+
const {
102+
createRfi,
103+
companyId,
104+
projectId,
105+
subject,
106+
questionBody,
107+
rfiManagerId,
108+
assigneIds,
109+
reference,
110+
isPrivate,
111+
locationId,
112+
} = this;
113+
114+
const response = await createRfi({
115+
$,
116+
companyId,
117+
projectId,
118+
data: {
119+
rfi: {
120+
subject,
121+
question: {
122+
body: questionBody,
123+
},
124+
rfi_manager_id: rfiManagerId,
125+
reference,
126+
private: isPrivate,
127+
location_id: locationId,
128+
assignee_ids: assigneIds,
129+
},
130+
},
131+
});
132+
$.export("$summary", `Successfully created RFI with ID \`${response.id}\`.`);
133+
return response;
134+
},
135+
};

0 commit comments

Comments
 (0)