@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.es.js
CHANGED
|
@@ -1717,8 +1717,8 @@ var logic = { exports: {} };
|
|
|
1717
1717
|
return jsonLogic;
|
|
1718
1718
|
});
|
|
1719
1719
|
})(logic);
|
|
1720
|
-
|
|
1721
|
-
|
|
1720
|
+
const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
1721
|
+
const { hasOwnProperty: hasOwnProperty$a } = Object.prototype;
|
|
1722
1722
|
function combineComparators(comparatorA, comparatorB) {
|
|
1723
1723
|
return function isEqual(a, b, state) {
|
|
1724
1724
|
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
@@ -1729,38 +1729,45 @@ function createIsCircular(areItemsEqual) {
|
|
|
1729
1729
|
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
|
1730
1730
|
return areItemsEqual(a, b, state);
|
|
1731
1731
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1732
|
+
const { cache } = state;
|
|
1733
|
+
const cachedA = cache.get(a);
|
|
1734
|
+
const cachedB = cache.get(b);
|
|
1735
1735
|
if (cachedA && cachedB) {
|
|
1736
1736
|
return cachedA === b && cachedB === a;
|
|
1737
1737
|
}
|
|
1738
1738
|
cache.set(a, b);
|
|
1739
1739
|
cache.set(b, a);
|
|
1740
|
-
|
|
1740
|
+
const result = areItemsEqual(a, b, state);
|
|
1741
1741
|
cache.delete(a);
|
|
1742
1742
|
cache.delete(b);
|
|
1743
1743
|
return result;
|
|
1744
1744
|
};
|
|
1745
1745
|
}
|
|
1746
|
-
function getShortTag(value) {
|
|
1747
|
-
return value != null ? value[Symbol.toStringTag] : void 0;
|
|
1748
|
-
}
|
|
1749
1746
|
function getStrictProperties(object) {
|
|
1750
1747
|
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
1751
1748
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1749
|
+
const hasOwn = (
|
|
1750
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1751
|
+
Object.hasOwn || ((object, property) => hasOwnProperty$a.call(object, property))
|
|
1752
|
+
);
|
|
1753
|
+
const PREACT_VNODE = "__v";
|
|
1754
|
+
const PREACT_OWNER = "__o";
|
|
1755
|
+
const REACT_OWNER = "_owner";
|
|
1756
|
+
const { getOwnPropertyDescriptor, keys: keys$4 } = Object;
|
|
1757
|
+
const sameValueEqual = (
|
|
1758
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1759
|
+
Object.is || function sameValueEqual2(a, b) {
|
|
1760
|
+
return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
|
|
1761
|
+
}
|
|
1762
|
+
);
|
|
1763
|
+
function strictEqual(a, b) {
|
|
1764
|
+
return a === b;
|
|
1765
|
+
}
|
|
1766
|
+
function areArrayBuffersEqual(a, b) {
|
|
1767
|
+
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
|
|
1757
1768
|
}
|
|
1758
|
-
var PREACT_VNODE = "__v";
|
|
1759
|
-
var PREACT_OWNER = "__o";
|
|
1760
|
-
var REACT_OWNER = "_owner";
|
|
1761
|
-
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, keys$4 = Object.keys;
|
|
1762
1769
|
function areArraysEqual(a, b, state) {
|
|
1763
|
-
|
|
1770
|
+
let index = a.length;
|
|
1764
1771
|
if (b.length !== index) {
|
|
1765
1772
|
return false;
|
|
1766
1773
|
}
|
|
@@ -1771,35 +1778,35 @@ function areArraysEqual(a, b, state) {
|
|
|
1771
1778
|
}
|
|
1772
1779
|
return true;
|
|
1773
1780
|
}
|
|
1781
|
+
function areDataViewsEqual(a, b) {
|
|
1782
|
+
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
|
|
1783
|
+
}
|
|
1774
1784
|
function areDatesEqual(a, b) {
|
|
1775
|
-
return
|
|
1785
|
+
return sameValueEqual(a.getTime(), b.getTime());
|
|
1776
1786
|
}
|
|
1777
1787
|
function areErrorsEqual(a, b) {
|
|
1778
1788
|
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
|
1779
1789
|
}
|
|
1780
|
-
function areFunctionsEqual(a, b) {
|
|
1781
|
-
return a === b;
|
|
1782
|
-
}
|
|
1783
1790
|
function areMapsEqual(a, b, state) {
|
|
1784
|
-
|
|
1791
|
+
const size = a.size;
|
|
1785
1792
|
if (size !== b.size) {
|
|
1786
1793
|
return false;
|
|
1787
1794
|
}
|
|
1788
1795
|
if (!size) {
|
|
1789
1796
|
return true;
|
|
1790
1797
|
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1798
|
+
const matchedIndices = new Array(size);
|
|
1799
|
+
const aIterable = a.entries();
|
|
1800
|
+
let aResult;
|
|
1801
|
+
let bResult;
|
|
1802
|
+
let index = 0;
|
|
1796
1803
|
while (aResult = aIterable.next()) {
|
|
1797
1804
|
if (aResult.done) {
|
|
1798
1805
|
break;
|
|
1799
1806
|
}
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1807
|
+
const bIterable = b.entries();
|
|
1808
|
+
let hasMatch = false;
|
|
1809
|
+
let matchIndex = 0;
|
|
1803
1810
|
while (bResult = bIterable.next()) {
|
|
1804
1811
|
if (bResult.done) {
|
|
1805
1812
|
break;
|
|
@@ -1808,8 +1815,8 @@ function areMapsEqual(a, b, state) {
|
|
|
1808
1815
|
matchIndex++;
|
|
1809
1816
|
continue;
|
|
1810
1817
|
}
|
|
1811
|
-
|
|
1812
|
-
|
|
1818
|
+
const aEntry = aResult.value;
|
|
1819
|
+
const bEntry = bResult.value;
|
|
1813
1820
|
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)) {
|
|
1814
1821
|
hasMatch = matchedIndices[matchIndex] = true;
|
|
1815
1822
|
break;
|
|
@@ -1823,10 +1830,9 @@ function areMapsEqual(a, b, state) {
|
|
|
1823
1830
|
}
|
|
1824
1831
|
return true;
|
|
1825
1832
|
}
|
|
1826
|
-
var areNumbersEqual = sameValueZeroEqual;
|
|
1827
1833
|
function areObjectsEqual(a, b, state) {
|
|
1828
|
-
|
|
1829
|
-
|
|
1834
|
+
const properties = keys$4(a);
|
|
1835
|
+
let index = properties.length;
|
|
1830
1836
|
if (keys$4(b).length !== index) {
|
|
1831
1837
|
return false;
|
|
1832
1838
|
}
|
|
@@ -1838,14 +1844,14 @@ function areObjectsEqual(a, b, state) {
|
|
|
1838
1844
|
return true;
|
|
1839
1845
|
}
|
|
1840
1846
|
function areObjectsEqualStrict(a, b, state) {
|
|
1841
|
-
|
|
1842
|
-
|
|
1847
|
+
const properties = getStrictProperties(a);
|
|
1848
|
+
let index = properties.length;
|
|
1843
1849
|
if (getStrictProperties(b).length !== index) {
|
|
1844
1850
|
return false;
|
|
1845
1851
|
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1852
|
+
let property;
|
|
1853
|
+
let descriptorA;
|
|
1854
|
+
let descriptorB;
|
|
1849
1855
|
while (index-- > 0) {
|
|
1850
1856
|
property = properties[index];
|
|
1851
1857
|
if (!isPropertyEqual(a, b, state, property)) {
|
|
@@ -1860,30 +1866,30 @@ function areObjectsEqualStrict(a, b, state) {
|
|
|
1860
1866
|
return true;
|
|
1861
1867
|
}
|
|
1862
1868
|
function arePrimitiveWrappersEqual(a, b) {
|
|
1863
|
-
return
|
|
1869
|
+
return sameValueEqual(a.valueOf(), b.valueOf());
|
|
1864
1870
|
}
|
|
1865
1871
|
function areRegExpsEqual(a, b) {
|
|
1866
1872
|
return a.source === b.source && a.flags === b.flags;
|
|
1867
1873
|
}
|
|
1868
1874
|
function areSetsEqual(a, b, state) {
|
|
1869
|
-
|
|
1875
|
+
const size = a.size;
|
|
1870
1876
|
if (size !== b.size) {
|
|
1871
1877
|
return false;
|
|
1872
1878
|
}
|
|
1873
1879
|
if (!size) {
|
|
1874
1880
|
return true;
|
|
1875
1881
|
}
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1882
|
+
const matchedIndices = new Array(size);
|
|
1883
|
+
const aIterable = a.values();
|
|
1884
|
+
let aResult;
|
|
1885
|
+
let bResult;
|
|
1880
1886
|
while (aResult = aIterable.next()) {
|
|
1881
1887
|
if (aResult.done) {
|
|
1882
1888
|
break;
|
|
1883
1889
|
}
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1890
|
+
const bIterable = b.values();
|
|
1891
|
+
let hasMatch = false;
|
|
1892
|
+
let matchIndex = 0;
|
|
1887
1893
|
while (bResult = bIterable.next()) {
|
|
1888
1894
|
if (bResult.done) {
|
|
1889
1895
|
break;
|
|
@@ -1901,8 +1907,8 @@ function areSetsEqual(a, b, state) {
|
|
|
1901
1907
|
return true;
|
|
1902
1908
|
}
|
|
1903
1909
|
function areTypedArraysEqual(a, b) {
|
|
1904
|
-
|
|
1905
|
-
if (b.
|
|
1910
|
+
let index = a.byteLength;
|
|
1911
|
+
if (b.byteLength !== index || a.byteOffset !== b.byteOffset) {
|
|
1906
1912
|
return false;
|
|
1907
1913
|
}
|
|
1908
1914
|
while (index-- > 0) {
|
|
@@ -1921,23 +1927,10 @@ function isPropertyEqual(a, b, state, property) {
|
|
|
1921
1927
|
}
|
|
1922
1928
|
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
|
1923
1929
|
}
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
var MAP_TAG = "[object Map]";
|
|
1929
|
-
var NUMBER_TAG = "[object Number]";
|
|
1930
|
-
var OBJECT_TAG = "[object Object]";
|
|
1931
|
-
var REG_EXP_TAG = "[object RegExp]";
|
|
1932
|
-
var SET_TAG = "[object Set]";
|
|
1933
|
-
var STRING_TAG = "[object String]";
|
|
1934
|
-
var URL_TAG = "[object URL]";
|
|
1935
|
-
var isArray$4 = Array.isArray;
|
|
1936
|
-
var isTypedArray$2 = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
|
|
1937
|
-
var assign = Object.assign;
|
|
1938
|
-
var getTag$4 = Object.prototype.toString.call.bind(Object.prototype.toString);
|
|
1939
|
-
function createEqualityComparator(_a) {
|
|
1940
|
-
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;
|
|
1930
|
+
const toString = Object.prototype.toString;
|
|
1931
|
+
function createEqualityComparator(config) {
|
|
1932
|
+
const supportedComparatorMap = createSupportedComparatorMap(config);
|
|
1933
|
+
const { areArraysEqual: areArraysEqual2, areDatesEqual: areDatesEqual2, areFunctionsEqual, areMapsEqual: areMapsEqual2, areNumbersEqual, areObjectsEqual: areObjectsEqual2, areRegExpsEqual: areRegExpsEqual2, areSetsEqual: areSetsEqual2, getUnsupportedCustomComparator } = config;
|
|
1941
1934
|
return function comparator(a, b, state) {
|
|
1942
1935
|
if (a === b) {
|
|
1943
1936
|
return true;
|
|
@@ -1945,32 +1938,29 @@ function createEqualityComparator(_a) {
|
|
|
1945
1938
|
if (a == null || b == null) {
|
|
1946
1939
|
return false;
|
|
1947
1940
|
}
|
|
1948
|
-
|
|
1941
|
+
const type = typeof a;
|
|
1949
1942
|
if (type !== typeof b) {
|
|
1950
1943
|
return false;
|
|
1951
1944
|
}
|
|
1952
1945
|
if (type !== "object") {
|
|
1953
|
-
if (type === "number") {
|
|
1954
|
-
return
|
|
1946
|
+
if (type === "number" || type === "bigint") {
|
|
1947
|
+
return areNumbersEqual(a, b, state);
|
|
1955
1948
|
}
|
|
1956
1949
|
if (type === "function") {
|
|
1957
|
-
return
|
|
1950
|
+
return areFunctionsEqual(a, b, state);
|
|
1958
1951
|
}
|
|
1959
1952
|
return false;
|
|
1960
1953
|
}
|
|
1961
|
-
|
|
1954
|
+
const constructor = a.constructor;
|
|
1962
1955
|
if (constructor !== b.constructor) {
|
|
1963
1956
|
return false;
|
|
1964
1957
|
}
|
|
1965
1958
|
if (constructor === Object) {
|
|
1966
1959
|
return areObjectsEqual2(a, b, state);
|
|
1967
1960
|
}
|
|
1968
|
-
if (
|
|
1961
|
+
if (constructor === Array) {
|
|
1969
1962
|
return areArraysEqual2(a, b, state);
|
|
1970
1963
|
}
|
|
1971
|
-
if (isTypedArray$2 != null && isTypedArray$2(a)) {
|
|
1972
|
-
return areTypedArraysEqual2(a, b, state);
|
|
1973
|
-
}
|
|
1974
1964
|
if (constructor === Date) {
|
|
1975
1965
|
return areDatesEqual2(a, b, state);
|
|
1976
1966
|
}
|
|
@@ -1983,79 +1973,55 @@ function createEqualityComparator(_a) {
|
|
|
1983
1973
|
if (constructor === Set) {
|
|
1984
1974
|
return areSetsEqual2(a, b, state);
|
|
1985
1975
|
}
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
return areDatesEqual2(a, b, state);
|
|
1989
|
-
}
|
|
1990
|
-
if (tag === REG_EXP_TAG) {
|
|
1991
|
-
return areRegExpsEqual2(a, b, state);
|
|
1992
|
-
}
|
|
1993
|
-
if (tag === MAP_TAG) {
|
|
1994
|
-
return areMapsEqual2(a, b, state);
|
|
1995
|
-
}
|
|
1996
|
-
if (tag === SET_TAG) {
|
|
1997
|
-
return areSetsEqual2(a, b, state);
|
|
1998
|
-
}
|
|
1999
|
-
if (tag === OBJECT_TAG) {
|
|
2000
|
-
return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
|
|
2001
|
-
}
|
|
2002
|
-
if (tag === URL_TAG) {
|
|
2003
|
-
return areUrlsEqual2(a, b, state);
|
|
2004
|
-
}
|
|
2005
|
-
if (tag === ERROR_TAG) {
|
|
2006
|
-
return areErrorsEqual2(a, b, state);
|
|
1976
|
+
if (constructor === Promise) {
|
|
1977
|
+
return false;
|
|
2007
1978
|
}
|
|
2008
|
-
if (
|
|
2009
|
-
return
|
|
1979
|
+
if (Array.isArray(a)) {
|
|
1980
|
+
return areArraysEqual2(a, b, state);
|
|
2010
1981
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
1982
|
+
const tag = toString.call(a);
|
|
1983
|
+
const supportedComparator = supportedComparatorMap[tag];
|
|
1984
|
+
if (supportedComparator) {
|
|
1985
|
+
return supportedComparator(a, b, state);
|
|
2013
1986
|
}
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
var shortTag = getShortTag(a);
|
|
2018
|
-
if (shortTag) {
|
|
2019
|
-
unknownTagComparator = unknownTagComparators[shortTag];
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
if (unknownTagComparator) {
|
|
2023
|
-
return unknownTagComparator(a, b, state);
|
|
2024
|
-
}
|
|
1987
|
+
const unsupportedCustomComparator = getUnsupportedCustomComparator && getUnsupportedCustomComparator(a, b, state, tag);
|
|
1988
|
+
if (unsupportedCustomComparator) {
|
|
1989
|
+
return unsupportedCustomComparator(a, b, state);
|
|
2025
1990
|
}
|
|
2026
1991
|
return false;
|
|
2027
1992
|
};
|
|
2028
1993
|
}
|
|
2029
|
-
function createEqualityComparatorConfig(
|
|
2030
|
-
|
|
2031
|
-
|
|
1994
|
+
function createEqualityComparatorConfig({ circular, createCustomConfig, strict }) {
|
|
1995
|
+
let config = {
|
|
1996
|
+
areArrayBuffersEqual,
|
|
2032
1997
|
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
1998
|
+
areDataViewsEqual,
|
|
2033
1999
|
areDatesEqual,
|
|
2034
2000
|
areErrorsEqual,
|
|
2035
|
-
areFunctionsEqual,
|
|
2001
|
+
areFunctionsEqual: strictEqual,
|
|
2036
2002
|
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
2037
|
-
areNumbersEqual,
|
|
2003
|
+
areNumbersEqual: sameValueEqual,
|
|
2038
2004
|
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
|
2039
2005
|
arePrimitiveWrappersEqual,
|
|
2040
2006
|
areRegExpsEqual,
|
|
2041
2007
|
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
2042
|
-
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
|
|
2008
|
+
areTypedArraysEqual: strict ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
|
|
2043
2009
|
areUrlsEqual,
|
|
2044
|
-
|
|
2010
|
+
getUnsupportedCustomComparator: void 0
|
|
2045
2011
|
};
|
|
2046
2012
|
if (createCustomConfig) {
|
|
2047
|
-
config = assign({}, config, createCustomConfig(config));
|
|
2013
|
+
config = Object.assign({}, config, createCustomConfig(config));
|
|
2048
2014
|
}
|
|
2049
2015
|
if (circular) {
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
config = assign({}, config, {
|
|
2055
|
-
areArraysEqual:
|
|
2056
|
-
areMapsEqual:
|
|
2057
|
-
areObjectsEqual:
|
|
2058
|
-
areSetsEqual:
|
|
2016
|
+
const areArraysEqual2 = createIsCircular(config.areArraysEqual);
|
|
2017
|
+
const areMapsEqual2 = createIsCircular(config.areMapsEqual);
|
|
2018
|
+
const areObjectsEqual2 = createIsCircular(config.areObjectsEqual);
|
|
2019
|
+
const areSetsEqual2 = createIsCircular(config.areSetsEqual);
|
|
2020
|
+
config = Object.assign({}, config, {
|
|
2021
|
+
areArraysEqual: areArraysEqual2,
|
|
2022
|
+
areMapsEqual: areMapsEqual2,
|
|
2023
|
+
areObjectsEqual: areObjectsEqual2,
|
|
2024
|
+
areSetsEqual: areSetsEqual2
|
|
2059
2025
|
});
|
|
2060
2026
|
}
|
|
2061
2027
|
return config;
|
|
@@ -2065,11 +2031,10 @@ function createInternalEqualityComparator(compare) {
|
|
|
2065
2031
|
return compare(a, b, state);
|
|
2066
2032
|
};
|
|
2067
2033
|
}
|
|
2068
|
-
function createIsEqual(
|
|
2069
|
-
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
|
2034
|
+
function createIsEqual({ circular, comparator, createState, equals, strict }) {
|
|
2070
2035
|
if (createState) {
|
|
2071
2036
|
return function isEqual(a, b) {
|
|
2072
|
-
|
|
2037
|
+
const { cache = circular ? /* @__PURE__ */ new WeakMap() : void 0, meta } = createState();
|
|
2073
2038
|
return comparator(a, b, {
|
|
2074
2039
|
cache,
|
|
2075
2040
|
equals,
|
|
@@ -2088,7 +2053,7 @@ function createIsEqual(_a) {
|
|
|
2088
2053
|
});
|
|
2089
2054
|
};
|
|
2090
2055
|
}
|
|
2091
|
-
|
|
2056
|
+
const state = {
|
|
2092
2057
|
cache: void 0,
|
|
2093
2058
|
equals,
|
|
2094
2059
|
meta: void 0,
|
|
@@ -2098,7 +2063,50 @@ function createIsEqual(_a) {
|
|
|
2098
2063
|
return comparator(a, b, state);
|
|
2099
2064
|
};
|
|
2100
2065
|
}
|
|
2101
|
-
|
|
2066
|
+
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 }) {
|
|
2067
|
+
return {
|
|
2068
|
+
"[object Arguments]": areObjectsEqual2,
|
|
2069
|
+
"[object Array]": areArraysEqual2,
|
|
2070
|
+
"[object ArrayBuffer]": areArrayBuffersEqual2,
|
|
2071
|
+
"[object AsyncGeneratorFunction]": areFunctionsEqual,
|
|
2072
|
+
"[object BigInt]": areNumbersEqual,
|
|
2073
|
+
"[object BigInt64Array]": areTypedArraysEqual2,
|
|
2074
|
+
"[object BigUint64Array]": areTypedArraysEqual2,
|
|
2075
|
+
"[object Boolean]": arePrimitiveWrappersEqual2,
|
|
2076
|
+
"[object DataView]": areDataViewsEqual2,
|
|
2077
|
+
"[object Date]": areDatesEqual2,
|
|
2078
|
+
// If an error tag, it should be tested explicitly. Like RegExp, the properties are not
|
|
2079
|
+
// enumerable, and therefore will give false positives if tested like a standard object.
|
|
2080
|
+
"[object Error]": areErrorsEqual2,
|
|
2081
|
+
"[object Float16Array]": areTypedArraysEqual2,
|
|
2082
|
+
"[object Float32Array]": areTypedArraysEqual2,
|
|
2083
|
+
"[object Float64Array]": areTypedArraysEqual2,
|
|
2084
|
+
"[object Function]": areFunctionsEqual,
|
|
2085
|
+
"[object GeneratorFunction]": areFunctionsEqual,
|
|
2086
|
+
"[object Int8Array]": areTypedArraysEqual2,
|
|
2087
|
+
"[object Int16Array]": areTypedArraysEqual2,
|
|
2088
|
+
"[object Int32Array]": areTypedArraysEqual2,
|
|
2089
|
+
"[object Map]": areMapsEqual2,
|
|
2090
|
+
"[object Number]": arePrimitiveWrappersEqual2,
|
|
2091
|
+
"[object Object]": (a, b, state) => (
|
|
2092
|
+
// The exception for value comparison is custom `Promise`-like class instances. These should
|
|
2093
|
+
// be treated the same as standard `Promise` objects, which means strict equality, and if
|
|
2094
|
+
// it reaches this point then that strict equality comparison has already failed.
|
|
2095
|
+
typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state)
|
|
2096
|
+
),
|
|
2097
|
+
// For RegExp, the properties are not enumerable, and therefore will give false positives if
|
|
2098
|
+
// tested like a standard object.
|
|
2099
|
+
"[object RegExp]": areRegExpsEqual2,
|
|
2100
|
+
"[object Set]": areSetsEqual2,
|
|
2101
|
+
"[object String]": arePrimitiveWrappersEqual2,
|
|
2102
|
+
"[object URL]": areUrlsEqual2,
|
|
2103
|
+
"[object Uint8Array]": areTypedArraysEqual2,
|
|
2104
|
+
"[object Uint8ClampedArray]": areTypedArraysEqual2,
|
|
2105
|
+
"[object Uint16Array]": areTypedArraysEqual2,
|
|
2106
|
+
"[object Uint32Array]": areTypedArraysEqual2
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
const deepEqual = createCustomEqual();
|
|
2102
2110
|
createCustomEqual({ strict: true });
|
|
2103
2111
|
createCustomEqual({ circular: true });
|
|
2104
2112
|
createCustomEqual({
|
|
@@ -2106,37 +2114,26 @@ createCustomEqual({
|
|
|
2106
2114
|
strict: true
|
|
2107
2115
|
});
|
|
2108
2116
|
createCustomEqual({
|
|
2109
|
-
createInternalComparator:
|
|
2110
|
-
return sameValueZeroEqual;
|
|
2111
|
-
}
|
|
2117
|
+
createInternalComparator: () => sameValueEqual
|
|
2112
2118
|
});
|
|
2113
2119
|
createCustomEqual({
|
|
2114
2120
|
strict: true,
|
|
2115
|
-
createInternalComparator:
|
|
2116
|
-
return sameValueZeroEqual;
|
|
2117
|
-
}
|
|
2121
|
+
createInternalComparator: () => sameValueEqual
|
|
2118
2122
|
});
|
|
2119
2123
|
createCustomEqual({
|
|
2120
2124
|
circular: true,
|
|
2121
|
-
createInternalComparator:
|
|
2122
|
-
return sameValueZeroEqual;
|
|
2123
|
-
}
|
|
2125
|
+
createInternalComparator: () => sameValueEqual
|
|
2124
2126
|
});
|
|
2125
2127
|
createCustomEqual({
|
|
2126
2128
|
circular: true,
|
|
2127
|
-
createInternalComparator:
|
|
2128
|
-
return sameValueZeroEqual;
|
|
2129
|
-
},
|
|
2129
|
+
createInternalComparator: () => sameValueEqual,
|
|
2130
2130
|
strict: true
|
|
2131
2131
|
});
|
|
2132
|
-
function createCustomEqual(options) {
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
var config = createEqualityComparatorConfig(options);
|
|
2138
|
-
var comparator = createEqualityComparator(config);
|
|
2139
|
-
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
|
2132
|
+
function createCustomEqual(options = {}) {
|
|
2133
|
+
const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false } = options;
|
|
2134
|
+
const config = createEqualityComparatorConfig(options);
|
|
2135
|
+
const comparator = createEqualityComparator(config);
|
|
2136
|
+
const equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
|
2140
2137
|
return createIsEqual({ circular, comparator, createState, equals, strict });
|
|
2141
2138
|
}
|
|
2142
2139
|
function listCacheClear$1() {
|
|
@@ -3386,7 +3383,10 @@ class CollectionRegistry {
|
|
|
3386
3383
|
if (!relation) {
|
|
3387
3384
|
throw new Error(`Relation '${relationKey}' not found in collection '${currentCollection.slug}'`);
|
|
3388
3385
|
}
|
|
3389
|
-
|
|
3386
|
+
const target = relation.target();
|
|
3387
|
+
const targetRelationKey = relation.relationName || target.slug;
|
|
3388
|
+
const targetSlug = relation.overrides?.slug ?? targetRelationKey;
|
|
3389
|
+
currentCollection = this.get(targetSlug) || this.normalizeCollection(target);
|
|
3390
3390
|
if (i + 1 < pathSegments.length) ;
|
|
3391
3391
|
}
|
|
3392
3392
|
return currentCollection;
|
|
@@ -3435,7 +3435,7 @@ class CollectionRegistry {
|
|
|
3435
3435
|
if (!subcollection) {
|
|
3436
3436
|
throw new Error(`Subcollection '${subcollectionSlug}' not found in ${currentCollection.slug}`);
|
|
3437
3437
|
}
|
|
3438
|
-
currentCollection = subcollection;
|
|
3438
|
+
currentCollection = this.get(subcollection.slug) || this.normalizeCollection(subcollection);
|
|
3439
3439
|
collections.push(currentCollection);
|
|
3440
3440
|
}
|
|
3441
3441
|
}
|
|
@@ -6622,7 +6622,7 @@ class EntityPersistService {
|
|
|
6622
6622
|
targetColumnName = relation.localKey;
|
|
6623
6623
|
} else if (relation.foreignKeyOnTarget) {
|
|
6624
6624
|
targetColumnName = relation.foreignKeyOnTarget;
|
|
6625
|
-
} else if (relation.joinPath && relation.joinPath.length
|
|
6625
|
+
} else if (relation.joinPath && relation.joinPath.length === 1) {
|
|
6626
6626
|
const targetTableName = getTableName(targetCollection);
|
|
6627
6627
|
const relevantJoinStep = relation.joinPath.find((joinStep) => joinStep.table === targetTableName);
|
|
6628
6628
|
if (relevantJoinStep) {
|
|
@@ -6633,6 +6633,8 @@ class EntityPersistService {
|
|
|
6633
6633
|
const targetColumnNames = DrizzleConditionBuilder.getColumnNamesFromColumns(relation.joinPath[0].on.to);
|
|
6634
6634
|
targetColumnName = targetColumnNames[0];
|
|
6635
6635
|
}
|
|
6636
|
+
} else if (relation.joinPath && relation.joinPath.length > 1) {
|
|
6637
|
+
break;
|
|
6636
6638
|
} else {
|
|
6637
6639
|
throw new Error(`Relation '${relationKey}' lacks configuration for path-based saving.`);
|
|
6638
6640
|
}
|
|
@@ -7095,6 +7097,14 @@ class PostgresBackendDriver {
|
|
|
7095
7097
|
} : {}
|
|
7096
7098
|
};
|
|
7097
7099
|
}
|
|
7100
|
+
/**
|
|
7101
|
+
* REST-optimised fetch service (include-aware eager-loading).
|
|
7102
|
+
* Delegates to the underlying EntityFetchService which already
|
|
7103
|
+
* implements the matching method signatures.
|
|
7104
|
+
*/
|
|
7105
|
+
get restFetchService() {
|
|
7106
|
+
return this.entityService.getFetchService();
|
|
7107
|
+
}
|
|
7098
7108
|
resolveCollectionCallbacks(collection, path2) {
|
|
7099
7109
|
if (!collection && !path2) return {
|
|
7100
7110
|
collection: void 0,
|
|
@@ -8543,29 +8553,10 @@ const generateSchema = async (collections, stripPolicies = false) => {
|
|
|
8543
8553
|
references: [${targetTableVar}.${getPrimaryKeyName(target)}],
|
|
8544
8554
|
relationName: "${drizzleRelationName}"
|
|
8545
8555
|
})`);
|
|
8546
|
-
} else if (rel.direction === "inverse"
|
|
8547
|
-
const sourceIdField = getPrimaryKeyName(collection);
|
|
8556
|
+
} else if (rel.direction === "inverse") {
|
|
8548
8557
|
tableRelations.push(` "${relationKey}": one(${targetTableVar}, {
|
|
8549
|
-
fields: [${tableVarName}.${sourceIdField}],
|
|
8550
|
-
references: [${targetTableVar}.${rel.foreignKeyOnTarget}],
|
|
8551
8558
|
relationName: "${drizzleRelationName}"
|
|
8552
8559
|
})`);
|
|
8553
|
-
} else if (rel.direction === "inverse" && !rel.foreignKeyOnTarget) {
|
|
8554
|
-
try {
|
|
8555
|
-
const targetCollection = rel.target();
|
|
8556
|
-
const targetResolvedRelations = resolveCollectionRelations(targetCollection);
|
|
8557
|
-
const correspondingRelation = Object.values(targetResolvedRelations).find((targetRel) => targetRel.direction === "owning" && targetRel.cardinality === "one" && targetRel.target().slug === collection.slug);
|
|
8558
|
-
if (correspondingRelation && correspondingRelation.localKey) {
|
|
8559
|
-
const sourceIdField = getPrimaryKeyName(collection);
|
|
8560
|
-
tableRelations.push(` "${relationKey}": one(${targetTableVar}, {
|
|
8561
|
-
fields: [${tableVarName}.${sourceIdField}],
|
|
8562
|
-
references: [${targetTableVar}.${correspondingRelation.localKey}],
|
|
8563
|
-
relationName: "${drizzleRelationName}"
|
|
8564
|
-
})`);
|
|
8565
|
-
}
|
|
8566
|
-
} catch (e) {
|
|
8567
|
-
console.warn(`Could not resolve inverse one-to-one relation '${relationKey}':`, e);
|
|
8568
|
-
}
|
|
8569
8560
|
}
|
|
8570
8561
|
} else if (rel.cardinality === "many") {
|
|
8571
8562
|
if (rel.direction === "inverse" && rel.foreignKeyOnTarget) {
|