sr-npm 1.7.1 → 1.7.3

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/consts.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {saveDataJobsToCMS,saveJobsDescriptionsToCMS,aggregateJobsByFieldToCMS,referenceJobsToField} from './data';
2
2
  const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend');
3
- export const TASKS_NAMES = {
3
+ const TASKS_NAMES = {
4
4
  SYNC_JOBS: 'syncJobsFromSRAPIToCMS',
5
5
  INSERT_JOBS_TO_CMS: 'insertJobsToCMS',
6
6
  INSERT_JOBS_DESCRIPTIONS_TO_CMS: 'insertJobsDescriptionsToCMS',
@@ -14,7 +14,7 @@ export const TASKS_NAMES = {
14
14
  }
15
15
 
16
16
 
17
- export const TASKS = {
17
+ const TASKS = {
18
18
  [TASKS_NAMES.SYNC_JOBS]: {
19
19
  name: TASKS_NAMES.SYNC_JOBS,
20
20
  childTasks: [
@@ -96,7 +96,7 @@ export const TASKS = {
96
96
  }
97
97
  }
98
98
 
99
- export const COLLECTIONS = {
99
+ const COLLECTIONS = {
100
100
  AMOUNT_OF_JOBS_PER_DEPARTMENT: 'AmountOfJobsPerDepartment',
101
101
  CITIES: 'cities',
102
102
  JOBS: 'Jobs',
@@ -136,7 +136,14 @@ const COLLECTIONS_FIELDS = {
136
136
  };
137
137
 
138
138
 
139
- export const TASK_TYPE = {
139
+ const TASK_TYPE = {
140
140
  SCHEDULED: 'scheduled',
141
141
  EVENT: 'event',
142
142
  };
143
+
144
+ module.exports = {
145
+ TASKS_NAMES,
146
+ TASK_TYPE,
147
+ TASKS,
148
+ COLLECTIONS,
149
+ };
@@ -28,7 +28,7 @@ async function makeSmartRecruitersRequest(path) {
28
28
  }
29
29
  }
30
30
 
31
- export async function fetchPositionsFromSRAPI() {
31
+ async function fetchPositionsFromSRAPI() {
32
32
  let allPositions = [];
33
33
  let totalFound = 0;
34
34
  let nextPageId = null; // Start with no page ID for the first request
@@ -104,6 +104,13 @@ export async function fetchPositionsFromSRAPI() {
104
104
  return result;
105
105
  }
106
106
 
107
- export async function fetchJobDescription(jobId) {
107
+ async function fetchJobDescription(jobId) {
108
108
  return await makeSmartRecruitersRequest(`/jobs/${jobId}`);
109
109
  }
110
+
111
+
112
+ module.exports = {
113
+
114
+ fetchPositionsFromSRAPI,
115
+ fetchJobDescription,
116
+ };
package/backend/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  module.exports = {
2
2
  ...require('./utils'),
3
3
  ...require('./queries'),
4
+ ...require('./fetchPositionsFromSRAPI'),
5
+ ...require('./consts'),
4
6
  };
5
7
 
@@ -1,18 +1,17 @@
1
1
  const { COLLECTIONS } = require('./consts');
2
- //const { items } = require('@wix/data');
3
- const { wixData } = require('./elevated-modules');
2
+ const { items } = require('@wix/data');
4
3
 
5
4
 
6
5
 
7
6
  async function getAllPositions() {
8
- const query = wixData.query(COLLECTIONS.JOBS);
7
+ const query = items.query(COLLECTIONS.JOBS);
9
8
  const results = await query.find();
10
9
  return results.items;
11
10
 
12
11
  }
13
12
 
14
13
  async function getPositionsByField(field, value) {
15
- const query = wixData.query(COLLECTIONS.JOBS)
14
+ const query = items.query(COLLECTIONS.JOBS)
16
15
  .eq(field, value);
17
16
  const results = await query.find();
18
17
  return results.items;
package/backend/utils.js CHANGED
@@ -3,4 +3,9 @@ async function chunkedBulkOperation({ items, chunkSize, processChunk }) {
3
3
  const chunk = items.slice(i, i + chunkSize);
4
4
  await processChunk(chunk, Math.floor(i / chunkSize) + 1);
5
5
  }
6
- }
6
+ }
7
+
8
+
9
+ module.exports = {
10
+ chunkedBulkOperation,
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,19 +0,0 @@
1
- const { items } = require('@wix/data');
2
- const { auth } = require('@wix/essentials');
3
-
4
- // @wix/data does not support suppressAuth currently, so we need to elevate it
5
- const wixData = {
6
- insert: auth.elevate(items.insert),
7
- update: auth.elevate(items.update),
8
- bulkInsert: auth.elevate(items.bulkInsert),
9
- query: auth.elevate(items.query),
10
- save: auth.elevate(items.save),
11
- remove: auth.elevate(items.remove),
12
- get: auth.elevate(items.get),
13
- //TODO: add other methods here as needed
14
-
15
- };
16
-
17
-
18
-
19
- module.exports = { wixData };