@ndbs-dk/afu-shared-services 2.5.33
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 +84 -0
- package/dist/helpers/altinn-helper.d.ts +54 -0
- package/dist/helpers/altinn-helper.d.ts.map +1 -0
- package/dist/helpers/altinn-helper.js +137 -0
- package/dist/helpers/altinn-helper.js.map +1 -0
- package/dist/helpers/mail-helper.d.ts +23 -0
- package/dist/helpers/mail-helper.d.ts.map +1 -0
- package/dist/helpers/mail-helper.js +46 -0
- package/dist/helpers/mail-helper.js.map +1 -0
- package/dist/helpers/sf-helper.d.ts +25 -0
- package/dist/helpers/sf-helper.d.ts.map +1 -0
- package/dist/helpers/sf-helper.js +83 -0
- package/dist/helpers/sf-helper.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/services/altinn-service.d.ts +32 -0
- package/dist/services/altinn-service.d.ts.map +1 -0
- package/dist/services/altinn-service.js +158 -0
- package/dist/services/altinn-service.js.map +1 -0
- package/dist/services/mail-service.d.ts +31 -0
- package/dist/services/mail-service.d.ts.map +1 -0
- package/dist/services/mail-service.js +89 -0
- package/dist/services/mail-service.js.map +1 -0
- package/dist/services/sf-service.d.ts +166 -0
- package/dist/services/sf-service.d.ts.map +1 -0
- package/dist/services/sf-service.js +695 -0
- package/dist/services/sf-service.js.map +1 -0
- package/dist/template/template.d.ts +16 -0
- package/dist/template/template.d.ts.map +1 -0
- package/dist/template/template.js +84 -0
- package/dist/template/template.js.map +1 -0
- package/dist/test/altinn-service.test.d.ts +2 -0
- package/dist/test/altinn-service.test.d.ts.map +1 -0
- package/dist/test/altinn-service.test.js +61 -0
- package/dist/test/altinn-service.test.js.map +1 -0
- package/dist/test/mail-service.test.d.ts +2 -0
- package/dist/test/mail-service.test.d.ts.map +1 -0
- package/dist/test/mail-service.test.js +56 -0
- package/dist/test/mail-service.test.js.map +1 -0
- package/dist/test/scripts/test-altinn-fetch.d.ts +2 -0
- package/dist/test/scripts/test-altinn-fetch.d.ts.map +1 -0
- package/dist/test/scripts/test-altinn-fetch.js +48 -0
- package/dist/test/scripts/test-altinn-fetch.js.map +1 -0
- package/dist/test/sf-service.test.d.ts +2 -0
- package/dist/test/sf-service.test.d.ts.map +1 -0
- package/dist/test/sf-service.test.js +188 -0
- package/dist/test/sf-service.test.js.map +1 -0
- package/dist/types/altinn.types.d.ts +208 -0
- package/dist/types/altinn.types.d.ts.map +1 -0
- package/dist/types/altinn.types.js +3 -0
- package/dist/types/altinn.types.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/mail.types.d.ts +72 -0
- package/dist/types/mail.types.d.ts.map +1 -0
- package/dist/types/mail.types.js +3 -0
- package/dist/types/mail.types.js.map +1 -0
- package/dist/types/sf.types.d.ts +248 -0
- package/dist/types/sf.types.d.ts.map +1 -0
- package/dist/types/sf.types.js +3 -0
- package/dist/types/sf.types.js.map +1 -0
- package/dist/utils/altinn-util.d.ts +88 -0
- package/dist/utils/altinn-util.d.ts.map +1 -0
- package/dist/utils/altinn-util.js +471 -0
- package/dist/utils/altinn-util.js.map +1 -0
- package/dist/utils/cache-util.d.ts +22 -0
- package/dist/utils/cache-util.d.ts.map +1 -0
- package/dist/utils/cache-util.js +82 -0
- package/dist/utils/cache-util.js.map +1 -0
- package/dist/utils/mail-util.d.ts +21 -0
- package/dist/utils/mail-util.d.ts.map +1 -0
- package/dist/utils/mail-util.js +61 -0
- package/dist/utils/mail-util.js.map +1 -0
- package/dist/utils/sf-util.d.ts +28 -0
- package/dist/utils/sf-util.d.ts.map +1 -0
- package/dist/utils/sf-util.js +71 -0
- package/dist/utils/sf-util.js.map +1 -0
- package/dist/utils/xml-util.d.ts +10 -0
- package/dist/utils/xml-util.d.ts.map +1 -0
- package/dist/utils/xml-util.js +24 -0
- package/dist/utils/xml-util.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AltinnService = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const cache_util_1 = require("../utils/cache-util");
|
|
9
|
+
const altinn_helper_1 = require("../helpers/altinn-helper");
|
|
10
|
+
const altinn_util_1 = require("../utils/altinn-util");
|
|
11
|
+
class AltinnService {
|
|
12
|
+
destination;
|
|
13
|
+
accessToken = "";
|
|
14
|
+
cert;
|
|
15
|
+
key;
|
|
16
|
+
ca;
|
|
17
|
+
who;
|
|
18
|
+
constructor(destination, cert, key, ca) {
|
|
19
|
+
this.destination = destination;
|
|
20
|
+
this.cert = cert;
|
|
21
|
+
this.key = key;
|
|
22
|
+
this.ca = ca;
|
|
23
|
+
}
|
|
24
|
+
/** * Authenticates the user and retrieves an access token from Altinn.
|
|
25
|
+
* @returns The access token string
|
|
26
|
+
* @throws Error if authentication fails
|
|
27
|
+
* @example authenticate() => "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
28
|
+
*/
|
|
29
|
+
async authenticate() {
|
|
30
|
+
try {
|
|
31
|
+
// Check token cache first (per service)
|
|
32
|
+
const cached = (0, cache_util_1.getCachedToken)('altinn');
|
|
33
|
+
if (cached)
|
|
34
|
+
return cached;
|
|
35
|
+
// Get destination and validate config
|
|
36
|
+
const config = (0, altinn_helper_1.getValidAltinnConfig)(this.destination);
|
|
37
|
+
const passphrase = this.destination.keyStorePassword;
|
|
38
|
+
this.who = config.organizationNumbers?.split(',')[0]?.trim() || 'self';
|
|
39
|
+
// Prepare HTTPS agent
|
|
40
|
+
const httpsAgent = (0, altinn_helper_1.createAltinnHttpsAgent)(this.cert, this.key, this.ca, passphrase);
|
|
41
|
+
// Prepare request
|
|
42
|
+
const url = this.destination?.url + config.authEndpoint;
|
|
43
|
+
const data = (0, altinn_helper_1.createAuthRequestData)(config.username, config.password);
|
|
44
|
+
// Execute HTTP request
|
|
45
|
+
const response = await axios_1.default.post(url, data, {
|
|
46
|
+
headers: {
|
|
47
|
+
'ApiKey': config.apiKey,
|
|
48
|
+
'Content-Type': 'application/json'
|
|
49
|
+
},
|
|
50
|
+
httpsAgent,
|
|
51
|
+
maxRedirects: 0
|
|
52
|
+
});
|
|
53
|
+
// Extract token from set-cookie header
|
|
54
|
+
const setCookie = response.headers?.['set-cookie']?.[0];
|
|
55
|
+
if (!setCookie)
|
|
56
|
+
throw new Error("No set-cookie header found in Altinn response");
|
|
57
|
+
const accessToken = setCookie.split(';')[0];
|
|
58
|
+
if (!accessToken) {
|
|
59
|
+
throw new Error("Failed to extract access token from set-cookie header");
|
|
60
|
+
}
|
|
61
|
+
// Cache token for 10 minutes (per service)
|
|
62
|
+
(0, cache_util_1.setCachedToken)('altinn', accessToken, 10 * 60 * 1000);
|
|
63
|
+
return accessToken;
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
if (err instanceof Error) {
|
|
67
|
+
throw new Error(`Destination authentication failed: ${err.message}`);
|
|
68
|
+
}
|
|
69
|
+
throw new Error("Destination authentication failed: Unknown error");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Synchronizes sick leave information from Altinn.
|
|
74
|
+
* @param dateFrom The start date for the synchronization
|
|
75
|
+
* @param dateTo The end date for the synchronization
|
|
76
|
+
* @returns A promise that resolves to an array of sick leave information summaries
|
|
77
|
+
*/
|
|
78
|
+
async syncSickLeaves(dateFrom, dateTo) {
|
|
79
|
+
await (0, cache_util_1.ensureServiceToken)(this, 'altinn');
|
|
80
|
+
const config = (0, altinn_helper_1.getValidAltinnConfig)(this.destination);
|
|
81
|
+
const orgNumbers = (config.organizationNumbers || "")
|
|
82
|
+
.split(",")
|
|
83
|
+
.map((s) => s.trim())
|
|
84
|
+
.filter(Boolean);
|
|
85
|
+
if (orgNumbers.length === 0) {
|
|
86
|
+
throw new Error("Organization number is not configured in destination");
|
|
87
|
+
}
|
|
88
|
+
if (new Date(dateFrom) > new Date(dateTo)) {
|
|
89
|
+
throw new Error("Invalid date range: dateFrom cannot be after dateTo");
|
|
90
|
+
}
|
|
91
|
+
dateFrom = dateFrom || '1970-01-01';
|
|
92
|
+
dateTo = dateTo || '2300-01-01';
|
|
93
|
+
const allCases = (await Promise.all(orgNumbers.map((orgNo) => (0, altinn_helper_1.fetchAltinnCases)({
|
|
94
|
+
destination: this.destination,
|
|
95
|
+
cert: this.cert,
|
|
96
|
+
key: this.key,
|
|
97
|
+
ca: this.ca,
|
|
98
|
+
accessToken: this.accessToken,
|
|
99
|
+
who: orgNo,
|
|
100
|
+
dateFrom,
|
|
101
|
+
dateTo,
|
|
102
|
+
})))).flat();
|
|
103
|
+
const sickLeaveInfos = allCases;
|
|
104
|
+
const filteredSickLeaveInfos = (0, altinn_util_1.filterSickNoteDuplicates)(sickLeaveInfos);
|
|
105
|
+
return filteredSickLeaveInfos;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Posts immediate leader information to Altinn.
|
|
109
|
+
* @param formData The form data to be sent
|
|
110
|
+
* @returns A promise that resolves to the response from Altinn
|
|
111
|
+
*/
|
|
112
|
+
async postAltinn(formData, who) {
|
|
113
|
+
const complete = this.destination?.originalProperties?.destinationConfiguration?.complete || 'true';
|
|
114
|
+
const booleanComplete = complete.toLowerCase() === 'true' ? true : false;
|
|
115
|
+
await (0, cache_util_1.ensureServiceToken)(this, 'altinn');
|
|
116
|
+
const data = {
|
|
117
|
+
"Type": "FormTask",
|
|
118
|
+
"ServiceCode": "2913",
|
|
119
|
+
"ServiceEdition": 4,
|
|
120
|
+
"_embedded": {
|
|
121
|
+
"forms": [
|
|
122
|
+
{
|
|
123
|
+
"Type": "MainForm",
|
|
124
|
+
"DataFormatId": "5223",
|
|
125
|
+
"DataFormatVersion": 41082,
|
|
126
|
+
"FormData": formData
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
try {
|
|
132
|
+
const url = `${this.destination.url}/${who}/Messages?ForceEIAuthentication&complete=${booleanComplete}`;
|
|
133
|
+
const response = await axios_1.default.post(url, data, {
|
|
134
|
+
headers: {
|
|
135
|
+
'Cookie': this.accessToken,
|
|
136
|
+
'ApiKey': (0, altinn_helper_1.getValidAltinnConfig)(this.destination).apiKey,
|
|
137
|
+
'Content-Type': 'Application/hal+json'
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
return response;
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
144
|
+
console.error('Altinn validation error:', {
|
|
145
|
+
status: error.response?.status,
|
|
146
|
+
statusText: error.response?.statusText,
|
|
147
|
+
data: typeof (error.response?.data) === 'object' ? JSON.stringify(error.response?.data) : error.response?.data
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
console.error('Error posting immediate leader information:', error);
|
|
152
|
+
}
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
exports.AltinnService = AltinnService;
|
|
158
|
+
//# sourceMappingURL=altinn-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"altinn-service.js","sourceRoot":"","sources":["../../src/services/altinn-service.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAC7C,oDAAyF;AAEzF,4DAAiI;AACjI,sDAAgE;AAGhE,MAAa,aAAa;IAChB,WAAW,CAAc;IAC1B,WAAW,GAAW,EAAE,CAAC;IACxB,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,EAAE,CAAS;IACX,GAAG,CAAq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EAAE,KAAK,CAAC,CAAC;YACtE,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAvKD,sCAuKC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Destination } from '@sap-cloud-sdk/connectivity';
|
|
2
|
+
export declare class MailService {
|
|
3
|
+
private destination;
|
|
4
|
+
accessToken: string;
|
|
5
|
+
constructor(destination: Destination);
|
|
6
|
+
/** * Authenticates the user and retrieves an access token from Microsoft Graph.
|
|
7
|
+
* @returns The access token string
|
|
8
|
+
* @throws Error if authentication fails
|
|
9
|
+
* @example authenticate() => "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
10
|
+
*/
|
|
11
|
+
authenticate(): Promise<string>;
|
|
12
|
+
/** * Sends an email using Microsoft Graph API.
|
|
13
|
+
* @param recipients Array of recipient email addresses
|
|
14
|
+
* @param subject Email subject
|
|
15
|
+
* @param body Email body content
|
|
16
|
+
* @param options Optional settings (isHtml)
|
|
17
|
+
* @param icalEvent Optional meeting event to attach as .ics
|
|
18
|
+
* @param attachments Optional array of file attachments
|
|
19
|
+
* @return Promise that resolves when the email is sent
|
|
20
|
+
* @throws Error if sending fails
|
|
21
|
+
*/
|
|
22
|
+
sendMail(recipients: string[], subject: string, body: string, options?: {
|
|
23
|
+
isHtml?: boolean;
|
|
24
|
+
}, attachments?: {
|
|
25
|
+
'@odata.type': string;
|
|
26
|
+
name: string;
|
|
27
|
+
contentType: string;
|
|
28
|
+
contentBytes: string;
|
|
29
|
+
}[]): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=mail-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mail-service.d.ts","sourceRoot":"","sources":["../../src/services/mail-service.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D,qBAAa,WAAW;IACpB,OAAO,CAAC,WAAW,CAAc;IAC1B,WAAW,EAAE,MAAM,CAAM;gBAEpB,WAAW,EAAE,WAAW;IAIpC;;;;OAIG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IA4BrC;;;;;;;;;OASG;IACG,QAAQ,CACV,UAAU,EAAE,MAAM,EAAE,EACpB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,EAC9B,WAAW,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,GACnG,OAAO,CAAC,IAAI,CAAC;CAsCnB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MailService = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const mail_helper_1 = require("../helpers/mail-helper");
|
|
9
|
+
const cache_util_1 = require("../utils/cache-util");
|
|
10
|
+
class MailService {
|
|
11
|
+
destination;
|
|
12
|
+
accessToken = "";
|
|
13
|
+
constructor(destination) {
|
|
14
|
+
this.destination = destination;
|
|
15
|
+
}
|
|
16
|
+
/** * Authenticates the user and retrieves an access token from Microsoft Graph.
|
|
17
|
+
* @returns The access token string
|
|
18
|
+
* @throws Error if authentication fails
|
|
19
|
+
* @example authenticate() => "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
20
|
+
*/
|
|
21
|
+
async authenticate() {
|
|
22
|
+
try {
|
|
23
|
+
// Check token cache first (per service)
|
|
24
|
+
const cached = (0, cache_util_1.getCachedToken)('mail');
|
|
25
|
+
if (cached)
|
|
26
|
+
return cached;
|
|
27
|
+
// Get destination and validate config
|
|
28
|
+
const config = (0, mail_helper_1.getValidEmailConfig)(this.destination);
|
|
29
|
+
const params = new URLSearchParams({
|
|
30
|
+
client_id: config.clientId,
|
|
31
|
+
scope: config.scope || 'https://graph.microsoft.com/.default',
|
|
32
|
+
client_secret: config.clientSecret,
|
|
33
|
+
grant_type: 'client_credentials',
|
|
34
|
+
tokenUrl: config.tokenUrl ?? `https://login.microsoftonline.com/${config.tenantId}/oauth2/v2.0/token`
|
|
35
|
+
});
|
|
36
|
+
const response = await axios_1.default.post(params.get('tokenUrl') ?? '', params.toString(), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });
|
|
37
|
+
// Cache token for 10 minutes (or use expires_in if available)
|
|
38
|
+
(0, cache_util_1.setCachedToken)('mail', response.data.access_token, 10 * 60 * 1000);
|
|
39
|
+
return response.data.access_token;
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
throw new Error(`Error getting access token: ${error}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** * Sends an email using Microsoft Graph API.
|
|
46
|
+
* @param recipients Array of recipient email addresses
|
|
47
|
+
* @param subject Email subject
|
|
48
|
+
* @param body Email body content
|
|
49
|
+
* @param options Optional settings (isHtml)
|
|
50
|
+
* @param icalEvent Optional meeting event to attach as .ics
|
|
51
|
+
* @param attachments Optional array of file attachments
|
|
52
|
+
* @return Promise that resolves when the email is sent
|
|
53
|
+
* @throws Error if sending fails
|
|
54
|
+
*/
|
|
55
|
+
async sendMail(recipients, subject, body, options, attachments) {
|
|
56
|
+
const config = (0, mail_helper_1.getValidEmailConfig)(this.destination);
|
|
57
|
+
await (0, cache_util_1.ensureServiceToken)(this, 'mail');
|
|
58
|
+
const accessToken = (0, cache_util_1.getCachedToken)('mail');
|
|
59
|
+
if (!attachments)
|
|
60
|
+
attachments = [];
|
|
61
|
+
const emailOptions = {
|
|
62
|
+
message: {
|
|
63
|
+
subject,
|
|
64
|
+
body: {
|
|
65
|
+
contentType: options?.isHtml ? 'HTML' : 'Text',
|
|
66
|
+
content: body
|
|
67
|
+
},
|
|
68
|
+
toRecipients: recipients.map(address => ({ emailAddress: { address } })),
|
|
69
|
+
...(attachments.length > 0 ? { attachments } : {})
|
|
70
|
+
},
|
|
71
|
+
saveToSentItems: 'true'
|
|
72
|
+
};
|
|
73
|
+
const requestConfig = {
|
|
74
|
+
url: `https://graph.microsoft.com/v1.0/users/${config.smtpUser}/sendMail`,
|
|
75
|
+
method: 'post',
|
|
76
|
+
data: emailOptions,
|
|
77
|
+
headers: {
|
|
78
|
+
Authorization: `Bearer ${accessToken}`,
|
|
79
|
+
'Content-Type': 'application/json'
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const response = await axios_1.default.post(requestConfig.url, requestConfig.data, { headers: requestConfig.headers });
|
|
83
|
+
if (response.status !== 202) {
|
|
84
|
+
throw new Error(`Graph API sendMail failed: ${response.status} ${response.statusText}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.MailService = MailService;
|
|
89
|
+
//# sourceMappingURL=mail-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mail-service.js","sourceRoot":"","sources":["../../src/services/mail-service.ts"],"names":[],"mappings":";;;;;;AAGA,kDAA0B;AAE1B,wDAA6D;AAC7D,oDAAyF;AAIzF,MAAa,WAAW;IACZ,WAAW,CAAc;IAC1B,WAAW,GAAW,EAAE,CAAC;IAEhC,YAAY,WAAwB;QAChC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY;QACd,IAAI,CAAC;YACD,wCAAwC;YACxC,MAAM,MAAM,GAAG,IAAA,2BAAc,EAAC,MAAM,CAAC,CAAC;YACtC,IAAI,MAAM;gBAAE,OAAO,MAAM,CAAC;YAE1B,sCAAsC;YACtC,MAAM,M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AE,CAAC;QAEnC,MAAM,YAAY,GAAG;YACjB,OAAO,EAAE;gBACL,OAAO;gBACP,IAAI,EAAE;oBACF,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;oBAC9C,OAAO,EAAE,IAAI;iBAChB;gBACD,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;gBACxE,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACrD;YACD,eAAe,EAAE,MAAM;SAC1B,CAAC;QAEF,MAAM,aAAa,GAAG;YAClB,GAAG,EAAE,0CAA0C,MAAM,CAAC,QAAQ,WAAW;YACzE,MAAM,EAAE,MAAe;YACvB,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE;gBACL,aAAa,EAAE,UAAU,WAAW,EAAE;gBACtC,cAAc,EAAE,kBAAkB;aACrC;SACJ,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAC7B,aAAa,CAAC,GAAG,EACjB,aAAa,CAAC,IAAI,EAClB,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,CACrC,CAAC;QACF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QAC5F,CAAC;IACL,CAAC;CACJ;AA/FD,kCA+FC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { type Destination } from "@sap-cloud-sdk/connectivity";
|
|
2
|
+
import { SickLeaveInfoSummary } from "../types/altinn.types";
|
|
3
|
+
import { SfAbsenceCase, SfManager, SfMeeting, SfPlan, SFUpsertResponse } from "../types";
|
|
4
|
+
export declare class SuccessFactorsService {
|
|
5
|
+
private destination;
|
|
6
|
+
accessToken: string;
|
|
7
|
+
constructor(destination: Destination);
|
|
8
|
+
/**
|
|
9
|
+
* Authenticates the user and retrieves an access token from SuccessFactors.
|
|
10
|
+
* @returns The access token string
|
|
11
|
+
* @throws Error if authentication fails
|
|
12
|
+
* @example authenticate() => "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
13
|
+
*/
|
|
14
|
+
authenticate(): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Fetches content from SuccessFactors API using the provided endpoint and query parameters.
|
|
17
|
+
* @param endpointAPI The API endpoint to call
|
|
18
|
+
* @param queryParams Optional query parameters for the request
|
|
19
|
+
* @returns The response data from the API or an error
|
|
20
|
+
* @throws Error if the request fails
|
|
21
|
+
* @example getSuccessFactorContent("EmpJob", { $filter: "userId eq '12345'" }) => { d: { results: [...] } } or throws error
|
|
22
|
+
*/
|
|
23
|
+
getSuccessFactorContent(endpointAPI: string, queryParams?: Record<string, any>): Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Posts content to SuccessFactors API.
|
|
26
|
+
* @param data The data to post
|
|
27
|
+
* @returns The response from the API
|
|
28
|
+
*/
|
|
29
|
+
postSuccessFactorContent(data: any): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Deletes content from SuccessFactors API using the provided relative URI.
|
|
32
|
+
* @param uri The relative URI to delete (e.g. "cust_absencefollowupdetails(externalCode='123',...)" )
|
|
33
|
+
* @returns The API response from SuccessFactors
|
|
34
|
+
* @throws Error if the request fails
|
|
35
|
+
*/
|
|
36
|
+
deleteSuccessFactorContent(uri: string): Promise<any>;
|
|
37
|
+
/**
|
|
38
|
+
* Fetches all case IDs from SuccessFactors.
|
|
39
|
+
* @returns Array of case IDs or null if not found
|
|
40
|
+
* @throws Error if the request fails
|
|
41
|
+
* @example fetchAllCaseIds() => ["caseId1", "caseId2", ...] or null
|
|
42
|
+
*/
|
|
43
|
+
fetchAllCaseIds(): Promise<string[] | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Fetches employee info from SuccessFactors by SSN using getSuccessFactorContent.
|
|
46
|
+
* Returns a normalized employee object or null if not found.
|
|
47
|
+
* @param ssn The SSN of the employee to fetch
|
|
48
|
+
* @param orgNo The organization number to filter employees
|
|
49
|
+
* @returns Employee object
|
|
50
|
+
* @throws Error if no employee or multiple employees are found with the same SSN and orgNo
|
|
51
|
+
* @example fetchEmployeeBySSN("12345678901", "987654321") => { userId: "12345", firstName: "Ola", lastName: "Nordmann", ... }
|
|
52
|
+
*/
|
|
53
|
+
fetchEmployeeBySSN(ssn: string, orgNo: string): Promise<any>;
|
|
54
|
+
/**
|
|
55
|
+
* Fetches employee info from SuccessFactors by userId using getSuccessFactorContent.
|
|
56
|
+
* Returns a normalized employee object or null if not found.
|
|
57
|
+
* @param userId The userId of the employee to fetch
|
|
58
|
+
* @returns Employee object or null if not found
|
|
59
|
+
* @throws Error if multiple employees are found with the same userId
|
|
60
|
+
* @example fetchEmployeeByUserId("12345") => { userId: "12345", firstName: "Ola", lastName: "Nordmann", ... }
|
|
61
|
+
*/
|
|
62
|
+
fetchEmployeeByUserId(userId: string): Promise<SfManager | null>;
|
|
63
|
+
fetchNationalIdByUserId(userId: string): Promise<string | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Fetches an absence follow-up case from SuccessFactors by userId using getSuccessFactorContent.
|
|
66
|
+
* Returns a normalized absence case object or null if not found.
|
|
67
|
+
* @param userId The userId of the employee whose absence case to fetch
|
|
68
|
+
* @returns Absence case object or null if not found
|
|
69
|
+
* @example fetchAbsenceCase("12345") => { cust_absenceID: "caseId1", cust_startDate: "...", ... } or null
|
|
70
|
+
* @throws Error if the request fails
|
|
71
|
+
*/
|
|
72
|
+
fetchAbsenceCase(userId: string): Promise<SfAbsenceCase | null>;
|
|
73
|
+
/**
|
|
74
|
+
* Fetches ready-to-send follow-up plans from SuccessFactors.
|
|
75
|
+
* @returns Array of follow-up plan objects or an empty array if not found
|
|
76
|
+
*/
|
|
77
|
+
fetchReadySentToNavPlans(): Promise<SfPlan[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Fetches follow-up plans for a specific user from SuccessFactors.
|
|
80
|
+
* @param userId The employee userId
|
|
81
|
+
* @returns Array of follow-up plan objects or an empty array if not found
|
|
82
|
+
*/
|
|
83
|
+
fetchPlanByUserId(userId: string): Promise<SfPlan[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Fetches case meeting invites from SuccessFactors.
|
|
86
|
+
* @returns Array of meeting invite objects or an empty array if not found
|
|
87
|
+
*/
|
|
88
|
+
fetchCaseMeetingInvites(): Promise<SfMeeting[]>;
|
|
89
|
+
/**
|
|
90
|
+
* Fetches approved time off records for a user from SuccessFactors.
|
|
91
|
+
* @param userId The employee userId
|
|
92
|
+
* @returns Array of time off records or null if not found
|
|
93
|
+
*/
|
|
94
|
+
fetchTimeOffRecordCollision(userId: string): Promise<Array<{
|
|
95
|
+
approvalStatus: string;
|
|
96
|
+
endDate: string;
|
|
97
|
+
externalCode: string;
|
|
98
|
+
startDate: string;
|
|
99
|
+
timeType: string;
|
|
100
|
+
userId: string;
|
|
101
|
+
}> | null>;
|
|
102
|
+
/**
|
|
103
|
+
* Inserts a new absence follow-up case into SuccessFactors.
|
|
104
|
+
* @param employeeId Employee externalCode/userId
|
|
105
|
+
* @param absence Absence object (should contain all required fields)
|
|
106
|
+
* @param orgNo Organization number
|
|
107
|
+
* @returns The API response from SuccessFactors
|
|
108
|
+
*/
|
|
109
|
+
insertAbsenceCase(employeeId: string, absence: SickLeaveInfoSummary, orgNo: string): Promise<SFUpsertResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Inserts a new absence follow-up case activity into SuccessFactors.
|
|
112
|
+
* @param employeeId Employee externalCode/userId
|
|
113
|
+
* @param mdfSystemEffectiveStartDate Effective start date (string or Date)
|
|
114
|
+
* @param status (optional) Activity status, defaults to "NOT_STARTED"
|
|
115
|
+
* @returns The API response from SuccessFactors
|
|
116
|
+
*/
|
|
117
|
+
insertCaseActivity(employeeId: string, mdfSystemEffectiveStartDate: string | Date, status?: string): Promise<SFUpsertResponse>;
|
|
118
|
+
/**
|
|
119
|
+
* Inserts an initial absence follow-up plan into SuccessFactors.
|
|
120
|
+
* @param employeeId Employee externalCode/userId
|
|
121
|
+
* @param caseInfo Case object containing required fields
|
|
122
|
+
* @returns The API response from SuccessFactors
|
|
123
|
+
*/
|
|
124
|
+
insertPlan(employeeId: string, caseInfo: SickLeaveInfoSummary, orgNo: string): Promise<SFUpsertResponse>;
|
|
125
|
+
updatePlanStatus(employeeId: string, effectiveStartDate: string | Date, status: string | undefined, metadata: {
|
|
126
|
+
__metadata: {
|
|
127
|
+
uri: string;
|
|
128
|
+
type: string;
|
|
129
|
+
};
|
|
130
|
+
}): Promise<SFUpsertResponse>;
|
|
131
|
+
/**
|
|
132
|
+
* Updates an absence case in SuccessFactors with new dates and information.
|
|
133
|
+
* @param externalCode Employee externalCode/userId
|
|
134
|
+
* @param mdfSystemEffectiveStartDate Effective start date (Date or ISO string)
|
|
135
|
+
* @param newCaseInfo Object containing new case information
|
|
136
|
+
* @returns The API response from SuccessFactors
|
|
137
|
+
*/
|
|
138
|
+
updateAbsenceCase(externalCode: string, mdfSystemEffectiveStartDate: Date | string, newCaseInfo: SickLeaveInfoSummary, metadata: {
|
|
139
|
+
__metadata: {
|
|
140
|
+
uri: string;
|
|
141
|
+
type: string;
|
|
142
|
+
};
|
|
143
|
+
}): Promise<SFUpsertResponse>;
|
|
144
|
+
/**
|
|
145
|
+
* Updates the status of an activity in SuccessFactors.
|
|
146
|
+
* @param uri The URI of the activity to update
|
|
147
|
+
* @param status The new status to set
|
|
148
|
+
* @returns The API response from SuccessFactors
|
|
149
|
+
*/
|
|
150
|
+
updateActivityStatus(uri: string, status: string): Promise<SFUpsertResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Copies an existing absence follow-up plan.
|
|
153
|
+
* @param case The existing absence follow-up plan to copy
|
|
154
|
+
* @returns The API response from SuccessFactors
|
|
155
|
+
*/
|
|
156
|
+
copyExistingAbsenceFollowUpPlan(plan: SfPlan): Promise<SFUpsertResponse>;
|
|
157
|
+
/**
|
|
158
|
+
* Inserts a new employee time off record into SuccessFactors.
|
|
159
|
+
* @param userId The employee userId
|
|
160
|
+
* @param startDate The start date (ISO string)
|
|
161
|
+
* @param endDate The end date (ISO string)
|
|
162
|
+
* @returns The API response from SuccessFactors
|
|
163
|
+
*/
|
|
164
|
+
insertEmployeeTimeOffRecord(userId: string, startDate: string, endDate: string): Promise<SFUpsertResponse>;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=sf-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sf-service.d.ts","sourceRoot":"","sources":["../../src/services/sf-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAA2C,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAElI,qBAAa,qBAAqB;IAChC,OAAO,CAAC,WAAW,CAAc;IAC1B,WAAW,EAAE,MAAM,CAAM;gBAEpB,WAAW,EAAE,WAAW;IAIpC;;;;;OAKG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAgDrC;;;;;;;OAOG;IACG,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IA0BnG;;;;OAIG;IACG,wBAAwB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAqBvD;;;;;OAKG;IACG,0BAA0B,CAAC,GAAG,EAAE,M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