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 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,19 @@ 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");
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.11",
3
+ "version": "1.7.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {