@mcurros2/microm 1.1.147-0 → 1.1.148

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/dist/index.js CHANGED
@@ -806,7 +806,21 @@ function $da685baa3bcc0ab0$export$f901ae239e30212a(columnName, sourceValue, colu
806
806
  } else valueToSet = sourceValue;
807
807
  // Convert string to Date if necessary
808
808
  if ((0, $lTNXP.isIn)(column.type, "date", "datetime", "datetime2", "smalldatetime") && typeof valueToSet === "string" && !(0, $lTNXP.isIn)(columnName, "dt_lu")) try {
809
- //valueToSet = new Date(valueToSet) as Value;
809
+ let dateValue;
810
+ // FIX to handle dayjs issue parsions string ISO 8601 with trimed zeroes ate the end of the millisconds
811
+ // 2025-07-02T16:58:45.57 57 here means 570 millisecons buy dayJS has a bug and parses it as 57 milliseconds
812
+ try {
813
+ if (valueToSet.indexOf("Z") === -1 && valueToSet.length === 22) {
814
+ dateValue = new Date(valueToSet);
815
+ if (isNaN(dateValue.getTime())) dateValue = null; // Invalid date
816
+ if (dateValue !== null) {
817
+ let new_value = valueToSet;
818
+ new_value = dateValue.toISOString();
819
+ if (new_value.endsWith("Z")) valueToSet = new_value.slice(0, -1);
820
+ }
821
+ }
822
+ } catch (_a) {}
823
+ // dayjs is used here for compatibility with mantine calendar component which formats the date with dayjs
810
824
  valueToSet = (0, ($parcel$interopDefault($b4te3$dayjs)))(valueToSet).toDate();
811
825
  } catch (e) {
812
826
  console.log(`Error converting string to Date: ${e}`, e);
@@ -1487,10 +1501,11 @@ var $a1f6b3ef69eb7cc7$var$__classPrivateFieldGet = undefined && undefined.__clas
1487
1501
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1488
1502
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1489
1503
  };
1490
- var $a1f6b3ef69eb7cc7$var$_MicroMClient_instances, $a1f6b3ef69eb7cc7$var$_MicroMClient_API_URL, $a1f6b3ef69eb7cc7$var$_MicroMClient_TOKEN_STORAGE, $a1f6b3ef69eb7cc7$var$_MicroMClient_APP_ID, $a1f6b3ef69eb7cc7$var$_MicroMClient_LOGIN_TIMEOUT, $a1f6b3ef69eb7cc7$var$_MicroMClient_REQUEST_MODE, $a1f6b3ef69eb7cc7$var$_MicroMClient_TOKEN, $a1f6b3ef69eb7cc7$var$_MicroMClient_tokenRefreshInProgress, $a1f6b3ef69eb7cc7$var$_MicroMClient_publicEndpoints, $a1f6b3ef69eb7cc7$var$_MicroMClient_DATA_STORAGE, $a1f6b3ef69eb7cc7$var$_MicroMClient_ENABLED_MENUS, $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORD_PATHS, $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORDED_PATHS, $a1f6b3ef69eb7cc7$var$_MicroMClient_REDIRECT_ON_401, $a1f6b3ef69eb7cc7$var$_MicroMClient_TIMEZONE_OFFSET, $a1f6b3ef69eb7cc7$var$_MicroMClient_recordAccess, $a1f6b3ef69eb7cc7$var$_MicroMClient_saveAllRecordedAccess, $a1f6b3ef69eb7cc7$var$_MicroMClient_saveTimeZoneOffset, $a1f6b3ef69eb7cc7$var$_MicroMClient_readTimeZoneOffset, $a1f6b3ef69eb7cc7$var$_MicroMClient_getTimeZoneOffset, $a1f6b3ef69eb7cc7$var$_MicroMClient_getAPIEnabledMenus, $a1f6b3ef69eb7cc7$var$_MicroMClient_uploadFile, $a1f6b3ef69eb7cc7$var$_MicroMClient_refreshToken, $a1f6b3ef69eb7cc7$var$_MicroMClient_saveRecordedAccessData, $a1f6b3ef69eb7cc7$var$_MicroMClient_saveEnabledMenus, $a1f6b3ef69eb7cc7$var$_MicroMClient_readEnabledMenus, $a1f6b3ef69eb7cc7$var$_MicroMClient_deleteEnabledMenus, $a1f6b3ef69eb7cc7$var$_MicroMClient_loadToken, $a1f6b3ef69eb7cc7$var$_MicroMClient_setToken, $a1f6b3ef69eb7cc7$var$_MicroMClient_removeToken, $a1f6b3ef69eb7cc7$var$_MicroMClient_checkAndRefreshToken, $a1f6b3ef69eb7cc7$var$_MicroMClient_submitToAPI, $a1f6b3ef69eb7cc7$var$_MicroMClient_submitToPublicAPI, $a1f6b3ef69eb7cc7$var$_MicroMClient_isPublicAPI;
1504
+ var $a1f6b3ef69eb7cc7$var$_MicroMClient_instances, $a1f6b3ef69eb7cc7$var$_MicroMClient_API_URL, $a1f6b3ef69eb7cc7$var$_MicroMClient_TOKEN_STORAGE, $a1f6b3ef69eb7cc7$var$_MicroMClient_APP_ID, $a1f6b3ef69eb7cc7$var$_MicroMClient_LOGIN_TIMEOUT, $a1f6b3ef69eb7cc7$var$_MicroMClient_REQUEST_MODE, $a1f6b3ef69eb7cc7$var$_MicroMClient_TOKEN, $a1f6b3ef69eb7cc7$var$_MicroMClient_LOCAL_DEVICE_ID, $a1f6b3ef69eb7cc7$var$_MicroMClient_tokenRefreshInProgress, $a1f6b3ef69eb7cc7$var$_MicroMClient_publicEndpoints, $a1f6b3ef69eb7cc7$var$_MicroMClient_DATA_STORAGE, $a1f6b3ef69eb7cc7$var$_MicroMClient_ENABLED_MENUS, $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORD_PATHS, $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORDED_PATHS, $a1f6b3ef69eb7cc7$var$_MicroMClient_REDIRECT_ON_401, $a1f6b3ef69eb7cc7$var$_MicroMClient_TIMEZONE_OFFSET, $a1f6b3ef69eb7cc7$var$_MicroMClient_recordAccess, $a1f6b3ef69eb7cc7$var$_MicroMClient_saveAllRecordedAccess, $a1f6b3ef69eb7cc7$var$_MicroMClient_getLocalDeviceId, $a1f6b3ef69eb7cc7$var$_MicroMClient_saveTimeZoneOffset, $a1f6b3ef69eb7cc7$var$_MicroMClient_readTimeZoneOffset, $a1f6b3ef69eb7cc7$var$_MicroMClient_getTimeZoneOffset, $a1f6b3ef69eb7cc7$var$_MicroMClient_getAPIEnabledMenus, $a1f6b3ef69eb7cc7$var$_MicroMClient_uploadFile, $a1f6b3ef69eb7cc7$var$_MicroMClient_refreshToken, $a1f6b3ef69eb7cc7$var$_MicroMClient_saveRecordedAccessData, $a1f6b3ef69eb7cc7$var$_MicroMClient_saveEnabledMenus, $a1f6b3ef69eb7cc7$var$_MicroMClient_readEnabledMenus, $a1f6b3ef69eb7cc7$var$_MicroMClient_deleteEnabledMenus, $a1f6b3ef69eb7cc7$var$_MicroMClient_loadToken, $a1f6b3ef69eb7cc7$var$_MicroMClient_setToken, $a1f6b3ef69eb7cc7$var$_MicroMClient_removeToken, $a1f6b3ef69eb7cc7$var$_MicroMClient_checkAndRefreshToken, $a1f6b3ef69eb7cc7$var$_MicroMClient_submitToAPI, $a1f6b3ef69eb7cc7$var$_MicroMClient_submitToPublicAPI, $a1f6b3ef69eb7cc7$var$_MicroMClient_isPublicAPI;
1491
1505
  const $a1f6b3ef69eb7cc7$var$ENABLED_MENUS_DATA_KEY = "mm_menus";
1492
1506
  const $a1f6b3ef69eb7cc7$var$REMEMBER_USER_DATA_KEY = "mm_remember_me";
1493
1507
  const $a1f6b3ef69eb7cc7$var$TIMEZONE_OFFSET_DATA_KEY = "mm_server_timezone_offset";
1508
+ const $a1f6b3ef69eb7cc7$var$LOCAL_DEVICE_ID_KEY = "mm_ldid";
1494
1509
  class $a1f6b3ef69eb7cc7$export$6118e57c65bf19ee {
1495
1510
  constructor({ api_url: api_url, app_id: app_id, login_timeout: login_timeout, mode: mode, tokenStorage: tokenStorage, publicEndpoints: publicEndpoints, dataStorage: dataStorage, redirect_on_401: redirect_on_401 }){
1496
1511
  $a1f6b3ef69eb7cc7$var$_MicroMClient_instances.add(this);
@@ -1500,6 +1515,7 @@ class $a1f6b3ef69eb7cc7$export$6118e57c65bf19ee {
1500
1515
  $a1f6b3ef69eb7cc7$var$_MicroMClient_LOGIN_TIMEOUT.set(this, void 0);
1501
1516
  $a1f6b3ef69eb7cc7$var$_MicroMClient_REQUEST_MODE.set(this, void 0);
1502
1517
  $a1f6b3ef69eb7cc7$var$_MicroMClient_TOKEN.set(this, null);
1518
+ $a1f6b3ef69eb7cc7$var$_MicroMClient_LOCAL_DEVICE_ID.set(this, null);
1503
1519
  $a1f6b3ef69eb7cc7$var$_MicroMClient_tokenRefreshInProgress.set(this, null);
1504
1520
  $a1f6b3ef69eb7cc7$var$_MicroMClient_publicEndpoints.set(this, {});
1505
1521
  $a1f6b3ef69eb7cc7$var$_MicroMClient_DATA_STORAGE.set(this, void 0);
@@ -1622,6 +1638,7 @@ class $a1f6b3ef69eb7cc7$export$6118e57c65bf19ee {
1622
1638
  const loginTimeout = new (0, $dF8o7.TimeoutSignal)($a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_LOGIN_TIMEOUT, "f"), "Login request timed out");
1623
1639
  try {
1624
1640
  if ($a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORD_PATHS, "f")) $a1f6b3ef69eb7cc7$var$__classPrivateFieldSet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORDED_PATHS, {}, "f");
1641
+ const localDeviceId = yield $a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_instances, "m", $a1f6b3ef69eb7cc7$var$_MicroMClient_getLocalDeviceId).call(this);
1625
1642
  const response = yield fetch(`${$a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_API_URL, "f")}/${$a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_APP_ID, "f")}/login`, {
1626
1643
  method: "POST",
1627
1644
  headers: {
@@ -1634,7 +1651,8 @@ class $a1f6b3ef69eb7cc7$export$6118e57c65bf19ee {
1634
1651
  signal: loginTimeout.signal,
1635
1652
  body: JSON.stringify({
1636
1653
  username: username,
1637
- password: password
1654
+ password: password,
1655
+ LocalDeviceId: localDeviceId
1638
1656
  })
1639
1657
  });
1640
1658
  if (!response.ok) throw {
@@ -1919,7 +1937,7 @@ class $a1f6b3ef69eb7cc7$export$6118e57c65bf19ee {
1919
1937
  return fileGuid ? `${$a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_API_URL, "f")}/${$a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_APP_ID, "f")}/thumbnail/${fileGuid}/${max_size}/${quality}` : "";
1920
1938
  }
1921
1939
  }
1922
- $a1f6b3ef69eb7cc7$var$_MicroMClient_API_URL = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_TOKEN_STORAGE = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_APP_ID = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_LOGIN_TIMEOUT = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_REQUEST_MODE = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_TOKEN = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_tokenRefreshInProgress = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_publicEndpoints = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_DATA_STORAGE = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_ENABLED_MENUS = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORD_PATHS = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORDED_PATHS = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_REDIRECT_ON_401 = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_TIMEZONE_OFFSET = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_instances = new WeakSet(), $a1f6b3ef69eb7cc7$var$_MicroMClient_recordAccess = function _MicroMClient_recordAccess({ entityName: entityName, access: access, views: views, procs: procs, actions: actions, lookups: lookups }) {
1940
+ $a1f6b3ef69eb7cc7$var$_MicroMClient_API_URL = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_TOKEN_STORAGE = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_APP_ID = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_LOGIN_TIMEOUT = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_REQUEST_MODE = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_TOKEN = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_LOCAL_DEVICE_ID = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_tokenRefreshInProgress = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_publicEndpoints = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_DATA_STORAGE = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_ENABLED_MENUS = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORD_PATHS = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORDED_PATHS = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_REDIRECT_ON_401 = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_TIMEZONE_OFFSET = new WeakMap(), $a1f6b3ef69eb7cc7$var$_MicroMClient_instances = new WeakSet(), $a1f6b3ef69eb7cc7$var$_MicroMClient_recordAccess = function _MicroMClient_recordAccess({ entityName: entityName, access: access, views: views, procs: procs, actions: actions, lookups: lookups }) {
1923
1941
  if ($a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORD_PATHS, "f")) {
1924
1942
  const rec = $a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_RECORDED_PATHS, "f")[entityName];
1925
1943
  if (rec) {
@@ -1964,6 +1982,19 @@ $a1f6b3ef69eb7cc7$var$_MicroMClient_API_URL = new WeakMap(), $a1f6b3ef69eb7cc7$v
1964
1982
  console.log(result);
1965
1983
  }
1966
1984
  });
1985
+ }, $a1f6b3ef69eb7cc7$var$_MicroMClient_getLocalDeviceId = function _MicroMClient_getLocalDeviceId() {
1986
+ return $a1f6b3ef69eb7cc7$var$__awaiter(this, void 0, void 0, function*() {
1987
+ const local_device = yield $a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_DATA_STORAGE, "f").readData($a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_APP_ID, "f"), $a1f6b3ef69eb7cc7$var$LOCAL_DEVICE_ID_KEY);
1988
+ if (local_device !== null) {
1989
+ $a1f6b3ef69eb7cc7$var$__classPrivateFieldSet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_LOCAL_DEVICE_ID, local_device, "f");
1990
+ return local_device;
1991
+ }
1992
+ // Generate a new local device ID if it doesn't exist
1993
+ const randomId = "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c)=>(+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16));
1994
+ yield $a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_DATA_STORAGE, "f").saveData($a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_APP_ID, "f"), $a1f6b3ef69eb7cc7$var$LOCAL_DEVICE_ID_KEY, randomId);
1995
+ $a1f6b3ef69eb7cc7$var$__classPrivateFieldSet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_LOCAL_DEVICE_ID, randomId, "f");
1996
+ return randomId;
1997
+ });
1967
1998
  }, $a1f6b3ef69eb7cc7$var$_MicroMClient_saveTimeZoneOffset = function _MicroMClient_saveTimeZoneOffset(data) {
1968
1999
  return $a1f6b3ef69eb7cc7$var$__awaiter(this, void 0, void 0, function*() {
1969
2000
  yield $a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_DATA_STORAGE, "f").saveData($a1f6b3ef69eb7cc7$var$__classPrivateFieldGet(this, $a1f6b3ef69eb7cc7$var$_MicroMClient_APP_ID, "f"), $a1f6b3ef69eb7cc7$var$TIMEZONE_OFFSET_DATA_KEY, data);