sr-npm 1.7.11 → 1.7.13
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 +11 -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,19 @@ 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");
|
|
337
|
+
console.log("COLLECTIONS", COLLECTIONS);
|
|
338
|
+
console.log("COLLECTIONS_FIELDS", COLLECTIONS_FIELDS);
|
|
346
339
|
await createCollectionIfMissing(COLLECTIONS.API_KEY, COLLECTIONS_FIELDS.API_KEY);
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
340
|
+
console.log("Getting the smart token");
|
|
341
|
+
const token = await getSmartToken();
|
|
342
|
+
console.log("Inserting the smart token into the ApiKey collection");
|
|
343
|
+
await wixData.insert("ApiKey", {
|
|
344
|
+
token: token
|
|
345
|
+
});
|
|
346
|
+
console.log("Smart token inserted into the ApiKey collection");
|
|
350
347
|
}
|
|
351
348
|
|
|
352
349
|
module.exports = {
|
|
@@ -355,5 +352,4 @@ module.exports = {
|
|
|
355
352
|
aggregateJobsByFieldToCMS,
|
|
356
353
|
referenceJobsToField,
|
|
357
354
|
createApiKeyCollectionAndFillIt,
|
|
358
|
-
getSmartToken,
|
|
359
355
|
};
|