sr-npm 1.7.11 → 1.7.12
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 +1 -1
- package/backend/data.js +9 -15
- package/package.json +1 -1
package/backend/consts.js
CHANGED
package/backend/data.js
CHANGED
|
@@ -4,7 +4,6 @@ const { chunkedBulkOperation } = require('./utils');
|
|
|
4
4
|
const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend');
|
|
5
5
|
const { COLLECTIONS, COLLECTIONS_FIELDS } = require('./consts');
|
|
6
6
|
const { secrets } = require("wix-secrets-backend.v2");
|
|
7
|
-
const { getJSON } = require("wix-fetch");
|
|
8
7
|
const { elevate } = require("wix-auth");
|
|
9
8
|
|
|
10
9
|
// Utility function to normalize city names
|
|
@@ -332,21 +331,17 @@ function getSmartToken() {
|
|
|
332
331
|
});
|
|
333
332
|
}
|
|
334
333
|
|
|
335
|
-
|
|
336
|
-
const elevatedListSecretInfo = elevate(secrets.listSecretInfo);
|
|
337
|
-
return elevatedListSecretInfo()
|
|
338
|
-
.then((secrets) => {
|
|
339
|
-
return elevatedGetSecretValue(secrets[0].name);
|
|
340
|
-
})
|
|
341
|
-
.catch((error) => {
|
|
342
|
-
console.error(error);
|
|
343
|
-
});
|
|
344
|
-
}
|
|
334
|
+
|
|
345
335
|
async function createApiKeyCollectionAndFillIt() {
|
|
336
|
+
console.log("Creating ApiKey collection and filling it with the smart token");
|
|
346
337
|
await createCollectionIfMissing(COLLECTIONS.API_KEY, COLLECTIONS_FIELDS.API_KEY);
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
338
|
+
console.log("Getting the smart token");
|
|
339
|
+
const token = await getSmartToken();
|
|
340
|
+
console.log("Inserting the smart token into the ApiKey collection");
|
|
341
|
+
await wixData.insert("ApiKey", {
|
|
342
|
+
token: token
|
|
343
|
+
});
|
|
344
|
+
console.log("Smart token inserted into the ApiKey collection");
|
|
350
345
|
}
|
|
351
346
|
|
|
352
347
|
module.exports = {
|
|
@@ -355,5 +350,4 @@ module.exports = {
|
|
|
355
350
|
aggregateJobsByFieldToCMS,
|
|
356
351
|
referenceJobsToField,
|
|
357
352
|
createApiKeyCollectionAndFillIt,
|
|
358
|
-
getSmartToken,
|
|
359
353
|
};
|