sr-npm 1.7.315 → 1.7.317

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/utils.js +10 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.315",
3
+ "version": "1.7.317",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/public/utils.js CHANGED
@@ -1,13 +1,17 @@
1
1
  const { fetch } = require('wix-fetch');
2
- const { secrets } = require("@wix/secrets");
2
+ const { secrets } = require("wix-secrets-backend.v2");
3
+ const { elevate } = require("wix-auth");
3
4
 
5
+ const elevatedGetSecretValue = elevate(secrets.getSecretValue);
4
6
 
5
7
  async function getServerlessAuth() {
6
- const serverlessAuth = await secrets.getSecretValue("serverless_auth")
8
+ console.log("i am here")
9
+ const serverlessAuth = await elevatedGetSecretValue("serverless_auth")
7
10
  console.log("serverlessAuth **********",serverlessAuth)
8
- return serverlessAuth;
11
+ return serverlessAuth.value;
9
12
  }
10
13
 
14
+
11
15
  function htmlToText(html) {
12
16
  if (!html) return '';
13
17
 
@@ -30,10 +34,9 @@ function htmlToText(html) {
30
34
  }
31
35
 
32
36
  async function htmlToRichContent(htmlString) {
33
- console.log("i am here")
34
- const serverlessAuth = await getServerlessAuth()
37
+ console.log("htmlString **********",htmlString)
38
+ const serverlessAuth = getServerlessAuth()
35
39
  console.log("serverlessAuth **********",serverlessAuth)
36
- // console.log("htmlString **********",htmlString)
37
40
  // const raw = JSON.stringify({
38
41
  // "content": htmlString
39
42
  // });
@@ -44,19 +47,17 @@ async function htmlToRichContent(htmlString) {
44
47
  // headers: {
45
48
  // "Content-Type": "application/json",
46
49
  // "Cookie": "XSRF-TOKEN=1753949844|p--a7HsuVjR4",
47
- // "Authorization": "Bearer "+await getServerlessAuth()
50
+ // "Authorization": "Bearer 2e19efe5f44d29d74480f5b744a5a90f19ba6ca7012ced19e7b14edb1ad6a641"
48
51
 
49
52
  // },
50
53
  // body: raw
51
54
  // };
52
55
 
53
- // console.log("requestOptions **********",requestOptions)
54
56
 
55
57
  // try{
56
58
  // const response = await fetch("https://www.wixapis.com/data-sync/v1/abmp-content-converter", requestOptions);
57
59
  // if (response.ok) {
58
60
  // const data = await response.json();
59
- // console.log("data.richContent **********",data.richContent)
60
61
  // return data.richContent;
61
62
  // }
62
63