akeyless-client-commons 1.0.209 → 1.0.211

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.
@@ -42,7 +42,9 @@ interface SnapshotResult {
42
42
  promise: Promise<void>;
43
43
  unsubscribe: Unsubscribe;
44
44
  }
45
- type Snapshot = (config: OnSnapshotConfig, snapshotsFirstTime: string[]) => SnapshotResult;
45
+ type Snapshot = (config: OnSnapshotConfig, snapshotsFirstTime: string[], settings?: {
46
+ disableLogs?: boolean;
47
+ }) => SnapshotResult;
46
48
  type SnapshotDocument = (config: OnSnapshotConfigDocument, snapshotsFirstTime: string[]) => SnapshotResult;
47
49
 
48
50
  declare const db: Firestore;
@@ -229,8 +231,8 @@ declare const biDomain: string;
229
231
  declare const callCenterDomain: string;
230
232
  declare const akeylessOnlineDomain: string;
231
233
  type Method = "GET" | "POST" | "PUT" | "DELETE";
232
- type ServerName = "devices" | "bi" | "call-center";
233
- declare const nx_api_call: (serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<any>;
234
+ type ServerName = "devices" | "bi" | "call-center-geo" | "call-center-events" | "notifications";
235
+ declare const nxApiCall: (serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<any>;
234
236
 
235
237
  declare const checkUserPermissions: <T extends keyof UserPermissionsObject>(userPermissions: UserPermissionsObject, entity: T, permissions?: userPermissionsObjectValue<T>[], mode?: "some" | "every") => boolean;
236
238
  declare const parsePermissions: (object: NxUser | Client) => TObject<TObject<boolean>>;
@@ -245,4 +247,4 @@ declare const initializeUserPermissions: ({ phoneNumber, email, firstTimeArray,
245
247
  permissions: TObject<TObject<boolean>>;
246
248
  }>;
247
249
 
248
- export { type ValidationType, addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFixedNumber, getFormCheckboxValue, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, get_international_phone_number, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, isValid, is_iccid, local_israel_phone_format, mode, multiStringFormat, numbersOnlyRegex, numbersRegex, nx_api_call, parseMultiSelectInput, parsePermissions, parseSnapshotAsArray, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateUserStatusAndPermissions };
250
+ export { type ValidationType, addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFixedNumber, getFormCheckboxValue, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, get_international_phone_number, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, isValid, is_iccid, local_israel_phone_format, mode, multiStringFormat, numbersOnlyRegex, numbersRegex, nxApiCall, parseMultiSelectInput, parsePermissions, parseSnapshotAsArray, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateUserStatusAndPermissions };
@@ -42,7 +42,9 @@ interface SnapshotResult {
42
42
  promise: Promise<void>;
43
43
  unsubscribe: Unsubscribe;
44
44
  }
45
- type Snapshot = (config: OnSnapshotConfig, snapshotsFirstTime: string[]) => SnapshotResult;
45
+ type Snapshot = (config: OnSnapshotConfig, snapshotsFirstTime: string[], settings?: {
46
+ disableLogs?: boolean;
47
+ }) => SnapshotResult;
46
48
  type SnapshotDocument = (config: OnSnapshotConfigDocument, snapshotsFirstTime: string[]) => SnapshotResult;
47
49
 
48
50
  declare const db: Firestore;
@@ -229,8 +231,8 @@ declare const biDomain: string;
229
231
  declare const callCenterDomain: string;
230
232
  declare const akeylessOnlineDomain: string;
231
233
  type Method = "GET" | "POST" | "PUT" | "DELETE";
232
- type ServerName = "devices" | "bi" | "call-center";
233
- declare const nx_api_call: (serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<any>;
234
+ type ServerName = "devices" | "bi" | "call-center-geo" | "call-center-events" | "notifications";
235
+ declare const nxApiCall: (serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<any>;
234
236
 
235
237
  declare const checkUserPermissions: <T extends keyof UserPermissionsObject>(userPermissions: UserPermissionsObject, entity: T, permissions?: userPermissionsObjectValue<T>[], mode?: "some" | "every") => boolean;
236
238
  declare const parsePermissions: (object: NxUser | Client) => TObject<TObject<boolean>>;
@@ -245,4 +247,4 @@ declare const initializeUserPermissions: ({ phoneNumber, email, firstTimeArray,
245
247
  permissions: TObject<TObject<boolean>>;
246
248
  }>;
247
249
 
248
- export { type ValidationType, addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFixedNumber, getFormCheckboxValue, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, get_international_phone_number, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, isValid, is_iccid, local_israel_phone_format, mode, multiStringFormat, numbersOnlyRegex, numbersRegex, nx_api_call, parseMultiSelectInput, parsePermissions, parseSnapshotAsArray, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateUserStatusAndPermissions };
250
+ export { type ValidationType, addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFixedNumber, getFormCheckboxValue, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, get_international_phone_number, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, isValid, is_iccid, local_israel_phone_format, mode, multiStringFormat, numbersOnlyRegex, numbersRegex, nxApiCall, parseMultiSelectInput, parsePermissions, parseSnapshotAsArray, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateUserStatusAndPermissions };
@@ -494,8 +494,8 @@ __export(index_exports, {
494
494
  numbersRegex: function() {
495
495
  return numbersRegex;
496
496
  },
497
- nx_api_call: function() {
498
- return nx_api_call;
497
+ nxApiCall: function() {
498
+ return nxApiCall;
499
499
  },
500
500
  parseMultiSelectInput: function() {
501
501
  return parseMultiSelectInput;
@@ -1364,11 +1364,13 @@ var query_document_by_conditions = /*#__PURE__*/ function() {
1364
1364
  return _ref.apply(this, arguments);
1365
1365
  };
1366
1366
  }();
1367
- var snapshot = function(config, snapshotsFirstTime) {
1367
+ var snapshot = function(config, snapshotsFirstTime, settings) {
1368
1368
  var resolvePromise;
1369
1369
  var isResolved = false;
1370
1370
  var promise = new Promise(function(resolve) {
1371
- console.log("==> ".concat(config.collectionName, " subscribed."));
1371
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
1372
+ console.log("==> ".concat(config.collectionName, " subscribed."));
1373
+ }
1372
1374
  resolvePromise = function() {
1373
1375
  if (!isResolved) {
1374
1376
  isResolved = true;
@@ -2139,7 +2141,7 @@ var devicesDomain = isLocal ? "http://localhost:9001/api/devices" : baseDomain +
2139
2141
  var biDomain = isLocal ? "http://localhost:9002/api/bi" : baseDomain + "/bi";
2140
2142
  var callCenterDomain = isLocal ? "http://localhost:9003/api/call-center" : baseDomain + "/call-center";
2141
2143
  var akeylessOnlineDomain = mode === "qa" ? "https://akeyless-online.xyz" : "https://akeyless-online.info";
2142
- var nx_api_call = /*#__PURE__*/ function() {
2144
+ var nxApiCall = /*#__PURE__*/ function() {
2143
2145
  var _ref = _async_to_generator(function(serverName, method, url, data) {
2144
2146
  var urlResult, headers, _tmp, _, response, error, _error_response;
2145
2147
  return _ts_generator(this, function(_state) {
@@ -2159,8 +2161,14 @@ var nx_api_call = /*#__PURE__*/ function() {
2159
2161
  case "devices":
2160
2162
  urlResult = "".concat(devicesDomain, "/").concat(url);
2161
2163
  break;
2162
- case "call-center":
2163
- urlResult = "".concat(callCenterDomain, "/").concat(url);
2164
+ case "notifications":
2165
+ urlResult = "".concat(devicesDomain, "/").concat(url);
2166
+ break;
2167
+ case "call-center-events":
2168
+ urlResult = "".concat(callCenterDomain, "/call-center/events");
2169
+ break;
2170
+ case "call-center-geo":
2171
+ urlResult = "".concat(callCenterDomain, "/call-center/geo");
2164
2172
  break;
2165
2173
  default:
2166
2174
  break;
@@ -2190,7 +2198,7 @@ var nx_api_call = /*#__PURE__*/ function() {
2190
2198
  ];
2191
2199
  case 3:
2192
2200
  error = _state.sent();
2193
- console.error("Error from nx_api_call: ".concat(JSON.stringify({
2201
+ console.error("Error from nxApiCall: ".concat(JSON.stringify({
2194
2202
  serverName: serverName,
2195
2203
  method: method,
2196
2204
  url: url,
@@ -2207,7 +2215,7 @@ var nx_api_call = /*#__PURE__*/ function() {
2207
2215
  }
2208
2216
  });
2209
2217
  });
2210
- return function nx_api_call(serverName, method, url, data) {
2218
+ return function nxApiCall(serverName, method, url, data) {
2211
2219
  return _ref.apply(this, arguments);
2212
2220
  };
2213
2221
  }();
@@ -2276,7 +2284,7 @@ var nx_api_call = /*#__PURE__*/ function() {
2276
2284
  multiStringFormat: multiStringFormat,
2277
2285
  numbersOnlyRegex: numbersOnlyRegex,
2278
2286
  numbersRegex: numbersRegex,
2279
- nx_api_call: nx_api_call,
2287
+ nxApiCall: nxApiCall,
2280
2288
  parseMultiSelectInput: parseMultiSelectInput,
2281
2289
  parsePermissions: parsePermissions,
2282
2290
  parseSnapshotAsArray: parseSnapshotAsArray,
@@ -1022,11 +1022,13 @@ var query_document_by_conditions = /*#__PURE__*/ function() {
1022
1022
  return _ref.apply(this, arguments);
1023
1023
  };
1024
1024
  }();
1025
- var snapshot = function(config, snapshotsFirstTime) {
1025
+ var snapshot = function(config, snapshotsFirstTime, settings) {
1026
1026
  var resolvePromise;
1027
1027
  var isResolved = false;
1028
1028
  var promise = new Promise(function(resolve) {
1029
- console.log("==> ".concat(config.collectionName, " subscribed."));
1029
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
1030
+ console.log("==> ".concat(config.collectionName, " subscribed."));
1031
+ }
1030
1032
  resolvePromise = function() {
1031
1033
  if (!isResolved) {
1032
1034
  isResolved = true;
@@ -1796,7 +1798,7 @@ var devicesDomain = isLocal ? "http://localhost:9001/api/devices" : baseDomain +
1796
1798
  var biDomain = isLocal ? "http://localhost:9002/api/bi" : baseDomain + "/bi";
1797
1799
  var callCenterDomain = isLocal ? "http://localhost:9003/api/call-center" : baseDomain + "/call-center";
1798
1800
  var akeylessOnlineDomain = mode === "qa" ? "https://akeyless-online.xyz" : "https://akeyless-online.info";
1799
- var nx_api_call = /*#__PURE__*/ function() {
1801
+ var nxApiCall = /*#__PURE__*/ function() {
1800
1802
  var _ref = _async_to_generator(function(serverName, method, url, data) {
1801
1803
  var urlResult, headers, _tmp, _, response, error, _error_response;
1802
1804
  return _ts_generator(this, function(_state) {
@@ -1816,8 +1818,14 @@ var nx_api_call = /*#__PURE__*/ function() {
1816
1818
  case "devices":
1817
1819
  urlResult = "".concat(devicesDomain, "/").concat(url);
1818
1820
  break;
1819
- case "call-center":
1820
- urlResult = "".concat(callCenterDomain, "/").concat(url);
1821
+ case "notifications":
1822
+ urlResult = "".concat(devicesDomain, "/").concat(url);
1823
+ break;
1824
+ case "call-center-events":
1825
+ urlResult = "".concat(callCenterDomain, "/call-center/events");
1826
+ break;
1827
+ case "call-center-geo":
1828
+ urlResult = "".concat(callCenterDomain, "/call-center/geo");
1821
1829
  break;
1822
1830
  default:
1823
1831
  break;
@@ -1847,7 +1855,7 @@ var nx_api_call = /*#__PURE__*/ function() {
1847
1855
  ];
1848
1856
  case 3:
1849
1857
  error = _state.sent();
1850
- console.error("Error from nx_api_call: ".concat(JSON.stringify({
1858
+ console.error("Error from nxApiCall: ".concat(JSON.stringify({
1851
1859
  serverName: serverName,
1852
1860
  method: method,
1853
1861
  url: url,
@@ -1864,9 +1872,9 @@ var nx_api_call = /*#__PURE__*/ function() {
1864
1872
  }
1865
1873
  });
1866
1874
  });
1867
- return function nx_api_call(serverName, method, url, data) {
1875
+ return function nxApiCall(serverName, method, url, data) {
1868
1876
  return _ref.apply(this, arguments);
1869
1877
  };
1870
1878
  }();
1871
- export { addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFixedNumber, getFormCheckboxValue, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, get_international_phone_number, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, isValid, is_iccid, local_israel_phone_format, mode, multiStringFormat, numbersOnlyRegex, numbersRegex, nx_api_call, parseMultiSelectInput, parsePermissions, parseSnapshotAsArray, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateUserStatusAndPermissions };
1879
+ export { addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFixedNumber, getFormCheckboxValue, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, get_international_phone_number, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, isValid, is_iccid, local_israel_phone_format, mode, multiStringFormat, numbersOnlyRegex, numbersRegex, nxApiCall, parseMultiSelectInput, parsePermissions, parseSnapshotAsArray, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateUserStatusAndPermissions };
1872
1880
  //# sourceMappingURL=index.mjs.map
@@ -366,11 +366,13 @@ var simpleExtractData = function(doc2) {
366
366
  id: doc2.id
367
367
  });
368
368
  };
369
- var snapshot = function(config, snapshotsFirstTime) {
369
+ var snapshot = function(config, snapshotsFirstTime, settings) {
370
370
  var resolvePromise;
371
371
  var isResolved = false;
372
372
  var promise = new Promise(function(resolve) {
373
- console.log("==> ".concat(config.collectionName, " subscribed."));
373
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
374
+ console.log("==> ".concat(config.collectionName, " subscribed."));
375
+ }
374
376
  resolvePromise = function() {
375
377
  if (!isResolved) {
376
378
  isResolved = true;
@@ -551,9 +553,11 @@ var useSnapshotBulk = function(configs, label, settings) {
551
553
  var unsubscribeFunctions = (0, import_react3.useRef)([]);
552
554
  useDeepCompareEffect(function() {
553
555
  var start = performance.now();
554
- console.log("==> ".concat(label || "Custom snapshots", " started... "));
556
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
557
+ console.log("==> ".concat(label || "Custom snapshots", " started... "));
558
+ }
555
559
  var snapshotResults = configs.map(function(config) {
556
- return snapshot(config, snapshotsFirstTime.current);
560
+ return snapshot(config, snapshotsFirstTime.current, settings);
557
561
  });
558
562
  unsubscribeFunctions.current = snapshotResults.map(function(result) {
559
563
  return result.unsubscribe;
@@ -561,10 +565,9 @@ var useSnapshotBulk = function(configs, label, settings) {
561
565
  Promise.all(snapshotResults.map(function(result) {
562
566
  return result.promise;
563
567
  })).then(function() {
564
- if (settings === null || settings === void 0 ? void 0 : settings.disableLogs) {
565
- return;
568
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
569
+ console.log("==> ".concat(label || "Custom snapshots", " ended. It took ").concat((performance.now() - start).toFixed(2), " ms"));
566
570
  }
567
- console.log("==> ".concat(label || "Custom snapshots", " ended. It took ").concat((performance.now() - start).toFixed(2), " ms"));
568
571
  });
569
572
  if (settings === null || settings === void 0 ? void 0 : settings.cleanupForConfigChange) {
570
573
  return function() {
@@ -573,16 +576,15 @@ var useSnapshotBulk = function(configs, label, settings) {
573
576
  unsubscribe();
574
577
  }
575
578
  });
576
- if (settings === null || settings === void 0 ? void 0 : settings.disableLogs) {
577
- return;
579
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
580
+ console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
578
581
  }
579
- console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
580
582
  };
581
583
  }
582
584
  }, [
583
585
  configs,
584
586
  label,
585
- settings === null || settings === void 0 ? void 0 : settings.cleanupForConfigChange
587
+ settings
586
588
  ]);
587
589
  (0, import_react3.useEffect)(function() {
588
590
  return function() {
@@ -591,10 +593,9 @@ var useSnapshotBulk = function(configs, label, settings) {
591
593
  unsubscribe();
592
594
  }
593
595
  });
594
- if (settings === null || settings === void 0 ? void 0 : settings.disableLogs) {
595
- return;
596
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
597
+ console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
596
598
  }
597
- console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
598
599
  };
599
600
  }, []);
600
601
  };
@@ -279,11 +279,13 @@ var simpleExtractData = function(doc2) {
279
279
  id: doc2.id
280
280
  });
281
281
  };
282
- var snapshot = function(config, snapshotsFirstTime) {
282
+ var snapshot = function(config, snapshotsFirstTime, settings) {
283
283
  var resolvePromise;
284
284
  var isResolved = false;
285
285
  var promise = new Promise(function(resolve) {
286
- console.log("==> ".concat(config.collectionName, " subscribed."));
286
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
287
+ console.log("==> ".concat(config.collectionName, " subscribed."));
288
+ }
287
289
  resolvePromise = function() {
288
290
  if (!isResolved) {
289
291
  isResolved = true;
@@ -463,9 +465,11 @@ var useSnapshotBulk = function(configs, label, settings) {
463
465
  var unsubscribeFunctions = useRef2([]);
464
466
  useDeepCompareEffect(function() {
465
467
  var start = performance.now();
466
- console.log("==> ".concat(label || "Custom snapshots", " started... "));
468
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
469
+ console.log("==> ".concat(label || "Custom snapshots", " started... "));
470
+ }
467
471
  var snapshotResults = configs.map(function(config) {
468
- return snapshot(config, snapshotsFirstTime.current);
472
+ return snapshot(config, snapshotsFirstTime.current, settings);
469
473
  });
470
474
  unsubscribeFunctions.current = snapshotResults.map(function(result) {
471
475
  return result.unsubscribe;
@@ -473,10 +477,9 @@ var useSnapshotBulk = function(configs, label, settings) {
473
477
  Promise.all(snapshotResults.map(function(result) {
474
478
  return result.promise;
475
479
  })).then(function() {
476
- if (settings === null || settings === void 0 ? void 0 : settings.disableLogs) {
477
- return;
480
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
481
+ console.log("==> ".concat(label || "Custom snapshots", " ended. It took ").concat((performance.now() - start).toFixed(2), " ms"));
478
482
  }
479
- console.log("==> ".concat(label || "Custom snapshots", " ended. It took ").concat((performance.now() - start).toFixed(2), " ms"));
480
483
  });
481
484
  if (settings === null || settings === void 0 ? void 0 : settings.cleanupForConfigChange) {
482
485
  return function() {
@@ -485,16 +488,15 @@ var useSnapshotBulk = function(configs, label, settings) {
485
488
  unsubscribe();
486
489
  }
487
490
  });
488
- if (settings === null || settings === void 0 ? void 0 : settings.disableLogs) {
489
- return;
491
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
492
+ console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
490
493
  }
491
- console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
492
494
  };
493
495
  }
494
496
  }, [
495
497
  configs,
496
498
  label,
497
- settings === null || settings === void 0 ? void 0 : settings.cleanupForConfigChange
499
+ settings
498
500
  ]);
499
501
  useEffect2(function() {
500
502
  return function() {
@@ -503,10 +505,9 @@ var useSnapshotBulk = function(configs, label, settings) {
503
505
  unsubscribe();
504
506
  }
505
507
  });
506
- if (settings === null || settings === void 0 ? void 0 : settings.disableLogs) {
507
- return;
508
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
509
+ console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
508
510
  }
509
- console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
510
511
  };
511
512
  }, []);
512
513
  };
@@ -107,7 +107,9 @@ interface SnapshotResult {
107
107
  promise: Promise<void>;
108
108
  unsubscribe: Unsubscribe;
109
109
  }
110
- type Snapshot = (config: OnSnapshotConfig, snapshotsFirstTime: string[]) => SnapshotResult;
110
+ type Snapshot = (config: OnSnapshotConfig, snapshotsFirstTime: string[], settings?: {
111
+ disableLogs?: boolean;
112
+ }) => SnapshotResult;
111
113
  type SnapshotDocument = (config: OnSnapshotConfigDocument, snapshotsFirstTime: string[]) => SnapshotResult;
112
114
 
113
115
  type ValidationType = "text" | "numbers" | "numbersOnly" | "price" | "textNumbers" | "email" | "color" | "address" | "cars" | "charts" | (string & {});
@@ -107,7 +107,9 @@ interface SnapshotResult {
107
107
  promise: Promise<void>;
108
108
  unsubscribe: Unsubscribe;
109
109
  }
110
- type Snapshot = (config: OnSnapshotConfig, snapshotsFirstTime: string[]) => SnapshotResult;
110
+ type Snapshot = (config: OnSnapshotConfig, snapshotsFirstTime: string[], settings?: {
111
+ disableLogs?: boolean;
112
+ }) => SnapshotResult;
111
113
  type SnapshotDocument = (config: OnSnapshotConfigDocument, snapshotsFirstTime: string[]) => SnapshotResult;
112
114
 
113
115
  type ValidationType = "text" | "numbers" | "numbersOnly" | "price" | "textNumbers" | "email" | "color" | "address" | "cars" | "charts" | (string & {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akeyless-client-commons",
3
- "version": "1.0.209",
3
+ "version": "1.0.211",
4
4
  "scripts": {
5
5
  "build": "tsup",
6
6
  "deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",