sr-npm 1.7.20 → 1.7.22
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 +3 -13
- package/backend/smartToken.js +17 -0
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -3,8 +3,7 @@ const { fetchPositionsFromSRAPI, fetchJobDescription } = require('./fetchPositio
|
|
|
3
3
|
const { chunkedBulkOperation } = require('./utils');
|
|
4
4
|
const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend');
|
|
5
5
|
const { COLLECTIONS, COLLECTIONS_FIELDS } = require('./collectionConsts');
|
|
6
|
-
const {
|
|
7
|
-
const { elevate } = require("wix-auth");
|
|
6
|
+
const { getSmartToken } = require('./smartToken');
|
|
8
7
|
|
|
9
8
|
// Utility function to normalize city names
|
|
10
9
|
function normalizeCityName(city) {
|
|
@@ -295,7 +294,6 @@ async function referenceJobsToField({
|
|
|
295
294
|
}
|
|
296
295
|
|
|
297
296
|
function fetchJobLocation(jobDetails) {
|
|
298
|
-
console.log("jobDetails.location is ", jobDetails.location);
|
|
299
297
|
const isZeroLocation = jobDetails.location.latitude === "0.0000" && jobDetails.location.longitude === "0.0000";
|
|
300
298
|
const jobLocation = {
|
|
301
299
|
location: isZeroLocation ? {} : {
|
|
@@ -320,16 +318,7 @@ function fetchJobLocation(jobDetails) {
|
|
|
320
318
|
|
|
321
319
|
|
|
322
320
|
|
|
323
|
-
|
|
324
|
-
const elevatedGetSecretValue = elevate(secrets.getSecretValue);
|
|
325
|
-
return elevatedGetSecretValue("x-smarttoken")
|
|
326
|
-
.then((secret) => {
|
|
327
|
-
return secret;
|
|
328
|
-
})
|
|
329
|
-
.catch((error) => {
|
|
330
|
-
console.error(error);
|
|
331
|
-
});
|
|
332
|
-
}
|
|
321
|
+
|
|
333
322
|
|
|
334
323
|
|
|
335
324
|
async function createApiKeyCollectionAndFillIt() {
|
|
@@ -346,6 +335,7 @@ async function createApiKeyCollectionAndFillIt() {
|
|
|
346
335
|
console.log("Smart token inserted into the ApiKey collection");
|
|
347
336
|
}
|
|
348
337
|
|
|
338
|
+
|
|
349
339
|
module.exports = {
|
|
350
340
|
saveDataJobsToCMS,
|
|
351
341
|
saveJobsDescriptionsAndLocationToCMS,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { secrets } = require("wix-secrets-backend.v2");
|
|
2
|
+
const { elevate } = require("wix-auth");
|
|
3
|
+
|
|
4
|
+
function getSmartToken() {
|
|
5
|
+
const elevatedGetSecretValue = elevate(secrets.getSecretValue);
|
|
6
|
+
return elevatedGetSecretValue("x-smarttoken")
|
|
7
|
+
.then((secret) => {
|
|
8
|
+
return secret;
|
|
9
|
+
})
|
|
10
|
+
.catch((error) => {
|
|
11
|
+
console.error(error);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = {
|
|
16
|
+
getSmartToken,
|
|
17
|
+
};
|