sr-npm 1.7.407 → 1.7.408
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.
|
@@ -34,9 +34,7 @@ async function fetchPositionsFromSRAPI() {
|
|
|
34
34
|
let totalFound = 0;
|
|
35
35
|
let page = 0;
|
|
36
36
|
const MAX_PAGES = 30 // Safety limit to prevent infinite loops
|
|
37
|
-
const companyId = await
|
|
38
|
-
const templateType = await getTemplateTypeFromCMS();
|
|
39
|
-
const smartToken = templateType==='INTERNAL' ? await getSmartTokenFromCMS():undefined;
|
|
37
|
+
const {companyId,templateType,smartToken} = await getApiKeysFromCMS();
|
|
40
38
|
console.log('Starting to fetch all positions with pagination...');
|
|
41
39
|
let offset=0;
|
|
42
40
|
|
|
@@ -98,8 +96,8 @@ async function fetchPositionsFromSRAPI() {
|
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
async function fetchJobDescription(jobId) {
|
|
101
|
-
const companyId = await
|
|
102
|
-
return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}
|
|
99
|
+
const {companyId,smartToken} = await getApiKeysFromCMS();
|
|
100
|
+
return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}`,smartToken);
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
async function getCompanyIdFromCMS() {
|
|
@@ -129,6 +127,12 @@ async function getTemplateTypeFromCMS() {
|
|
|
129
127
|
}
|
|
130
128
|
}
|
|
131
129
|
|
|
130
|
+
async function getApiKeys() {
|
|
131
|
+
const companyId = await getCompanyIdFromCMS();
|
|
132
|
+
const templateType = await getTemplateTypeFromCMS();
|
|
133
|
+
const smartToken = templateType==='INTERNAL' ? await getSmartTokenFromCMS():undefined;
|
|
134
|
+
return {companyId,templateType,smartToken};
|
|
135
|
+
}
|
|
132
136
|
|
|
133
137
|
module.exports = {
|
|
134
138
|
fetchPositionsFromSRAPI,
|