@rebasepro/server-postgresql 0.0.1-canary.6e26b67 → 0.0.1-canary.892f711
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 +184 -186
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +184 -186
- package/dist/index.umd.js.map +1 -1
- package/dist/server-postgresql/src/PostgresBackendDriver.d.ts +6 -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 +71 -87
- package/dist/types/src/types/slots.d.ts +20 -10
- package/dist/types/src/types/translations.d.ts +4 -0
- package/package.json +5 -5
- package/src/PostgresBackendDriver.ts +9 -0
- package/src/cli.ts +2 -2
- package/src/schema/doctor.ts +14 -2
- package/src/schema/generate-drizzle-schema-logic.ts +24 -30
- package/src/schema/introspect-db-logic.ts +33 -30
- package/src/services/EntityPersistService.ts +7 -1
- package/test/generate-drizzle-schema.test.ts +214 -0
- package/test/introspect-db-generation.test.ts +27 -5
- package/test/relations.test.ts +4 -4
- package/jest-all.log +0 -3128
- package/jest.log +0 -49
- package/scratch.ts +0 -41
- package/test-drizzle-bug.ts +0 -18
- package/test-drizzle-out/0000_cultured_freak.sql +0 -7
- package/test-drizzle-out/0001_tiresome_professor_monster.sql +0 -1
- package/test-drizzle-out/meta/0000_snapshot.json +0 -55
- package/test-drizzle-out/meta/0001_snapshot.json +0 -63
- package/test-drizzle-out/meta/_journal.json +0 -20
- package/test-drizzle-prompt.sh +0 -2
- package/test-policy-prompt.sh +0 -3
- package/test-programmatic.ts +0 -30
- package/test-programmatic2.ts +0 -59
- package/test-schema-no-policies.ts +0 -12
- package/test_drizzle_mock.js +0 -3
- package/test_find_changed.mjs +0 -32
- package/test_hash.js +0 -14
- package/test_output.txt +0 -3145
package/dist/index.es.js
CHANGED
|
@@ -124,7 +124,8 @@ function getDataSourceCapabilities(driver) {
|
|
|
124
124
|
}
|
|
125
125
|
const DEFAULT_ONE_OF_TYPE = "type";
|
|
126
126
|
const DEFAULT_ONE_OF_VALUE = "value";
|
|
127
|
-
const
|
|
127
|
+
const tokenizeRegex = /[A-Z]{2,}(?=[A-Z][a-z]|\b)|[A-Z]?[a-z]+|[0-9]+(?:[a-z](?![a-z]))?|[A-Z]/g;
|
|
128
|
+
const snakeCaseRegex = tokenizeRegex;
|
|
128
129
|
const toSnakeCase = (str) => {
|
|
129
130
|
const regExpMatchArray = str.match(snakeCaseRegex);
|
|
130
131
|
if (!regExpMatchArray) return "";
|
|
@@ -1717,8 +1718,8 @@ var logic = { exports: {} };
|
|
|
1717
1718
|
return jsonLogic;
|
|
1718
1719
|
});
|
|
1719
1720
|
})(logic);
|
|
1720
|
-
|
|
1721
|
-
|
|
1721
|
+
const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
1722
|
+
const { hasOwnProperty: hasOwnProperty$a } = Object.prototype;
|
|
1722
1723
|
function combineComparators(comparatorA, comparatorB) {
|
|
1723
1724
|
return function isEqual(a, b, state) {
|
|
1724
1725
|
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
@@ -1729,38 +1730,45 @@ function createIsCircular(areItemsEqual) {
|
|
|
1729
1730
|
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
|
1730
1731
|
return areItemsEqual(a, b, state);
|
|
1731
1732
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1733
|
+
const { cache } = state;
|
|
1734
|
+
const cachedA = cache.get(a);
|
|
1735
|
+
const cachedB = cache.get(b);
|
|
1735
1736
|
if (cachedA && cachedB) {
|
|
1736
1737
|
return cachedA === b && cachedB === a;
|
|
1737
1738
|
}
|
|
1738
1739
|
cache.set(a, b);
|
|
1739
1740
|
cache.set(b, a);
|
|
1740
|
-
|
|
1741
|
+
const result = areItemsEqual(a, b, state);
|
|
1741
1742
|
cache.delete(a);
|
|
1742
1743
|
cache.delete(b);
|
|
1743
1744
|
return result;
|
|
1744
1745
|
};
|
|
1745
1746
|
}
|
|
1746
|
-
function getShortTag(value) {
|
|
1747
|
-
return value != null ? value[Symbol.toStringTag] : void 0;
|
|
1748
|
-
}
|
|
1749
1747
|
function getStrictProperties(object) {
|
|
1750
1748
|
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
1751
1749
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1750
|
+
const hasOwn = (
|
|
1751
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1752
|
+
Object.hasOwn || ((object, property) => hasOwnProperty$a.call(object, property))
|
|
1753
|
+
);
|
|
1754
|
+
const PREACT_VNODE = "__v";
|
|
1755
|
+
const PREACT_OWNER = "__o";
|
|
1756
|
+
const REACT_OWNER = "_owner";
|
|
1757
|
+
const { getOwnPropertyDescriptor, keys: keys$4 } = Object;
|
|
1758
|
+
const sameValueEqual = (
|
|
1759
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1760
|
+
Object.is || function sameValueEqual2(a, b) {
|
|
1761
|
+
return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
|
|
1762
|
+
}
|
|
1763
|
+
);
|
|
1764
|
+
function strictEqual(a, b) {
|
|
1765
|
+
return a === b;
|
|
1766
|
+
}
|
|
1767
|
+
function areArrayBuffersEqual(a, b) {
|
|
1768
|
+
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
|
|
1757
1769
|
}
|
|
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
1770
|
function areArraysEqual(a, b, state) {
|
|
1763
|
-
|
|
1771
|
+
let index = a.length;
|
|
1764
1772
|
if (b.length !== index) {
|
|
1765
1773
|
return false;
|
|
1766
1774
|
}
|
|
@@ -1771,35 +1779,35 @@ function areArraysEqual(a, b, state) {
|
|
|
1771
1779
|
}
|
|
1772
1780
|
return true;
|
|
1773
1781
|
}
|
|
1782
|
+
function areDataViewsEqual(a, b) {
|
|
1783
|
+
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
|
|
1784
|
+
}
|
|
1774
1785
|
function areDatesEqual(a, b) {
|
|
1775
|
-
return
|
|
1786
|
+
return sameValueEqual(a.getTime(), b.getTime());
|
|
1776
1787
|
}
|
|
1777
1788
|
function areErrorsEqual(a, b) {
|
|
1778
1789
|
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
|
1779
1790
|
}
|
|
1780
|
-
function areFunctionsEqual(a, b) {
|
|
1781
|
-
return a === b;
|
|
1782
|
-
}
|
|
1783
1791
|
function areMapsEqual(a, b, state) {
|
|
1784
|
-
|
|
1792
|
+
const size = a.size;
|
|
1785
1793
|
if (size !== b.size) {
|
|
1786
1794
|
return false;
|
|
1787
1795
|
}
|
|
1788
1796
|
if (!size) {
|
|
1789
1797
|
return true;
|
|
1790
1798
|
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1799
|
+
const matchedIndices = new Array(size);
|
|
1800
|
+
const aIterable = a.entries();
|
|
1801
|
+
let aResult;
|
|
1802
|
+
let bResult;
|
|
1803
|
+
let index = 0;
|
|
1796
1804
|
while (aResult = aIterable.next()) {
|
|
1797
1805
|
if (aResult.done) {
|
|
1798
1806
|
break;
|
|
1799
1807
|
}
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1808
|
+
const bIterable = b.entries();
|
|
1809
|
+
let hasMatch = false;
|
|
1810
|
+
let matchIndex = 0;
|
|
1803
1811
|
while (bResult = bIterable.next()) {
|
|
1804
1812
|
if (bResult.done) {
|
|
1805
1813
|
break;
|
|
@@ -1808,8 +1816,8 @@ function areMapsEqual(a, b, state) {
|
|
|
1808
1816
|
matchIndex++;
|
|
1809
1817
|
continue;
|
|
1810
1818
|
}
|
|
1811
|
-
|
|
1812
|
-
|
|
1819
|
+
const aEntry = aResult.value;
|
|
1820
|
+
const bEntry = bResult.value;
|
|
1813
1821
|
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
1822
|
hasMatch = matchedIndices[matchIndex] = true;
|
|
1815
1823
|
break;
|
|
@@ -1823,10 +1831,9 @@ function areMapsEqual(a, b, state) {
|
|
|
1823
1831
|
}
|
|
1824
1832
|
return true;
|
|
1825
1833
|
}
|
|
1826
|
-
var areNumbersEqual = sameValueZeroEqual;
|
|
1827
1834
|
function areObjectsEqual(a, b, state) {
|
|
1828
|
-
|
|
1829
|
-
|
|
1835
|
+
const properties = keys$4(a);
|
|
1836
|
+
let index = properties.length;
|
|
1830
1837
|
if (keys$4(b).length !== index) {
|
|
1831
1838
|
return false;
|
|
1832
1839
|
}
|
|
@@ -1838,14 +1845,14 @@ function areObjectsEqual(a, b, state) {
|
|
|
1838
1845
|
return true;
|
|
1839
1846
|
}
|
|
1840
1847
|
function areObjectsEqualStrict(a, b, state) {
|
|
1841
|
-
|
|
1842
|
-
|
|
1848
|
+
const properties = getStrictProperties(a);
|
|
1849
|
+
let index = properties.length;
|
|
1843
1850
|
if (getStrictProperties(b).length !== index) {
|
|
1844
1851
|
return false;
|
|
1845
1852
|
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1853
|
+
let property;
|
|
1854
|
+
let descriptorA;
|
|
1855
|
+
let descriptorB;
|
|
1849
1856
|
while (index-- > 0) {
|
|
1850
1857
|
property = properties[index];
|
|
1851
1858
|
if (!isPropertyEqual(a, b, state, property)) {
|
|
@@ -1860,30 +1867,30 @@ function areObjectsEqualStrict(a, b, state) {
|
|
|
1860
1867
|
return true;
|
|
1861
1868
|
}
|
|
1862
1869
|
function arePrimitiveWrappersEqual(a, b) {
|
|
1863
|
-
return
|
|
1870
|
+
return sameValueEqual(a.valueOf(), b.valueOf());
|
|
1864
1871
|
}
|
|
1865
1872
|
function areRegExpsEqual(a, b) {
|
|
1866
1873
|
return a.source === b.source && a.flags === b.flags;
|
|
1867
1874
|
}
|
|
1868
1875
|
function areSetsEqual(a, b, state) {
|
|
1869
|
-
|
|
1876
|
+
const size = a.size;
|
|
1870
1877
|
if (size !== b.size) {
|
|
1871
1878
|
return false;
|
|
1872
1879
|
}
|
|
1873
1880
|
if (!size) {
|
|
1874
1881
|
return true;
|
|
1875
1882
|
}
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1883
|
+
const matchedIndices = new Array(size);
|
|
1884
|
+
const aIterable = a.values();
|
|
1885
|
+
let aResult;
|
|
1886
|
+
let bResult;
|
|
1880
1887
|
while (aResult = aIterable.next()) {
|
|
1881
1888
|
if (aResult.done) {
|
|
1882
1889
|
break;
|
|
1883
1890
|
}
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1891
|
+
const bIterable = b.values();
|
|
1892
|
+
let hasMatch = false;
|
|
1893
|
+
let matchIndex = 0;
|
|
1887
1894
|
while (bResult = bIterable.next()) {
|
|
1888
1895
|
if (bResult.done) {
|
|
1889
1896
|
break;
|
|
@@ -1901,8 +1908,8 @@ function areSetsEqual(a, b, state) {
|
|
|
1901
1908
|
return true;
|
|
1902
1909
|
}
|
|
1903
1910
|
function areTypedArraysEqual(a, b) {
|
|
1904
|
-
|
|
1905
|
-
if (b.
|
|
1911
|
+
let index = a.byteLength;
|
|
1912
|
+
if (b.byteLength !== index || a.byteOffset !== b.byteOffset) {
|
|
1906
1913
|
return false;
|
|
1907
1914
|
}
|
|
1908
1915
|
while (index-- > 0) {
|
|
@@ -1921,23 +1928,10 @@ function isPropertyEqual(a, b, state, property) {
|
|
|
1921
1928
|
}
|
|
1922
1929
|
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
|
1923
1930
|
}
|
|
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;
|
|
1931
|
+
const toString = Object.prototype.toString;
|
|
1932
|
+
function createEqualityComparator(config) {
|
|
1933
|
+
const supportedComparatorMap = createSupportedComparatorMap(config);
|
|
1934
|
+
const { areArraysEqual: areArraysEqual2, areDatesEqual: areDatesEqual2, areFunctionsEqual, areMapsEqual: areMapsEqual2, areNumbersEqual, areObjectsEqual: areObjectsEqual2, areRegExpsEqual: areRegExpsEqual2, areSetsEqual: areSetsEqual2, getUnsupportedCustomComparator } = config;
|
|
1941
1935
|
return function comparator(a, b, state) {
|
|
1942
1936
|
if (a === b) {
|
|
1943
1937
|
return true;
|
|
@@ -1945,32 +1939,29 @@ function createEqualityComparator(_a) {
|
|
|
1945
1939
|
if (a == null || b == null) {
|
|
1946
1940
|
return false;
|
|
1947
1941
|
}
|
|
1948
|
-
|
|
1942
|
+
const type = typeof a;
|
|
1949
1943
|
if (type !== typeof b) {
|
|
1950
1944
|
return false;
|
|
1951
1945
|
}
|
|
1952
1946
|
if (type !== "object") {
|
|
1953
|
-
if (type === "number") {
|
|
1954
|
-
return
|
|
1947
|
+
if (type === "number" || type === "bigint") {
|
|
1948
|
+
return areNumbersEqual(a, b, state);
|
|
1955
1949
|
}
|
|
1956
1950
|
if (type === "function") {
|
|
1957
|
-
return
|
|
1951
|
+
return areFunctionsEqual(a, b, state);
|
|
1958
1952
|
}
|
|
1959
1953
|
return false;
|
|
1960
1954
|
}
|
|
1961
|
-
|
|
1955
|
+
const constructor = a.constructor;
|
|
1962
1956
|
if (constructor !== b.constructor) {
|
|
1963
1957
|
return false;
|
|
1964
1958
|
}
|
|
1965
1959
|
if (constructor === Object) {
|
|
1966
1960
|
return areObjectsEqual2(a, b, state);
|
|
1967
1961
|
}
|
|
1968
|
-
if (
|
|
1962
|
+
if (constructor === Array) {
|
|
1969
1963
|
return areArraysEqual2(a, b, state);
|
|
1970
1964
|
}
|
|
1971
|
-
if (isTypedArray$2 != null && isTypedArray$2(a)) {
|
|
1972
|
-
return areTypedArraysEqual2(a, b, state);
|
|
1973
|
-
}
|
|
1974
1965
|
if (constructor === Date) {
|
|
1975
1966
|
return areDatesEqual2(a, b, state);
|
|
1976
1967
|
}
|
|
@@ -1983,79 +1974,55 @@ function createEqualityComparator(_a) {
|
|
|
1983
1974
|
if (constructor === Set) {
|
|
1984
1975
|
return areSetsEqual2(a, b, state);
|
|
1985
1976
|
}
|
|
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);
|
|
1977
|
+
if (constructor === Promise) {
|
|
1978
|
+
return false;
|
|
2004
1979
|
}
|
|
2005
|
-
if (
|
|
2006
|
-
return
|
|
1980
|
+
if (Array.isArray(a)) {
|
|
1981
|
+
return areArraysEqual2(a, b, state);
|
|
2007
1982
|
}
|
|
2008
|
-
|
|
2009
|
-
|
|
1983
|
+
const tag = toString.call(a);
|
|
1984
|
+
const supportedComparator = supportedComparatorMap[tag];
|
|
1985
|
+
if (supportedComparator) {
|
|
1986
|
+
return supportedComparator(a, b, state);
|
|
2010
1987
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
if (unknownTagComparators) {
|
|
2015
|
-
var unknownTagComparator = unknownTagComparators[tag];
|
|
2016
|
-
if (!unknownTagComparator) {
|
|
2017
|
-
var shortTag = getShortTag(a);
|
|
2018
|
-
if (shortTag) {
|
|
2019
|
-
unknownTagComparator = unknownTagComparators[shortTag];
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
if (unknownTagComparator) {
|
|
2023
|
-
return unknownTagComparator(a, b, state);
|
|
2024
|
-
}
|
|
1988
|
+
const unsupportedCustomComparator = getUnsupportedCustomComparator && getUnsupportedCustomComparator(a, b, state, tag);
|
|
1989
|
+
if (unsupportedCustomComparator) {
|
|
1990
|
+
return unsupportedCustomComparator(a, b, state);
|
|
2025
1991
|
}
|
|
2026
1992
|
return false;
|
|
2027
1993
|
};
|
|
2028
1994
|
}
|
|
2029
|
-
function createEqualityComparatorConfig(
|
|
2030
|
-
|
|
2031
|
-
|
|
1995
|
+
function createEqualityComparatorConfig({ circular, createCustomConfig, strict }) {
|
|
1996
|
+
let config = {
|
|
1997
|
+
areArrayBuffersEqual,
|
|
2032
1998
|
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
1999
|
+
areDataViewsEqual,
|
|
2033
2000
|
areDatesEqual,
|
|
2034
2001
|
areErrorsEqual,
|
|
2035
|
-
areFunctionsEqual,
|
|
2002
|
+
areFunctionsEqual: strictEqual,
|
|
2036
2003
|
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
2037
|
-
areNumbersEqual,
|
|
2004
|
+
areNumbersEqual: sameValueEqual,
|
|
2038
2005
|
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
|
2039
2006
|
arePrimitiveWrappersEqual,
|
|
2040
2007
|
areRegExpsEqual,
|
|
2041
2008
|
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
2042
|
-
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
|
|
2009
|
+
areTypedArraysEqual: strict ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
|
|
2043
2010
|
areUrlsEqual,
|
|
2044
|
-
|
|
2011
|
+
getUnsupportedCustomComparator: void 0
|
|
2045
2012
|
};
|
|
2046
2013
|
if (createCustomConfig) {
|
|
2047
|
-
config = assign({}, config, createCustomConfig(config));
|
|
2014
|
+
config = Object.assign({}, config, createCustomConfig(config));
|
|
2048
2015
|
}
|
|
2049
2016
|
if (circular) {
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
config = assign({}, config, {
|
|
2055
|
-
areArraysEqual:
|
|
2056
|
-
areMapsEqual:
|
|
2057
|
-
areObjectsEqual:
|
|
2058
|
-
areSetsEqual:
|
|
2017
|
+
const areArraysEqual2 = createIsCircular(config.areArraysEqual);
|
|
2018
|
+
const areMapsEqual2 = createIsCircular(config.areMapsEqual);
|
|
2019
|
+
const areObjectsEqual2 = createIsCircular(config.areObjectsEqual);
|
|
2020
|
+
const areSetsEqual2 = createIsCircular(config.areSetsEqual);
|
|
2021
|
+
config = Object.assign({}, config, {
|
|
2022
|
+
areArraysEqual: areArraysEqual2,
|
|
2023
|
+
areMapsEqual: areMapsEqual2,
|
|
2024
|
+
areObjectsEqual: areObjectsEqual2,
|
|
2025
|
+
areSetsEqual: areSetsEqual2
|
|
2059
2026
|
});
|
|
2060
2027
|
}
|
|
2061
2028
|
return config;
|
|
@@ -2065,11 +2032,10 @@ function createInternalEqualityComparator(compare) {
|
|
|
2065
2032
|
return compare(a, b, state);
|
|
2066
2033
|
};
|
|
2067
2034
|
}
|
|
2068
|
-
function createIsEqual(
|
|
2069
|
-
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
|
2035
|
+
function createIsEqual({ circular, comparator, createState, equals, strict }) {
|
|
2070
2036
|
if (createState) {
|
|
2071
2037
|
return function isEqual(a, b) {
|
|
2072
|
-
|
|
2038
|
+
const { cache = circular ? /* @__PURE__ */ new WeakMap() : void 0, meta } = createState();
|
|
2073
2039
|
return comparator(a, b, {
|
|
2074
2040
|
cache,
|
|
2075
2041
|
equals,
|
|
@@ -2088,7 +2054,7 @@ function createIsEqual(_a) {
|
|
|
2088
2054
|
});
|
|
2089
2055
|
};
|
|
2090
2056
|
}
|
|
2091
|
-
|
|
2057
|
+
const state = {
|
|
2092
2058
|
cache: void 0,
|
|
2093
2059
|
equals,
|
|
2094
2060
|
meta: void 0,
|
|
@@ -2098,7 +2064,50 @@ function createIsEqual(_a) {
|
|
|
2098
2064
|
return comparator(a, b, state);
|
|
2099
2065
|
};
|
|
2100
2066
|
}
|
|
2101
|
-
|
|
2067
|
+
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 }) {
|
|
2068
|
+
return {
|
|
2069
|
+
"[object Arguments]": areObjectsEqual2,
|
|
2070
|
+
"[object Array]": areArraysEqual2,
|
|
2071
|
+
"[object ArrayBuffer]": areArrayBuffersEqual2,
|
|
2072
|
+
"[object AsyncGeneratorFunction]": areFunctionsEqual,
|
|
2073
|
+
"[object BigInt]": areNumbersEqual,
|
|
2074
|
+
"[object BigInt64Array]": areTypedArraysEqual2,
|
|
2075
|
+
"[object BigUint64Array]": areTypedArraysEqual2,
|
|
2076
|
+
"[object Boolean]": arePrimitiveWrappersEqual2,
|
|
2077
|
+
"[object DataView]": areDataViewsEqual2,
|
|
2078
|
+
"[object Date]": areDatesEqual2,
|
|
2079
|
+
// If an error tag, it should be tested explicitly. Like RegExp, the properties are not
|
|
2080
|
+
// enumerable, and therefore will give false positives if tested like a standard object.
|
|
2081
|
+
"[object Error]": areErrorsEqual2,
|
|
2082
|
+
"[object Float16Array]": areTypedArraysEqual2,
|
|
2083
|
+
"[object Float32Array]": areTypedArraysEqual2,
|
|
2084
|
+
"[object Float64Array]": areTypedArraysEqual2,
|
|
2085
|
+
"[object Function]": areFunctionsEqual,
|
|
2086
|
+
"[object GeneratorFunction]": areFunctionsEqual,
|
|
2087
|
+
"[object Int8Array]": areTypedArraysEqual2,
|
|
2088
|
+
"[object Int16Array]": areTypedArraysEqual2,
|
|
2089
|
+
"[object Int32Array]": areTypedArraysEqual2,
|
|
2090
|
+
"[object Map]": areMapsEqual2,
|
|
2091
|
+
"[object Number]": arePrimitiveWrappersEqual2,
|
|
2092
|
+
"[object Object]": (a, b, state) => (
|
|
2093
|
+
// The exception for value comparison is custom `Promise`-like class instances. These should
|
|
2094
|
+
// be treated the same as standard `Promise` objects, which means strict equality, and if
|
|
2095
|
+
// it reaches this point then that strict equality comparison has already failed.
|
|
2096
|
+
typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state)
|
|
2097
|
+
),
|
|
2098
|
+
// For RegExp, the properties are not enumerable, and therefore will give false positives if
|
|
2099
|
+
// tested like a standard object.
|
|
2100
|
+
"[object RegExp]": areRegExpsEqual2,
|
|
2101
|
+
"[object Set]": areSetsEqual2,
|
|
2102
|
+
"[object String]": arePrimitiveWrappersEqual2,
|
|
2103
|
+
"[object URL]": areUrlsEqual2,
|
|
2104
|
+
"[object Uint8Array]": areTypedArraysEqual2,
|
|
2105
|
+
"[object Uint8ClampedArray]": areTypedArraysEqual2,
|
|
2106
|
+
"[object Uint16Array]": areTypedArraysEqual2,
|
|
2107
|
+
"[object Uint32Array]": areTypedArraysEqual2
|
|
2108
|
+
};
|
|
2109
|
+
}
|
|
2110
|
+
const deepEqual = createCustomEqual();
|
|
2102
2111
|
createCustomEqual({ strict: true });
|
|
2103
2112
|
createCustomEqual({ circular: true });
|
|
2104
2113
|
createCustomEqual({
|
|
@@ -2106,37 +2115,26 @@ createCustomEqual({
|
|
|
2106
2115
|
strict: true
|
|
2107
2116
|
});
|
|
2108
2117
|
createCustomEqual({
|
|
2109
|
-
createInternalComparator:
|
|
2110
|
-
return sameValueZeroEqual;
|
|
2111
|
-
}
|
|
2118
|
+
createInternalComparator: () => sameValueEqual
|
|
2112
2119
|
});
|
|
2113
2120
|
createCustomEqual({
|
|
2114
2121
|
strict: true,
|
|
2115
|
-
createInternalComparator:
|
|
2116
|
-
return sameValueZeroEqual;
|
|
2117
|
-
}
|
|
2122
|
+
createInternalComparator: () => sameValueEqual
|
|
2118
2123
|
});
|
|
2119
2124
|
createCustomEqual({
|
|
2120
2125
|
circular: true,
|
|
2121
|
-
createInternalComparator:
|
|
2122
|
-
return sameValueZeroEqual;
|
|
2123
|
-
}
|
|
2126
|
+
createInternalComparator: () => sameValueEqual
|
|
2124
2127
|
});
|
|
2125
2128
|
createCustomEqual({
|
|
2126
2129
|
circular: true,
|
|
2127
|
-
createInternalComparator:
|
|
2128
|
-
return sameValueZeroEqual;
|
|
2129
|
-
},
|
|
2130
|
+
createInternalComparator: () => sameValueEqual,
|
|
2130
2131
|
strict: true
|
|
2131
2132
|
});
|
|
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);
|
|
2133
|
+
function createCustomEqual(options = {}) {
|
|
2134
|
+
const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false } = options;
|
|
2135
|
+
const config = createEqualityComparatorConfig(options);
|
|
2136
|
+
const comparator = createEqualityComparator(config);
|
|
2137
|
+
const equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
|
2140
2138
|
return createIsEqual({ circular, comparator, createState, equals, strict });
|
|
2141
2139
|
}
|
|
2142
2140
|
function listCacheClear$1() {
|
|
@@ -3386,7 +3384,10 @@ class CollectionRegistry {
|
|
|
3386
3384
|
if (!relation) {
|
|
3387
3385
|
throw new Error(`Relation '${relationKey}' not found in collection '${currentCollection.slug}'`);
|
|
3388
3386
|
}
|
|
3389
|
-
|
|
3387
|
+
const target = relation.target();
|
|
3388
|
+
const targetRelationKey = relation.relationName || target.slug;
|
|
3389
|
+
const targetSlug = relation.overrides?.slug ?? targetRelationKey;
|
|
3390
|
+
currentCollection = this.get(targetSlug) || this.normalizeCollection(target);
|
|
3390
3391
|
if (i + 1 < pathSegments.length) ;
|
|
3391
3392
|
}
|
|
3392
3393
|
return currentCollection;
|
|
@@ -3435,7 +3436,7 @@ class CollectionRegistry {
|
|
|
3435
3436
|
if (!subcollection) {
|
|
3436
3437
|
throw new Error(`Subcollection '${subcollectionSlug}' not found in ${currentCollection.slug}`);
|
|
3437
3438
|
}
|
|
3438
|
-
currentCollection = subcollection;
|
|
3439
|
+
currentCollection = this.get(subcollection.slug) || this.normalizeCollection(subcollection);
|
|
3439
3440
|
collections.push(currentCollection);
|
|
3440
3441
|
}
|
|
3441
3442
|
}
|
|
@@ -6622,7 +6623,7 @@ class EntityPersistService {
|
|
|
6622
6623
|
targetColumnName = relation.localKey;
|
|
6623
6624
|
} else if (relation.foreignKeyOnTarget) {
|
|
6624
6625
|
targetColumnName = relation.foreignKeyOnTarget;
|
|
6625
|
-
} else if (relation.joinPath && relation.joinPath.length
|
|
6626
|
+
} else if (relation.joinPath && relation.joinPath.length === 1) {
|
|
6626
6627
|
const targetTableName = getTableName(targetCollection);
|
|
6627
6628
|
const relevantJoinStep = relation.joinPath.find((joinStep) => joinStep.table === targetTableName);
|
|
6628
6629
|
if (relevantJoinStep) {
|
|
@@ -6633,6 +6634,8 @@ class EntityPersistService {
|
|
|
6633
6634
|
const targetColumnNames = DrizzleConditionBuilder.getColumnNamesFromColumns(relation.joinPath[0].on.to);
|
|
6634
6635
|
targetColumnName = targetColumnNames[0];
|
|
6635
6636
|
}
|
|
6637
|
+
} else if (relation.joinPath && relation.joinPath.length > 1) {
|
|
6638
|
+
break;
|
|
6636
6639
|
} else {
|
|
6637
6640
|
throw new Error(`Relation '${relationKey}' lacks configuration for path-based saving.`);
|
|
6638
6641
|
}
|
|
@@ -7095,6 +7098,14 @@ class PostgresBackendDriver {
|
|
|
7095
7098
|
} : {}
|
|
7096
7099
|
};
|
|
7097
7100
|
}
|
|
7101
|
+
/**
|
|
7102
|
+
* REST-optimised fetch service (include-aware eager-loading).
|
|
7103
|
+
* Delegates to the underlying EntityFetchService which already
|
|
7104
|
+
* implements the matching method signatures.
|
|
7105
|
+
*/
|
|
7106
|
+
get restFetchService() {
|
|
7107
|
+
return this.entityService.getFetchService();
|
|
7108
|
+
}
|
|
7098
7109
|
resolveCollectionCallbacks(collection, path2) {
|
|
7099
7110
|
if (!collection && !path2) return {
|
|
7100
7111
|
collection: void 0,
|
|
@@ -8059,6 +8070,12 @@ const userIdentitiesRelations = relations(userIdentities, ({
|
|
|
8059
8070
|
references: [users.id]
|
|
8060
8071
|
})
|
|
8061
8072
|
}));
|
|
8073
|
+
const resolveColumnName = (propName, prop) => {
|
|
8074
|
+
if (prop && "columnName" in prop && typeof prop.columnName === "string") {
|
|
8075
|
+
return prop.columnName;
|
|
8076
|
+
}
|
|
8077
|
+
return toSnakeCase(propName);
|
|
8078
|
+
};
|
|
8062
8079
|
const getPrimaryKeyProp = (collection) => {
|
|
8063
8080
|
if (collection.properties) {
|
|
8064
8081
|
const idPropEntry = Object.entries(collection.properties).find(([_, prop]) => "isId" in prop && Boolean(prop.isId));
|
|
@@ -8099,7 +8116,7 @@ const isIdProperty = (propName, prop, collection) => {
|
|
|
8099
8116
|
return !hasExplicitId && propName === "id";
|
|
8100
8117
|
};
|
|
8101
8118
|
const getDrizzleColumn = (propName, prop, collection, collections) => {
|
|
8102
|
-
const colName =
|
|
8119
|
+
const colName = resolveColumnName(propName, prop);
|
|
8103
8120
|
let columnDefinition;
|
|
8104
8121
|
switch (prop.type) {
|
|
8105
8122
|
case "string": {
|
|
@@ -8203,7 +8220,7 @@ const getDrizzleColumn = (propName, prop, collection, collections) => {
|
|
|
8203
8220
|
} catch {
|
|
8204
8221
|
return null;
|
|
8205
8222
|
}
|
|
8206
|
-
const fkColumnName =
|
|
8223
|
+
const fkColumnName = relation.localKey;
|
|
8207
8224
|
const targetTableVar = getTableVarName(getTableName(targetCollection));
|
|
8208
8225
|
const pkProp = getPrimaryKeyProp(targetCollection);
|
|
8209
8226
|
const targetIdField = pkProp.name;
|
|
@@ -8391,7 +8408,7 @@ const generateSchema = async (collections, stripPolicies = false) => {
|
|
|
8391
8408
|
Object.entries(collection.properties ?? {}).forEach(([propName, prop]) => {
|
|
8392
8409
|
if ("enum" in prop && (prop.type === "string" || prop.type === "number") && prop.enum) {
|
|
8393
8410
|
const enumVarName = getEnumVarName(collectionPath, propName);
|
|
8394
|
-
const enumDbName = `${collectionPath}_${
|
|
8411
|
+
const enumDbName = `${collectionPath}_${resolveColumnName(propName, prop)}`;
|
|
8395
8412
|
const values = Array.isArray(prop.enum) ? prop.enum.map((v) => String(v.id ?? v)) : Object.keys(prop.enum);
|
|
8396
8413
|
if (values.length > 0) {
|
|
8397
8414
|
schemaContent += `export const ${enumVarName} = pgEnum("${enumDbName}", [${values.map((v) => `'${v}'`).join(", ")}]);
|
|
@@ -8448,9 +8465,9 @@ const generateSchema = async (collections, stripPolicies = false) => {
|
|
|
8448
8465
|
const targetId = getPrimaryKeyName(targetCollection);
|
|
8449
8466
|
schemaContent += `export const ${tableVarName} = pgTable("${tableName}", {
|
|
8450
8467
|
`;
|
|
8451
|
-
schemaContent += ` ${sourceColumn}: ${sourceColType}("${
|
|
8468
|
+
schemaContent += ` ${sourceColumn}: ${sourceColType}("${sourceColumn}").notNull().references(() => ${getTableVarName(getTableName(sourceCollection))}.${sourceId}, ${refOptions}),
|
|
8452
8469
|
`;
|
|
8453
|
-
schemaContent += ` ${targetColumn}: ${targetColType}("${
|
|
8470
|
+
schemaContent += ` ${targetColumn}: ${targetColType}("${targetColumn}").notNull().references(() => ${getTableVarName(getTableName(targetCollection))}.${targetId}, ${refOptions}),
|
|
8454
8471
|
`;
|
|
8455
8472
|
schemaContent += "}, (table) => ({\n";
|
|
8456
8473
|
schemaContent += ` pk: primaryKey({ columns: [table.${sourceColumn}, table.${targetColumn}] })
|
|
@@ -8543,29 +8560,10 @@ const generateSchema = async (collections, stripPolicies = false) => {
|
|
|
8543
8560
|
references: [${targetTableVar}.${getPrimaryKeyName(target)}],
|
|
8544
8561
|
relationName: "${drizzleRelationName}"
|
|
8545
8562
|
})`);
|
|
8546
|
-
} else if (rel.direction === "inverse"
|
|
8547
|
-
const sourceIdField = getPrimaryKeyName(collection);
|
|
8563
|
+
} else if (rel.direction === "inverse") {
|
|
8548
8564
|
tableRelations.push(` "${relationKey}": one(${targetTableVar}, {
|
|
8549
|
-
fields: [${tableVarName}.${sourceIdField}],
|
|
8550
|
-
references: [${targetTableVar}.${rel.foreignKeyOnTarget}],
|
|
8551
|
-
relationName: "${drizzleRelationName}"
|
|
8552
|
-
})`);
|
|
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
8565
|
relationName: "${drizzleRelationName}"
|
|
8564
8566
|
})`);
|
|
8565
|
-
}
|
|
8566
|
-
} catch (e) {
|
|
8567
|
-
console.warn(`Could not resolve inverse one-to-one relation '${relationKey}':`, e);
|
|
8568
|
-
}
|
|
8569
8567
|
}
|
|
8570
8568
|
} else if (rel.cardinality === "many") {
|
|
8571
8569
|
if (rel.direction === "inverse" && rel.foreignKeyOnTarget) {
|