@rebasepro/server-postgresql 0.0.1-canary.eae7889 → 0.0.1-canary.f81da60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +171 -180
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +171 -180
- package/dist/index.umd.js.map +1 -1
- package/dist/server-postgresql/src/PostgresBackendDriver.d.ts +6 -0
- package/dist/server-postgresql/src/schema/introspect-db-logic.d.ts +82 -0
- package/dist/server-postgresql/src/schema/introspect-db.d.ts +1 -0
- package/dist/types/src/controllers/auth.d.ts +2 -2
- package/dist/types/src/controllers/collection_registry.d.ts +2 -1
- package/dist/types/src/controllers/data_driver.d.ts +36 -1
- package/dist/types/src/types/backend_hooks.d.ts +187 -0
- package/dist/types/src/types/collections.d.ts +11 -10
- package/dist/types/src/types/cron.d.ts +1 -1
- package/dist/types/src/types/entity_views.d.ts +4 -6
- package/dist/types/src/types/formex.d.ts +40 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/plugins.d.ts +6 -3
- package/dist/types/src/types/properties.d.ts +61 -89
- package/dist/types/src/types/slots.d.ts +20 -10
- package/dist/types/src/types/translations.d.ts +4 -0
- package/package.json +6 -5
- package/src/PostgresBackendDriver.ts +9 -0
- package/src/cli.ts +59 -1
- package/src/schema/generate-drizzle-schema-logic.ts +7 -25
- package/src/schema/introspect-db-logic.ts +592 -0
- package/src/schema/introspect-db.ts +211 -0
- package/src/services/EntityPersistService.ts +7 -1
- package/test/generate-drizzle-schema.test.ts +47 -0
- package/test/introspect-db-generation.test.ts +436 -0
- package/test/introspect-db-utils.test.ts +392 -0
- package/test/relations.test.ts +4 -4
- package/test/unmapped-tables-safety.test.ts +345 -0
package/dist/index.umd.js
CHANGED
|
@@ -1725,8 +1725,8 @@
|
|
|
1725
1725
|
return jsonLogic;
|
|
1726
1726
|
});
|
|
1727
1727
|
})(logic);
|
|
1728
|
-
|
|
1729
|
-
|
|
1728
|
+
const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
1729
|
+
const { hasOwnProperty: hasOwnProperty$a } = Object.prototype;
|
|
1730
1730
|
function combineComparators(comparatorA, comparatorB) {
|
|
1731
1731
|
return function isEqual(a, b, state) {
|
|
1732
1732
|
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
@@ -1737,38 +1737,45 @@
|
|
|
1737
1737
|
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
|
1738
1738
|
return areItemsEqual(a, b, state);
|
|
1739
1739
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1740
|
+
const { cache } = state;
|
|
1741
|
+
const cachedA = cache.get(a);
|
|
1742
|
+
const cachedB = cache.get(b);
|
|
1743
1743
|
if (cachedA && cachedB) {
|
|
1744
1744
|
return cachedA === b && cachedB === a;
|
|
1745
1745
|
}
|
|
1746
1746
|
cache.set(a, b);
|
|
1747
1747
|
cache.set(b, a);
|
|
1748
|
-
|
|
1748
|
+
const result = areItemsEqual(a, b, state);
|
|
1749
1749
|
cache.delete(a);
|
|
1750
1750
|
cache.delete(b);
|
|
1751
1751
|
return result;
|
|
1752
1752
|
};
|
|
1753
1753
|
}
|
|
1754
|
-
function getShortTag(value) {
|
|
1755
|
-
return value != null ? value[Symbol.toStringTag] : void 0;
|
|
1756
|
-
}
|
|
1757
1754
|
function getStrictProperties(object) {
|
|
1758
1755
|
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
1759
1756
|
}
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1757
|
+
const hasOwn = (
|
|
1758
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1759
|
+
Object.hasOwn || ((object, property) => hasOwnProperty$a.call(object, property))
|
|
1760
|
+
);
|
|
1761
|
+
const PREACT_VNODE = "__v";
|
|
1762
|
+
const PREACT_OWNER = "__o";
|
|
1763
|
+
const REACT_OWNER = "_owner";
|
|
1764
|
+
const { getOwnPropertyDescriptor, keys: keys$4 } = Object;
|
|
1765
|
+
const sameValueEqual = (
|
|
1766
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1767
|
+
Object.is || function sameValueEqual2(a, b) {
|
|
1768
|
+
return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
|
|
1769
|
+
}
|
|
1770
|
+
);
|
|
1771
|
+
function strictEqual(a, b) {
|
|
1772
|
+
return a === b;
|
|
1773
|
+
}
|
|
1774
|
+
function areArrayBuffersEqual(a, b) {
|
|
1775
|
+
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
|
|
1765
1776
|
}
|
|
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
1777
|
function areArraysEqual(a, b, state) {
|
|
1771
|
-
|
|
1778
|
+
let index = a.length;
|
|
1772
1779
|
if (b.length !== index) {
|
|
1773
1780
|
return false;
|
|
1774
1781
|
}
|
|
@@ -1779,35 +1786,35 @@
|
|
|
1779
1786
|
}
|
|
1780
1787
|
return true;
|
|
1781
1788
|
}
|
|
1789
|
+
function areDataViewsEqual(a, b) {
|
|
1790
|
+
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
|
|
1791
|
+
}
|
|
1782
1792
|
function areDatesEqual(a, b) {
|
|
1783
|
-
return
|
|
1793
|
+
return sameValueEqual(a.getTime(), b.getTime());
|
|
1784
1794
|
}
|
|
1785
1795
|
function areErrorsEqual(a, b) {
|
|
1786
1796
|
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
|
1787
1797
|
}
|
|
1788
|
-
function areFunctionsEqual(a, b) {
|
|
1789
|
-
return a === b;
|
|
1790
|
-
}
|
|
1791
1798
|
function areMapsEqual(a, b, state) {
|
|
1792
|
-
|
|
1799
|
+
const size = a.size;
|
|
1793
1800
|
if (size !== b.size) {
|
|
1794
1801
|
return false;
|
|
1795
1802
|
}
|
|
1796
1803
|
if (!size) {
|
|
1797
1804
|
return true;
|
|
1798
1805
|
}
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1806
|
+
const matchedIndices = new Array(size);
|
|
1807
|
+
const aIterable = a.entries();
|
|
1808
|
+
let aResult;
|
|
1809
|
+
let bResult;
|
|
1810
|
+
let index = 0;
|
|
1804
1811
|
while (aResult = aIterable.next()) {
|
|
1805
1812
|
if (aResult.done) {
|
|
1806
1813
|
break;
|
|
1807
1814
|
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1815
|
+
const bIterable = b.entries();
|
|
1816
|
+
let hasMatch = false;
|
|
1817
|
+
let matchIndex = 0;
|
|
1811
1818
|
while (bResult = bIterable.next()) {
|
|
1812
1819
|
if (bResult.done) {
|
|
1813
1820
|
break;
|
|
@@ -1816,8 +1823,8 @@
|
|
|
1816
1823
|
matchIndex++;
|
|
1817
1824
|
continue;
|
|
1818
1825
|
}
|
|
1819
|
-
|
|
1820
|
-
|
|
1826
|
+
const aEntry = aResult.value;
|
|
1827
|
+
const bEntry = bResult.value;
|
|
1821
1828
|
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
1829
|
hasMatch = matchedIndices[matchIndex] = true;
|
|
1823
1830
|
break;
|
|
@@ -1831,10 +1838,9 @@
|
|
|
1831
1838
|
}
|
|
1832
1839
|
return true;
|
|
1833
1840
|
}
|
|
1834
|
-
var areNumbersEqual = sameValueZeroEqual;
|
|
1835
1841
|
function areObjectsEqual(a, b, state) {
|
|
1836
|
-
|
|
1837
|
-
|
|
1842
|
+
const properties = keys$4(a);
|
|
1843
|
+
let index = properties.length;
|
|
1838
1844
|
if (keys$4(b).length !== index) {
|
|
1839
1845
|
return false;
|
|
1840
1846
|
}
|
|
@@ -1846,14 +1852,14 @@
|
|
|
1846
1852
|
return true;
|
|
1847
1853
|
}
|
|
1848
1854
|
function areObjectsEqualStrict(a, b, state) {
|
|
1849
|
-
|
|
1850
|
-
|
|
1855
|
+
const properties = getStrictProperties(a);
|
|
1856
|
+
let index = properties.length;
|
|
1851
1857
|
if (getStrictProperties(b).length !== index) {
|
|
1852
1858
|
return false;
|
|
1853
1859
|
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1860
|
+
let property;
|
|
1861
|
+
let descriptorA;
|
|
1862
|
+
let descriptorB;
|
|
1857
1863
|
while (index-- > 0) {
|
|
1858
1864
|
property = properties[index];
|
|
1859
1865
|
if (!isPropertyEqual(a, b, state, property)) {
|
|
@@ -1868,30 +1874,30 @@
|
|
|
1868
1874
|
return true;
|
|
1869
1875
|
}
|
|
1870
1876
|
function arePrimitiveWrappersEqual(a, b) {
|
|
1871
|
-
return
|
|
1877
|
+
return sameValueEqual(a.valueOf(), b.valueOf());
|
|
1872
1878
|
}
|
|
1873
1879
|
function areRegExpsEqual(a, b) {
|
|
1874
1880
|
return a.source === b.source && a.flags === b.flags;
|
|
1875
1881
|
}
|
|
1876
1882
|
function areSetsEqual(a, b, state) {
|
|
1877
|
-
|
|
1883
|
+
const size = a.size;
|
|
1878
1884
|
if (size !== b.size) {
|
|
1879
1885
|
return false;
|
|
1880
1886
|
}
|
|
1881
1887
|
if (!size) {
|
|
1882
1888
|
return true;
|
|
1883
1889
|
}
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1890
|
+
const matchedIndices = new Array(size);
|
|
1891
|
+
const aIterable = a.values();
|
|
1892
|
+
let aResult;
|
|
1893
|
+
let bResult;
|
|
1888
1894
|
while (aResult = aIterable.next()) {
|
|
1889
1895
|
if (aResult.done) {
|
|
1890
1896
|
break;
|
|
1891
1897
|
}
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1898
|
+
const bIterable = b.values();
|
|
1899
|
+
let hasMatch = false;
|
|
1900
|
+
let matchIndex = 0;
|
|
1895
1901
|
while (bResult = bIterable.next()) {
|
|
1896
1902
|
if (bResult.done) {
|
|
1897
1903
|
break;
|
|
@@ -1909,8 +1915,8 @@
|
|
|
1909
1915
|
return true;
|
|
1910
1916
|
}
|
|
1911
1917
|
function areTypedArraysEqual(a, b) {
|
|
1912
|
-
|
|
1913
|
-
if (b.
|
|
1918
|
+
let index = a.byteLength;
|
|
1919
|
+
if (b.byteLength !== index || a.byteOffset !== b.byteOffset) {
|
|
1914
1920
|
return false;
|
|
1915
1921
|
}
|
|
1916
1922
|
while (index-- > 0) {
|
|
@@ -1929,23 +1935,10 @@
|
|
|
1929
1935
|
}
|
|
1930
1936
|
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
|
1931
1937
|
}
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
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;
|
|
1938
|
+
const toString = Object.prototype.toString;
|
|
1939
|
+
function createEqualityComparator(config) {
|
|
1940
|
+
const supportedComparatorMap = createSupportedComparatorMap(config);
|
|
1941
|
+
const { areArraysEqual: areArraysEqual2, areDatesEqual: areDatesEqual2, areFunctionsEqual, areMapsEqual: areMapsEqual2, areNumbersEqual, areObjectsEqual: areObjectsEqual2, areRegExpsEqual: areRegExpsEqual2, areSetsEqual: areSetsEqual2, getUnsupportedCustomComparator } = config;
|
|
1949
1942
|
return function comparator(a, b, state) {
|
|
1950
1943
|
if (a === b) {
|
|
1951
1944
|
return true;
|
|
@@ -1953,32 +1946,29 @@
|
|
|
1953
1946
|
if (a == null || b == null) {
|
|
1954
1947
|
return false;
|
|
1955
1948
|
}
|
|
1956
|
-
|
|
1949
|
+
const type = typeof a;
|
|
1957
1950
|
if (type !== typeof b) {
|
|
1958
1951
|
return false;
|
|
1959
1952
|
}
|
|
1960
1953
|
if (type !== "object") {
|
|
1961
|
-
if (type === "number") {
|
|
1962
|
-
return
|
|
1954
|
+
if (type === "number" || type === "bigint") {
|
|
1955
|
+
return areNumbersEqual(a, b, state);
|
|
1963
1956
|
}
|
|
1964
1957
|
if (type === "function") {
|
|
1965
|
-
return
|
|
1958
|
+
return areFunctionsEqual(a, b, state);
|
|
1966
1959
|
}
|
|
1967
1960
|
return false;
|
|
1968
1961
|
}
|
|
1969
|
-
|
|
1962
|
+
const constructor = a.constructor;
|
|
1970
1963
|
if (constructor !== b.constructor) {
|
|
1971
1964
|
return false;
|
|
1972
1965
|
}
|
|
1973
1966
|
if (constructor === Object) {
|
|
1974
1967
|
return areObjectsEqual2(a, b, state);
|
|
1975
1968
|
}
|
|
1976
|
-
if (
|
|
1969
|
+
if (constructor === Array) {
|
|
1977
1970
|
return areArraysEqual2(a, b, state);
|
|
1978
1971
|
}
|
|
1979
|
-
if (isTypedArray$2 != null && isTypedArray$2(a)) {
|
|
1980
|
-
return areTypedArraysEqual2(a, b, state);
|
|
1981
|
-
}
|
|
1982
1972
|
if (constructor === Date) {
|
|
1983
1973
|
return areDatesEqual2(a, b, state);
|
|
1984
1974
|
}
|
|
@@ -1991,79 +1981,55 @@
|
|
|
1991
1981
|
if (constructor === Set) {
|
|
1992
1982
|
return areSetsEqual2(a, b, state);
|
|
1993
1983
|
}
|
|
1994
|
-
|
|
1995
|
-
|
|
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);
|
|
1984
|
+
if (constructor === Promise) {
|
|
1985
|
+
return false;
|
|
2015
1986
|
}
|
|
2016
|
-
if (
|
|
2017
|
-
return
|
|
1987
|
+
if (Array.isArray(a)) {
|
|
1988
|
+
return areArraysEqual2(a, b, state);
|
|
2018
1989
|
}
|
|
2019
|
-
|
|
2020
|
-
|
|
1990
|
+
const tag = toString.call(a);
|
|
1991
|
+
const supportedComparator = supportedComparatorMap[tag];
|
|
1992
|
+
if (supportedComparator) {
|
|
1993
|
+
return supportedComparator(a, b, state);
|
|
2021
1994
|
}
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
var shortTag = getShortTag(a);
|
|
2026
|
-
if (shortTag) {
|
|
2027
|
-
unknownTagComparator = unknownTagComparators[shortTag];
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
if (unknownTagComparator) {
|
|
2031
|
-
return unknownTagComparator(a, b, state);
|
|
2032
|
-
}
|
|
1995
|
+
const unsupportedCustomComparator = getUnsupportedCustomComparator && getUnsupportedCustomComparator(a, b, state, tag);
|
|
1996
|
+
if (unsupportedCustomComparator) {
|
|
1997
|
+
return unsupportedCustomComparator(a, b, state);
|
|
2033
1998
|
}
|
|
2034
1999
|
return false;
|
|
2035
2000
|
};
|
|
2036
2001
|
}
|
|
2037
|
-
function createEqualityComparatorConfig(
|
|
2038
|
-
|
|
2039
|
-
|
|
2002
|
+
function createEqualityComparatorConfig({ circular, createCustomConfig, strict }) {
|
|
2003
|
+
let config = {
|
|
2004
|
+
areArrayBuffersEqual,
|
|
2040
2005
|
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
2006
|
+
areDataViewsEqual,
|
|
2041
2007
|
areDatesEqual,
|
|
2042
2008
|
areErrorsEqual,
|
|
2043
|
-
areFunctionsEqual,
|
|
2009
|
+
areFunctionsEqual: strictEqual,
|
|
2044
2010
|
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
2045
|
-
areNumbersEqual,
|
|
2011
|
+
areNumbersEqual: sameValueEqual,
|
|
2046
2012
|
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
|
2047
2013
|
arePrimitiveWrappersEqual,
|
|
2048
2014
|
areRegExpsEqual,
|
|
2049
2015
|
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
2050
|
-
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
|
|
2016
|
+
areTypedArraysEqual: strict ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
|
|
2051
2017
|
areUrlsEqual,
|
|
2052
|
-
|
|
2018
|
+
getUnsupportedCustomComparator: void 0
|
|
2053
2019
|
};
|
|
2054
2020
|
if (createCustomConfig) {
|
|
2055
|
-
config = assign({}, config, createCustomConfig(config));
|
|
2021
|
+
config = Object.assign({}, config, createCustomConfig(config));
|
|
2056
2022
|
}
|
|
2057
2023
|
if (circular) {
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
config = assign({}, config, {
|
|
2063
|
-
areArraysEqual:
|
|
2064
|
-
areMapsEqual:
|
|
2065
|
-
areObjectsEqual:
|
|
2066
|
-
areSetsEqual:
|
|
2024
|
+
const areArraysEqual2 = createIsCircular(config.areArraysEqual);
|
|
2025
|
+
const areMapsEqual2 = createIsCircular(config.areMapsEqual);
|
|
2026
|
+
const areObjectsEqual2 = createIsCircular(config.areObjectsEqual);
|
|
2027
|
+
const areSetsEqual2 = createIsCircular(config.areSetsEqual);
|
|
2028
|
+
config = Object.assign({}, config, {
|
|
2029
|
+
areArraysEqual: areArraysEqual2,
|
|
2030
|
+
areMapsEqual: areMapsEqual2,
|
|
2031
|
+
areObjectsEqual: areObjectsEqual2,
|
|
2032
|
+
areSetsEqual: areSetsEqual2
|
|
2067
2033
|
});
|
|
2068
2034
|
}
|
|
2069
2035
|
return config;
|
|
@@ -2073,11 +2039,10 @@
|
|
|
2073
2039
|
return compare(a, b, state);
|
|
2074
2040
|
};
|
|
2075
2041
|
}
|
|
2076
|
-
function createIsEqual(
|
|
2077
|
-
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
|
2042
|
+
function createIsEqual({ circular, comparator, createState, equals, strict }) {
|
|
2078
2043
|
if (createState) {
|
|
2079
2044
|
return function isEqual(a, b) {
|
|
2080
|
-
|
|
2045
|
+
const { cache = circular ? /* @__PURE__ */ new WeakMap() : void 0, meta } = createState();
|
|
2081
2046
|
return comparator(a, b, {
|
|
2082
2047
|
cache,
|
|
2083
2048
|
equals,
|
|
@@ -2096,7 +2061,7 @@
|
|
|
2096
2061
|
});
|
|
2097
2062
|
};
|
|
2098
2063
|
}
|
|
2099
|
-
|
|
2064
|
+
const state = {
|
|
2100
2065
|
cache: void 0,
|
|
2101
2066
|
equals,
|
|
2102
2067
|
meta: void 0,
|
|
@@ -2106,7 +2071,50 @@
|
|
|
2106
2071
|
return comparator(a, b, state);
|
|
2107
2072
|
};
|
|
2108
2073
|
}
|
|
2109
|
-
|
|
2074
|
+
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 }) {
|
|
2075
|
+
return {
|
|
2076
|
+
"[object Arguments]": areObjectsEqual2,
|
|
2077
|
+
"[object Array]": areArraysEqual2,
|
|
2078
|
+
"[object ArrayBuffer]": areArrayBuffersEqual2,
|
|
2079
|
+
"[object AsyncGeneratorFunction]": areFunctionsEqual,
|
|
2080
|
+
"[object BigInt]": areNumbersEqual,
|
|
2081
|
+
"[object BigInt64Array]": areTypedArraysEqual2,
|
|
2082
|
+
"[object BigUint64Array]": areTypedArraysEqual2,
|
|
2083
|
+
"[object Boolean]": arePrimitiveWrappersEqual2,
|
|
2084
|
+
"[object DataView]": areDataViewsEqual2,
|
|
2085
|
+
"[object Date]": areDatesEqual2,
|
|
2086
|
+
// If an error tag, it should be tested explicitly. Like RegExp, the properties are not
|
|
2087
|
+
// enumerable, and therefore will give false positives if tested like a standard object.
|
|
2088
|
+
"[object Error]": areErrorsEqual2,
|
|
2089
|
+
"[object Float16Array]": areTypedArraysEqual2,
|
|
2090
|
+
"[object Float32Array]": areTypedArraysEqual2,
|
|
2091
|
+
"[object Float64Array]": areTypedArraysEqual2,
|
|
2092
|
+
"[object Function]": areFunctionsEqual,
|
|
2093
|
+
"[object GeneratorFunction]": areFunctionsEqual,
|
|
2094
|
+
"[object Int8Array]": areTypedArraysEqual2,
|
|
2095
|
+
"[object Int16Array]": areTypedArraysEqual2,
|
|
2096
|
+
"[object Int32Array]": areTypedArraysEqual2,
|
|
2097
|
+
"[object Map]": areMapsEqual2,
|
|
2098
|
+
"[object Number]": arePrimitiveWrappersEqual2,
|
|
2099
|
+
"[object Object]": (a, b, state) => (
|
|
2100
|
+
// The exception for value comparison is custom `Promise`-like class instances. These should
|
|
2101
|
+
// be treated the same as standard `Promise` objects, which means strict equality, and if
|
|
2102
|
+
// it reaches this point then that strict equality comparison has already failed.
|
|
2103
|
+
typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state)
|
|
2104
|
+
),
|
|
2105
|
+
// For RegExp, the properties are not enumerable, and therefore will give false positives if
|
|
2106
|
+
// tested like a standard object.
|
|
2107
|
+
"[object RegExp]": areRegExpsEqual2,
|
|
2108
|
+
"[object Set]": areSetsEqual2,
|
|
2109
|
+
"[object String]": arePrimitiveWrappersEqual2,
|
|
2110
|
+
"[object URL]": areUrlsEqual2,
|
|
2111
|
+
"[object Uint8Array]": areTypedArraysEqual2,
|
|
2112
|
+
"[object Uint8ClampedArray]": areTypedArraysEqual2,
|
|
2113
|
+
"[object Uint16Array]": areTypedArraysEqual2,
|
|
2114
|
+
"[object Uint32Array]": areTypedArraysEqual2
|
|
2115
|
+
};
|
|
2116
|
+
}
|
|
2117
|
+
const deepEqual = createCustomEqual();
|
|
2110
2118
|
createCustomEqual({ strict: true });
|
|
2111
2119
|
createCustomEqual({ circular: true });
|
|
2112
2120
|
createCustomEqual({
|
|
@@ -2114,37 +2122,26 @@
|
|
|
2114
2122
|
strict: true
|
|
2115
2123
|
});
|
|
2116
2124
|
createCustomEqual({
|
|
2117
|
-
createInternalComparator:
|
|
2118
|
-
return sameValueZeroEqual;
|
|
2119
|
-
}
|
|
2125
|
+
createInternalComparator: () => sameValueEqual
|
|
2120
2126
|
});
|
|
2121
2127
|
createCustomEqual({
|
|
2122
2128
|
strict: true,
|
|
2123
|
-
createInternalComparator:
|
|
2124
|
-
return sameValueZeroEqual;
|
|
2125
|
-
}
|
|
2129
|
+
createInternalComparator: () => sameValueEqual
|
|
2126
2130
|
});
|
|
2127
2131
|
createCustomEqual({
|
|
2128
2132
|
circular: true,
|
|
2129
|
-
createInternalComparator:
|
|
2130
|
-
return sameValueZeroEqual;
|
|
2131
|
-
}
|
|
2133
|
+
createInternalComparator: () => sameValueEqual
|
|
2132
2134
|
});
|
|
2133
2135
|
createCustomEqual({
|
|
2134
2136
|
circular: true,
|
|
2135
|
-
createInternalComparator:
|
|
2136
|
-
return sameValueZeroEqual;
|
|
2137
|
-
},
|
|
2137
|
+
createInternalComparator: () => sameValueEqual,
|
|
2138
2138
|
strict: true
|
|
2139
2139
|
});
|
|
2140
|
-
function createCustomEqual(options) {
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
var config = createEqualityComparatorConfig(options);
|
|
2146
|
-
var comparator = createEqualityComparator(config);
|
|
2147
|
-
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
|
2140
|
+
function createCustomEqual(options = {}) {
|
|
2141
|
+
const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false } = options;
|
|
2142
|
+
const config = createEqualityComparatorConfig(options);
|
|
2143
|
+
const comparator = createEqualityComparator(config);
|
|
2144
|
+
const equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
|
2148
2145
|
return createIsEqual({ circular, comparator, createState, equals, strict });
|
|
2149
2146
|
}
|
|
2150
2147
|
function listCacheClear$1() {
|
|
@@ -3394,7 +3391,10 @@
|
|
|
3394
3391
|
if (!relation) {
|
|
3395
3392
|
throw new Error(`Relation '${relationKey}' not found in collection '${currentCollection.slug}'`);
|
|
3396
3393
|
}
|
|
3397
|
-
|
|
3394
|
+
const target = relation.target();
|
|
3395
|
+
const targetRelationKey = relation.relationName || target.slug;
|
|
3396
|
+
const targetSlug = relation.overrides?.slug ?? targetRelationKey;
|
|
3397
|
+
currentCollection = this.get(targetSlug) || this.normalizeCollection(target);
|
|
3398
3398
|
if (i + 1 < pathSegments.length) ;
|
|
3399
3399
|
}
|
|
3400
3400
|
return currentCollection;
|
|
@@ -3443,7 +3443,7 @@
|
|
|
3443
3443
|
if (!subcollection) {
|
|
3444
3444
|
throw new Error(`Subcollection '${subcollectionSlug}' not found in ${currentCollection.slug}`);
|
|
3445
3445
|
}
|
|
3446
|
-
currentCollection = subcollection;
|
|
3446
|
+
currentCollection = this.get(subcollection.slug) || this.normalizeCollection(subcollection);
|
|
3447
3447
|
collections.push(currentCollection);
|
|
3448
3448
|
}
|
|
3449
3449
|
}
|
|
@@ -6630,7 +6630,7 @@
|
|
|
6630
6630
|
targetColumnName = relation.localKey;
|
|
6631
6631
|
} else if (relation.foreignKeyOnTarget) {
|
|
6632
6632
|
targetColumnName = relation.foreignKeyOnTarget;
|
|
6633
|
-
} else if (relation.joinPath && relation.joinPath.length
|
|
6633
|
+
} else if (relation.joinPath && relation.joinPath.length === 1) {
|
|
6634
6634
|
const targetTableName = getTableName(targetCollection);
|
|
6635
6635
|
const relevantJoinStep = relation.joinPath.find((joinStep) => joinStep.table === targetTableName);
|
|
6636
6636
|
if (relevantJoinStep) {
|
|
@@ -6641,6 +6641,8 @@
|
|
|
6641
6641
|
const targetColumnNames = DrizzleConditionBuilder.getColumnNamesFromColumns(relation.joinPath[0].on.to);
|
|
6642
6642
|
targetColumnName = targetColumnNames[0];
|
|
6643
6643
|
}
|
|
6644
|
+
} else if (relation.joinPath && relation.joinPath.length > 1) {
|
|
6645
|
+
break;
|
|
6644
6646
|
} else {
|
|
6645
6647
|
throw new Error(`Relation '${relationKey}' lacks configuration for path-based saving.`);
|
|
6646
6648
|
}
|
|
@@ -7103,6 +7105,14 @@
|
|
|
7103
7105
|
} : {}
|
|
7104
7106
|
};
|
|
7105
7107
|
}
|
|
7108
|
+
/**
|
|
7109
|
+
* REST-optimised fetch service (include-aware eager-loading).
|
|
7110
|
+
* Delegates to the underlying EntityFetchService which already
|
|
7111
|
+
* implements the matching method signatures.
|
|
7112
|
+
*/
|
|
7113
|
+
get restFetchService() {
|
|
7114
|
+
return this.entityService.getFetchService();
|
|
7115
|
+
}
|
|
7106
7116
|
resolveCollectionCallbacks(collection, path2) {
|
|
7107
7117
|
if (!collection && !path2) return {
|
|
7108
7118
|
collection: void 0,
|
|
@@ -8551,29 +8561,10 @@
|
|
|
8551
8561
|
references: [${targetTableVar}.${getPrimaryKeyName(target)}],
|
|
8552
8562
|
relationName: "${drizzleRelationName}"
|
|
8553
8563
|
})`);
|
|
8554
|
-
} else if (rel.direction === "inverse"
|
|
8555
|
-
const sourceIdField = getPrimaryKeyName(collection);
|
|
8564
|
+
} else if (rel.direction === "inverse") {
|
|
8556
8565
|
tableRelations.push(` "${relationKey}": one(${targetTableVar}, {
|
|
8557
|
-
fields: [${tableVarName}.${sourceIdField}],
|
|
8558
|
-
references: [${targetTableVar}.${rel.foreignKeyOnTarget}],
|
|
8559
8566
|
relationName: "${drizzleRelationName}"
|
|
8560
8567
|
})`);
|
|
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
|
-
relationName: "${drizzleRelationName}"
|
|
8572
|
-
})`);
|
|
8573
|
-
}
|
|
8574
|
-
} catch (e) {
|
|
8575
|
-
console.warn(`Could not resolve inverse one-to-one relation '${relationKey}':`, e);
|
|
8576
|
-
}
|
|
8577
8568
|
}
|
|
8578
8569
|
} else if (rel.cardinality === "many") {
|
|
8579
8570
|
if (rel.direction === "inverse" && rel.foreignKeyOnTarget) {
|