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 CHANGED
@@ -142,7 +142,7 @@ const COLLECTIONS_FIELDS = {
142
142
  {key:'city', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: 'cities' } } },
143
143
  ],
144
144
  API_KEY: [
145
- {key:'key', type: 'TEXT'},
145
+ {key:'token', type: 'TEXT'},
146
146
  ],
147
147
  };
148
148
 
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
- function getFirstSecretValue() {
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.11",
3
+ "version": "1.7.12",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {