sr-npm 1.7.266 → 1.7.267

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/backend/data.js CHANGED
@@ -4,7 +4,7 @@ const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend
4
4
  const { COLLECTIONS, COLLECTIONS_FIELDS,JOBS_COLLECTION_FIELDS } = require('./collectionConsts');
5
5
  const { chunkedBulkOperation, delay, countJobsPerGivenField, fillCityLocationAndLocationAddress ,prepareToSaveArray,normalizeCityName} = require('./utils');
6
6
  const { getAllPositions } = require('./queries');
7
- const secretsData = require('./secretsData');
7
+ const { getSmartToken } = require('./secretsData');
8
8
 
9
9
  function validatePosition(position) {
10
10
  if (!position.id) {
@@ -293,7 +293,7 @@ async function createApiKeyCollectionAndFillIt() {
293
293
  console.log("Creating ApiKey collection and filling it with the smart token");
294
294
  await createCollectionIfMissing(COLLECTIONS.API_KEY, COLLECTIONS_FIELDS.API_KEY,null,'singleItem');
295
295
  console.log("Getting the smart token");
296
- const token = await secretsData.getSmartToken();
296
+ const token = await getSmartToken();
297
297
  console.log("token is : ", token);
298
298
  console.log("Inserting the smart token into the ApiKey collection");
299
299
  await wixData.insert(COLLECTIONS.API_KEY, {
@@ -47,10 +47,7 @@ async function fetchPositionsFromSRAPI() {
47
47
  page++;
48
48
 
49
49
  // Build the API path - first request has no page parameter, subsequent use nextPageId
50
- let apiPath = `/v1/companies/${companyId.value}/postings?offset=${offset}`;
51
- if (nextPageId) {
52
- apiPath += `&pageId=${nextPageId}`;
53
- }
50
+ let apiPath = `/v1/companies/${companyId.value}/postings?offset=${offset}&limit=10`;
54
51
 
55
52
  console.log(`Fetching page ${page} with path: ${apiPath}`);
56
53
  const response = await makeSmartRecruitersRequest(apiPath,token);
@@ -69,13 +66,9 @@ async function fetchPositionsFromSRAPI() {
69
66
  }
70
67
 
71
68
  // Get the nextPageId for the next iteration
72
- nextPageId = response.nextPageId && response.nextPageId !== '' ? response.nextPageId : null;
73
-
74
- if (nextPageId) {
75
- console.log(`Next page ID: ${nextPageId}`);
76
- } else {
77
- console.log('No more pages to fetch');
78
- }
69
+ // nextPageId = response.nextPageId && response.nextPageId !== '' ? response.nextPageId : null;
70
+ offset+=10;
71
+
79
72
  } catch (error) {
80
73
  console.error(`Error fetching page ${page}:`, error);
81
74
  throw error;
@@ -86,7 +79,7 @@ async function fetchPositionsFromSRAPI() {
86
79
  console.warn(`Reached maximum page limit of ${MAX_PAGES}. Stopping pagination.`);
87
80
  break;
88
81
  }
89
- } while (nextPageId); // Continue while there's a nextPageId
82
+ } while (offset<totalFound); // Continue while there's a nextPageId
90
83
 
91
84
  console.log(`Finished fetching all pages. Total positions collected: ${allPositions.length}`);
92
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.266",
3
+ "version": "1.7.267",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {