@scopieflows/app-assembled 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/package.json +28 -0
- package/src/i18n/de.json +82 -0
- package/src/i18n/es.json +82 -0
- package/src/i18n/fr.json +82 -0
- package/src/i18n/ja.json +82 -0
- package/src/i18n/nl.json +82 -0
- package/src/i18n/pt.json +82 -0
- package/src/i18n/translation.json +82 -0
- package/src/i18n/zh.json +82 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +38 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/add-shift.d.ts +8 -0
- package/src/lib/actions/add-shift.js +83 -0
- package/src/lib/actions/add-shift.js.map +1 -0
- package/src/lib/actions/custom-api-call.d.ts +12 -0
- package/src/lib/actions/custom-api-call.js +20 -0
- package/src/lib/actions/custom-api-call.js.map +1 -0
- package/src/lib/actions/custom-graphql.d.ts +4 -0
- package/src/lib/actions/custom-graphql.js +25 -0
- package/src/lib/actions/custom-graphql.js.map +1 -0
- package/src/lib/actions/delete-OOO.d.ts +3 -0
- package/src/lib/actions/delete-OOO.js +32 -0
- package/src/lib/actions/delete-OOO.js.map +1 -0
- package/src/lib/actions/get-user-schedule.d.ts +5 -0
- package/src/lib/actions/get-user-schedule.js +40 -0
- package/src/lib/actions/get-user-schedule.js.map +1 -0
- package/src/lib/actions/ooo.d.ts +9 -0
- package/src/lib/actions/ooo.js +95 -0
- package/src/lib/actions/ooo.js.map +1 -0
- package/src/lib/actions/update-OOO.d.ts +9 -0
- package/src/lib/actions/update-OOO.js +90 -0
- package/src/lib/actions/update-OOO.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +10 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/index.d.ts +10 -0
- package/src/lib/common/index.js +34 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/triggers/OOO-status-changed.d.ts +2 -0
- package/src/lib/triggers/OOO-status-changed.js +62 -0
- package/src/lib/triggers/OOO-status-changed.js.map +1 -0
- package/src/lib/triggers/new-OOO-request.d.ts +2 -0
- package/src/lib/triggers/new-OOO-request.js +50 -0
- package/src/lib/triggers/new-OOO-request.js.map +1 -0
- package/src/lib/triggers/schedule-updated.d.ts +2 -0
- package/src/lib/triggers/schedule-updated.js +44 -0
- package/src/lib/triggers/schedule-updated.js.map +1 -0
- package/test-endpoints.md +35 -0
package/src/i18n/zh.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Workforce management platform for scheduling and forecasting": "Workforce management platform for scheduling and forecasting",
|
|
3
|
+
"You can obtain API key by navigating to [Settings->API](https://app.assembledhq.com/settings/api) page.": "You can obtain API key by navigating to [Settings->API](https://app.assembledhq.com/settings/api) page.",
|
|
4
|
+
"Custom API Call": "自定义 API 呼叫",
|
|
5
|
+
"Custom GraphQL": "Custom GraphQL",
|
|
6
|
+
"Create OOO Request": "Create OOO Request",
|
|
7
|
+
"Add Shift on Assembled": "Add Shift on Assembled",
|
|
8
|
+
"Update OOO Request": "Update OOO Request",
|
|
9
|
+
"Delete OOO Request": "Delete OOO Request",
|
|
10
|
+
"Make custom API calls to Assembled endpoints": "Make custom API calls to Assembled endpoints",
|
|
11
|
+
"Perform a custom GraphQL query": "Perform a custom GraphQL query",
|
|
12
|
+
"Create an Out of Office request in Assembled.": "Create an Out of Office request in Assembled.",
|
|
13
|
+
"Add a new shift to a user's schedule in Assembled": "Add a new shift to a user's schedule in Assembled",
|
|
14
|
+
"Updates an existing OOO request.": "Updates an existing OOO request.",
|
|
15
|
+
"Cancel/delete a OOO request.": "Cancel/delete a OOO request.",
|
|
16
|
+
"Method": "方法",
|
|
17
|
+
"Headers": "信头",
|
|
18
|
+
"Query Parameters": "查询参数",
|
|
19
|
+
"Body Type": "Body Type",
|
|
20
|
+
"Body": "正文内容",
|
|
21
|
+
"Response is Binary ?": "Response is Binary ?",
|
|
22
|
+
"No Error on Failure": "失败时没有错误",
|
|
23
|
+
"Timeout (in seconds)": "超时(秒)",
|
|
24
|
+
"Follow redirects": "Follow redirects",
|
|
25
|
+
"Query": "Query",
|
|
26
|
+
"Parameters": "Parameters",
|
|
27
|
+
"Mock Mode": "Mock Mode",
|
|
28
|
+
"User ID": "User ID",
|
|
29
|
+
"Start Date": "Start Date",
|
|
30
|
+
"End Date": "End Date",
|
|
31
|
+
"Activity Type ID": "Activity Type ID",
|
|
32
|
+
"All Day Event": "All Day Event",
|
|
33
|
+
"Reason": "Reason",
|
|
34
|
+
"Agent ID": "Agent ID",
|
|
35
|
+
"Start Time": "开始时间",
|
|
36
|
+
"End Time": "End Time",
|
|
37
|
+
"Shift Type": "Shift Type",
|
|
38
|
+
"Notes": "Notes",
|
|
39
|
+
"OOO ID": "OOO ID",
|
|
40
|
+
"Status": "状态",
|
|
41
|
+
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
|
|
42
|
+
"Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
|
|
43
|
+
"Use mock data for testing": "Use mock data for testing",
|
|
44
|
+
"ID of the user requesting time off": "ID of the user requesting time off",
|
|
45
|
+
"Start date of the OOO period": "Start date of the OOO period",
|
|
46
|
+
"End date of the OOO period": "End date of the OOO period",
|
|
47
|
+
"UUID of the activity type for time off (can be retrieved from activity types endpoints)": "UUID of the activity type for time off (can be retrieved from activity types endpoints)",
|
|
48
|
+
"Whether this is an all-day OOO event": "Whether this is an all-day OOO event",
|
|
49
|
+
"Reason for the OOO request": "Reason for the OOO request",
|
|
50
|
+
"Agent ID of the person to assign the shift to (use the agent_id field from /people endpoint, not the person id)": "Agent ID of the person to assign the shift to (use the agent_id field from /people endpoint, not the person id)",
|
|
51
|
+
"Start time of the shift": "Start time of the shift",
|
|
52
|
+
"End time of the shift": "End time of the shift",
|
|
53
|
+
"Type of shift": "Type of shift",
|
|
54
|
+
"UUID of the activity type for this shift (get from /activity_types endpoint)": "UUID of the activity type for this shift (get from /activity_types endpoint)",
|
|
55
|
+
"Additional notes for the shift": "Additional notes for the shift",
|
|
56
|
+
"ID of the user for the time off request (required for creating new request)": "ID of the user for the time off request (required for creating new request)",
|
|
57
|
+
"UUID of the activity type for time off (required for creating new request)": "UUID of the activity type for time off (required for creating new request)",
|
|
58
|
+
"GET": "获取",
|
|
59
|
+
"POST": "帖子",
|
|
60
|
+
"PATCH": "PATCH",
|
|
61
|
+
"PUT": "弹出",
|
|
62
|
+
"DELETE": "删除",
|
|
63
|
+
"HEAD": "黑色",
|
|
64
|
+
"None": "无",
|
|
65
|
+
"JSON": "JSON",
|
|
66
|
+
"Form Data": "表单数据",
|
|
67
|
+
"Raw": "原始文件",
|
|
68
|
+
"Regular": "Regular",
|
|
69
|
+
"Overtime": "Overtime",
|
|
70
|
+
"On-call": "On-call",
|
|
71
|
+
"Training": "Training",
|
|
72
|
+
"Pending": "待處理",
|
|
73
|
+
"Approved": "Approved",
|
|
74
|
+
"Rejected": "Rejected",
|
|
75
|
+
"Cancelled": "Cancelled",
|
|
76
|
+
"New OOO Request": "New OOO Request",
|
|
77
|
+
"OOO Status Changed": "OOO Status Changed",
|
|
78
|
+
"Schedule Updated": "Schedule Updated",
|
|
79
|
+
"Triggers when a new OOO request is created.": "Triggers when a new OOO request is created.",
|
|
80
|
+
"Triggers on approval/rejection of OOO.": "Triggers on approval/rejection of OOO.",
|
|
81
|
+
"Triggers when user schedule is modified.": "Triggers when user schedule is modified."
|
|
82
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const assembled: import("@scopieflows/pieces-framework").Piece<import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assembled = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
5
|
+
const shared_1 = require("@scopieflows/shared");
|
|
6
|
+
const custom_api_call_1 = require("./lib/actions/custom-api-call");
|
|
7
|
+
const custom_graphql_1 = require("./lib/actions/custom-graphql");
|
|
8
|
+
const ooo_1 = require("./lib/actions/ooo");
|
|
9
|
+
const update_OOO_1 = require("./lib/actions/update-OOO");
|
|
10
|
+
const delete_OOO_1 = require("./lib/actions/delete-OOO");
|
|
11
|
+
const add_shift_1 = require("./lib/actions/add-shift");
|
|
12
|
+
const schedule_updated_1 = require("./lib/triggers/schedule-updated");
|
|
13
|
+
const OOO_status_changed_1 = require("./lib/triggers/OOO-status-changed");
|
|
14
|
+
const new_OOO_request_1 = require("./lib/triggers/new-OOO-request");
|
|
15
|
+
const auth_1 = require("./lib/common/auth");
|
|
16
|
+
exports.assembled = (0, pieces_framework_1.createPiece)({
|
|
17
|
+
displayName: 'Assembled',
|
|
18
|
+
description: 'Workforce management platform for scheduling and forecasting',
|
|
19
|
+
auth: auth_1.assembledAuth,
|
|
20
|
+
minimumSupportedRelease: '0.20.0',
|
|
21
|
+
logoUrl: '/pieces/assembled.png',
|
|
22
|
+
categories: [shared_1.PieceCategory.PRODUCTIVITY, shared_1.PieceCategory.HUMAN_RESOURCES],
|
|
23
|
+
authors: ['meenulekha-premakumar'],
|
|
24
|
+
actions: [
|
|
25
|
+
custom_api_call_1.customApiCall,
|
|
26
|
+
custom_graphql_1.customGraphql,
|
|
27
|
+
ooo_1.OOO,
|
|
28
|
+
add_shift_1.addShift,
|
|
29
|
+
update_OOO_1.updateOOO,
|
|
30
|
+
delete_OOO_1.deleteOOO,
|
|
31
|
+
],
|
|
32
|
+
triggers: [
|
|
33
|
+
new_OOO_request_1.newTimeOffRequest,
|
|
34
|
+
OOO_status_changed_1.timeOffStatusChanged,
|
|
35
|
+
schedule_updated_1.scheduleUpdated,
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/assembled/src/index.ts"],"names":[],"mappings":";;;AAAA,oEAAuE;AACvE,gDAAoD;AAEpD,mEAA8D;AAC9D,iEAA6D;AAC7D,2CAAwC;AACxC,yDAAqD;AACrD,yDAAoD;AACpD,uDAAmD;AACnD,sEAAkE;AAClE,0EAAyE;AACzE,oEAAmE;AACnE,4CAAkD;AAErC,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACnC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,8DAA8D;IAC3E,IAAI,EAAE,oBAAa;IACnB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,uBAAuB;IAChC,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,EAAE,sBAAa,CAAC,eAAe,CAAC;IACvE,OAAO,EAAE,CAAC,uBAAuB,CAAC;IAClC,OAAO,EAAE;QACP,+BAAa;QACb,8BAAa;QACb,SAAG;QACH,oBAAQ;QACR,sBAAS;QACT,sBAAS;KACV;IACD,QAAQ,EAAE;QACR,mCAAiB;QACjB,yCAAoB;QACpB,kCAAe;KAChB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const addShift: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
agent_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
start_time: import("@scopieflows/pieces-framework").DateTimeProperty<true>;
|
|
4
|
+
end_time: import("@scopieflows/pieces-framework").DateTimeProperty<true>;
|
|
5
|
+
shift_type: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
activity_type_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
notes: import("@scopieflows/pieces-framework").LongTextProperty<false>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addShift = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
exports.addShift = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.assembledAuth,
|
|
11
|
+
name: 'add_shift',
|
|
12
|
+
displayName: 'Add Shift on Assembled',
|
|
13
|
+
description: 'Add a new shift to a user\'s schedule in Assembled',
|
|
14
|
+
props: {
|
|
15
|
+
agent_id: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Agent ID',
|
|
17
|
+
description: 'Agent ID of the person to assign the shift to (use the agent_id field from /people endpoint, not the person id)',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
start_time: pieces_framework_1.Property.DateTime({
|
|
21
|
+
displayName: 'Start Time',
|
|
22
|
+
description: 'Start time of the shift',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
end_time: pieces_framework_1.Property.DateTime({
|
|
26
|
+
displayName: 'End Time',
|
|
27
|
+
description: 'End time of the shift',
|
|
28
|
+
required: true,
|
|
29
|
+
}),
|
|
30
|
+
shift_type: pieces_framework_1.Property.StaticDropdown({
|
|
31
|
+
displayName: 'Shift Type',
|
|
32
|
+
description: 'Type of shift',
|
|
33
|
+
required: false,
|
|
34
|
+
defaultValue: 'regular',
|
|
35
|
+
options: {
|
|
36
|
+
options: [
|
|
37
|
+
{ label: 'Regular', value: 'regular' },
|
|
38
|
+
{ label: 'Overtime', value: 'overtime' },
|
|
39
|
+
{ label: 'On-call', value: 'on_call' },
|
|
40
|
+
{ label: 'Training', value: 'training' },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
activity_type_id: pieces_framework_1.Property.ShortText({
|
|
45
|
+
displayName: 'Activity Type ID',
|
|
46
|
+
description: 'UUID of the activity type for this shift (get from /activity_types endpoint)',
|
|
47
|
+
required: true,
|
|
48
|
+
}),
|
|
49
|
+
notes: pieces_framework_1.Property.LongText({
|
|
50
|
+
displayName: 'Notes',
|
|
51
|
+
description: 'Additional notes for the shift',
|
|
52
|
+
required: false,
|
|
53
|
+
}),
|
|
54
|
+
},
|
|
55
|
+
run(context) {
|
|
56
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const { agent_id, start_time, end_time, shift_type, activity_type_id, notes } = context.propsValue;
|
|
58
|
+
try {
|
|
59
|
+
// Convert to Unix timestamps as required by Assembled API
|
|
60
|
+
const startTimestamp = Math.floor(new Date(start_time).getTime() / 1000);
|
|
61
|
+
const endTimestamp = Math.floor(new Date(end_time).getTime() / 1000);
|
|
62
|
+
const shiftData = {
|
|
63
|
+
agent_id: agent_id,
|
|
64
|
+
type_id: activity_type_id,
|
|
65
|
+
start_time: startTimestamp,
|
|
66
|
+
end_time: endTimestamp,
|
|
67
|
+
description: notes || `${shift_type || 'regular'} shift`,
|
|
68
|
+
};
|
|
69
|
+
const response = yield common_1.assembledCommon.makeRequest(context.auth.secret_text, pieces_common_1.HttpMethod.POST, '/activities', shiftData);
|
|
70
|
+
return {
|
|
71
|
+
success: true,
|
|
72
|
+
shift_id: response.body.id,
|
|
73
|
+
message: 'Shift added successfully',
|
|
74
|
+
data: response.body,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
throw new Error(`Failed to add shift: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=add-shift.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-shift.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/actions/add-shift.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AC,eAAe,EAAE,CAAC,CAAC;YACtG,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const customApiCall: import("dist/packages/pieces/community/framework/src").IAction<import("dist/packages/pieces/community/framework/src").SecretTextProperty<true>, {
|
|
2
|
+
url: import("dist/packages/pieces/community/framework/src").DynamicProperties<true, import("dist/packages/pieces/community/framework/src").SecretTextProperty<true> | undefined>;
|
|
3
|
+
method: import("dist/packages/pieces/community/framework/src").StaticDropdownProperty<import("@scopieflows/pieces-common").HttpMethod, false> | import("dist/packages/pieces/community/framework/src").StaticDropdownProperty<import("@scopieflows/pieces-common").HttpMethod, true>;
|
|
4
|
+
headers: import("dist/packages/pieces/community/framework/src").ObjectProperty<false> | import("dist/packages/pieces/community/framework/src").ObjectProperty<true>;
|
|
5
|
+
queryParams: import("dist/packages/pieces/community/framework/src").ObjectProperty<false> | import("dist/packages/pieces/community/framework/src").ObjectProperty<true>;
|
|
6
|
+
body_type: import("dist/packages/pieces/community/framework/src").StaticDropdownProperty<string, false>;
|
|
7
|
+
body: import("dist/packages/pieces/community/framework/src").DynamicProperties<false, import("dist/packages/pieces/community/framework/src").SecretTextProperty<true> | undefined>;
|
|
8
|
+
response_is_binary: import("dist/packages/pieces/community/framework/src").CheckboxProperty<false>;
|
|
9
|
+
failsafe: import("dist/packages/pieces/community/framework/src").CheckboxProperty<false> | import("dist/packages/pieces/community/framework/src").CheckboxProperty<true>;
|
|
10
|
+
timeout: import("dist/packages/pieces/community/framework/src").NumberProperty<false> | import("dist/packages/pieces/community/framework/src").NumberProperty<true>;
|
|
11
|
+
followRedirects: import("dist/packages/pieces/community/framework/src").CheckboxProperty<false>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customApiCall = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
exports.customApiCall = (0, pieces_common_1.createCustomApiCallAction)({
|
|
8
|
+
auth: auth_1.assembledAuth,
|
|
9
|
+
name: 'custom_api_call',
|
|
10
|
+
displayName: 'Custom API Call',
|
|
11
|
+
description: 'Make custom API calls to Assembled endpoints',
|
|
12
|
+
baseUrl: () => 'https://api.assembledhq.com/v0',
|
|
13
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
return ({
|
|
15
|
+
'Authorization': `Basic ${Buffer.from(auth.secret_text + ':').toString('base64')}`,
|
|
16
|
+
'Content-Type': 'application/json',
|
|
17
|
+
});
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=custom-api-call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-api-call.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/actions/custom-api-call.ts"],"names":[],"mappings":";;;;AAAA,8DAAuE;AACvE,yCAA+C;AAElC,QAAA,aAAa,GAAG,IAAA,yCAAyB,EAAC;IACrD,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,8CAA8C;IAC3D,OAAO,EAAE,GAAG,EAAE,CAAC,gCAAgC;IAC/C,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;QAAC,OAAA,CAAC;YAC5B,eAAe,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAClF,cAAc,EAAE,kBAAkB;SACnC,CAAC,CAAA;MAAA;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const customGraphql: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
query: import("@scopieflows/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
variables: import("@scopieflows/pieces-framework").ObjectProperty<false>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customGraphql = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
exports.customGraphql = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'custom_graphql',
|
|
10
|
+
displayName: 'Custom GraphQL',
|
|
11
|
+
description: 'Perform a custom GraphQL query',
|
|
12
|
+
auth: auth_1.assembledAuth,
|
|
13
|
+
props: {
|
|
14
|
+
query: pieces_framework_1.Property.LongText({ displayName: 'Query', required: true }),
|
|
15
|
+
variables: pieces_framework_1.Property.Object({ displayName: 'Parameters', required: false }),
|
|
16
|
+
},
|
|
17
|
+
run(_a) {
|
|
18
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
19
|
+
const client = common_1.assembledCommon.makeClient(auth.secret_text);
|
|
20
|
+
const result = yield client.rawRequest(propsValue.query, propsValue.variables);
|
|
21
|
+
return result;
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=custom-graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-graphql.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/actions/custom-graphql.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,sCAA4C;AAC5C,yCAA+C;AAElC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,gCAAgC;IAC7C,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAClE,SAAS,EAAE,2BAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;KAC3E;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,MAAM,GAAG,wBAAe,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC5D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CACpC,UAAU,CAAC,KAAK,EAChB,UAAU,CAAC,SAAS,CACrB,CAAC;YACF,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteOOO = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
exports.deleteOOO = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.assembledAuth,
|
|
11
|
+
name: 'delete_OOO',
|
|
12
|
+
displayName: 'Delete OOO Request',
|
|
13
|
+
description: 'Cancel/delete a OOO request.',
|
|
14
|
+
props: {
|
|
15
|
+
OOO_id: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'OOO ID',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
},
|
|
20
|
+
run(context) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const { OOO_id } = context.propsValue;
|
|
23
|
+
const response = yield common_1.assembledCommon.makeRequest(context.auth.secret_text, pieces_common_1.HttpMethod.POST, `/time_off/${OOO_id}/cancel`, {});
|
|
24
|
+
return {
|
|
25
|
+
success: true,
|
|
26
|
+
message: 'OOO request deleted successfully',
|
|
27
|
+
data: response.body,
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=delete-OOO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-OOO.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/actions/delete-OOO.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,sCAA4C;AAC5C,8DAAwD;AACxD,yCAA+C;AAElC,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,8BAA8B;IAC3C,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEtC,MAAM,QAAQ,GAAG,MAAM,wBAAe,CAAC,WAAW,CAChD,OAAO,CAAC,IAAI,CAAC,WAAW,EACxB,0BAAU,CAAC,IAAI,EACf,aAAa,MAAM,SAAS,EAC5B,EAAE,CACH,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,kCAAkC;gBAC3C,IAAI,EAAE,QAAQ,CAAC,IAAI;aACpB,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const getUserSchedule: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
user_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
start_date: import("@scopieflows/pieces-framework").DateTimeProperty<true>;
|
|
4
|
+
end_date: import("@scopieflows/pieces-framework").DateTimeProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserSchedule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
exports.getUserSchedule = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.assembledAuth,
|
|
11
|
+
name: 'get_user_schedule',
|
|
12
|
+
displayName: 'Get User Schedule',
|
|
13
|
+
description: 'Retrieves user\'s schedule for specified period.',
|
|
14
|
+
props: {
|
|
15
|
+
user_id: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'User ID',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
start_date: pieces_framework_1.Property.DateTime({
|
|
20
|
+
displayName: 'Start Date',
|
|
21
|
+
required: true,
|
|
22
|
+
}),
|
|
23
|
+
end_date: pieces_framework_1.Property.DateTime({
|
|
24
|
+
displayName: 'End Date',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
run(context) {
|
|
29
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const { user_id, start_date, end_date } = context.propsValue;
|
|
31
|
+
const params = new URLSearchParams({
|
|
32
|
+
start_date: common_1.assembledCommon.formatDate(start_date),
|
|
33
|
+
end_date: common_1.assembledCommon.formatDate(end_date),
|
|
34
|
+
});
|
|
35
|
+
const response = yield common_1.assembledCommon.makeRequest(context.auth.secret_text, pieces_common_1.HttpMethod.GET, `/users/${user_id}/schedule?${params.toString()}`);
|
|
36
|
+
return response.body;
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=get-user-schedule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-user-schedule.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/actions/get-user-schedule.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,sCAA4C;AAC5C,8DAAwD;AACxD,yCAA+C;AAElC,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,kDAAkD;IAC/D,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE7D,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;gBACjC,UAAU,EAAE,wBAAe,CAAC,UAAU,CAAC,UAAU,CAAC;gBAClD,QAAQ,EAAE,wBAAe,CAAC,UAAU,CAAC,QAAQ,CAAC;aAC/C,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,wBAAe,CAAC,WAAW,CAChD,OAAO,CAAC,IAAI,CAAC,WAAW,EACxB,0BAAU,CAAC,GAAG,EACd,UAAU,OAAO,aAAa,MAAM,CAAC,QAAQ,EAAE,EAAE,CAClD,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const OOO: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
mock_mode: import("@scopieflows/pieces-framework").CheckboxProperty<false>;
|
|
3
|
+
user_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
start_date: import("@scopieflows/pieces-framework").DateTimeProperty<true>;
|
|
5
|
+
end_date: import("@scopieflows/pieces-framework").DateTimeProperty<true>;
|
|
6
|
+
activity_type_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
all_day: import("@scopieflows/pieces-framework").CheckboxProperty<false>;
|
|
8
|
+
reason: import("@scopieflows/pieces-framework").LongTextProperty<false>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OOO = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
exports.OOO = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.assembledAuth,
|
|
11
|
+
name: 'OOO',
|
|
12
|
+
displayName: 'Create OOO Request',
|
|
13
|
+
description: 'Create an Out of Office request in Assembled.',
|
|
14
|
+
props: {
|
|
15
|
+
mock_mode: pieces_framework_1.Property.Checkbox({
|
|
16
|
+
displayName: 'Mock Mode',
|
|
17
|
+
description: 'Use mock data for testing',
|
|
18
|
+
required: false,
|
|
19
|
+
defaultValue: true,
|
|
20
|
+
}),
|
|
21
|
+
user_id: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'User ID',
|
|
23
|
+
description: 'ID of the user requesting time off',
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
start_date: pieces_framework_1.Property.DateTime({
|
|
27
|
+
displayName: 'Start Date',
|
|
28
|
+
description: 'Start date of the OOO period',
|
|
29
|
+
required: true,
|
|
30
|
+
}),
|
|
31
|
+
end_date: pieces_framework_1.Property.DateTime({
|
|
32
|
+
displayName: 'End Date',
|
|
33
|
+
description: 'End date of the OOO period',
|
|
34
|
+
required: true,
|
|
35
|
+
}),
|
|
36
|
+
activity_type_id: pieces_framework_1.Property.ShortText({
|
|
37
|
+
displayName: 'Activity Type ID',
|
|
38
|
+
description: 'UUID of the activity type for time off (can be retrieved from activity types endpoints)',
|
|
39
|
+
required: true,
|
|
40
|
+
}),
|
|
41
|
+
all_day: pieces_framework_1.Property.Checkbox({
|
|
42
|
+
displayName: 'All Day Event',
|
|
43
|
+
description: 'Whether this is an all-day OOO event',
|
|
44
|
+
required: false,
|
|
45
|
+
defaultValue: true,
|
|
46
|
+
}),
|
|
47
|
+
reason: pieces_framework_1.Property.LongText({
|
|
48
|
+
displayName: 'Reason',
|
|
49
|
+
description: 'Reason for the OOO request',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
53
|
+
run(context) {
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const { mock_mode, user_id, start_date, end_date, activity_type_id, all_day, reason } = context.propsValue;
|
|
56
|
+
// Mock response for testing
|
|
57
|
+
if (mock_mode) {
|
|
58
|
+
return {
|
|
59
|
+
success: true,
|
|
60
|
+
message: 'Mock OOO created successfully',
|
|
61
|
+
data: {
|
|
62
|
+
id: `mock_ooo_${Date.now()}`,
|
|
63
|
+
user_id,
|
|
64
|
+
start_date,
|
|
65
|
+
end_date,
|
|
66
|
+
activity_type_id: activity_type_id || 'mock-activity-type-id',
|
|
67
|
+
status: 'pending',
|
|
68
|
+
created_at: new Date().toISOString(),
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const oooData = {
|
|
74
|
+
user_id: user_id,
|
|
75
|
+
start_time: Math.floor(new Date(start_date).getTime() / 1000),
|
|
76
|
+
end_time: Math.floor(new Date(end_date).getTime() / 1000),
|
|
77
|
+
activity_type_id,
|
|
78
|
+
all_day: all_day !== null && all_day !== void 0 ? all_day : true,
|
|
79
|
+
description: reason || '',
|
|
80
|
+
};
|
|
81
|
+
const response = yield common_1.assembledCommon.makeRequest(context.auth.secret_text, pieces_common_1.HttpMethod.POST, '/time_off', oooData);
|
|
82
|
+
return {
|
|
83
|
+
success: true,
|
|
84
|
+
ooo_id: response.body.id,
|
|
85
|
+
message: 'OOO request created successfully',
|
|
86
|
+
data: response.body,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
throw new Error(`Failed to create OOO request: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=ooo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ooo.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/actions/ooo.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,sCAA4C;AAC5C,8DAAwD;AACxD,yCAA+C;AAElC,QAAA,GAAG,GAAG,IAAA,+BAAY,EAAC;IAC9B,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,oBAAoB;IACjC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,CAAC;YAC/G,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const updateOOO: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
OOO_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
start_date: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
|
|
4
|
+
end_date: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
|
|
5
|
+
status: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
reason: import("@scopieflows/pieces-framework").LongTextProperty<false>;
|
|
7
|
+
user_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
8
|
+
activity_type_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateOOO = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
exports.updateOOO = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.assembledAuth,
|
|
11
|
+
name: 'update_OOO',
|
|
12
|
+
displayName: 'Update OOO Request',
|
|
13
|
+
description: 'Updates an existing OOO request.',
|
|
14
|
+
props: {
|
|
15
|
+
OOO_id: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'OOO ID',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
start_date: pieces_framework_1.Property.DateTime({
|
|
20
|
+
displayName: 'Start Date',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
end_date: pieces_framework_1.Property.DateTime({
|
|
24
|
+
displayName: 'End Date',
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
27
|
+
status: pieces_framework_1.Property.StaticDropdown({
|
|
28
|
+
displayName: 'Status',
|
|
29
|
+
required: false,
|
|
30
|
+
options: {
|
|
31
|
+
options: [
|
|
32
|
+
{ label: 'Pending', value: 'pending' },
|
|
33
|
+
{ label: 'Approved', value: 'approved' },
|
|
34
|
+
{ label: 'Rejected', value: 'rejected' },
|
|
35
|
+
{ label: 'Cancelled', value: 'cancelled' },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
reason: pieces_framework_1.Property.LongText({
|
|
40
|
+
displayName: 'Reason',
|
|
41
|
+
required: false,
|
|
42
|
+
}),
|
|
43
|
+
user_id: pieces_framework_1.Property.ShortText({
|
|
44
|
+
displayName: 'User ID',
|
|
45
|
+
description: 'ID of the user for the time off request (required for creating new request)',
|
|
46
|
+
required: true,
|
|
47
|
+
}),
|
|
48
|
+
activity_type_id: pieces_framework_1.Property.ShortText({
|
|
49
|
+
displayName: 'Activity Type ID',
|
|
50
|
+
description: 'UUID of the activity type for time off (required for creating new request)',
|
|
51
|
+
required: true,
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
run(context) {
|
|
55
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const { OOO_id, start_date, end_date, status, reason, user_id, activity_type_id } = context.propsValue;
|
|
57
|
+
// no direct endpoint to update a time off request, so need to cancel and create new time off request
|
|
58
|
+
try {
|
|
59
|
+
// cancel the existing time off request
|
|
60
|
+
console.log(`Canceling existing time off request: ${OOO_id}`);
|
|
61
|
+
yield common_1.assembledCommon.makeRequest(context.auth.secret_text, pieces_common_1.HttpMethod.POST, `/time_off/${OOO_id}/cancel`);
|
|
62
|
+
// create new time off request with updated details
|
|
63
|
+
console.log('Creating new time off request with updated details');
|
|
64
|
+
const newRequestData = {
|
|
65
|
+
user_id,
|
|
66
|
+
activity_type_id,
|
|
67
|
+
all_day: true,
|
|
68
|
+
};
|
|
69
|
+
if (start_date)
|
|
70
|
+
newRequestData['start_time'] = Math.floor(new Date(start_date).getTime() / 1000);
|
|
71
|
+
if (end_date)
|
|
72
|
+
newRequestData['end_time'] = Math.floor(new Date(end_date).getTime() / 1000);
|
|
73
|
+
if (reason)
|
|
74
|
+
newRequestData['description'] = reason;
|
|
75
|
+
const response = yield common_1.assembledCommon.makeRequest(context.auth.secret_text, pieces_common_1.HttpMethod.POST, '/time_off', newRequestData);
|
|
76
|
+
return {
|
|
77
|
+
success: true,
|
|
78
|
+
message: 'Time off request updated successfully (canceled old and created new)',
|
|
79
|
+
canceled_request_id: OOO_id,
|
|
80
|
+
new_request_id: response.body.id,
|
|
81
|
+
data: response.body,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
throw new Error(`Failed to update time off request: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=update-OOO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-OOO.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/actions/update-OOO.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,sCAA4C;AAC5C,8DAAwD;AACxD,yCAA+C;AAElC,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,kCAAkC;IAC/C,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC5B,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