@credal/actions 0.1.59 → 0.1.60
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.
@@ -18,7 +18,11 @@ const confluenceFetchPageContent = (_a) => __awaiter(void 0, [_a], void 0, funct
|
|
18
18
|
if (!authToken) {
|
19
19
|
throw new Error("Missing required authentication parameters");
|
20
20
|
}
|
21
|
-
const cloudDetails = yield axiosClient_1.axiosClient.get("https://api.atlassian.com/oauth/token/accessible-resources"
|
21
|
+
const cloudDetails = yield axiosClient_1.axiosClient.get("https://api.atlassian.com/oauth/token/accessible-resources", {
|
22
|
+
headers: {
|
23
|
+
Authorization: `Bearer ${authToken}`,
|
24
|
+
},
|
25
|
+
});
|
22
26
|
const cloudId = cloudDetails.data[0].id;
|
23
27
|
const baseUrl = `https://api.atlassian.com/ex/confluence/${cloudId}/api/v2`;
|
24
28
|
const config = (0, helpers_1.getConfluenceRequestConfig)(baseUrl, authToken);
|
@@ -17,7 +17,11 @@ const confluenceOverwritePage = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
17
17
|
if (!authToken) {
|
18
18
|
throw new Error("Missing required authentication parameters");
|
19
19
|
}
|
20
|
-
const cloudDetails = yield axiosClient_1.axiosClient.get("https://api.atlassian.com/oauth/token/accessible-resources"
|
20
|
+
const cloudDetails = yield axiosClient_1.axiosClient.get("https://api.atlassian.com/oauth/token/accessible-resources", {
|
21
|
+
headers: {
|
22
|
+
Authorization: `Bearer ${authToken}`,
|
23
|
+
},
|
24
|
+
});
|
21
25
|
const cloudId = cloudDetails.data[0].id;
|
22
26
|
const baseUrl = `https://api.atlassian.com/ex/confluence/${cloudId}/api/v2`;
|
23
27
|
const config = (0, helpers_1.getConfluenceRequestConfig)(baseUrl, authToken);
|
package/package.json
CHANGED
@@ -1,23 +0,0 @@
|
|
1
|
-
declare const axios: any;
|
2
|
-
declare const WORKDAY_BASE_URL = "https://your-workday-url/ccx/service/YOUR_TENANT/Absence_Management/v43.2";
|
3
|
-
declare const TOKEN_URL = "https://your-workday-url/oauth2/YOUR_TENANT/token";
|
4
|
-
declare const CLIENT_ID = "your-client-id";
|
5
|
-
declare const CLIENT_SECRET = "your-client-secret";
|
6
|
-
/**
|
7
|
-
* Fetches an OAuth 2.0 access token from Workday.
|
8
|
-
*/
|
9
|
-
declare function getAccessToken(): Promise<any>;
|
10
|
-
/**
|
11
|
-
* Submits a time-off request to Workday.
|
12
|
-
* @param {Object} params - Time-off details.
|
13
|
-
* @param {string} params.workerId - Worker's ID in Workday.
|
14
|
-
* @param {string} params.startDate - Start date (YYYY-MM-DD).
|
15
|
-
* @param {string} params.endDate - End date (YYYY-MM-DD).
|
16
|
-
* @param {string} params.timeOffType - Time-off type (e.g., "SICK_LEAVE").
|
17
|
-
*/
|
18
|
-
declare function submitTimeOff({ workerId, startDate, endDate, timeOffType }: {
|
19
|
-
workerId: any;
|
20
|
-
startDate: any;
|
21
|
-
endDate: any;
|
22
|
-
timeOffType: any;
|
23
|
-
}): Promise<any>;
|
@@ -1,88 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
const axios = require("axios");
|
12
|
-
const WORKDAY_BASE_URL = "https://your-workday-url/ccx/service/YOUR_TENANT/Absence_Management/v43.2";
|
13
|
-
const TOKEN_URL = "https://your-workday-url/oauth2/YOUR_TENANT/token"; // OAuth token endpoint
|
14
|
-
const CLIENT_ID = "your-client-id";
|
15
|
-
const CLIENT_SECRET = "your-client-secret";
|
16
|
-
/**
|
17
|
-
* Fetches an OAuth 2.0 access token from Workday.
|
18
|
-
*/
|
19
|
-
function getAccessToken() {
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
21
|
-
var _a;
|
22
|
-
try {
|
23
|
-
const response = yield axios.post(TOKEN_URL, new URLSearchParams({ grant_type: "client_credentials" }), {
|
24
|
-
auth: {
|
25
|
-
username: CLIENT_ID,
|
26
|
-
password: CLIENT_SECRET
|
27
|
-
},
|
28
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
29
|
-
});
|
30
|
-
return response.data.access_token;
|
31
|
-
}
|
32
|
-
catch (error) {
|
33
|
-
console.error("Error fetching access token:", ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || error.message);
|
34
|
-
throw error;
|
35
|
-
}
|
36
|
-
});
|
37
|
-
}
|
38
|
-
/**
|
39
|
-
* Submits a time-off request to Workday.
|
40
|
-
* @param {Object} params - Time-off details.
|
41
|
-
* @param {string} params.workerId - Worker's ID in Workday.
|
42
|
-
* @param {string} params.startDate - Start date (YYYY-MM-DD).
|
43
|
-
* @param {string} params.endDate - End date (YYYY-MM-DD).
|
44
|
-
* @param {string} params.timeOffType - Time-off type (e.g., "SICK_LEAVE").
|
45
|
-
*/
|
46
|
-
function submitTimeOff(_a) {
|
47
|
-
return __awaiter(this, arguments, void 0, function* ({ workerId, startDate, endDate, timeOffType }) {
|
48
|
-
var _b;
|
49
|
-
try {
|
50
|
-
const token = yield getAccessToken(); // Get OAuth token
|
51
|
-
const requestBody = {
|
52
|
-
"wd:Enter_Time_Off_Request": {
|
53
|
-
"wd:Worker_Reference": {
|
54
|
-
"wd:ID": [{ "_": workerId, "$": { "wd:type": "WID" } }]
|
55
|
-
},
|
56
|
-
"wd:Time_Off_Entries": [
|
57
|
-
{
|
58
|
-
"wd:Start_Date": startDate,
|
59
|
-
"wd:End_Date": endDate,
|
60
|
-
"wd:Time_Off_Type_Reference": {
|
61
|
-
"wd:ID": [{ "_": timeOffType, "$": { "wd:type": "Time_Off_Type_ID" } }]
|
62
|
-
}
|
63
|
-
}
|
64
|
-
]
|
65
|
-
}
|
66
|
-
};
|
67
|
-
const response = yield axios.post(`${WORKDAY_BASE_URL}/Enter_Time_Off`, requestBody, {
|
68
|
-
headers: {
|
69
|
-
"Authorization": `Bearer ${token}`,
|
70
|
-
"Content-Type": "application/json"
|
71
|
-
}
|
72
|
-
});
|
73
|
-
console.log("Time-off request submitted successfully:", response.data);
|
74
|
-
return response.data;
|
75
|
-
}
|
76
|
-
catch (error) {
|
77
|
-
console.error("Error submitting time-off request:", ((_b = error.response) === null || _b === void 0 ? void 0 : _b.data) || error.message);
|
78
|
-
throw error;
|
79
|
-
}
|
80
|
-
});
|
81
|
-
}
|
82
|
-
// Example Usage:
|
83
|
-
submitTimeOff({
|
84
|
-
workerId: "12345",
|
85
|
-
startDate: "2025-03-10",
|
86
|
-
endDate: "2025-03-12",
|
87
|
-
timeOffType: "SICK_LEAVE"
|
88
|
-
}).then(console.log).catch(console.error);
|