sr-npm 1.7.407 → 1.7.409
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,16 +34,13 @@ 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
|
|
|
43
41
|
do {
|
|
44
42
|
try {
|
|
45
43
|
page++;
|
|
46
|
-
|
|
47
44
|
// Build the API path - first request has no page parameter, subsequent use nextPageId
|
|
48
45
|
const apiPath = `/v1/companies/${companyId}/postings?offset=${offset}&destination=${templateType}`;
|
|
49
46
|
|
|
@@ -98,8 +95,8 @@ async function fetchPositionsFromSRAPI() {
|
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
async function fetchJobDescription(jobId) {
|
|
101
|
-
const companyId = await
|
|
102
|
-
return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}
|
|
98
|
+
const {companyId,smartToken} = await getApiKeysFromCMS();
|
|
99
|
+
return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}`,smartToken);
|
|
103
100
|
}
|
|
104
101
|
|
|
105
102
|
async function getCompanyIdFromCMS() {
|
|
@@ -129,6 +126,12 @@ async function getTemplateTypeFromCMS() {
|
|
|
129
126
|
}
|
|
130
127
|
}
|
|
131
128
|
|
|
129
|
+
async function getApiKeys() {
|
|
130
|
+
const companyId = await getCompanyIdFromCMS();
|
|
131
|
+
const templateType = await getTemplateTypeFromCMS();
|
|
132
|
+
const smartToken = templateType==='INTERNAL' ? await getSmartTokenFromCMS():undefined;
|
|
133
|
+
return {companyId,templateType,smartToken};
|
|
134
|
+
}
|
|
132
135
|
|
|
133
136
|
module.exports = {
|
|
134
137
|
fetchPositionsFromSRAPI,
|