sr-npm 1.7.501 → 1.7.503
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 +5 -2
- package/backend/secretsData.js +1 -1
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -28,7 +28,7 @@ function validatePosition(position) {
|
|
|
28
28
|
|
|
29
29
|
async function filterBasedOnBrand(positions) {
|
|
30
30
|
try{
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
const desiredBrand = await getTokenFromCMS(TOKEN_NAME.DESIRED_BRAND);
|
|
33
33
|
validateSingleDesiredBrand(desiredBrand);
|
|
34
34
|
console.log("filtering positions based on brand: ", desiredBrand);
|
|
@@ -47,6 +47,8 @@ async function filterBasedOnBrand(positions) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
function validateSingleDesiredBrand(desiredBrand) {
|
|
50
|
+
console.log("desiredBrand is: ", desiredBrand);
|
|
51
|
+
console.log("typeof desiredBrand is: ", typeof desiredBrand);
|
|
50
52
|
if(typeof desiredBrand !== 'string' || desiredBrand.includes("[") || desiredBrand.includes("]") || desiredBrand.includes(",")){
|
|
51
53
|
throw new Error("Desired brand must be a single brand");
|
|
52
54
|
}
|
|
@@ -406,9 +408,10 @@ async function fillSecretManagerMirror() {
|
|
|
406
408
|
|
|
407
409
|
async function insertSecretValToCMS(tokenName) {
|
|
408
410
|
const token = await retrieveSecretVal(tokenName);
|
|
411
|
+
console.log("token is: ", token);
|
|
409
412
|
await wixData.save(COLLECTIONS.SECRET_MANAGER_MIRROR, {
|
|
410
413
|
tokenName: tokenName,
|
|
411
|
-
|
|
414
|
+
value: token.value,
|
|
412
415
|
_id: normalizeString(tokenName)
|
|
413
416
|
});
|
|
414
417
|
}
|
package/backend/secretsData.js
CHANGED
|
@@ -22,7 +22,7 @@ const getSecretValue = auth.elevate(secrets.getSecretValue);
|
|
|
22
22
|
async function getTokenFromCMS(tokenName) {
|
|
23
23
|
const result = await wixData.query(COLLECTIONS.SECRET_MANAGER_MIRROR).eq('tokenName',tokenName).find();
|
|
24
24
|
if (result.items.length > 0) {
|
|
25
|
-
return result.items[0].
|
|
25
|
+
return result.items[0].value;
|
|
26
26
|
} else {
|
|
27
27
|
throw new Error(`[getTokenFromCMS], No ${tokenName} found`);
|
|
28
28
|
}
|