@rebasepro/server-postgresql 0.0.1-canary.ca2cb6e → 0.0.1-canary.cbdd980

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 (63) hide show
  1. package/dist/index.es.js +550 -1256
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.umd.js +481 -1187
  4. package/dist/index.umd.js.map +1 -1
  5. package/dist/server-postgresql/src/PostgresBackendDriver.d.ts +8 -1
  6. package/dist/server-postgresql/src/schema/introspect-db-inference.d.ts +5 -0
  7. package/dist/server-postgresql/src/schema/introspect-db-logic.d.ts +117 -0
  8. package/dist/server-postgresql/src/schema/introspect-db.d.ts +1 -0
  9. package/dist/server-postgresql/src/services/EntityPersistService.d.ts +9 -0
  10. package/dist/types/src/controllers/auth.d.ts +8 -2
  11. package/dist/types/src/controllers/client.d.ts +13 -0
  12. package/dist/types/src/controllers/collection_registry.d.ts +2 -1
  13. package/dist/types/src/controllers/data_driver.d.ts +36 -1
  14. package/dist/types/src/controllers/navigation.d.ts +18 -6
  15. package/dist/types/src/controllers/registry.d.ts +9 -1
  16. package/dist/types/src/controllers/side_entity_controller.d.ts +7 -0
  17. package/dist/types/src/rebase_context.d.ts +17 -0
  18. package/dist/types/src/types/backend_hooks.d.ts +187 -0
  19. package/dist/types/src/types/collections.d.ts +31 -11
  20. package/dist/types/src/types/component_ref.d.ts +47 -0
  21. package/dist/types/src/types/cron.d.ts +1 -1
  22. package/dist/types/src/types/entity_views.d.ts +6 -7
  23. package/dist/types/src/types/formex.d.ts +40 -0
  24. package/dist/types/src/types/index.d.ts +3 -0
  25. package/dist/types/src/types/plugins.d.ts +6 -3
  26. package/dist/types/src/types/properties.d.ts +72 -88
  27. package/dist/types/src/types/slots.d.ts +20 -10
  28. package/dist/types/src/types/translations.d.ts +6 -0
  29. package/package.json +6 -5
  30. package/src/PostgresBackendDriver.ts +32 -6
  31. package/src/cli.ts +68 -2
  32. package/src/data-transformer.ts +84 -1
  33. package/src/schema/doctor.ts +14 -2
  34. package/src/schema/generate-drizzle-schema-logic.ts +59 -30
  35. package/src/schema/introspect-db-inference.ts +238 -0
  36. package/src/schema/introspect-db-logic.ts +896 -0
  37. package/src/schema/introspect-db.ts +254 -0
  38. package/src/services/EntityFetchService.ts +16 -0
  39. package/src/services/EntityPersistService.ts +95 -13
  40. package/test/generate-drizzle-schema.test.ts +342 -0
  41. package/test/introspect-db-generation.test.ts +458 -0
  42. package/test/introspect-db-utils.test.ts +392 -0
  43. package/test/property-ordering.test.ts +395 -0
  44. package/test/relations.test.ts +4 -4
  45. package/test/unmapped-tables-safety.test.ts +345 -0
  46. package/jest-all.log +0 -3128
  47. package/jest.log +0 -49
  48. package/scratch.ts +0 -41
  49. package/test-drizzle-bug.ts +0 -18
  50. package/test-drizzle-out/0000_cultured_freak.sql +0 -7
  51. package/test-drizzle-out/0001_tiresome_professor_monster.sql +0 -1
  52. package/test-drizzle-out/meta/0000_snapshot.json +0 -55
  53. package/test-drizzle-out/meta/0001_snapshot.json +0 -63
  54. package/test-drizzle-out/meta/_journal.json +0 -20
  55. package/test-drizzle-prompt.sh +0 -2
  56. package/test-policy-prompt.sh +0 -3
  57. package/test-programmatic.ts +0 -30
  58. package/test-programmatic2.ts +0 -59
  59. package/test-schema-no-policies.ts +0 -12
  60. package/test_drizzle_mock.js +0 -3
  61. package/test_find_changed.mjs +0 -32
  62. package/test_hash.js +0 -14
  63. package/test_output.txt +0 -3145
package/dist/index.umd.js CHANGED
@@ -132,16 +132,14 @@
132
132
  }
133
133
  const DEFAULT_ONE_OF_TYPE = "type";
134
134
  const DEFAULT_ONE_OF_VALUE = "value";
135
- const snakeCaseRegex = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g;
135
+ const tokenizeRegex = /[A-Z]{2,}(?=[A-Z][a-z]|\b)|[A-Z]?[a-z]+|[0-9]+(?:[a-z](?![a-z]))?|[A-Z]/g;
136
+ const snakeCaseRegex = tokenizeRegex;
136
137
  const toSnakeCase = (str) => {
137
138
  const regExpMatchArray = str.match(snakeCaseRegex);
138
139
  if (!regExpMatchArray) return "";
139
140
  return regExpMatchArray.map((x) => x.toLowerCase()).join("_");
140
141
  };
141
142
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
142
- function getDefaultExportFromCjs(x) {
143
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
144
- }
145
143
  function commonjsRequire(path2) {
146
144
  throw new Error('Could not dynamically require "' + path2 + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
147
145
  }
@@ -928,7 +926,23 @@
928
926
  }, { buffer: 3, lYpoI2: 11 }] }, {}, [1])(1);
929
927
  });
930
928
  })(object_hash);
931
- function isObject$6(item) {
929
+ function deepClone(value) {
930
+ if (value === null || value === void 0) return value;
931
+ if (typeof value === "function") return value;
932
+ if (typeof value !== "object") return value;
933
+ if (Array.isArray(value)) {
934
+ return value.map((item) => deepClone(item));
935
+ }
936
+ if (Object.getPrototypeOf(value) !== Object.prototype) {
937
+ return value;
938
+ }
939
+ const result = {};
940
+ for (const key of Object.keys(value)) {
941
+ result[key] = deepClone(value[key]);
942
+ }
943
+ return result;
944
+ }
945
+ function isObject(item) {
932
946
  return !!item && typeof item === "object" && !Array.isArray(item);
933
947
  }
934
948
  function isPlainObject(obj) {
@@ -939,13 +953,13 @@
939
953
  return proto === Object.prototype;
940
954
  }
941
955
  function mergeDeep(target, source, ignoreUndefined = false) {
942
- if (!isObject$6(target)) {
956
+ if (!isObject(target)) {
943
957
  return target;
944
958
  }
945
959
  const output = {
946
960
  ...target
947
961
  };
948
- if (!isObject$6(source)) {
962
+ if (!isObject(source)) {
949
963
  return output;
950
964
  }
951
965
  for (const key in source) {
@@ -986,7 +1000,7 @@
986
1000
  } else {
987
1001
  output[key] = sourceValue;
988
1002
  }
989
- } else if (isObject$6(sourceValue)) {
1003
+ } else if (isObject(sourceValue)) {
990
1004
  output[key] = sourceValue;
991
1005
  } else {
992
1006
  output[key] = sourceValue;
@@ -1029,6 +1043,80 @@
1029
1043
  const singularName = snakeCaseName.endsWith("s") ? snakeCaseName.slice(0, -1) : snakeCaseName;
1030
1044
  return `${singularName}_id`;
1031
1045
  }
1046
+ function updateDateAutoValues({
1047
+ inputValues,
1048
+ properties,
1049
+ status,
1050
+ timestampNowValue
1051
+ }) {
1052
+ return traverseValuesProperties(inputValues, properties, (inputValue, property) => {
1053
+ if (property.type === "date") {
1054
+ if (status === "existing" && property.autoValue === "on_update") {
1055
+ return timestampNowValue;
1056
+ } else if ((status === "new" || status === "copy") && (property.autoValue === "on_update" || property.autoValue === "on_create")) {
1057
+ return timestampNowValue;
1058
+ } else {
1059
+ return inputValue;
1060
+ }
1061
+ } else {
1062
+ return inputValue;
1063
+ }
1064
+ }) ?? {};
1065
+ }
1066
+ function traverseValuesProperties(inputValues, properties, operation) {
1067
+ const safeInputValues = inputValues ?? {};
1068
+ const updatedValues = Object.entries(properties).map(([key, property]) => {
1069
+ const inputValue = safeInputValues && safeInputValues[key];
1070
+ const updatedValue = traverseValueProperty(inputValue, property, operation);
1071
+ if (updatedValue === null) return null;
1072
+ if (updatedValue === void 0) return void 0;
1073
+ return {
1074
+ [key]: updatedValue
1075
+ };
1076
+ }).reduce((a, b) => ({
1077
+ ...a,
1078
+ ...b
1079
+ }), {});
1080
+ const result = mergeDeep(safeInputValues, updatedValues);
1081
+ if (!result || Object.keys(result).length === 0) return void 0;
1082
+ return result;
1083
+ }
1084
+ function traverseValueProperty(inputValue, property, operation) {
1085
+ let value;
1086
+ if (property.type === "map" && property.properties) {
1087
+ value = traverseValuesProperties(inputValue, property.properties, operation);
1088
+ } else if (property.type === "array") {
1089
+ const of = property.of;
1090
+ if (of && Array.isArray(inputValue) && !Array.isArray(of)) {
1091
+ value = inputValue.map((e) => traverseValueProperty(e, of, operation));
1092
+ } else if (of && Array.isArray(inputValue) && Array.isArray(of)) {
1093
+ value = inputValue.map((e, i) => {
1094
+ if (i < of.length) return traverseValueProperty(e, of[i], operation);
1095
+ return null;
1096
+ }).filter(Boolean);
1097
+ } else if (property.oneOf && Array.isArray(inputValue)) {
1098
+ const typeField = property.oneOf?.typeField ?? DEFAULT_ONE_OF_TYPE;
1099
+ const valueField = property.oneOf?.valueField ?? DEFAULT_ONE_OF_VALUE;
1100
+ value = inputValue.map((e) => {
1101
+ if (e === null) return null;
1102
+ if (typeof e !== "object") return e;
1103
+ const rec = e;
1104
+ const type = rec[typeField];
1105
+ const childProperty = property.oneOf?.properties[type];
1106
+ if (!type || !childProperty) return e;
1107
+ return {
1108
+ [typeField]: type,
1109
+ [valueField]: traverseValueProperty(rec[valueField], childProperty, operation)
1110
+ };
1111
+ });
1112
+ } else {
1113
+ value = inputValue;
1114
+ }
1115
+ } else {
1116
+ value = operation(inputValue, property);
1117
+ }
1118
+ return value;
1119
+ }
1032
1120
  function createRelationRef(id, path2) {
1033
1121
  return {
1034
1122
  id,
@@ -1358,7 +1446,7 @@
1358
1446
  }
1359
1447
  var logic = { exports: {} };
1360
1448
  (function(module2, exports$1) {
1361
- (function(root2, factory) {
1449
+ (function(root, factory) {
1362
1450
  {
1363
1451
  module2.exports = factory();
1364
1452
  }
@@ -1725,8 +1813,8 @@
1725
1813
  return jsonLogic;
1726
1814
  });
1727
1815
  })(logic);
1728
- var getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
1729
- var hasOwnProperty$a = Object.prototype.hasOwnProperty;
1816
+ const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
1817
+ const { hasOwnProperty } = Object.prototype;
1730
1818
  function combineComparators(comparatorA, comparatorB) {
1731
1819
  return function isEqual(a, b, state) {
1732
1820
  return comparatorA(a, b, state) && comparatorB(a, b, state);
@@ -1737,38 +1825,45 @@
1737
1825
  if (!a || !b || typeof a !== "object" || typeof b !== "object") {
1738
1826
  return areItemsEqual(a, b, state);
1739
1827
  }
1740
- var cache = state.cache;
1741
- var cachedA = cache.get(a);
1742
- var cachedB = cache.get(b);
1828
+ const { cache } = state;
1829
+ const cachedA = cache.get(a);
1830
+ const cachedB = cache.get(b);
1743
1831
  if (cachedA && cachedB) {
1744
1832
  return cachedA === b && cachedB === a;
1745
1833
  }
1746
1834
  cache.set(a, b);
1747
1835
  cache.set(b, a);
1748
- var result = areItemsEqual(a, b, state);
1836
+ const result = areItemsEqual(a, b, state);
1749
1837
  cache.delete(a);
1750
1838
  cache.delete(b);
1751
1839
  return result;
1752
1840
  };
1753
1841
  }
1754
- function getShortTag(value) {
1755
- return value != null ? value[Symbol.toStringTag] : void 0;
1756
- }
1757
1842
  function getStrictProperties(object) {
1758
1843
  return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1759
1844
  }
1760
- var hasOwn = Object.hasOwn || function(object, property) {
1761
- return hasOwnProperty$a.call(object, property);
1762
- };
1763
- function sameValueZeroEqual(a, b) {
1764
- return a === b || !a && !b && a !== a && b !== b;
1845
+ const hasOwn = (
1846
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1847
+ Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property))
1848
+ );
1849
+ const PREACT_VNODE = "__v";
1850
+ const PREACT_OWNER = "__o";
1851
+ const REACT_OWNER = "_owner";
1852
+ const { getOwnPropertyDescriptor, keys } = Object;
1853
+ const sameValueEqual = (
1854
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1855
+ Object.is || function sameValueEqual2(a, b) {
1856
+ return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
1857
+ }
1858
+ );
1859
+ function strictEqual(a, b) {
1860
+ return a === b;
1861
+ }
1862
+ function areArrayBuffersEqual(a, b) {
1863
+ return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
1765
1864
  }
1766
- var PREACT_VNODE = "__v";
1767
- var PREACT_OWNER = "__o";
1768
- var REACT_OWNER = "_owner";
1769
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, keys$4 = Object.keys;
1770
1865
  function areArraysEqual(a, b, state) {
1771
- var index = a.length;
1866
+ let index = a.length;
1772
1867
  if (b.length !== index) {
1773
1868
  return false;
1774
1869
  }
@@ -1779,35 +1874,35 @@
1779
1874
  }
1780
1875
  return true;
1781
1876
  }
1877
+ function areDataViewsEqual(a, b) {
1878
+ return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
1879
+ }
1782
1880
  function areDatesEqual(a, b) {
1783
- return sameValueZeroEqual(a.getTime(), b.getTime());
1881
+ return sameValueEqual(a.getTime(), b.getTime());
1784
1882
  }
1785
1883
  function areErrorsEqual(a, b) {
1786
1884
  return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
1787
1885
  }
1788
- function areFunctionsEqual(a, b) {
1789
- return a === b;
1790
- }
1791
1886
  function areMapsEqual(a, b, state) {
1792
- var size = a.size;
1887
+ const size = a.size;
1793
1888
  if (size !== b.size) {
1794
1889
  return false;
1795
1890
  }
1796
1891
  if (!size) {
1797
1892
  return true;
1798
1893
  }
1799
- var matchedIndices = new Array(size);
1800
- var aIterable = a.entries();
1801
- var aResult;
1802
- var bResult;
1803
- var index = 0;
1894
+ const matchedIndices = new Array(size);
1895
+ const aIterable = a.entries();
1896
+ let aResult;
1897
+ let bResult;
1898
+ let index = 0;
1804
1899
  while (aResult = aIterable.next()) {
1805
1900
  if (aResult.done) {
1806
1901
  break;
1807
1902
  }
1808
- var bIterable = b.entries();
1809
- var hasMatch = false;
1810
- var matchIndex = 0;
1903
+ const bIterable = b.entries();
1904
+ let hasMatch = false;
1905
+ let matchIndex = 0;
1811
1906
  while (bResult = bIterable.next()) {
1812
1907
  if (bResult.done) {
1813
1908
  break;
@@ -1816,8 +1911,8 @@
1816
1911
  matchIndex++;
1817
1912
  continue;
1818
1913
  }
1819
- var aEntry = aResult.value;
1820
- var bEntry = bResult.value;
1914
+ const aEntry = aResult.value;
1915
+ const bEntry = bResult.value;
1821
1916
  if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
1822
1917
  hasMatch = matchedIndices[matchIndex] = true;
1823
1918
  break;
@@ -1831,11 +1926,10 @@
1831
1926
  }
1832
1927
  return true;
1833
1928
  }
1834
- var areNumbersEqual = sameValueZeroEqual;
1835
1929
  function areObjectsEqual(a, b, state) {
1836
- var properties = keys$4(a);
1837
- var index = properties.length;
1838
- if (keys$4(b).length !== index) {
1930
+ const properties = keys(a);
1931
+ let index = properties.length;
1932
+ if (keys(b).length !== index) {
1839
1933
  return false;
1840
1934
  }
1841
1935
  while (index-- > 0) {
@@ -1846,14 +1940,14 @@
1846
1940
  return true;
1847
1941
  }
1848
1942
  function areObjectsEqualStrict(a, b, state) {
1849
- var properties = getStrictProperties(a);
1850
- var index = properties.length;
1943
+ const properties = getStrictProperties(a);
1944
+ let index = properties.length;
1851
1945
  if (getStrictProperties(b).length !== index) {
1852
1946
  return false;
1853
1947
  }
1854
- var property;
1855
- var descriptorA;
1856
- var descriptorB;
1948
+ let property;
1949
+ let descriptorA;
1950
+ let descriptorB;
1857
1951
  while (index-- > 0) {
1858
1952
  property = properties[index];
1859
1953
  if (!isPropertyEqual(a, b, state, property)) {
@@ -1868,30 +1962,30 @@
1868
1962
  return true;
1869
1963
  }
1870
1964
  function arePrimitiveWrappersEqual(a, b) {
1871
- return sameValueZeroEqual(a.valueOf(), b.valueOf());
1965
+ return sameValueEqual(a.valueOf(), b.valueOf());
1872
1966
  }
1873
1967
  function areRegExpsEqual(a, b) {
1874
1968
  return a.source === b.source && a.flags === b.flags;
1875
1969
  }
1876
1970
  function areSetsEqual(a, b, state) {
1877
- var size = a.size;
1971
+ const size = a.size;
1878
1972
  if (size !== b.size) {
1879
1973
  return false;
1880
1974
  }
1881
1975
  if (!size) {
1882
1976
  return true;
1883
1977
  }
1884
- var matchedIndices = new Array(size);
1885
- var aIterable = a.values();
1886
- var aResult;
1887
- var bResult;
1978
+ const matchedIndices = new Array(size);
1979
+ const aIterable = a.values();
1980
+ let aResult;
1981
+ let bResult;
1888
1982
  while (aResult = aIterable.next()) {
1889
1983
  if (aResult.done) {
1890
1984
  break;
1891
1985
  }
1892
- var bIterable = b.values();
1893
- var hasMatch = false;
1894
- var matchIndex = 0;
1986
+ const bIterable = b.values();
1987
+ let hasMatch = false;
1988
+ let matchIndex = 0;
1895
1989
  while (bResult = bIterable.next()) {
1896
1990
  if (bResult.done) {
1897
1991
  break;
@@ -1909,8 +2003,8 @@
1909
2003
  return true;
1910
2004
  }
1911
2005
  function areTypedArraysEqual(a, b) {
1912
- var index = a.length;
1913
- if (b.length !== index) {
2006
+ let index = a.byteLength;
2007
+ if (b.byteLength !== index || a.byteOffset !== b.byteOffset) {
1914
2008
  return false;
1915
2009
  }
1916
2010
  while (index-- > 0) {
@@ -1929,23 +2023,10 @@
1929
2023
  }
1930
2024
  return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
1931
2025
  }
1932
- var ARGUMENTS_TAG = "[object Arguments]";
1933
- var BOOLEAN_TAG = "[object Boolean]";
1934
- var DATE_TAG = "[object Date]";
1935
- var ERROR_TAG = "[object Error]";
1936
- var MAP_TAG = "[object Map]";
1937
- var NUMBER_TAG = "[object Number]";
1938
- var OBJECT_TAG = "[object Object]";
1939
- var REG_EXP_TAG = "[object RegExp]";
1940
- var SET_TAG = "[object Set]";
1941
- var STRING_TAG = "[object String]";
1942
- var URL_TAG = "[object URL]";
1943
- var isArray$4 = Array.isArray;
1944
- var isTypedArray$2 = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
1945
- var assign = Object.assign;
1946
- var getTag$4 = Object.prototype.toString.call.bind(Object.prototype.toString);
1947
- function createEqualityComparator(_a) {
1948
- var areArraysEqual2 = _a.areArraysEqual, areDatesEqual2 = _a.areDatesEqual, areErrorsEqual2 = _a.areErrorsEqual, areFunctionsEqual2 = _a.areFunctionsEqual, areMapsEqual2 = _a.areMapsEqual, areNumbersEqual2 = _a.areNumbersEqual, areObjectsEqual2 = _a.areObjectsEqual, arePrimitiveWrappersEqual2 = _a.arePrimitiveWrappersEqual, areRegExpsEqual2 = _a.areRegExpsEqual, areSetsEqual2 = _a.areSetsEqual, areTypedArraysEqual2 = _a.areTypedArraysEqual, areUrlsEqual2 = _a.areUrlsEqual, unknownTagComparators = _a.unknownTagComparators;
2026
+ const toString = Object.prototype.toString;
2027
+ function createEqualityComparator(config) {
2028
+ const supportedComparatorMap = createSupportedComparatorMap(config);
2029
+ const { areArraysEqual: areArraysEqual2, areDatesEqual: areDatesEqual2, areFunctionsEqual, areMapsEqual: areMapsEqual2, areNumbersEqual, areObjectsEqual: areObjectsEqual2, areRegExpsEqual: areRegExpsEqual2, areSetsEqual: areSetsEqual2, getUnsupportedCustomComparator } = config;
1949
2030
  return function comparator(a, b, state) {
1950
2031
  if (a === b) {
1951
2032
  return true;
@@ -1953,32 +2034,29 @@
1953
2034
  if (a == null || b == null) {
1954
2035
  return false;
1955
2036
  }
1956
- var type = typeof a;
2037
+ const type = typeof a;
1957
2038
  if (type !== typeof b) {
1958
2039
  return false;
1959
2040
  }
1960
2041
  if (type !== "object") {
1961
- if (type === "number") {
1962
- return areNumbersEqual2(a, b, state);
2042
+ if (type === "number" || type === "bigint") {
2043
+ return areNumbersEqual(a, b, state);
1963
2044
  }
1964
2045
  if (type === "function") {
1965
- return areFunctionsEqual2(a, b, state);
2046
+ return areFunctionsEqual(a, b, state);
1966
2047
  }
1967
2048
  return false;
1968
2049
  }
1969
- var constructor = a.constructor;
2050
+ const constructor = a.constructor;
1970
2051
  if (constructor !== b.constructor) {
1971
2052
  return false;
1972
2053
  }
1973
2054
  if (constructor === Object) {
1974
2055
  return areObjectsEqual2(a, b, state);
1975
2056
  }
1976
- if (isArray$4(a)) {
2057
+ if (constructor === Array) {
1977
2058
  return areArraysEqual2(a, b, state);
1978
2059
  }
1979
- if (isTypedArray$2 != null && isTypedArray$2(a)) {
1980
- return areTypedArraysEqual2(a, b, state);
1981
- }
1982
2060
  if (constructor === Date) {
1983
2061
  return areDatesEqual2(a, b, state);
1984
2062
  }
@@ -1991,79 +2069,55 @@
1991
2069
  if (constructor === Set) {
1992
2070
  return areSetsEqual2(a, b, state);
1993
2071
  }
1994
- var tag = getTag$4(a);
1995
- if (tag === DATE_TAG) {
1996
- return areDatesEqual2(a, b, state);
1997
- }
1998
- if (tag === REG_EXP_TAG) {
1999
- return areRegExpsEqual2(a, b, state);
2000
- }
2001
- if (tag === MAP_TAG) {
2002
- return areMapsEqual2(a, b, state);
2003
- }
2004
- if (tag === SET_TAG) {
2005
- return areSetsEqual2(a, b, state);
2006
- }
2007
- if (tag === OBJECT_TAG) {
2008
- return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
2009
- }
2010
- if (tag === URL_TAG) {
2011
- return areUrlsEqual2(a, b, state);
2012
- }
2013
- if (tag === ERROR_TAG) {
2014
- return areErrorsEqual2(a, b, state);
2072
+ if (constructor === Promise) {
2073
+ return false;
2015
2074
  }
2016
- if (tag === ARGUMENTS_TAG) {
2017
- return areObjectsEqual2(a, b, state);
2075
+ if (Array.isArray(a)) {
2076
+ return areArraysEqual2(a, b, state);
2018
2077
  }
2019
- if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
2020
- return arePrimitiveWrappersEqual2(a, b, state);
2078
+ const tag = toString.call(a);
2079
+ const supportedComparator = supportedComparatorMap[tag];
2080
+ if (supportedComparator) {
2081
+ return supportedComparator(a, b, state);
2021
2082
  }
2022
- if (unknownTagComparators) {
2023
- var unknownTagComparator = unknownTagComparators[tag];
2024
- if (!unknownTagComparator) {
2025
- var shortTag = getShortTag(a);
2026
- if (shortTag) {
2027
- unknownTagComparator = unknownTagComparators[shortTag];
2028
- }
2029
- }
2030
- if (unknownTagComparator) {
2031
- return unknownTagComparator(a, b, state);
2032
- }
2083
+ const unsupportedCustomComparator = getUnsupportedCustomComparator && getUnsupportedCustomComparator(a, b, state, tag);
2084
+ if (unsupportedCustomComparator) {
2085
+ return unsupportedCustomComparator(a, b, state);
2033
2086
  }
2034
2087
  return false;
2035
2088
  };
2036
2089
  }
2037
- function createEqualityComparatorConfig(_a) {
2038
- var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
2039
- var config = {
2090
+ function createEqualityComparatorConfig({ circular, createCustomConfig, strict }) {
2091
+ let config = {
2092
+ areArrayBuffersEqual,
2040
2093
  areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
2094
+ areDataViewsEqual,
2041
2095
  areDatesEqual,
2042
2096
  areErrorsEqual,
2043
- areFunctionsEqual,
2097
+ areFunctionsEqual: strictEqual,
2044
2098
  areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
2045
- areNumbersEqual,
2099
+ areNumbersEqual: sameValueEqual,
2046
2100
  areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
2047
2101
  arePrimitiveWrappersEqual,
2048
2102
  areRegExpsEqual,
2049
2103
  areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
2050
- areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
2104
+ areTypedArraysEqual: strict ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
2051
2105
  areUrlsEqual,
2052
- unknownTagComparators: void 0
2106
+ getUnsupportedCustomComparator: void 0
2053
2107
  };
2054
2108
  if (createCustomConfig) {
2055
- config = assign({}, config, createCustomConfig(config));
2109
+ config = Object.assign({}, config, createCustomConfig(config));
2056
2110
  }
2057
2111
  if (circular) {
2058
- var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
2059
- var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
2060
- var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
2061
- var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
2062
- config = assign({}, config, {
2063
- areArraysEqual: areArraysEqual$1,
2064
- areMapsEqual: areMapsEqual$1,
2065
- areObjectsEqual: areObjectsEqual$1,
2066
- areSetsEqual: areSetsEqual$1
2112
+ const areArraysEqual2 = createIsCircular(config.areArraysEqual);
2113
+ const areMapsEqual2 = createIsCircular(config.areMapsEqual);
2114
+ const areObjectsEqual2 = createIsCircular(config.areObjectsEqual);
2115
+ const areSetsEqual2 = createIsCircular(config.areSetsEqual);
2116
+ config = Object.assign({}, config, {
2117
+ areArraysEqual: areArraysEqual2,
2118
+ areMapsEqual: areMapsEqual2,
2119
+ areObjectsEqual: areObjectsEqual2,
2120
+ areSetsEqual: areSetsEqual2
2067
2121
  });
2068
2122
  }
2069
2123
  return config;
@@ -2073,11 +2127,10 @@
2073
2127
  return compare(a, b, state);
2074
2128
  };
2075
2129
  }
2076
- function createIsEqual(_a) {
2077
- var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
2130
+ function createIsEqual({ circular, comparator, createState, equals, strict }) {
2078
2131
  if (createState) {
2079
2132
  return function isEqual(a, b) {
2080
- var _a2 = createState(), _b = _a2.cache, cache = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
2133
+ const { cache = circular ? /* @__PURE__ */ new WeakMap() : void 0, meta } = createState();
2081
2134
  return comparator(a, b, {
2082
2135
  cache,
2083
2136
  equals,
@@ -2096,7 +2149,7 @@
2096
2149
  });
2097
2150
  };
2098
2151
  }
2099
- var state = {
2152
+ const state = {
2100
2153
  cache: void 0,
2101
2154
  equals,
2102
2155
  meta: void 0,
@@ -2106,7 +2159,50 @@
2106
2159
  return comparator(a, b, state);
2107
2160
  };
2108
2161
  }
2109
- var deepEqual = createCustomEqual();
2162
+ function createSupportedComparatorMap({ areArrayBuffersEqual: areArrayBuffersEqual2, areArraysEqual: areArraysEqual2, areDataViewsEqual: areDataViewsEqual2, areDatesEqual: areDatesEqual2, areErrorsEqual: areErrorsEqual2, areFunctionsEqual, areMapsEqual: areMapsEqual2, areNumbersEqual, areObjectsEqual: areObjectsEqual2, arePrimitiveWrappersEqual: arePrimitiveWrappersEqual2, areRegExpsEqual: areRegExpsEqual2, areSetsEqual: areSetsEqual2, areTypedArraysEqual: areTypedArraysEqual2, areUrlsEqual: areUrlsEqual2 }) {
2163
+ return {
2164
+ "[object Arguments]": areObjectsEqual2,
2165
+ "[object Array]": areArraysEqual2,
2166
+ "[object ArrayBuffer]": areArrayBuffersEqual2,
2167
+ "[object AsyncGeneratorFunction]": areFunctionsEqual,
2168
+ "[object BigInt]": areNumbersEqual,
2169
+ "[object BigInt64Array]": areTypedArraysEqual2,
2170
+ "[object BigUint64Array]": areTypedArraysEqual2,
2171
+ "[object Boolean]": arePrimitiveWrappersEqual2,
2172
+ "[object DataView]": areDataViewsEqual2,
2173
+ "[object Date]": areDatesEqual2,
2174
+ // If an error tag, it should be tested explicitly. Like RegExp, the properties are not
2175
+ // enumerable, and therefore will give false positives if tested like a standard object.
2176
+ "[object Error]": areErrorsEqual2,
2177
+ "[object Float16Array]": areTypedArraysEqual2,
2178
+ "[object Float32Array]": areTypedArraysEqual2,
2179
+ "[object Float64Array]": areTypedArraysEqual2,
2180
+ "[object Function]": areFunctionsEqual,
2181
+ "[object GeneratorFunction]": areFunctionsEqual,
2182
+ "[object Int8Array]": areTypedArraysEqual2,
2183
+ "[object Int16Array]": areTypedArraysEqual2,
2184
+ "[object Int32Array]": areTypedArraysEqual2,
2185
+ "[object Map]": areMapsEqual2,
2186
+ "[object Number]": arePrimitiveWrappersEqual2,
2187
+ "[object Object]": (a, b, state) => (
2188
+ // The exception for value comparison is custom `Promise`-like class instances. These should
2189
+ // be treated the same as standard `Promise` objects, which means strict equality, and if
2190
+ // it reaches this point then that strict equality comparison has already failed.
2191
+ typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state)
2192
+ ),
2193
+ // For RegExp, the properties are not enumerable, and therefore will give false positives if
2194
+ // tested like a standard object.
2195
+ "[object RegExp]": areRegExpsEqual2,
2196
+ "[object Set]": areSetsEqual2,
2197
+ "[object String]": arePrimitiveWrappersEqual2,
2198
+ "[object URL]": areUrlsEqual2,
2199
+ "[object Uint8Array]": areTypedArraysEqual2,
2200
+ "[object Uint8ClampedArray]": areTypedArraysEqual2,
2201
+ "[object Uint16Array]": areTypedArraysEqual2,
2202
+ "[object Uint32Array]": areTypedArraysEqual2
2203
+ };
2204
+ }
2205
+ const deepEqual = createCustomEqual();
2110
2206
  createCustomEqual({ strict: true });
2111
2207
  createCustomEqual({ circular: true });
2112
2208
  createCustomEqual({
@@ -2114,1015 +2210,28 @@
2114
2210
  strict: true
2115
2211
  });
2116
2212
  createCustomEqual({
2117
- createInternalComparator: function() {
2118
- return sameValueZeroEqual;
2119
- }
2213
+ createInternalComparator: () => sameValueEqual
2120
2214
  });
2121
2215
  createCustomEqual({
2122
2216
  strict: true,
2123
- createInternalComparator: function() {
2124
- return sameValueZeroEqual;
2125
- }
2217
+ createInternalComparator: () => sameValueEqual
2126
2218
  });
2127
2219
  createCustomEqual({
2128
2220
  circular: true,
2129
- createInternalComparator: function() {
2130
- return sameValueZeroEqual;
2131
- }
2221
+ createInternalComparator: () => sameValueEqual
2132
2222
  });
2133
2223
  createCustomEqual({
2134
2224
  circular: true,
2135
- createInternalComparator: function() {
2136
- return sameValueZeroEqual;
2137
- },
2225
+ createInternalComparator: () => sameValueEqual,
2138
2226
  strict: true
2139
2227
  });
2140
- function createCustomEqual(options) {
2141
- if (options === void 0) {
2142
- options = {};
2143
- }
2144
- var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b;
2145
- var config = createEqualityComparatorConfig(options);
2146
- var comparator = createEqualityComparator(config);
2147
- var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
2228
+ function createCustomEqual(options = {}) {
2229
+ const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false } = options;
2230
+ const config = createEqualityComparatorConfig(options);
2231
+ const comparator = createEqualityComparator(config);
2232
+ const equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
2148
2233
  return createIsEqual({ circular, comparator, createState, equals, strict });
2149
2234
  }
2150
- function listCacheClear$1() {
2151
- this.__data__ = [];
2152
- this.size = 0;
2153
- }
2154
- var _listCacheClear = listCacheClear$1;
2155
- function eq$2(value, other) {
2156
- return value === other || value !== value && other !== other;
2157
- }
2158
- var eq_1 = eq$2;
2159
- var eq$1 = eq_1;
2160
- function assocIndexOf$4(array, key) {
2161
- var length = array.length;
2162
- while (length--) {
2163
- if (eq$1(array[length][0], key)) {
2164
- return length;
2165
- }
2166
- }
2167
- return -1;
2168
- }
2169
- var _assocIndexOf = assocIndexOf$4;
2170
- var assocIndexOf$3 = _assocIndexOf;
2171
- var arrayProto = Array.prototype;
2172
- var splice = arrayProto.splice;
2173
- function listCacheDelete$1(key) {
2174
- var data = this.__data__, index = assocIndexOf$3(data, key);
2175
- if (index < 0) {
2176
- return false;
2177
- }
2178
- var lastIndex = data.length - 1;
2179
- if (index == lastIndex) {
2180
- data.pop();
2181
- } else {
2182
- splice.call(data, index, 1);
2183
- }
2184
- --this.size;
2185
- return true;
2186
- }
2187
- var _listCacheDelete = listCacheDelete$1;
2188
- var assocIndexOf$2 = _assocIndexOf;
2189
- function listCacheGet$1(key) {
2190
- var data = this.__data__, index = assocIndexOf$2(data, key);
2191
- return index < 0 ? void 0 : data[index][1];
2192
- }
2193
- var _listCacheGet = listCacheGet$1;
2194
- var assocIndexOf$1 = _assocIndexOf;
2195
- function listCacheHas$1(key) {
2196
- return assocIndexOf$1(this.__data__, key) > -1;
2197
- }
2198
- var _listCacheHas = listCacheHas$1;
2199
- var assocIndexOf = _assocIndexOf;
2200
- function listCacheSet$1(key, value) {
2201
- var data = this.__data__, index = assocIndexOf(data, key);
2202
- if (index < 0) {
2203
- ++this.size;
2204
- data.push([key, value]);
2205
- } else {
2206
- data[index][1] = value;
2207
- }
2208
- return this;
2209
- }
2210
- var _listCacheSet = listCacheSet$1;
2211
- var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
2212
- function ListCache$4(entries) {
2213
- var index = -1, length = entries == null ? 0 : entries.length;
2214
- this.clear();
2215
- while (++index < length) {
2216
- var entry = entries[index];
2217
- this.set(entry[0], entry[1]);
2218
- }
2219
- }
2220
- ListCache$4.prototype.clear = listCacheClear;
2221
- ListCache$4.prototype["delete"] = listCacheDelete;
2222
- ListCache$4.prototype.get = listCacheGet;
2223
- ListCache$4.prototype.has = listCacheHas;
2224
- ListCache$4.prototype.set = listCacheSet;
2225
- var _ListCache = ListCache$4;
2226
- var ListCache$3 = _ListCache;
2227
- function stackClear$1() {
2228
- this.__data__ = new ListCache$3();
2229
- this.size = 0;
2230
- }
2231
- var _stackClear = stackClear$1;
2232
- function stackDelete$1(key) {
2233
- var data = this.__data__, result = data["delete"](key);
2234
- this.size = data.size;
2235
- return result;
2236
- }
2237
- var _stackDelete = stackDelete$1;
2238
- function stackGet$1(key) {
2239
- return this.__data__.get(key);
2240
- }
2241
- var _stackGet = stackGet$1;
2242
- function stackHas$1(key) {
2243
- return this.__data__.has(key);
2244
- }
2245
- var _stackHas = stackHas$1;
2246
- var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
2247
- var _freeGlobal = freeGlobal$1;
2248
- var freeGlobal = _freeGlobal;
2249
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
2250
- var root$8 = freeGlobal || freeSelf || Function("return this")();
2251
- var _root = root$8;
2252
- var root$7 = _root;
2253
- var Symbol$4 = root$7.Symbol;
2254
- var _Symbol = Symbol$4;
2255
- var Symbol$3 = _Symbol;
2256
- var objectProto$c = Object.prototype;
2257
- var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
2258
- var nativeObjectToString$1 = objectProto$c.toString;
2259
- var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : void 0;
2260
- function getRawTag$1(value) {
2261
- var isOwn = hasOwnProperty$9.call(value, symToStringTag$1), tag = value[symToStringTag$1];
2262
- try {
2263
- value[symToStringTag$1] = void 0;
2264
- var unmasked = true;
2265
- } catch (e) {
2266
- }
2267
- var result = nativeObjectToString$1.call(value);
2268
- if (unmasked) {
2269
- if (isOwn) {
2270
- value[symToStringTag$1] = tag;
2271
- } else {
2272
- delete value[symToStringTag$1];
2273
- }
2274
- }
2275
- return result;
2276
- }
2277
- var _getRawTag = getRawTag$1;
2278
- var objectProto$b = Object.prototype;
2279
- var nativeObjectToString = objectProto$b.toString;
2280
- function objectToString$1(value) {
2281
- return nativeObjectToString.call(value);
2282
- }
2283
- var _objectToString = objectToString$1;
2284
- var Symbol$2 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
2285
- var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
2286
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
2287
- function baseGetTag$4(value) {
2288
- if (value == null) {
2289
- return value === void 0 ? undefinedTag : nullTag;
2290
- }
2291
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
2292
- }
2293
- var _baseGetTag = baseGetTag$4;
2294
- function isObject$5(value) {
2295
- var type = typeof value;
2296
- return value != null && (type == "object" || type == "function");
2297
- }
2298
- var isObject_1 = isObject$5;
2299
- var baseGetTag$3 = _baseGetTag, isObject$4 = isObject_1;
2300
- var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
2301
- function isFunction$2(value) {
2302
- if (!isObject$4(value)) {
2303
- return false;
2304
- }
2305
- var tag = baseGetTag$3(value);
2306
- return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
2307
- }
2308
- var isFunction_1 = isFunction$2;
2309
- var root$6 = _root;
2310
- var coreJsData$1 = root$6["__core-js_shared__"];
2311
- var _coreJsData = coreJsData$1;
2312
- var coreJsData = _coreJsData;
2313
- var maskSrcKey = function() {
2314
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
2315
- return uid ? "Symbol(src)_1." + uid : "";
2316
- }();
2317
- function isMasked$1(func) {
2318
- return !!maskSrcKey && maskSrcKey in func;
2319
- }
2320
- var _isMasked = isMasked$1;
2321
- var funcProto$1 = Function.prototype;
2322
- var funcToString$1 = funcProto$1.toString;
2323
- function toSource$2(func) {
2324
- if (func != null) {
2325
- try {
2326
- return funcToString$1.call(func);
2327
- } catch (e) {
2328
- }
2329
- try {
2330
- return func + "";
2331
- } catch (e) {
2332
- }
2333
- }
2334
- return "";
2335
- }
2336
- var _toSource = toSource$2;
2337
- var isFunction$1 = isFunction_1, isMasked = _isMasked, isObject$3 = isObject_1, toSource$1 = _toSource;
2338
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
2339
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
2340
- var funcProto = Function.prototype, objectProto$a = Object.prototype;
2341
- var funcToString = funcProto.toString;
2342
- var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
2343
- var reIsNative = RegExp(
2344
- "^" + funcToString.call(hasOwnProperty$8).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
2345
- );
2346
- function baseIsNative$1(value) {
2347
- if (!isObject$3(value) || isMasked(value)) {
2348
- return false;
2349
- }
2350
- var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
2351
- return pattern.test(toSource$1(value));
2352
- }
2353
- var _baseIsNative = baseIsNative$1;
2354
- function getValue$1(object, key) {
2355
- return object == null ? void 0 : object[key];
2356
- }
2357
- var _getValue = getValue$1;
2358
- var baseIsNative = _baseIsNative, getValue = _getValue;
2359
- function getNative$7(object, key) {
2360
- var value = getValue(object, key);
2361
- return baseIsNative(value) ? value : void 0;
2362
- }
2363
- var _getNative = getNative$7;
2364
- var getNative$6 = _getNative, root$5 = _root;
2365
- var Map$4 = getNative$6(root$5, "Map");
2366
- var _Map = Map$4;
2367
- var getNative$5 = _getNative;
2368
- var nativeCreate$4 = getNative$5(Object, "create");
2369
- var _nativeCreate = nativeCreate$4;
2370
- var nativeCreate$3 = _nativeCreate;
2371
- function hashClear$1() {
2372
- this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
2373
- this.size = 0;
2374
- }
2375
- var _hashClear = hashClear$1;
2376
- function hashDelete$1(key) {
2377
- var result = this.has(key) && delete this.__data__[key];
2378
- this.size -= result ? 1 : 0;
2379
- return result;
2380
- }
2381
- var _hashDelete = hashDelete$1;
2382
- var nativeCreate$2 = _nativeCreate;
2383
- var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
2384
- var objectProto$9 = Object.prototype;
2385
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
2386
- function hashGet$1(key) {
2387
- var data = this.__data__;
2388
- if (nativeCreate$2) {
2389
- var result = data[key];
2390
- return result === HASH_UNDEFINED$1 ? void 0 : result;
2391
- }
2392
- return hasOwnProperty$7.call(data, key) ? data[key] : void 0;
2393
- }
2394
- var _hashGet = hashGet$1;
2395
- var nativeCreate$1 = _nativeCreate;
2396
- var objectProto$8 = Object.prototype;
2397
- var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
2398
- function hashHas$1(key) {
2399
- var data = this.__data__;
2400
- return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$6.call(data, key);
2401
- }
2402
- var _hashHas = hashHas$1;
2403
- var nativeCreate = _nativeCreate;
2404
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
2405
- function hashSet$1(key, value) {
2406
- var data = this.__data__;
2407
- this.size += this.has(key) ? 0 : 1;
2408
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
2409
- return this;
2410
- }
2411
- var _hashSet = hashSet$1;
2412
- var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
2413
- function Hash$1(entries) {
2414
- var index = -1, length = entries == null ? 0 : entries.length;
2415
- this.clear();
2416
- while (++index < length) {
2417
- var entry = entries[index];
2418
- this.set(entry[0], entry[1]);
2419
- }
2420
- }
2421
- Hash$1.prototype.clear = hashClear;
2422
- Hash$1.prototype["delete"] = hashDelete;
2423
- Hash$1.prototype.get = hashGet;
2424
- Hash$1.prototype.has = hashHas;
2425
- Hash$1.prototype.set = hashSet;
2426
- var _Hash = Hash$1;
2427
- var Hash = _Hash, ListCache$2 = _ListCache, Map$3 = _Map;
2428
- function mapCacheClear$1() {
2429
- this.size = 0;
2430
- this.__data__ = {
2431
- "hash": new Hash(),
2432
- "map": new (Map$3 || ListCache$2)(),
2433
- "string": new Hash()
2434
- };
2435
- }
2436
- var _mapCacheClear = mapCacheClear$1;
2437
- function isKeyable$1(value) {
2438
- var type = typeof value;
2439
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
2440
- }
2441
- var _isKeyable = isKeyable$1;
2442
- var isKeyable = _isKeyable;
2443
- function getMapData$4(map, key) {
2444
- var data = map.__data__;
2445
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
2446
- }
2447
- var _getMapData = getMapData$4;
2448
- var getMapData$3 = _getMapData;
2449
- function mapCacheDelete$1(key) {
2450
- var result = getMapData$3(this, key)["delete"](key);
2451
- this.size -= result ? 1 : 0;
2452
- return result;
2453
- }
2454
- var _mapCacheDelete = mapCacheDelete$1;
2455
- var getMapData$2 = _getMapData;
2456
- function mapCacheGet$1(key) {
2457
- return getMapData$2(this, key).get(key);
2458
- }
2459
- var _mapCacheGet = mapCacheGet$1;
2460
- var getMapData$1 = _getMapData;
2461
- function mapCacheHas$1(key) {
2462
- return getMapData$1(this, key).has(key);
2463
- }
2464
- var _mapCacheHas = mapCacheHas$1;
2465
- var getMapData = _getMapData;
2466
- function mapCacheSet$1(key, value) {
2467
- var data = getMapData(this, key), size = data.size;
2468
- data.set(key, value);
2469
- this.size += data.size == size ? 0 : 1;
2470
- return this;
2471
- }
2472
- var _mapCacheSet = mapCacheSet$1;
2473
- var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
2474
- function MapCache$1(entries) {
2475
- var index = -1, length = entries == null ? 0 : entries.length;
2476
- this.clear();
2477
- while (++index < length) {
2478
- var entry = entries[index];
2479
- this.set(entry[0], entry[1]);
2480
- }
2481
- }
2482
- MapCache$1.prototype.clear = mapCacheClear;
2483
- MapCache$1.prototype["delete"] = mapCacheDelete;
2484
- MapCache$1.prototype.get = mapCacheGet;
2485
- MapCache$1.prototype.has = mapCacheHas;
2486
- MapCache$1.prototype.set = mapCacheSet;
2487
- var _MapCache = MapCache$1;
2488
- var ListCache$1 = _ListCache, Map$2 = _Map, MapCache = _MapCache;
2489
- var LARGE_ARRAY_SIZE = 200;
2490
- function stackSet$1(key, value) {
2491
- var data = this.__data__;
2492
- if (data instanceof ListCache$1) {
2493
- var pairs = data.__data__;
2494
- if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
2495
- pairs.push([key, value]);
2496
- this.size = ++data.size;
2497
- return this;
2498
- }
2499
- data = this.__data__ = new MapCache(pairs);
2500
- }
2501
- data.set(key, value);
2502
- this.size = data.size;
2503
- return this;
2504
- }
2505
- var _stackSet = stackSet$1;
2506
- var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet;
2507
- function Stack$1(entries) {
2508
- var data = this.__data__ = new ListCache(entries);
2509
- this.size = data.size;
2510
- }
2511
- Stack$1.prototype.clear = stackClear;
2512
- Stack$1.prototype["delete"] = stackDelete;
2513
- Stack$1.prototype.get = stackGet;
2514
- Stack$1.prototype.has = stackHas;
2515
- Stack$1.prototype.set = stackSet;
2516
- var _Stack = Stack$1;
2517
- function arrayEach$1(array, iteratee) {
2518
- var index = -1, length = array == null ? 0 : array.length;
2519
- while (++index < length) {
2520
- if (iteratee(array[index], index, array) === false) {
2521
- break;
2522
- }
2523
- }
2524
- return array;
2525
- }
2526
- var _arrayEach = arrayEach$1;
2527
- var getNative$4 = _getNative;
2528
- var defineProperty$1 = function() {
2529
- try {
2530
- var func = getNative$4(Object, "defineProperty");
2531
- func({}, "", {});
2532
- return func;
2533
- } catch (e) {
2534
- }
2535
- }();
2536
- var _defineProperty = defineProperty$1;
2537
- var defineProperty = _defineProperty;
2538
- function baseAssignValue$2(object, key, value) {
2539
- if (key == "__proto__" && defineProperty) {
2540
- defineProperty(object, key, {
2541
- "configurable": true,
2542
- "enumerable": true,
2543
- "value": value,
2544
- "writable": true
2545
- });
2546
- } else {
2547
- object[key] = value;
2548
- }
2549
- }
2550
- var _baseAssignValue = baseAssignValue$2;
2551
- var baseAssignValue$1 = _baseAssignValue, eq = eq_1;
2552
- var objectProto$7 = Object.prototype;
2553
- var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
2554
- function assignValue$2(object, key, value) {
2555
- var objValue = object[key];
2556
- if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
2557
- baseAssignValue$1(object, key, value);
2558
- }
2559
- }
2560
- var _assignValue = assignValue$2;
2561
- var assignValue$1 = _assignValue, baseAssignValue = _baseAssignValue;
2562
- function copyObject$4(source, props, object, customizer) {
2563
- var isNew = !object;
2564
- object || (object = {});
2565
- var index = -1, length = props.length;
2566
- while (++index < length) {
2567
- var key = props[index];
2568
- var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
2569
- if (newValue === void 0) {
2570
- newValue = source[key];
2571
- }
2572
- if (isNew) {
2573
- baseAssignValue(object, key, newValue);
2574
- } else {
2575
- assignValue$1(object, key, newValue);
2576
- }
2577
- }
2578
- return object;
2579
- }
2580
- var _copyObject = copyObject$4;
2581
- function baseTimes$1(n, iteratee) {
2582
- var index = -1, result = Array(n);
2583
- while (++index < n) {
2584
- result[index] = iteratee(index);
2585
- }
2586
- return result;
2587
- }
2588
- var _baseTimes = baseTimes$1;
2589
- function isObjectLike$5(value) {
2590
- return value != null && typeof value == "object";
2591
- }
2592
- var isObjectLike_1 = isObjectLike$5;
2593
- var baseGetTag$2 = _baseGetTag, isObjectLike$4 = isObjectLike_1;
2594
- var argsTag$2 = "[object Arguments]";
2595
- function baseIsArguments$1(value) {
2596
- return isObjectLike$4(value) && baseGetTag$2(value) == argsTag$2;
2597
- }
2598
- var _baseIsArguments = baseIsArguments$1;
2599
- var baseIsArguments = _baseIsArguments, isObjectLike$3 = isObjectLike_1;
2600
- var objectProto$6 = Object.prototype;
2601
- var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
2602
- var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
2603
- var isArguments$1 = baseIsArguments(/* @__PURE__ */ function() {
2604
- return arguments;
2605
- }()) ? baseIsArguments : function(value) {
2606
- return isObjectLike$3(value) && hasOwnProperty$4.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
2607
- };
2608
- var isArguments_1 = isArguments$1;
2609
- var isArray$3 = Array.isArray;
2610
- var isArray_1 = isArray$3;
2611
- var isBuffer$2 = { exports: {} };
2612
- function stubFalse() {
2613
- return false;
2614
- }
2615
- var stubFalse_1 = stubFalse;
2616
- isBuffer$2.exports;
2617
- (function(module2, exports$1) {
2618
- var root2 = _root, stubFalse2 = stubFalse_1;
2619
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
2620
- var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
2621
- var moduleExports = freeModule && freeModule.exports === freeExports;
2622
- var Buffer = moduleExports ? root2.Buffer : void 0;
2623
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
2624
- var isBuffer2 = nativeIsBuffer || stubFalse2;
2625
- module2.exports = isBuffer2;
2626
- })(isBuffer$2, isBuffer$2.exports);
2627
- var isBufferExports = isBuffer$2.exports;
2628
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
2629
- var reIsUint = /^(?:0|[1-9]\d*)$/;
2630
- function isIndex$1(value, length) {
2631
- var type = typeof value;
2632
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
2633
- return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
2634
- }
2635
- var _isIndex = isIndex$1;
2636
- var MAX_SAFE_INTEGER = 9007199254740991;
2637
- function isLength$2(value) {
2638
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2639
- }
2640
- var isLength_1 = isLength$2;
2641
- var baseGetTag$1 = _baseGetTag, isLength$1 = isLength_1, isObjectLike$2 = isObjectLike_1;
2642
- var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", errorTag$1 = "[object Error]", funcTag$1 = "[object Function]", mapTag$4 = "[object Map]", numberTag$2 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$2 = "[object RegExp]", setTag$4 = "[object Set]", stringTag$2 = "[object String]", weakMapTag$2 = "[object WeakMap]";
2643
- var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$3 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
2644
- var typedArrayTags = {};
2645
- typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
2646
- typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] = typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$2] = typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] = typedArrayTags[weakMapTag$2] = false;
2647
- function baseIsTypedArray$1(value) {
2648
- return isObjectLike$2(value) && isLength$1(value.length) && !!typedArrayTags[baseGetTag$1(value)];
2649
- }
2650
- var _baseIsTypedArray = baseIsTypedArray$1;
2651
- function baseUnary$3(func) {
2652
- return function(value) {
2653
- return func(value);
2654
- };
2655
- }
2656
- var _baseUnary = baseUnary$3;
2657
- var _nodeUtil = { exports: {} };
2658
- _nodeUtil.exports;
2659
- (function(module2, exports$1) {
2660
- var freeGlobal2 = _freeGlobal;
2661
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
2662
- var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
2663
- var moduleExports = freeModule && freeModule.exports === freeExports;
2664
- var freeProcess = moduleExports && freeGlobal2.process;
2665
- var nodeUtil2 = function() {
2666
- try {
2667
- var types = freeModule && freeModule.require && freeModule.require("util").types;
2668
- if (types) {
2669
- return types;
2670
- }
2671
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
2672
- } catch (e) {
2673
- }
2674
- }();
2675
- module2.exports = nodeUtil2;
2676
- })(_nodeUtil, _nodeUtil.exports);
2677
- var _nodeUtilExports = _nodeUtil.exports;
2678
- var baseIsTypedArray = _baseIsTypedArray, baseUnary$2 = _baseUnary, nodeUtil$2 = _nodeUtilExports;
2679
- var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray;
2680
- var isTypedArray$1 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray;
2681
- var isTypedArray_1 = isTypedArray$1;
2682
- var baseTimes = _baseTimes, isArguments = isArguments_1, isArray$2 = isArray_1, isBuffer$1 = isBufferExports, isIndex = _isIndex, isTypedArray = isTypedArray_1;
2683
- var objectProto$5 = Object.prototype;
2684
- var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
2685
- function arrayLikeKeys$2(value, inherited) {
2686
- var isArr = isArray$2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
2687
- for (var key in value) {
2688
- if ((inherited || hasOwnProperty$3.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
2689
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
2690
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
2691
- isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
2692
- isIndex(key, length)))) {
2693
- result.push(key);
2694
- }
2695
- }
2696
- return result;
2697
- }
2698
- var _arrayLikeKeys = arrayLikeKeys$2;
2699
- var objectProto$4 = Object.prototype;
2700
- function isPrototype$3(value) {
2701
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$4;
2702
- return value === proto;
2703
- }
2704
- var _isPrototype = isPrototype$3;
2705
- function overArg$2(func, transform) {
2706
- return function(arg) {
2707
- return func(transform(arg));
2708
- };
2709
- }
2710
- var _overArg = overArg$2;
2711
- var overArg$1 = _overArg;
2712
- var nativeKeys$1 = overArg$1(Object.keys, Object);
2713
- var _nativeKeys = nativeKeys$1;
2714
- var isPrototype$2 = _isPrototype, nativeKeys = _nativeKeys;
2715
- var objectProto$3 = Object.prototype;
2716
- var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
2717
- function baseKeys$1(object) {
2718
- if (!isPrototype$2(object)) {
2719
- return nativeKeys(object);
2720
- }
2721
- var result = [];
2722
- for (var key in Object(object)) {
2723
- if (hasOwnProperty$2.call(object, key) && key != "constructor") {
2724
- result.push(key);
2725
- }
2726
- }
2727
- return result;
2728
- }
2729
- var _baseKeys = baseKeys$1;
2730
- var isFunction = isFunction_1, isLength = isLength_1;
2731
- function isArrayLike$2(value) {
2732
- return value != null && isLength(value.length) && !isFunction(value);
2733
- }
2734
- var isArrayLike_1 = isArrayLike$2;
2735
- var arrayLikeKeys$1 = _arrayLikeKeys, baseKeys = _baseKeys, isArrayLike$1 = isArrayLike_1;
2736
- function keys$3(object) {
2737
- return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys(object);
2738
- }
2739
- var keys_1 = keys$3;
2740
- var copyObject$3 = _copyObject, keys$2 = keys_1;
2741
- function baseAssign$1(object, source) {
2742
- return object && copyObject$3(source, keys$2(source), object);
2743
- }
2744
- var _baseAssign = baseAssign$1;
2745
- function nativeKeysIn$1(object) {
2746
- var result = [];
2747
- if (object != null) {
2748
- for (var key in Object(object)) {
2749
- result.push(key);
2750
- }
2751
- }
2752
- return result;
2753
- }
2754
- var _nativeKeysIn = nativeKeysIn$1;
2755
- var isObject$2 = isObject_1, isPrototype$1 = _isPrototype, nativeKeysIn = _nativeKeysIn;
2756
- var objectProto$2 = Object.prototype;
2757
- var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
2758
- function baseKeysIn$1(object) {
2759
- if (!isObject$2(object)) {
2760
- return nativeKeysIn(object);
2761
- }
2762
- var isProto = isPrototype$1(object), result = [];
2763
- for (var key in object) {
2764
- if (!(key == "constructor" && (isProto || !hasOwnProperty$1.call(object, key)))) {
2765
- result.push(key);
2766
- }
2767
- }
2768
- return result;
2769
- }
2770
- var _baseKeysIn = baseKeysIn$1;
2771
- var arrayLikeKeys = _arrayLikeKeys, baseKeysIn = _baseKeysIn, isArrayLike = isArrayLike_1;
2772
- function keysIn$3(object) {
2773
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
2774
- }
2775
- var keysIn_1 = keysIn$3;
2776
- var copyObject$2 = _copyObject, keysIn$2 = keysIn_1;
2777
- function baseAssignIn$1(object, source) {
2778
- return object && copyObject$2(source, keysIn$2(source), object);
2779
- }
2780
- var _baseAssignIn = baseAssignIn$1;
2781
- var _cloneBuffer = { exports: {} };
2782
- _cloneBuffer.exports;
2783
- (function(module2, exports$1) {
2784
- var root2 = _root;
2785
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
2786
- var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
2787
- var moduleExports = freeModule && freeModule.exports === freeExports;
2788
- var Buffer = moduleExports ? root2.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
2789
- function cloneBuffer2(buffer, isDeep) {
2790
- if (isDeep) {
2791
- return buffer.slice();
2792
- }
2793
- var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
2794
- buffer.copy(result);
2795
- return result;
2796
- }
2797
- module2.exports = cloneBuffer2;
2798
- })(_cloneBuffer, _cloneBuffer.exports);
2799
- var _cloneBufferExports = _cloneBuffer.exports;
2800
- function copyArray$1(source, array) {
2801
- var index = -1, length = source.length;
2802
- array || (array = Array(length));
2803
- while (++index < length) {
2804
- array[index] = source[index];
2805
- }
2806
- return array;
2807
- }
2808
- var _copyArray = copyArray$1;
2809
- function arrayFilter$1(array, predicate) {
2810
- var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
2811
- while (++index < length) {
2812
- var value = array[index];
2813
- if (predicate(value, index, array)) {
2814
- result[resIndex++] = value;
2815
- }
2816
- }
2817
- return result;
2818
- }
2819
- var _arrayFilter = arrayFilter$1;
2820
- function stubArray$2() {
2821
- return [];
2822
- }
2823
- var stubArray_1 = stubArray$2;
2824
- var arrayFilter = _arrayFilter, stubArray$1 = stubArray_1;
2825
- var objectProto$1 = Object.prototype;
2826
- var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
2827
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
2828
- var getSymbols$3 = !nativeGetSymbols$1 ? stubArray$1 : function(object) {
2829
- if (object == null) {
2830
- return [];
2831
- }
2832
- object = Object(object);
2833
- return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
2834
- return propertyIsEnumerable.call(object, symbol);
2835
- });
2836
- };
2837
- var _getSymbols = getSymbols$3;
2838
- var copyObject$1 = _copyObject, getSymbols$2 = _getSymbols;
2839
- function copySymbols$1(source, object) {
2840
- return copyObject$1(source, getSymbols$2(source), object);
2841
- }
2842
- var _copySymbols = copySymbols$1;
2843
- function arrayPush$2(array, values) {
2844
- var index = -1, length = values.length, offset = array.length;
2845
- while (++index < length) {
2846
- array[offset + index] = values[index];
2847
- }
2848
- return array;
2849
- }
2850
- var _arrayPush = arrayPush$2;
2851
- var overArg = _overArg;
2852
- var getPrototype$2 = overArg(Object.getPrototypeOf, Object);
2853
- var _getPrototype = getPrototype$2;
2854
- var arrayPush$1 = _arrayPush, getPrototype$1 = _getPrototype, getSymbols$1 = _getSymbols, stubArray = stubArray_1;
2855
- var nativeGetSymbols = Object.getOwnPropertySymbols;
2856
- var getSymbolsIn$2 = !nativeGetSymbols ? stubArray : function(object) {
2857
- var result = [];
2858
- while (object) {
2859
- arrayPush$1(result, getSymbols$1(object));
2860
- object = getPrototype$1(object);
2861
- }
2862
- return result;
2863
- };
2864
- var _getSymbolsIn = getSymbolsIn$2;
2865
- var copyObject = _copyObject, getSymbolsIn$1 = _getSymbolsIn;
2866
- function copySymbolsIn$1(source, object) {
2867
- return copyObject(source, getSymbolsIn$1(source), object);
2868
- }
2869
- var _copySymbolsIn = copySymbolsIn$1;
2870
- var arrayPush = _arrayPush, isArray$1 = isArray_1;
2871
- function baseGetAllKeys$2(object, keysFunc, symbolsFunc) {
2872
- var result = keysFunc(object);
2873
- return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
2874
- }
2875
- var _baseGetAllKeys = baseGetAllKeys$2;
2876
- var baseGetAllKeys$1 = _baseGetAllKeys, getSymbols = _getSymbols, keys$1 = keys_1;
2877
- function getAllKeys$1(object) {
2878
- return baseGetAllKeys$1(object, keys$1, getSymbols);
2879
- }
2880
- var _getAllKeys = getAllKeys$1;
2881
- var baseGetAllKeys = _baseGetAllKeys, getSymbolsIn = _getSymbolsIn, keysIn$1 = keysIn_1;
2882
- function getAllKeysIn$1(object) {
2883
- return baseGetAllKeys(object, keysIn$1, getSymbolsIn);
2884
- }
2885
- var _getAllKeysIn = getAllKeysIn$1;
2886
- var getNative$3 = _getNative, root$4 = _root;
2887
- var DataView$1 = getNative$3(root$4, "DataView");
2888
- var _DataView = DataView$1;
2889
- var getNative$2 = _getNative, root$3 = _root;
2890
- var Promise$2 = getNative$2(root$3, "Promise");
2891
- var _Promise = Promise$2;
2892
- var getNative$1 = _getNative, root$2 = _root;
2893
- var Set$2 = getNative$1(root$2, "Set");
2894
- var _Set = Set$2;
2895
- var getNative = _getNative, root$1 = _root;
2896
- var WeakMap$2 = getNative(root$1, "WeakMap");
2897
- var _WeakMap = WeakMap$2;
2898
- var DataView = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$1 = _Set, WeakMap$1 = _WeakMap, baseGetTag = _baseGetTag, toSource = _toSource;
2899
- var mapTag$3 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$3 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
2900
- var dataViewTag$2 = "[object DataView]";
2901
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1);
2902
- var getTag$3 = baseGetTag;
2903
- if (DataView && getTag$3(new DataView(new ArrayBuffer(1))) != dataViewTag$2 || Map$1 && getTag$3(new Map$1()) != mapTag$3 || Promise$1 && getTag$3(Promise$1.resolve()) != promiseTag || Set$1 && getTag$3(new Set$1()) != setTag$3 || WeakMap$1 && getTag$3(new WeakMap$1()) != weakMapTag$1) {
2904
- getTag$3 = function(value) {
2905
- var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
2906
- if (ctorString) {
2907
- switch (ctorString) {
2908
- case dataViewCtorString:
2909
- return dataViewTag$2;
2910
- case mapCtorString:
2911
- return mapTag$3;
2912
- case promiseCtorString:
2913
- return promiseTag;
2914
- case setCtorString:
2915
- return setTag$3;
2916
- case weakMapCtorString:
2917
- return weakMapTag$1;
2918
- }
2919
- }
2920
- return result;
2921
- };
2922
- }
2923
- var _getTag = getTag$3;
2924
- var objectProto = Object.prototype;
2925
- var hasOwnProperty = objectProto.hasOwnProperty;
2926
- function initCloneArray$1(array) {
2927
- var length = array.length, result = new array.constructor(length);
2928
- if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
2929
- result.index = array.index;
2930
- result.input = array.input;
2931
- }
2932
- return result;
2933
- }
2934
- var _initCloneArray = initCloneArray$1;
2935
- var root = _root;
2936
- var Uint8Array$2 = root.Uint8Array;
2937
- var _Uint8Array = Uint8Array$2;
2938
- var Uint8Array$1 = _Uint8Array;
2939
- function cloneArrayBuffer$3(arrayBuffer) {
2940
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
2941
- new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
2942
- return result;
2943
- }
2944
- var _cloneArrayBuffer = cloneArrayBuffer$3;
2945
- var cloneArrayBuffer$2 = _cloneArrayBuffer;
2946
- function cloneDataView$1(dataView, isDeep) {
2947
- var buffer = isDeep ? cloneArrayBuffer$2(dataView.buffer) : dataView.buffer;
2948
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
2949
- }
2950
- var _cloneDataView = cloneDataView$1;
2951
- var reFlags = /\w*$/;
2952
- function cloneRegExp$1(regexp) {
2953
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
2954
- result.lastIndex = regexp.lastIndex;
2955
- return result;
2956
- }
2957
- var _cloneRegExp = cloneRegExp$1;
2958
- var Symbol$1 = _Symbol;
2959
- var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
2960
- function cloneSymbol$1(symbol) {
2961
- return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
2962
- }
2963
- var _cloneSymbol = cloneSymbol$1;
2964
- var cloneArrayBuffer$1 = _cloneArrayBuffer;
2965
- function cloneTypedArray$1(typedArray, isDeep) {
2966
- var buffer = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer;
2967
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
2968
- }
2969
- var _cloneTypedArray = cloneTypedArray$1;
2970
- var cloneArrayBuffer = _cloneArrayBuffer, cloneDataView = _cloneDataView, cloneRegExp = _cloneRegExp, cloneSymbol = _cloneSymbol, cloneTypedArray = _cloneTypedArray;
2971
- var boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]";
2972
- var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
2973
- function initCloneByTag$1(object, tag, isDeep) {
2974
- var Ctor = object.constructor;
2975
- switch (tag) {
2976
- case arrayBufferTag$1:
2977
- return cloneArrayBuffer(object);
2978
- case boolTag$1:
2979
- case dateTag$1:
2980
- return new Ctor(+object);
2981
- case dataViewTag$1:
2982
- return cloneDataView(object, isDeep);
2983
- case float32Tag$1:
2984
- case float64Tag$1:
2985
- case int8Tag$1:
2986
- case int16Tag$1:
2987
- case int32Tag$1:
2988
- case uint8Tag$1:
2989
- case uint8ClampedTag$1:
2990
- case uint16Tag$1:
2991
- case uint32Tag$1:
2992
- return cloneTypedArray(object, isDeep);
2993
- case mapTag$2:
2994
- return new Ctor();
2995
- case numberTag$1:
2996
- case stringTag$1:
2997
- return new Ctor(object);
2998
- case regexpTag$1:
2999
- return cloneRegExp(object);
3000
- case setTag$2:
3001
- return new Ctor();
3002
- case symbolTag$1:
3003
- return cloneSymbol(object);
3004
- }
3005
- }
3006
- var _initCloneByTag = initCloneByTag$1;
3007
- var isObject$1 = isObject_1;
3008
- var objectCreate = Object.create;
3009
- var baseCreate$1 = /* @__PURE__ */ function() {
3010
- function object() {
3011
- }
3012
- return function(proto) {
3013
- if (!isObject$1(proto)) {
3014
- return {};
3015
- }
3016
- if (objectCreate) {
3017
- return objectCreate(proto);
3018
- }
3019
- object.prototype = proto;
3020
- var result = new object();
3021
- object.prototype = void 0;
3022
- return result;
3023
- };
3024
- }();
3025
- var _baseCreate = baseCreate$1;
3026
- var baseCreate = _baseCreate, getPrototype = _getPrototype, isPrototype = _isPrototype;
3027
- function initCloneObject$1(object) {
3028
- return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
3029
- }
3030
- var _initCloneObject = initCloneObject$1;
3031
- var getTag$2 = _getTag, isObjectLike$1 = isObjectLike_1;
3032
- var mapTag$1 = "[object Map]";
3033
- function baseIsMap$1(value) {
3034
- return isObjectLike$1(value) && getTag$2(value) == mapTag$1;
3035
- }
3036
- var _baseIsMap = baseIsMap$1;
3037
- var baseIsMap = _baseIsMap, baseUnary$1 = _baseUnary, nodeUtil$1 = _nodeUtilExports;
3038
- var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
3039
- var isMap$1 = nodeIsMap ? baseUnary$1(nodeIsMap) : baseIsMap;
3040
- var isMap_1 = isMap$1;
3041
- var getTag$1 = _getTag, isObjectLike = isObjectLike_1;
3042
- var setTag$1 = "[object Set]";
3043
- function baseIsSet$1(value) {
3044
- return isObjectLike(value) && getTag$1(value) == setTag$1;
3045
- }
3046
- var _baseIsSet = baseIsSet$1;
3047
- var baseIsSet = _baseIsSet, baseUnary = _baseUnary, nodeUtil = _nodeUtilExports;
3048
- var nodeIsSet = nodeUtil && nodeUtil.isSet;
3049
- var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
3050
- var isSet_1 = isSet$1;
3051
- var Stack = _Stack, arrayEach = _arrayEach, assignValue = _assignValue, baseAssign = _baseAssign, baseAssignIn = _baseAssignIn, cloneBuffer = _cloneBufferExports, copyArray = _copyArray, copySymbols = _copySymbols, copySymbolsIn = _copySymbolsIn, getAllKeys = _getAllKeys, getAllKeysIn = _getAllKeysIn, getTag = _getTag, initCloneArray = _initCloneArray, initCloneByTag = _initCloneByTag, initCloneObject = _initCloneObject, isArray = isArray_1, isBuffer = isBufferExports, isMap = isMap_1, isObject = isObject_1, isSet = isSet_1, keys = keys_1, keysIn = keysIn_1;
3052
- var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4;
3053
- var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]";
3054
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
3055
- var cloneableTags = {};
3056
- cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
3057
- cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
3058
- function baseClone$1(value, bitmask, customizer, key, object, stack) {
3059
- var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
3060
- if (customizer) {
3061
- result = object ? customizer(value, key, object, stack) : customizer(value);
3062
- }
3063
- if (result !== void 0) {
3064
- return result;
3065
- }
3066
- if (!isObject(value)) {
3067
- return value;
3068
- }
3069
- var isArr = isArray(value);
3070
- if (isArr) {
3071
- result = initCloneArray(value);
3072
- if (!isDeep) {
3073
- return copyArray(value, result);
3074
- }
3075
- } else {
3076
- var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
3077
- if (isBuffer(value)) {
3078
- return cloneBuffer(value, isDeep);
3079
- }
3080
- if (tag == objectTag || tag == argsTag || isFunc && !object) {
3081
- result = isFlat || isFunc ? {} : initCloneObject(value);
3082
- if (!isDeep) {
3083
- return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
3084
- }
3085
- } else {
3086
- if (!cloneableTags[tag]) {
3087
- return object ? value : {};
3088
- }
3089
- result = initCloneByTag(value, tag, isDeep);
3090
- }
3091
- }
3092
- stack || (stack = new Stack());
3093
- var stacked = stack.get(value);
3094
- if (stacked) {
3095
- return stacked;
3096
- }
3097
- stack.set(value, result);
3098
- if (isSet(value)) {
3099
- value.forEach(function(subValue) {
3100
- result.add(baseClone$1(subValue, bitmask, customizer, subValue, value, stack));
3101
- });
3102
- } else if (isMap(value)) {
3103
- value.forEach(function(subValue, key2) {
3104
- result.set(key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
3105
- });
3106
- }
3107
- var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
3108
- var props = isArr ? void 0 : keysFunc(value);
3109
- arrayEach(props || value, function(subValue, key2) {
3110
- if (props) {
3111
- key2 = subValue;
3112
- subValue = value[key2];
3113
- }
3114
- assignValue(result, key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
3115
- });
3116
- return result;
3117
- }
3118
- var _baseClone = baseClone$1;
3119
- var baseClone = _baseClone;
3120
- var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
3121
- function cloneDeep$1(value) {
3122
- return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
3123
- }
3124
- var cloneDeep_1 = cloneDeep$1;
3125
- const cloneDeep = /* @__PURE__ */ getDefaultExportFromCjs(cloneDeep_1);
3126
2235
  class CollectionRegistry {
3127
2236
  // Normalized runtime layer (used by Data Grid / UI)
3128
2237
  collectionsByTableName = /* @__PURE__ */ new Map();
@@ -3170,7 +2279,7 @@
3170
2279
  ...c
3171
2280
  }));
3172
2281
  normalizedCollections.forEach((c, index) => {
3173
- const raw = cloneDeep(collections[index]);
2282
+ const raw = deepClone(collections[index]);
3174
2283
  this.rootCollections.push(c);
3175
2284
  this.rawRootCollections.push(raw);
3176
2285
  const normalized = this.normalizeCollection(c);
@@ -3190,7 +2299,7 @@
3190
2299
  if (!subCollection) return;
3191
2300
  this._registerRecursively(this.normalizeCollection({
3192
2301
  ...subCollection
3193
- }), cloneDeep(subCollection));
2302
+ }), deepClone(subCollection));
3194
2303
  });
3195
2304
  }
3196
2305
  });
@@ -3198,7 +2307,7 @@
3198
2307
  return true;
3199
2308
  }
3200
2309
  register(collection, rawCollection) {
3201
- const raw = rawCollection ? cloneDeep(rawCollection) : cloneDeep(collection);
2310
+ const raw = rawCollection ? deepClone(rawCollection) : deepClone(collection);
3202
2311
  this.rootCollections.push(collection);
3203
2312
  this.rawRootCollections.push(raw);
3204
2313
  this._registerRecursively(collection, raw);
@@ -3222,7 +2331,7 @@
3222
2331
  if (!subCollection) return;
3223
2332
  this._registerRecursively(this.normalizeCollection({
3224
2333
  ...subCollection
3225
- }), cloneDeep(subCollection));
2334
+ }), deepClone(subCollection));
3226
2335
  });
3227
2336
  }
3228
2337
  }
@@ -3394,7 +2503,10 @@
3394
2503
  if (!relation) {
3395
2504
  throw new Error(`Relation '${relationKey}' not found in collection '${currentCollection.slug}'`);
3396
2505
  }
3397
- currentCollection = relation.target();
2506
+ const target = relation.target();
2507
+ const targetRelationKey = relation.relationName || target.slug;
2508
+ const targetSlug = relation.overrides?.slug ?? targetRelationKey;
2509
+ currentCollection = this.get(targetSlug) || this.normalizeCollection(target);
3398
2510
  if (i + 1 < pathSegments.length) ;
3399
2511
  }
3400
2512
  return currentCollection;
@@ -3443,7 +2555,7 @@
3443
2555
  if (!subcollection) {
3444
2556
  throw new Error(`Subcollection '${subcollectionSlug}' not found in ${currentCollection.slug}`);
3445
2557
  }
3446
- currentCollection = subcollection;
2558
+ currentCollection = this.get(subcollection.slug) || this.normalizeCollection(subcollection);
3447
2559
  collections.push(currentCollection);
3448
2560
  }
3449
2561
  }
@@ -4485,7 +3597,25 @@
4485
3597
  return result;
4486
3598
  }
4487
3599
  return value;
3600
+ case "string":
3601
+ if (typeof value === "string") {
3602
+ if (value.startsWith("data:application/octet-stream;base64,")) {
3603
+ const base64Data = value.split(",")[1];
3604
+ if (base64Data) {
3605
+ return Buffer.from(base64Data, "base64");
3606
+ }
3607
+ }
3608
+ }
3609
+ return value;
4488
3610
  default:
3611
+ if (typeof value === "string") {
3612
+ if (value.startsWith("data:application/octet-stream;base64,")) {
3613
+ const base64Data = value.split(",")[1];
3614
+ if (base64Data) {
3615
+ return Buffer.from(base64Data, "base64");
3616
+ }
3617
+ }
3618
+ }
4489
3619
  return value;
4490
3620
  }
4491
3621
  }
@@ -4611,6 +3741,37 @@
4611
3741
  return value;
4612
3742
  }
4613
3743
  switch (property.type) {
3744
+ case "string": {
3745
+ if (typeof value === "string") return value;
3746
+ let isBuffer = false;
3747
+ let buf = null;
3748
+ if (Buffer.isBuffer(value)) {
3749
+ isBuffer = true;
3750
+ buf = value;
3751
+ } else if (typeof value === "object" && value !== null && value.type === "Buffer" && Array.isArray(value.data)) {
3752
+ isBuffer = true;
3753
+ buf = Buffer.from(value.data);
3754
+ }
3755
+ if (isBuffer && buf) {
3756
+ let isPrintable = true;
3757
+ for (let i = 0; i < buf.length; i++) {
3758
+ const b = buf[i];
3759
+ if ((b < 32 || b > 126) && b !== 9 && b !== 10 && b !== 13) {
3760
+ isPrintable = false;
3761
+ break;
3762
+ }
3763
+ }
3764
+ return isPrintable ? buf.toString("utf8") : `data:application/octet-stream;base64,${buf.toString("base64")}`;
3765
+ }
3766
+ if (typeof value === "object" && value !== null) {
3767
+ try {
3768
+ return JSON.stringify(value);
3769
+ } catch {
3770
+ return String(value);
3771
+ }
3772
+ }
3773
+ return String(value);
3774
+ }
4614
3775
  case "relation":
4615
3776
  if (typeof value === "string" || typeof value === "number") {
4616
3777
  let relationDef = property.relation;
@@ -4694,8 +3855,29 @@
4694
3855
  }
4695
3856
  return null;
4696
3857
  }
4697
- default:
3858
+ default: {
3859
+ let isBuffer = false;
3860
+ let buf = null;
3861
+ if (Buffer.isBuffer(value)) {
3862
+ isBuffer = true;
3863
+ buf = value;
3864
+ } else if (typeof value === "object" && value !== null && value.type === "Buffer" && Array.isArray(value.data)) {
3865
+ isBuffer = true;
3866
+ buf = Buffer.from(value.data);
3867
+ }
3868
+ if (isBuffer && buf) {
3869
+ let isPrintable = true;
3870
+ for (let i = 0; i < buf.length; i++) {
3871
+ const b = buf[i];
3872
+ if ((b < 32 || b > 126) && b !== 9 && b !== 10 && b !== 13) {
3873
+ isPrintable = false;
3874
+ break;
3875
+ }
3876
+ }
3877
+ return isPrintable ? buf.toString("utf8") : `data:application/octet-stream;base64,${buf.toString("base64")}`;
3878
+ }
4698
3879
  return value;
3880
+ }
4699
3881
  }
4700
3882
  }
4701
3883
  function normalizeScalarValues(data, properties, collection, resolvedRelations, options) {
@@ -5963,6 +5145,10 @@
5963
5145
  await this.resolveJoinPathRelations(entity, collection, collectionPath, parsedId, databaseId);
5964
5146
  return entity;
5965
5147
  } catch (e) {
5148
+ if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
5149
+ console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
5150
+ console.error(`Hint: This usually means a relation in your drizzle schema is missing a reciprocal 'one()' or 'many()' definition. Run 'rebase schema generate' to fix this.`);
5151
+ }
5966
5152
  console.warn(`[EntityFetchService] db.query.findFirst failed for ${collectionPath}, falling back to db.select:`, e);
5967
5153
  }
5968
5154
  }
@@ -6023,6 +5209,10 @@
6023
5209
  const entities = results2.map((row) => this.drizzleResultToEntity(row, collection, collectionPath, idInfo, options.databaseId, idInfoArray));
6024
5210
  return entities;
6025
5211
  } catch (e) {
5212
+ if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
5213
+ console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
5214
+ console.error(`Hint: This usually means a relation in your drizzle schema is missing a reciprocal 'one()' or 'many()' definition. Run 'rebase schema generate' to fix this.`);
5215
+ }
6026
5216
  console.warn(`[EntityFetchService] db.query.findMany failed for ${collectionPath}, falling back to db.select:`, e);
6027
5217
  }
6028
5218
  }
@@ -6292,6 +5482,10 @@
6292
5482
  await this.resolveJoinPathRelationsBatchRest(restRows, collection, collectionPath, idInfoArray, include);
6293
5483
  return restRows;
6294
5484
  } catch (e) {
5485
+ if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
5486
+ console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
5487
+ console.error(`Hint: This usually means a relation in your drizzle schema is missing a reciprocal 'one()' or 'many()' definition. Run 'rebase schema generate' to fix this.`);
5488
+ }
6295
5489
  console.warn(`[fetchCollectionForRest] db.query.findMany failed for ${collectionPath}, falling back:`, e);
6296
5490
  }
6297
5491
  }
@@ -6372,6 +5566,10 @@
6372
5566
  await this.resolveJoinPathRelationsBatchRest([restRow], collection, collectionPath, idInfoArray, include);
6373
5567
  return restRow;
6374
5568
  } catch (e) {
5569
+ if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
5570
+ console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
5571
+ console.error(`Hint: This usually means a relation in your drizzle schema is missing a reciprocal 'one()' or 'many()' definition. Run 'rebase schema generate' to fix this.`);
5572
+ }
6375
5573
  console.warn(`[fetchEntityForRest] db.query.findFirst failed for ${collectionPath}, falling back:`, e);
6376
5574
  }
6377
5575
  }
@@ -6630,7 +5828,7 @@
6630
5828
  targetColumnName = relation.localKey;
6631
5829
  } else if (relation.foreignKeyOnTarget) {
6632
5830
  targetColumnName = relation.foreignKeyOnTarget;
6633
- } else if (relation.joinPath && relation.joinPath.length > 0) {
5831
+ } else if (relation.joinPath && relation.joinPath.length === 1) {
6634
5832
  const targetTableName = getTableName(targetCollection);
6635
5833
  const relevantJoinStep = relation.joinPath.find((joinStep) => joinStep.table === targetTableName);
6636
5834
  if (relevantJoinStep) {
@@ -6641,6 +5839,8 @@
6641
5839
  const targetColumnNames = DrizzleConditionBuilder.getColumnNamesFromColumns(relation.joinPath[0].on.to);
6642
5840
  targetColumnName = targetColumnNames[0];
6643
5841
  }
5842
+ } else if (relation.joinPath && relation.joinPath.length > 1) {
5843
+ break;
6644
5844
  } else {
6645
5845
  throw new Error(`Relation '${relationKey}' lacks configuration for path-based saving.`);
6646
5846
  }
@@ -6763,22 +5963,78 @@
6763
5963
  const pgError = this.extractPgError(error);
6764
5964
  if (pgError) {
6765
5965
  const detail = pgError.detail;
5966
+ const hint = pgError.hint;
6766
5967
  const constraint = pgError.constraint;
6767
5968
  const column = pgError.column;
6768
5969
  const table = pgError.table;
5970
+ const dataType = pgError.dataType;
5971
+ const pgMessage = pgError.message || "Unknown database error";
5972
+ const suffix = hint ? ` Hint: ${hint}` : "";
5973
+ const tableRef = table ?? collectionSlug;
6769
5974
  switch (pgError.code) {
6770
5975
  case "23503":
6771
- return new Error(detail ? `Foreign key constraint violated: ${detail}` : `Cannot save: a foreign key constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".`);
5976
+ return new Error(detail ? `Foreign key constraint violated: ${detail}${suffix}` : `Cannot save: a foreign key constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".${suffix}`);
6772
5977
  case "23505":
6773
- return new Error(detail ? `Duplicate value: ${detail}` : `Cannot save: a unique constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".`);
5978
+ return new Error(detail ? `Duplicate value: ${detail}${suffix}` : `Cannot save: a unique constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".${suffix}`);
6774
5979
  case "23502":
6775
- return new Error(`Missing required field: "${column ?? "unknown"}" in "${table ?? collectionSlug}" cannot be empty.`);
5980
+ return new Error(`Missing required field: "${column ?? "unknown"}" in "${tableRef}" cannot be empty.${suffix}`);
6776
5981
  case "23514":
6777
- return new Error(`Validation failed: a check constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".`);
5982
+ return new Error(`Validation failed: a check constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".${suffix}`);
5983
+ case "22P02":
5984
+ return new Error(`Invalid data format in "${collectionSlug}": ${pgMessage}${suffix}`);
5985
+ case "22001":
5986
+ return new Error(`Value too long for column "${column ?? "unknown"}" in "${tableRef}": ${pgMessage}${suffix}`);
5987
+ case "22003":
5988
+ return new Error(`Numeric value out of range for column "${column ?? "unknown"}" in "${tableRef}": ${pgMessage}${suffix}`);
5989
+ case "42703":
5990
+ return new Error(`Unknown column in "${tableRef}": ${pgMessage}. Check if your schema is up to date (run migrations).${suffix}`);
5991
+ case "42P01":
5992
+ return new Error(`Table not found for "${collectionSlug}": ${pgMessage}. Check if your schema is up to date (run migrations).${suffix}`);
5993
+ default: {
5994
+ const parts = [`Database error in "${collectionSlug}" [${pgError.code}]: ${pgMessage}`];
5995
+ if (detail) parts.push(`Detail: ${detail}`);
5996
+ if (column) parts.push(`Column: ${column}`);
5997
+ if (dataType) parts.push(`Data type: ${dataType}`);
5998
+ if (constraint) parts.push(`Constraint: ${constraint}`);
5999
+ if (hint) parts.push(`Hint: ${hint}`);
6000
+ return new Error(parts.join(". "));
6001
+ }
6002
+ }
6003
+ }
6004
+ const causeMessage = this.extractCauseMessage(error);
6005
+ if (causeMessage) {
6006
+ return new Error(`Database error in "${collectionSlug}": ${causeMessage}`);
6007
+ }
6008
+ if (error instanceof Error) {
6009
+ const cleaned = this.stripSqlFromMessage(error.message, collectionSlug);
6010
+ return new Error(cleaned);
6011
+ }
6012
+ return new Error(`Database error in "${collectionSlug}": ${String(error)}`);
6013
+ }
6014
+ /**
6015
+ * Walk the error cause chain and return the deepest meaningful message.
6016
+ */
6017
+ extractCauseMessage(error) {
6018
+ if (!error || typeof error !== "object") return null;
6019
+ const err = error;
6020
+ if (err.cause && typeof err.cause === "object") {
6021
+ const deeper = this.extractCauseMessage(err.cause);
6022
+ if (deeper) return deeper;
6023
+ if (err.cause instanceof Error && err.cause.message) {
6024
+ return err.cause.message;
6778
6025
  }
6779
6026
  }
6780
- if (error instanceof Error) return error;
6781
- return new Error(String(error));
6027
+ return null;
6028
+ }
6029
+ /**
6030
+ * Strip the raw SQL query from a Drizzle "Failed query: ..." message,
6031
+ * keeping only the error description.
6032
+ */
6033
+ stripSqlFromMessage(message, collectionSlug) {
6034
+ if (message.startsWith("Failed query:")) {
6035
+ return `Failed to save entity in "${collectionSlug}". Check server logs for details.`;
6036
+ }
6037
+ return message;
6782
6038
  }
6783
6039
  /**
6784
6040
  * Extract the underlying PostgreSQL error from a Drizzle wrapper.
@@ -6787,7 +6043,7 @@
6787
6043
  extractPgError(error) {
6788
6044
  if (!error || typeof error !== "object") return null;
6789
6045
  const err = error;
6790
- if (err.code && /^[0-9]{5}$/.test(err.code)) {
6046
+ if (err.code && /^[0-9A-Z]{5}$/.test(err.code)) {
6791
6047
  return err;
6792
6048
  }
6793
6049
  if (err.cause && typeof err.cause === "object") {
@@ -7075,6 +6331,7 @@
7075
6331
  branchService;
7076
6332
  user;
7077
6333
  data;
6334
+ client;
7078
6335
  /**
7079
6336
  * When true, realtime notifications are deferred until after the
7080
6337
  * wrapping transaction commits. Set by `withAuth` → `withTransaction`.
@@ -7103,6 +6360,14 @@
7103
6360
  } : {}
7104
6361
  };
7105
6362
  }
6363
+ /**
6364
+ * REST-optimised fetch service (include-aware eager-loading).
6365
+ * Delegates to the underlying EntityFetchService which already
6366
+ * implements the matching method signatures.
6367
+ */
6368
+ get restFetchService() {
6369
+ return this.entityService.getFetchService();
6370
+ }
7106
6371
  resolveCollectionCallbacks(collection, path2) {
7107
6372
  if (!collection && !path2) return {
7108
6373
  collection: void 0,
@@ -7156,7 +6421,8 @@
7156
6421
  const contextForCallback = {
7157
6422
  user: this.user,
7158
6423
  driver: this,
7159
- data: this.data
6424
+ data: this.data,
6425
+ client: this.client
7160
6426
  };
7161
6427
  return Promise.all(entities.map(async (entity) => {
7162
6428
  let fetched = entity;
@@ -7250,7 +6516,8 @@
7250
6516
  const contextForCallback = {
7251
6517
  user: this.user,
7252
6518
  driver: this,
7253
- data: this.data
6519
+ data: this.data,
6520
+ client: this.client
7254
6521
  };
7255
6522
  if (callbacks?.afterRead) {
7256
6523
  entity = await callbacks.afterRead({
@@ -7319,7 +6586,8 @@
7319
6586
  const contextForCallback = {
7320
6587
  user: this.user,
7321
6588
  driver: this,
7322
- data: this.data
6589
+ data: this.data,
6590
+ client: this.client
7323
6591
  };
7324
6592
  let previousValuesForHistory;
7325
6593
  if (status === "existing" && entityId) {
@@ -7354,6 +6622,14 @@
7354
6622
  if (result) updatedValues = mergeDeep(updatedValues, result);
7355
6623
  }
7356
6624
  }
6625
+ if (resolvedCollection?.properties) {
6626
+ updatedValues = updateDateAutoValues({
6627
+ inputValues: updatedValues,
6628
+ properties: resolvedCollection.properties,
6629
+ status: status ?? "new",
6630
+ timestampNowValue: /* @__PURE__ */ new Date()
6631
+ });
6632
+ }
7357
6633
  try {
7358
6634
  let savedEntity = await this.entityService.saveEntity(path2, updatedValues, entityId, resolvedCollection?.databaseId);
7359
6635
  if (savedEntity && (callbacks?.afterRead || propertyCallbacks?.afterRead)) {
@@ -7459,7 +6735,8 @@
7459
6735
  const contextForCallback = {
7460
6736
  user: this.user,
7461
6737
  driver: this,
7462
- data: this.data
6738
+ data: this.data,
6739
+ client: this.client
7463
6740
  };
7464
6741
  if (callbacks?.beforeDelete || propertyCallbacks?.beforeDelete) {
7465
6742
  if (callbacks?.beforeDelete) {
@@ -7786,6 +7063,7 @@
7786
7063
  txDelegate.entityService = txEntityService;
7787
7064
  txDelegate._deferNotifications = true;
7788
7065
  txDelegate._pendingNotifications = pendingNotifications;
7066
+ txDelegate.client = this.delegate.client;
7789
7067
  return await operation(txDelegate);
7790
7068
  });
7791
7069
  for (const notification of pendingNotifications) {
@@ -8067,6 +7345,12 @@
8067
7345
  references: [users.id]
8068
7346
  })
8069
7347
  }));
7348
+ const resolveColumnName = (propName, prop) => {
7349
+ if (prop && "columnName" in prop && typeof prop.columnName === "string") {
7350
+ return prop.columnName;
7351
+ }
7352
+ return toSnakeCase(propName);
7353
+ };
8070
7354
  const getPrimaryKeyProp = (collection) => {
8071
7355
  if (collection.properties) {
8072
7356
  const idPropEntry = Object.entries(collection.properties).find(([_, prop]) => "isId" in prop && Boolean(prop.isId));
@@ -8107,7 +7391,7 @@
8107
7391
  return !hasExplicitId && propName === "id";
8108
7392
  };
8109
7393
  const getDrizzleColumn = (propName, prop, collection, collections) => {
8110
- const colName = toSnakeCase(propName);
7394
+ const colName = resolveColumnName(propName, prop);
8111
7395
  let columnDefinition;
8112
7396
  switch (prop.type) {
8113
7397
  case "string": {
@@ -8179,6 +7463,9 @@
8179
7463
  } else {
8180
7464
  columnDefinition = `timestamp("${colName}", { withTimezone: true, mode: 'string' })`;
8181
7465
  }
7466
+ if (dateProp.autoValue === "on_create" || dateProp.autoValue === "on_update") {
7467
+ columnDefinition += `.default(sql\`now()\`)`;
7468
+ }
8182
7469
  break;
8183
7470
  }
8184
7471
  case "map":
@@ -8211,7 +7498,7 @@
8211
7498
  } catch {
8212
7499
  return null;
8213
7500
  }
8214
- const fkColumnName = toSnakeCase(relation.localKey);
7501
+ const fkColumnName = relation.localKey;
8215
7502
  const targetTableVar = getTableVarName(getTableName(targetCollection));
8216
7503
  const pkProp = getPrimaryKeyProp(targetCollection);
8217
7504
  const targetIdField = pkProp.name;
@@ -8399,7 +7686,7 @@
8399
7686
  Object.entries(collection.properties ?? {}).forEach(([propName, prop]) => {
8400
7687
  if ("enum" in prop && (prop.type === "string" || prop.type === "number") && prop.enum) {
8401
7688
  const enumVarName = getEnumVarName(collectionPath, propName);
8402
- const enumDbName = `${collectionPath}_${toSnakeCase(propName)}`;
7689
+ const enumDbName = `${collectionPath}_${resolveColumnName(propName, prop)}`;
8403
7690
  const values = Array.isArray(prop.enum) ? prop.enum.map((v) => String(v.id ?? v)) : Object.keys(prop.enum);
8404
7691
  if (values.length > 0) {
8405
7692
  schemaContent += `export const ${enumVarName} = pgEnum("${enumDbName}", [${values.map((v) => `'${v}'`).join(", ")}]);
@@ -8456,9 +7743,9 @@
8456
7743
  const targetId = getPrimaryKeyName(targetCollection);
8457
7744
  schemaContent += `export const ${tableVarName} = pgTable("${tableName}", {
8458
7745
  `;
8459
- schemaContent += ` ${sourceColumn}: ${sourceColType}("${toSnakeCase(sourceColumn)}").notNull().references(() => ${getTableVarName(getTableName(sourceCollection))}.${sourceId}, ${refOptions}),
7746
+ schemaContent += ` ${sourceColumn}: ${sourceColType}("${sourceColumn}").notNull().references(() => ${getTableVarName(getTableName(sourceCollection))}.${sourceId}, ${refOptions}),
8460
7747
  `;
8461
- schemaContent += ` ${targetColumn}: ${targetColType}("${toSnakeCase(targetColumn)}").notNull().references(() => ${getTableVarName(getTableName(targetCollection))}.${targetId}, ${refOptions}),
7748
+ schemaContent += ` ${targetColumn}: ${targetColType}("${targetColumn}").notNull().references(() => ${getTableVarName(getTableName(targetCollection))}.${targetId}, ${refOptions}),
8462
7749
  `;
8463
7750
  schemaContent += "}, (table) => ({\n";
8464
7751
  schemaContent += ` pk: primaryKey({ columns: [table.${sourceColumn}, table.${targetColumn}] })
@@ -8551,29 +7838,10 @@
8551
7838
  references: [${targetTableVar}.${getPrimaryKeyName(target)}],
8552
7839
  relationName: "${drizzleRelationName}"
8553
7840
  })`);
8554
- } else if (rel.direction === "inverse" && rel.foreignKeyOnTarget) {
8555
- const sourceIdField = getPrimaryKeyName(collection);
7841
+ } else if (rel.direction === "inverse") {
8556
7842
  tableRelations.push(` "${relationKey}": one(${targetTableVar}, {
8557
- fields: [${tableVarName}.${sourceIdField}],
8558
- references: [${targetTableVar}.${rel.foreignKeyOnTarget}],
8559
- relationName: "${drizzleRelationName}"
8560
- })`);
8561
- } else if (rel.direction === "inverse" && !rel.foreignKeyOnTarget) {
8562
- try {
8563
- const targetCollection = rel.target();
8564
- const targetResolvedRelations = resolveCollectionRelations(targetCollection);
8565
- const correspondingRelation = Object.values(targetResolvedRelations).find((targetRel) => targetRel.direction === "owning" && targetRel.cardinality === "one" && targetRel.target().slug === collection.slug);
8566
- if (correspondingRelation && correspondingRelation.localKey) {
8567
- const sourceIdField = getPrimaryKeyName(collection);
8568
- tableRelations.push(` "${relationKey}": one(${targetTableVar}, {
8569
- fields: [${tableVarName}.${sourceIdField}],
8570
- references: [${targetTableVar}.${correspondingRelation.localKey}],
8571
7843
  relationName: "${drizzleRelationName}"
8572
7844
  })`);
8573
- }
8574
- } catch (e) {
8575
- console.warn(`Could not resolve inverse one-to-one relation '${relationKey}':`, e);
8576
- }
8577
7845
  }
8578
7846
  } else if (rel.cardinality === "many") {
8579
7847
  if (rel.direction === "inverse" && rel.foreignKeyOnTarget) {
@@ -8601,6 +7869,32 @@
8601
7869
  console.warn(`Could not generate relation ${relationKey} for ${collection.name}:`, e);
8602
7870
  }
8603
7871
  }
7872
+ for (const otherCollection of collections) {
7873
+ if (otherCollection.slug === collection.slug) continue;
7874
+ const otherRelations = resolveCollectionRelations(otherCollection);
7875
+ for (const [otherKey, otherRel] of Object.entries(otherRelations)) {
7876
+ if (otherRel.direction === "inverse" && otherRel.foreignKeyOnTarget) {
7877
+ try {
7878
+ const otherTarget = otherRel.target();
7879
+ if (otherTarget.slug === collection.slug) {
7880
+ const drizzleRelationName = computeSharedRelationName(otherRel, otherCollection, collections);
7881
+ const deduplicationKey = `${drizzleRelationName}::owning`;
7882
+ if (!emittedRelationNames.has(deduplicationKey)) {
7883
+ const otherTableVar = getTableVarName(getTableName(otherCollection));
7884
+ const synthKey = `_synth_${otherTableVar}_${otherRel.foreignKeyOnTarget}`;
7885
+ tableRelations.push(` "${synthKey}": one(${otherTableVar}, {
7886
+ fields: [${tableVarName}.${otherRel.foreignKeyOnTarget}],
7887
+ references: [${otherTableVar}.${getPrimaryKeyName(otherCollection)}],
7888
+ relationName: "${drizzleRelationName}"
7889
+ })`);
7890
+ emittedRelationNames.add(deduplicationKey);
7891
+ }
7892
+ }
7893
+ } catch (e) {
7894
+ }
7895
+ }
7896
+ }
7897
+ }
8604
7898
  }
8605
7899
  if (tableRelations.length > 0) {
8606
7900
  const relVarName = `${tableVarName}Relations`;