@rebasepro/server-postgresql 0.0.1-canary.f81da60 → 0.1.2

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 (52) hide show
  1. package/dist/index.es.js +383 -1080
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.umd.js +314 -1011
  4. package/dist/index.umd.js.map +1 -1
  5. package/dist/server-postgresql/src/PostgresBackendDriver.d.ts +2 -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 +44 -9
  8. package/dist/server-postgresql/src/services/EntityPersistService.d.ts +9 -0
  9. package/dist/types/src/controllers/auth.d.ts +8 -2
  10. package/dist/types/src/controllers/client.d.ts +13 -0
  11. package/dist/types/src/controllers/navigation.d.ts +18 -6
  12. package/dist/types/src/controllers/registry.d.ts +9 -1
  13. package/dist/types/src/controllers/side_entity_controller.d.ts +7 -0
  14. package/dist/types/src/rebase_context.d.ts +17 -0
  15. package/dist/types/src/types/collections.d.ts +20 -1
  16. package/dist/types/src/types/component_ref.d.ts +47 -0
  17. package/dist/types/src/types/entity_views.d.ts +2 -1
  18. package/dist/types/src/types/index.d.ts +1 -0
  19. package/dist/types/src/types/properties.d.ts +15 -3
  20. package/dist/types/src/types/translations.d.ts +2 -0
  21. package/package.json +5 -5
  22. package/src/PostgresBackendDriver.ts +23 -6
  23. package/src/cli.ts +10 -2
  24. package/src/data-transformer.ts +84 -1
  25. package/src/schema/doctor.ts +14 -2
  26. package/src/schema/generate-drizzle-schema-logic.ts +52 -5
  27. package/src/schema/introspect-db-inference.ts +238 -0
  28. package/src/schema/introspect-db-logic.ts +365 -61
  29. package/src/schema/introspect-db.ts +66 -23
  30. package/src/services/EntityFetchService.ts +16 -0
  31. package/src/services/EntityPersistService.ts +88 -12
  32. package/test/generate-drizzle-schema.test.ts +295 -0
  33. package/test/introspect-db-generation.test.ts +32 -10
  34. package/test/property-ordering.test.ts +395 -0
  35. package/jest-all.log +0 -3128
  36. package/jest.log +0 -49
  37. package/scratch.ts +0 -41
  38. package/test-drizzle-bug.ts +0 -18
  39. package/test-drizzle-out/0000_cultured_freak.sql +0 -7
  40. package/test-drizzle-out/0001_tiresome_professor_monster.sql +0 -1
  41. package/test-drizzle-out/meta/0000_snapshot.json +0 -55
  42. package/test-drizzle-out/meta/0001_snapshot.json +0 -63
  43. package/test-drizzle-out/meta/_journal.json +0 -20
  44. package/test-drizzle-prompt.sh +0 -2
  45. package/test-policy-prompt.sh +0 -3
  46. package/test-programmatic.ts +0 -30
  47. package/test-programmatic2.ts +0 -59
  48. package/test-schema-no-policies.ts +0 -12
  49. package/test_drizzle_mock.js +0 -3
  50. package/test_find_changed.mjs +0 -32
  51. package/test_hash.js +0 -14
  52. package/test_output.txt +0 -3145
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Pool, Client } from "pg";
2
2
  import { drizzle } from "drizzle-orm/node-postgres";
3
- import { sql, inArray, eq as eq$3, and, or, ilike, asc, desc, gt, lt, getTableName as getTableName$1, count, relations, isTable } from "drizzle-orm";
3
+ import { sql, inArray, eq, and, or, ilike, asc, desc, gt, lt, getTableName as getTableName$1, count, relations, isTable } from "drizzle-orm";
4
4
  import { pgSchema, timestamp, varchar, boolean, uuid, jsonb, primaryKey, unique } from "drizzle-orm/pg-core";
5
5
  import { createHash, randomUUID } from "crypto";
6
6
  import * as fs from "fs";
@@ -124,16 +124,14 @@ function getDataSourceCapabilities(driver) {
124
124
  }
125
125
  const DEFAULT_ONE_OF_TYPE = "type";
126
126
  const DEFAULT_ONE_OF_VALUE = "value";
127
- const snakeCaseRegex = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g;
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 "";
131
132
  return regExpMatchArray.map((x) => x.toLowerCase()).join("_");
132
133
  };
133
134
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
134
- function getDefaultExportFromCjs(x) {
135
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
136
- }
137
135
  function commonjsRequire(path2) {
138
136
  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.');
139
137
  }
@@ -920,7 +918,23 @@ var object_hash = { exports: {} };
920
918
  }, { buffer: 3, lYpoI2: 11 }] }, {}, [1])(1);
921
919
  });
922
920
  })(object_hash);
923
- function isObject$6(item) {
921
+ function deepClone(value) {
922
+ if (value === null || value === void 0) return value;
923
+ if (typeof value === "function") return value;
924
+ if (typeof value !== "object") return value;
925
+ if (Array.isArray(value)) {
926
+ return value.map((item) => deepClone(item));
927
+ }
928
+ if (Object.getPrototypeOf(value) !== Object.prototype) {
929
+ return value;
930
+ }
931
+ const result = {};
932
+ for (const key of Object.keys(value)) {
933
+ result[key] = deepClone(value[key]);
934
+ }
935
+ return result;
936
+ }
937
+ function isObject(item) {
924
938
  return !!item && typeof item === "object" && !Array.isArray(item);
925
939
  }
926
940
  function isPlainObject(obj) {
@@ -931,13 +945,13 @@ function isPlainObject(obj) {
931
945
  return proto === Object.prototype;
932
946
  }
933
947
  function mergeDeep(target, source, ignoreUndefined = false) {
934
- if (!isObject$6(target)) {
948
+ if (!isObject(target)) {
935
949
  return target;
936
950
  }
937
951
  const output = {
938
952
  ...target
939
953
  };
940
- if (!isObject$6(source)) {
954
+ if (!isObject(source)) {
941
955
  return output;
942
956
  }
943
957
  for (const key in source) {
@@ -978,7 +992,7 @@ function mergeDeep(target, source, ignoreUndefined = false) {
978
992
  } else {
979
993
  output[key] = sourceValue;
980
994
  }
981
- } else if (isObject$6(sourceValue)) {
995
+ } else if (isObject(sourceValue)) {
982
996
  output[key] = sourceValue;
983
997
  } else {
984
998
  output[key] = sourceValue;
@@ -1021,6 +1035,80 @@ function generateForeignKeyName(name) {
1021
1035
  const singularName = snakeCaseName.endsWith("s") ? snakeCaseName.slice(0, -1) : snakeCaseName;
1022
1036
  return `${singularName}_id`;
1023
1037
  }
1038
+ function updateDateAutoValues({
1039
+ inputValues,
1040
+ properties,
1041
+ status,
1042
+ timestampNowValue
1043
+ }) {
1044
+ return traverseValuesProperties(inputValues, properties, (inputValue, property) => {
1045
+ if (property.type === "date") {
1046
+ if (status === "existing" && property.autoValue === "on_update") {
1047
+ return timestampNowValue;
1048
+ } else if ((status === "new" || status === "copy") && (property.autoValue === "on_update" || property.autoValue === "on_create")) {
1049
+ return timestampNowValue;
1050
+ } else {
1051
+ return inputValue;
1052
+ }
1053
+ } else {
1054
+ return inputValue;
1055
+ }
1056
+ }) ?? {};
1057
+ }
1058
+ function traverseValuesProperties(inputValues, properties, operation) {
1059
+ const safeInputValues = inputValues ?? {};
1060
+ const updatedValues = Object.entries(properties).map(([key, property]) => {
1061
+ const inputValue = safeInputValues && safeInputValues[key];
1062
+ const updatedValue = traverseValueProperty(inputValue, property, operation);
1063
+ if (updatedValue === null) return null;
1064
+ if (updatedValue === void 0) return void 0;
1065
+ return {
1066
+ [key]: updatedValue
1067
+ };
1068
+ }).reduce((a, b) => ({
1069
+ ...a,
1070
+ ...b
1071
+ }), {});
1072
+ const result = mergeDeep(safeInputValues, updatedValues);
1073
+ if (!result || Object.keys(result).length === 0) return void 0;
1074
+ return result;
1075
+ }
1076
+ function traverseValueProperty(inputValue, property, operation) {
1077
+ let value;
1078
+ if (property.type === "map" && property.properties) {
1079
+ value = traverseValuesProperties(inputValue, property.properties, operation);
1080
+ } else if (property.type === "array") {
1081
+ const of = property.of;
1082
+ if (of && Array.isArray(inputValue) && !Array.isArray(of)) {
1083
+ value = inputValue.map((e) => traverseValueProperty(e, of, operation));
1084
+ } else if (of && Array.isArray(inputValue) && Array.isArray(of)) {
1085
+ value = inputValue.map((e, i) => {
1086
+ if (i < of.length) return traverseValueProperty(e, of[i], operation);
1087
+ return null;
1088
+ }).filter(Boolean);
1089
+ } else if (property.oneOf && Array.isArray(inputValue)) {
1090
+ const typeField = property.oneOf?.typeField ?? DEFAULT_ONE_OF_TYPE;
1091
+ const valueField = property.oneOf?.valueField ?? DEFAULT_ONE_OF_VALUE;
1092
+ value = inputValue.map((e) => {
1093
+ if (e === null) return null;
1094
+ if (typeof e !== "object") return e;
1095
+ const rec = e;
1096
+ const type = rec[typeField];
1097
+ const childProperty = property.oneOf?.properties[type];
1098
+ if (!type || !childProperty) return e;
1099
+ return {
1100
+ [typeField]: type,
1101
+ [valueField]: traverseValueProperty(rec[valueField], childProperty, operation)
1102
+ };
1103
+ });
1104
+ } else {
1105
+ value = inputValue;
1106
+ }
1107
+ } else {
1108
+ value = operation(inputValue, property);
1109
+ }
1110
+ return value;
1111
+ }
1024
1112
  function createRelationRef(id, path2) {
1025
1113
  return {
1026
1114
  id,
@@ -1350,7 +1438,7 @@ function findRelation(resolvedRelations, key) {
1350
1438
  }
1351
1439
  var logic = { exports: {} };
1352
1440
  (function(module, exports$1) {
1353
- (function(root2, factory) {
1441
+ (function(root, factory) {
1354
1442
  {
1355
1443
  module.exports = factory();
1356
1444
  }
@@ -1718,7 +1806,7 @@ var logic = { exports: {} };
1718
1806
  });
1719
1807
  })(logic);
1720
1808
  const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
1721
- const { hasOwnProperty: hasOwnProperty$a } = Object.prototype;
1809
+ const { hasOwnProperty } = Object.prototype;
1722
1810
  function combineComparators(comparatorA, comparatorB) {
1723
1811
  return function isEqual(a, b, state) {
1724
1812
  return comparatorA(a, b, state) && comparatorB(a, b, state);
@@ -1748,12 +1836,12 @@ function getStrictProperties(object) {
1748
1836
  }
1749
1837
  const hasOwn = (
1750
1838
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1751
- Object.hasOwn || ((object, property) => hasOwnProperty$a.call(object, property))
1839
+ Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property))
1752
1840
  );
1753
1841
  const PREACT_VNODE = "__v";
1754
1842
  const PREACT_OWNER = "__o";
1755
1843
  const REACT_OWNER = "_owner";
1756
- const { getOwnPropertyDescriptor, keys: keys$4 } = Object;
1844
+ const { getOwnPropertyDescriptor, keys } = Object;
1757
1845
  const sameValueEqual = (
1758
1846
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1759
1847
  Object.is || function sameValueEqual2(a, b) {
@@ -1831,9 +1919,9 @@ function areMapsEqual(a, b, state) {
1831
1919
  return true;
1832
1920
  }
1833
1921
  function areObjectsEqual(a, b, state) {
1834
- const properties = keys$4(a);
1922
+ const properties = keys(a);
1835
1923
  let index = properties.length;
1836
- if (keys$4(b).length !== index) {
1924
+ if (keys(b).length !== index) {
1837
1925
  return false;
1838
1926
  }
1839
1927
  while (index-- > 0) {
@@ -2136,982 +2224,6 @@ function createCustomEqual(options = {}) {
2136
2224
  const equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
2137
2225
  return createIsEqual({ circular, comparator, createState, equals, strict });
2138
2226
  }
2139
- function listCacheClear$1() {
2140
- this.__data__ = [];
2141
- this.size = 0;
2142
- }
2143
- var _listCacheClear = listCacheClear$1;
2144
- function eq$2(value, other) {
2145
- return value === other || value !== value && other !== other;
2146
- }
2147
- var eq_1 = eq$2;
2148
- var eq$1 = eq_1;
2149
- function assocIndexOf$4(array, key) {
2150
- var length = array.length;
2151
- while (length--) {
2152
- if (eq$1(array[length][0], key)) {
2153
- return length;
2154
- }
2155
- }
2156
- return -1;
2157
- }
2158
- var _assocIndexOf = assocIndexOf$4;
2159
- var assocIndexOf$3 = _assocIndexOf;
2160
- var arrayProto = Array.prototype;
2161
- var splice = arrayProto.splice;
2162
- function listCacheDelete$1(key) {
2163
- var data = this.__data__, index = assocIndexOf$3(data, key);
2164
- if (index < 0) {
2165
- return false;
2166
- }
2167
- var lastIndex = data.length - 1;
2168
- if (index == lastIndex) {
2169
- data.pop();
2170
- } else {
2171
- splice.call(data, index, 1);
2172
- }
2173
- --this.size;
2174
- return true;
2175
- }
2176
- var _listCacheDelete = listCacheDelete$1;
2177
- var assocIndexOf$2 = _assocIndexOf;
2178
- function listCacheGet$1(key) {
2179
- var data = this.__data__, index = assocIndexOf$2(data, key);
2180
- return index < 0 ? void 0 : data[index][1];
2181
- }
2182
- var _listCacheGet = listCacheGet$1;
2183
- var assocIndexOf$1 = _assocIndexOf;
2184
- function listCacheHas$1(key) {
2185
- return assocIndexOf$1(this.__data__, key) > -1;
2186
- }
2187
- var _listCacheHas = listCacheHas$1;
2188
- var assocIndexOf = _assocIndexOf;
2189
- function listCacheSet$1(key, value) {
2190
- var data = this.__data__, index = assocIndexOf(data, key);
2191
- if (index < 0) {
2192
- ++this.size;
2193
- data.push([key, value]);
2194
- } else {
2195
- data[index][1] = value;
2196
- }
2197
- return this;
2198
- }
2199
- var _listCacheSet = listCacheSet$1;
2200
- var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
2201
- function ListCache$4(entries) {
2202
- var index = -1, length = entries == null ? 0 : entries.length;
2203
- this.clear();
2204
- while (++index < length) {
2205
- var entry = entries[index];
2206
- this.set(entry[0], entry[1]);
2207
- }
2208
- }
2209
- ListCache$4.prototype.clear = listCacheClear;
2210
- ListCache$4.prototype["delete"] = listCacheDelete;
2211
- ListCache$4.prototype.get = listCacheGet;
2212
- ListCache$4.prototype.has = listCacheHas;
2213
- ListCache$4.prototype.set = listCacheSet;
2214
- var _ListCache = ListCache$4;
2215
- var ListCache$3 = _ListCache;
2216
- function stackClear$1() {
2217
- this.__data__ = new ListCache$3();
2218
- this.size = 0;
2219
- }
2220
- var _stackClear = stackClear$1;
2221
- function stackDelete$1(key) {
2222
- var data = this.__data__, result = data["delete"](key);
2223
- this.size = data.size;
2224
- return result;
2225
- }
2226
- var _stackDelete = stackDelete$1;
2227
- function stackGet$1(key) {
2228
- return this.__data__.get(key);
2229
- }
2230
- var _stackGet = stackGet$1;
2231
- function stackHas$1(key) {
2232
- return this.__data__.has(key);
2233
- }
2234
- var _stackHas = stackHas$1;
2235
- var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
2236
- var _freeGlobal = freeGlobal$1;
2237
- var freeGlobal = _freeGlobal;
2238
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
2239
- var root$8 = freeGlobal || freeSelf || Function("return this")();
2240
- var _root = root$8;
2241
- var root$7 = _root;
2242
- var Symbol$4 = root$7.Symbol;
2243
- var _Symbol = Symbol$4;
2244
- var Symbol$3 = _Symbol;
2245
- var objectProto$c = Object.prototype;
2246
- var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
2247
- var nativeObjectToString$1 = objectProto$c.toString;
2248
- var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : void 0;
2249
- function getRawTag$1(value) {
2250
- var isOwn = hasOwnProperty$9.call(value, symToStringTag$1), tag = value[symToStringTag$1];
2251
- try {
2252
- value[symToStringTag$1] = void 0;
2253
- var unmasked = true;
2254
- } catch (e) {
2255
- }
2256
- var result = nativeObjectToString$1.call(value);
2257
- if (unmasked) {
2258
- if (isOwn) {
2259
- value[symToStringTag$1] = tag;
2260
- } else {
2261
- delete value[symToStringTag$1];
2262
- }
2263
- }
2264
- return result;
2265
- }
2266
- var _getRawTag = getRawTag$1;
2267
- var objectProto$b = Object.prototype;
2268
- var nativeObjectToString = objectProto$b.toString;
2269
- function objectToString$1(value) {
2270
- return nativeObjectToString.call(value);
2271
- }
2272
- var _objectToString = objectToString$1;
2273
- var Symbol$2 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
2274
- var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
2275
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
2276
- function baseGetTag$4(value) {
2277
- if (value == null) {
2278
- return value === void 0 ? undefinedTag : nullTag;
2279
- }
2280
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
2281
- }
2282
- var _baseGetTag = baseGetTag$4;
2283
- function isObject$5(value) {
2284
- var type = typeof value;
2285
- return value != null && (type == "object" || type == "function");
2286
- }
2287
- var isObject_1 = isObject$5;
2288
- var baseGetTag$3 = _baseGetTag, isObject$4 = isObject_1;
2289
- var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
2290
- function isFunction$2(value) {
2291
- if (!isObject$4(value)) {
2292
- return false;
2293
- }
2294
- var tag = baseGetTag$3(value);
2295
- return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
2296
- }
2297
- var isFunction_1 = isFunction$2;
2298
- var root$6 = _root;
2299
- var coreJsData$1 = root$6["__core-js_shared__"];
2300
- var _coreJsData = coreJsData$1;
2301
- var coreJsData = _coreJsData;
2302
- var maskSrcKey = function() {
2303
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
2304
- return uid ? "Symbol(src)_1." + uid : "";
2305
- }();
2306
- function isMasked$1(func) {
2307
- return !!maskSrcKey && maskSrcKey in func;
2308
- }
2309
- var _isMasked = isMasked$1;
2310
- var funcProto$1 = Function.prototype;
2311
- var funcToString$1 = funcProto$1.toString;
2312
- function toSource$2(func) {
2313
- if (func != null) {
2314
- try {
2315
- return funcToString$1.call(func);
2316
- } catch (e) {
2317
- }
2318
- try {
2319
- return func + "";
2320
- } catch (e) {
2321
- }
2322
- }
2323
- return "";
2324
- }
2325
- var _toSource = toSource$2;
2326
- var isFunction$1 = isFunction_1, isMasked = _isMasked, isObject$3 = isObject_1, toSource$1 = _toSource;
2327
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
2328
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
2329
- var funcProto = Function.prototype, objectProto$a = Object.prototype;
2330
- var funcToString = funcProto.toString;
2331
- var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
2332
- var reIsNative = RegExp(
2333
- "^" + funcToString.call(hasOwnProperty$8).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
2334
- );
2335
- function baseIsNative$1(value) {
2336
- if (!isObject$3(value) || isMasked(value)) {
2337
- return false;
2338
- }
2339
- var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
2340
- return pattern.test(toSource$1(value));
2341
- }
2342
- var _baseIsNative = baseIsNative$1;
2343
- function getValue$1(object, key) {
2344
- return object == null ? void 0 : object[key];
2345
- }
2346
- var _getValue = getValue$1;
2347
- var baseIsNative = _baseIsNative, getValue = _getValue;
2348
- function getNative$7(object, key) {
2349
- var value = getValue(object, key);
2350
- return baseIsNative(value) ? value : void 0;
2351
- }
2352
- var _getNative = getNative$7;
2353
- var getNative$6 = _getNative, root$5 = _root;
2354
- var Map$4 = getNative$6(root$5, "Map");
2355
- var _Map = Map$4;
2356
- var getNative$5 = _getNative;
2357
- var nativeCreate$4 = getNative$5(Object, "create");
2358
- var _nativeCreate = nativeCreate$4;
2359
- var nativeCreate$3 = _nativeCreate;
2360
- function hashClear$1() {
2361
- this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
2362
- this.size = 0;
2363
- }
2364
- var _hashClear = hashClear$1;
2365
- function hashDelete$1(key) {
2366
- var result = this.has(key) && delete this.__data__[key];
2367
- this.size -= result ? 1 : 0;
2368
- return result;
2369
- }
2370
- var _hashDelete = hashDelete$1;
2371
- var nativeCreate$2 = _nativeCreate;
2372
- var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
2373
- var objectProto$9 = Object.prototype;
2374
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
2375
- function hashGet$1(key) {
2376
- var data = this.__data__;
2377
- if (nativeCreate$2) {
2378
- var result = data[key];
2379
- return result === HASH_UNDEFINED$1 ? void 0 : result;
2380
- }
2381
- return hasOwnProperty$7.call(data, key) ? data[key] : void 0;
2382
- }
2383
- var _hashGet = hashGet$1;
2384
- var nativeCreate$1 = _nativeCreate;
2385
- var objectProto$8 = Object.prototype;
2386
- var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
2387
- function hashHas$1(key) {
2388
- var data = this.__data__;
2389
- return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$6.call(data, key);
2390
- }
2391
- var _hashHas = hashHas$1;
2392
- var nativeCreate = _nativeCreate;
2393
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
2394
- function hashSet$1(key, value) {
2395
- var data = this.__data__;
2396
- this.size += this.has(key) ? 0 : 1;
2397
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
2398
- return this;
2399
- }
2400
- var _hashSet = hashSet$1;
2401
- var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
2402
- function Hash$1(entries) {
2403
- var index = -1, length = entries == null ? 0 : entries.length;
2404
- this.clear();
2405
- while (++index < length) {
2406
- var entry = entries[index];
2407
- this.set(entry[0], entry[1]);
2408
- }
2409
- }
2410
- Hash$1.prototype.clear = hashClear;
2411
- Hash$1.prototype["delete"] = hashDelete;
2412
- Hash$1.prototype.get = hashGet;
2413
- Hash$1.prototype.has = hashHas;
2414
- Hash$1.prototype.set = hashSet;
2415
- var _Hash = Hash$1;
2416
- var Hash = _Hash, ListCache$2 = _ListCache, Map$3 = _Map;
2417
- function mapCacheClear$1() {
2418
- this.size = 0;
2419
- this.__data__ = {
2420
- "hash": new Hash(),
2421
- "map": new (Map$3 || ListCache$2)(),
2422
- "string": new Hash()
2423
- };
2424
- }
2425
- var _mapCacheClear = mapCacheClear$1;
2426
- function isKeyable$1(value) {
2427
- var type = typeof value;
2428
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
2429
- }
2430
- var _isKeyable = isKeyable$1;
2431
- var isKeyable = _isKeyable;
2432
- function getMapData$4(map, key) {
2433
- var data = map.__data__;
2434
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
2435
- }
2436
- var _getMapData = getMapData$4;
2437
- var getMapData$3 = _getMapData;
2438
- function mapCacheDelete$1(key) {
2439
- var result = getMapData$3(this, key)["delete"](key);
2440
- this.size -= result ? 1 : 0;
2441
- return result;
2442
- }
2443
- var _mapCacheDelete = mapCacheDelete$1;
2444
- var getMapData$2 = _getMapData;
2445
- function mapCacheGet$1(key) {
2446
- return getMapData$2(this, key).get(key);
2447
- }
2448
- var _mapCacheGet = mapCacheGet$1;
2449
- var getMapData$1 = _getMapData;
2450
- function mapCacheHas$1(key) {
2451
- return getMapData$1(this, key).has(key);
2452
- }
2453
- var _mapCacheHas = mapCacheHas$1;
2454
- var getMapData = _getMapData;
2455
- function mapCacheSet$1(key, value) {
2456
- var data = getMapData(this, key), size = data.size;
2457
- data.set(key, value);
2458
- this.size += data.size == size ? 0 : 1;
2459
- return this;
2460
- }
2461
- var _mapCacheSet = mapCacheSet$1;
2462
- var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
2463
- function MapCache$1(entries) {
2464
- var index = -1, length = entries == null ? 0 : entries.length;
2465
- this.clear();
2466
- while (++index < length) {
2467
- var entry = entries[index];
2468
- this.set(entry[0], entry[1]);
2469
- }
2470
- }
2471
- MapCache$1.prototype.clear = mapCacheClear;
2472
- MapCache$1.prototype["delete"] = mapCacheDelete;
2473
- MapCache$1.prototype.get = mapCacheGet;
2474
- MapCache$1.prototype.has = mapCacheHas;
2475
- MapCache$1.prototype.set = mapCacheSet;
2476
- var _MapCache = MapCache$1;
2477
- var ListCache$1 = _ListCache, Map$2 = _Map, MapCache = _MapCache;
2478
- var LARGE_ARRAY_SIZE = 200;
2479
- function stackSet$1(key, value) {
2480
- var data = this.__data__;
2481
- if (data instanceof ListCache$1) {
2482
- var pairs = data.__data__;
2483
- if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
2484
- pairs.push([key, value]);
2485
- this.size = ++data.size;
2486
- return this;
2487
- }
2488
- data = this.__data__ = new MapCache(pairs);
2489
- }
2490
- data.set(key, value);
2491
- this.size = data.size;
2492
- return this;
2493
- }
2494
- var _stackSet = stackSet$1;
2495
- var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet;
2496
- function Stack$1(entries) {
2497
- var data = this.__data__ = new ListCache(entries);
2498
- this.size = data.size;
2499
- }
2500
- Stack$1.prototype.clear = stackClear;
2501
- Stack$1.prototype["delete"] = stackDelete;
2502
- Stack$1.prototype.get = stackGet;
2503
- Stack$1.prototype.has = stackHas;
2504
- Stack$1.prototype.set = stackSet;
2505
- var _Stack = Stack$1;
2506
- function arrayEach$1(array, iteratee) {
2507
- var index = -1, length = array == null ? 0 : array.length;
2508
- while (++index < length) {
2509
- if (iteratee(array[index], index, array) === false) {
2510
- break;
2511
- }
2512
- }
2513
- return array;
2514
- }
2515
- var _arrayEach = arrayEach$1;
2516
- var getNative$4 = _getNative;
2517
- var defineProperty$1 = function() {
2518
- try {
2519
- var func = getNative$4(Object, "defineProperty");
2520
- func({}, "", {});
2521
- return func;
2522
- } catch (e) {
2523
- }
2524
- }();
2525
- var _defineProperty = defineProperty$1;
2526
- var defineProperty = _defineProperty;
2527
- function baseAssignValue$2(object, key, value) {
2528
- if (key == "__proto__" && defineProperty) {
2529
- defineProperty(object, key, {
2530
- "configurable": true,
2531
- "enumerable": true,
2532
- "value": value,
2533
- "writable": true
2534
- });
2535
- } else {
2536
- object[key] = value;
2537
- }
2538
- }
2539
- var _baseAssignValue = baseAssignValue$2;
2540
- var baseAssignValue$1 = _baseAssignValue, eq = eq_1;
2541
- var objectProto$7 = Object.prototype;
2542
- var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
2543
- function assignValue$2(object, key, value) {
2544
- var objValue = object[key];
2545
- if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
2546
- baseAssignValue$1(object, key, value);
2547
- }
2548
- }
2549
- var _assignValue = assignValue$2;
2550
- var assignValue$1 = _assignValue, baseAssignValue = _baseAssignValue;
2551
- function copyObject$4(source, props, object, customizer) {
2552
- var isNew = !object;
2553
- object || (object = {});
2554
- var index = -1, length = props.length;
2555
- while (++index < length) {
2556
- var key = props[index];
2557
- var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
2558
- if (newValue === void 0) {
2559
- newValue = source[key];
2560
- }
2561
- if (isNew) {
2562
- baseAssignValue(object, key, newValue);
2563
- } else {
2564
- assignValue$1(object, key, newValue);
2565
- }
2566
- }
2567
- return object;
2568
- }
2569
- var _copyObject = copyObject$4;
2570
- function baseTimes$1(n, iteratee) {
2571
- var index = -1, result = Array(n);
2572
- while (++index < n) {
2573
- result[index] = iteratee(index);
2574
- }
2575
- return result;
2576
- }
2577
- var _baseTimes = baseTimes$1;
2578
- function isObjectLike$5(value) {
2579
- return value != null && typeof value == "object";
2580
- }
2581
- var isObjectLike_1 = isObjectLike$5;
2582
- var baseGetTag$2 = _baseGetTag, isObjectLike$4 = isObjectLike_1;
2583
- var argsTag$2 = "[object Arguments]";
2584
- function baseIsArguments$1(value) {
2585
- return isObjectLike$4(value) && baseGetTag$2(value) == argsTag$2;
2586
- }
2587
- var _baseIsArguments = baseIsArguments$1;
2588
- var baseIsArguments = _baseIsArguments, isObjectLike$3 = isObjectLike_1;
2589
- var objectProto$6 = Object.prototype;
2590
- var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
2591
- var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
2592
- var isArguments$1 = baseIsArguments(/* @__PURE__ */ function() {
2593
- return arguments;
2594
- }()) ? baseIsArguments : function(value) {
2595
- return isObjectLike$3(value) && hasOwnProperty$4.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
2596
- };
2597
- var isArguments_1 = isArguments$1;
2598
- var isArray$3 = Array.isArray;
2599
- var isArray_1 = isArray$3;
2600
- var isBuffer$2 = { exports: {} };
2601
- function stubFalse() {
2602
- return false;
2603
- }
2604
- var stubFalse_1 = stubFalse;
2605
- isBuffer$2.exports;
2606
- (function(module, exports$1) {
2607
- var root2 = _root, stubFalse2 = stubFalse_1;
2608
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
2609
- var freeModule = freeExports && true && module && !module.nodeType && module;
2610
- var moduleExports = freeModule && freeModule.exports === freeExports;
2611
- var Buffer = moduleExports ? root2.Buffer : void 0;
2612
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
2613
- var isBuffer2 = nativeIsBuffer || stubFalse2;
2614
- module.exports = isBuffer2;
2615
- })(isBuffer$2, isBuffer$2.exports);
2616
- var isBufferExports = isBuffer$2.exports;
2617
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
2618
- var reIsUint = /^(?:0|[1-9]\d*)$/;
2619
- function isIndex$1(value, length) {
2620
- var type = typeof value;
2621
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
2622
- return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
2623
- }
2624
- var _isIndex = isIndex$1;
2625
- var MAX_SAFE_INTEGER = 9007199254740991;
2626
- function isLength$2(value) {
2627
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2628
- }
2629
- var isLength_1 = isLength$2;
2630
- var baseGetTag$1 = _baseGetTag, isLength$1 = isLength_1, isObjectLike$2 = isObjectLike_1;
2631
- 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]";
2632
- 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]";
2633
- var typedArrayTags = {};
2634
- 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;
2635
- 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;
2636
- function baseIsTypedArray$1(value) {
2637
- return isObjectLike$2(value) && isLength$1(value.length) && !!typedArrayTags[baseGetTag$1(value)];
2638
- }
2639
- var _baseIsTypedArray = baseIsTypedArray$1;
2640
- function baseUnary$3(func) {
2641
- return function(value) {
2642
- return func(value);
2643
- };
2644
- }
2645
- var _baseUnary = baseUnary$3;
2646
- var _nodeUtil = { exports: {} };
2647
- _nodeUtil.exports;
2648
- (function(module, exports$1) {
2649
- var freeGlobal2 = _freeGlobal;
2650
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
2651
- var freeModule = freeExports && true && module && !module.nodeType && module;
2652
- var moduleExports = freeModule && freeModule.exports === freeExports;
2653
- var freeProcess = moduleExports && freeGlobal2.process;
2654
- var nodeUtil2 = function() {
2655
- try {
2656
- var types = freeModule && freeModule.require && freeModule.require("util").types;
2657
- if (types) {
2658
- return types;
2659
- }
2660
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
2661
- } catch (e) {
2662
- }
2663
- }();
2664
- module.exports = nodeUtil2;
2665
- })(_nodeUtil, _nodeUtil.exports);
2666
- var _nodeUtilExports = _nodeUtil.exports;
2667
- var baseIsTypedArray = _baseIsTypedArray, baseUnary$2 = _baseUnary, nodeUtil$2 = _nodeUtilExports;
2668
- var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray;
2669
- var isTypedArray$1 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray;
2670
- var isTypedArray_1 = isTypedArray$1;
2671
- var baseTimes = _baseTimes, isArguments = isArguments_1, isArray$2 = isArray_1, isBuffer$1 = isBufferExports, isIndex = _isIndex, isTypedArray = isTypedArray_1;
2672
- var objectProto$5 = Object.prototype;
2673
- var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
2674
- function arrayLikeKeys$2(value, inherited) {
2675
- 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;
2676
- for (var key in value) {
2677
- if ((inherited || hasOwnProperty$3.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
2678
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
2679
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
2680
- isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
2681
- isIndex(key, length)))) {
2682
- result.push(key);
2683
- }
2684
- }
2685
- return result;
2686
- }
2687
- var _arrayLikeKeys = arrayLikeKeys$2;
2688
- var objectProto$4 = Object.prototype;
2689
- function isPrototype$3(value) {
2690
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$4;
2691
- return value === proto;
2692
- }
2693
- var _isPrototype = isPrototype$3;
2694
- function overArg$2(func, transform) {
2695
- return function(arg) {
2696
- return func(transform(arg));
2697
- };
2698
- }
2699
- var _overArg = overArg$2;
2700
- var overArg$1 = _overArg;
2701
- var nativeKeys$1 = overArg$1(Object.keys, Object);
2702
- var _nativeKeys = nativeKeys$1;
2703
- var isPrototype$2 = _isPrototype, nativeKeys = _nativeKeys;
2704
- var objectProto$3 = Object.prototype;
2705
- var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
2706
- function baseKeys$1(object) {
2707
- if (!isPrototype$2(object)) {
2708
- return nativeKeys(object);
2709
- }
2710
- var result = [];
2711
- for (var key in Object(object)) {
2712
- if (hasOwnProperty$2.call(object, key) && key != "constructor") {
2713
- result.push(key);
2714
- }
2715
- }
2716
- return result;
2717
- }
2718
- var _baseKeys = baseKeys$1;
2719
- var isFunction = isFunction_1, isLength = isLength_1;
2720
- function isArrayLike$2(value) {
2721
- return value != null && isLength(value.length) && !isFunction(value);
2722
- }
2723
- var isArrayLike_1 = isArrayLike$2;
2724
- var arrayLikeKeys$1 = _arrayLikeKeys, baseKeys = _baseKeys, isArrayLike$1 = isArrayLike_1;
2725
- function keys$3(object) {
2726
- return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys(object);
2727
- }
2728
- var keys_1 = keys$3;
2729
- var copyObject$3 = _copyObject, keys$2 = keys_1;
2730
- function baseAssign$1(object, source) {
2731
- return object && copyObject$3(source, keys$2(source), object);
2732
- }
2733
- var _baseAssign = baseAssign$1;
2734
- function nativeKeysIn$1(object) {
2735
- var result = [];
2736
- if (object != null) {
2737
- for (var key in Object(object)) {
2738
- result.push(key);
2739
- }
2740
- }
2741
- return result;
2742
- }
2743
- var _nativeKeysIn = nativeKeysIn$1;
2744
- var isObject$2 = isObject_1, isPrototype$1 = _isPrototype, nativeKeysIn = _nativeKeysIn;
2745
- var objectProto$2 = Object.prototype;
2746
- var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
2747
- function baseKeysIn$1(object) {
2748
- if (!isObject$2(object)) {
2749
- return nativeKeysIn(object);
2750
- }
2751
- var isProto = isPrototype$1(object), result = [];
2752
- for (var key in object) {
2753
- if (!(key == "constructor" && (isProto || !hasOwnProperty$1.call(object, key)))) {
2754
- result.push(key);
2755
- }
2756
- }
2757
- return result;
2758
- }
2759
- var _baseKeysIn = baseKeysIn$1;
2760
- var arrayLikeKeys = _arrayLikeKeys, baseKeysIn = _baseKeysIn, isArrayLike = isArrayLike_1;
2761
- function keysIn$3(object) {
2762
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
2763
- }
2764
- var keysIn_1 = keysIn$3;
2765
- var copyObject$2 = _copyObject, keysIn$2 = keysIn_1;
2766
- function baseAssignIn$1(object, source) {
2767
- return object && copyObject$2(source, keysIn$2(source), object);
2768
- }
2769
- var _baseAssignIn = baseAssignIn$1;
2770
- var _cloneBuffer = { exports: {} };
2771
- _cloneBuffer.exports;
2772
- (function(module, exports$1) {
2773
- var root2 = _root;
2774
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
2775
- var freeModule = freeExports && true && module && !module.nodeType && module;
2776
- var moduleExports = freeModule && freeModule.exports === freeExports;
2777
- var Buffer = moduleExports ? root2.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
2778
- function cloneBuffer2(buffer, isDeep) {
2779
- if (isDeep) {
2780
- return buffer.slice();
2781
- }
2782
- var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
2783
- buffer.copy(result);
2784
- return result;
2785
- }
2786
- module.exports = cloneBuffer2;
2787
- })(_cloneBuffer, _cloneBuffer.exports);
2788
- var _cloneBufferExports = _cloneBuffer.exports;
2789
- function copyArray$1(source, array) {
2790
- var index = -1, length = source.length;
2791
- array || (array = Array(length));
2792
- while (++index < length) {
2793
- array[index] = source[index];
2794
- }
2795
- return array;
2796
- }
2797
- var _copyArray = copyArray$1;
2798
- function arrayFilter$1(array, predicate) {
2799
- var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
2800
- while (++index < length) {
2801
- var value = array[index];
2802
- if (predicate(value, index, array)) {
2803
- result[resIndex++] = value;
2804
- }
2805
- }
2806
- return result;
2807
- }
2808
- var _arrayFilter = arrayFilter$1;
2809
- function stubArray$2() {
2810
- return [];
2811
- }
2812
- var stubArray_1 = stubArray$2;
2813
- var arrayFilter = _arrayFilter, stubArray$1 = stubArray_1;
2814
- var objectProto$1 = Object.prototype;
2815
- var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
2816
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
2817
- var getSymbols$3 = !nativeGetSymbols$1 ? stubArray$1 : function(object) {
2818
- if (object == null) {
2819
- return [];
2820
- }
2821
- object = Object(object);
2822
- return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
2823
- return propertyIsEnumerable.call(object, symbol);
2824
- });
2825
- };
2826
- var _getSymbols = getSymbols$3;
2827
- var copyObject$1 = _copyObject, getSymbols$2 = _getSymbols;
2828
- function copySymbols$1(source, object) {
2829
- return copyObject$1(source, getSymbols$2(source), object);
2830
- }
2831
- var _copySymbols = copySymbols$1;
2832
- function arrayPush$2(array, values) {
2833
- var index = -1, length = values.length, offset = array.length;
2834
- while (++index < length) {
2835
- array[offset + index] = values[index];
2836
- }
2837
- return array;
2838
- }
2839
- var _arrayPush = arrayPush$2;
2840
- var overArg = _overArg;
2841
- var getPrototype$2 = overArg(Object.getPrototypeOf, Object);
2842
- var _getPrototype = getPrototype$2;
2843
- var arrayPush$1 = _arrayPush, getPrototype$1 = _getPrototype, getSymbols$1 = _getSymbols, stubArray = stubArray_1;
2844
- var nativeGetSymbols = Object.getOwnPropertySymbols;
2845
- var getSymbolsIn$2 = !nativeGetSymbols ? stubArray : function(object) {
2846
- var result = [];
2847
- while (object) {
2848
- arrayPush$1(result, getSymbols$1(object));
2849
- object = getPrototype$1(object);
2850
- }
2851
- return result;
2852
- };
2853
- var _getSymbolsIn = getSymbolsIn$2;
2854
- var copyObject = _copyObject, getSymbolsIn$1 = _getSymbolsIn;
2855
- function copySymbolsIn$1(source, object) {
2856
- return copyObject(source, getSymbolsIn$1(source), object);
2857
- }
2858
- var _copySymbolsIn = copySymbolsIn$1;
2859
- var arrayPush = _arrayPush, isArray$1 = isArray_1;
2860
- function baseGetAllKeys$2(object, keysFunc, symbolsFunc) {
2861
- var result = keysFunc(object);
2862
- return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
2863
- }
2864
- var _baseGetAllKeys = baseGetAllKeys$2;
2865
- var baseGetAllKeys$1 = _baseGetAllKeys, getSymbols = _getSymbols, keys$1 = keys_1;
2866
- function getAllKeys$1(object) {
2867
- return baseGetAllKeys$1(object, keys$1, getSymbols);
2868
- }
2869
- var _getAllKeys = getAllKeys$1;
2870
- var baseGetAllKeys = _baseGetAllKeys, getSymbolsIn = _getSymbolsIn, keysIn$1 = keysIn_1;
2871
- function getAllKeysIn$1(object) {
2872
- return baseGetAllKeys(object, keysIn$1, getSymbolsIn);
2873
- }
2874
- var _getAllKeysIn = getAllKeysIn$1;
2875
- var getNative$3 = _getNative, root$4 = _root;
2876
- var DataView$1 = getNative$3(root$4, "DataView");
2877
- var _DataView = DataView$1;
2878
- var getNative$2 = _getNative, root$3 = _root;
2879
- var Promise$2 = getNative$2(root$3, "Promise");
2880
- var _Promise = Promise$2;
2881
- var getNative$1 = _getNative, root$2 = _root;
2882
- var Set$2 = getNative$1(root$2, "Set");
2883
- var _Set = Set$2;
2884
- var getNative = _getNative, root$1 = _root;
2885
- var WeakMap$2 = getNative(root$1, "WeakMap");
2886
- var _WeakMap = WeakMap$2;
2887
- var DataView = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$1 = _Set, WeakMap$1 = _WeakMap, baseGetTag = _baseGetTag, toSource = _toSource;
2888
- var mapTag$3 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$3 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
2889
- var dataViewTag$2 = "[object DataView]";
2890
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1);
2891
- var getTag$3 = baseGetTag;
2892
- 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) {
2893
- getTag$3 = function(value) {
2894
- var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
2895
- if (ctorString) {
2896
- switch (ctorString) {
2897
- case dataViewCtorString:
2898
- return dataViewTag$2;
2899
- case mapCtorString:
2900
- return mapTag$3;
2901
- case promiseCtorString:
2902
- return promiseTag;
2903
- case setCtorString:
2904
- return setTag$3;
2905
- case weakMapCtorString:
2906
- return weakMapTag$1;
2907
- }
2908
- }
2909
- return result;
2910
- };
2911
- }
2912
- var _getTag = getTag$3;
2913
- var objectProto = Object.prototype;
2914
- var hasOwnProperty = objectProto.hasOwnProperty;
2915
- function initCloneArray$1(array) {
2916
- var length = array.length, result = new array.constructor(length);
2917
- if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
2918
- result.index = array.index;
2919
- result.input = array.input;
2920
- }
2921
- return result;
2922
- }
2923
- var _initCloneArray = initCloneArray$1;
2924
- var root = _root;
2925
- var Uint8Array$2 = root.Uint8Array;
2926
- var _Uint8Array = Uint8Array$2;
2927
- var Uint8Array$1 = _Uint8Array;
2928
- function cloneArrayBuffer$3(arrayBuffer) {
2929
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
2930
- new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
2931
- return result;
2932
- }
2933
- var _cloneArrayBuffer = cloneArrayBuffer$3;
2934
- var cloneArrayBuffer$2 = _cloneArrayBuffer;
2935
- function cloneDataView$1(dataView, isDeep) {
2936
- var buffer = isDeep ? cloneArrayBuffer$2(dataView.buffer) : dataView.buffer;
2937
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
2938
- }
2939
- var _cloneDataView = cloneDataView$1;
2940
- var reFlags = /\w*$/;
2941
- function cloneRegExp$1(regexp) {
2942
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
2943
- result.lastIndex = regexp.lastIndex;
2944
- return result;
2945
- }
2946
- var _cloneRegExp = cloneRegExp$1;
2947
- var Symbol$1 = _Symbol;
2948
- var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
2949
- function cloneSymbol$1(symbol) {
2950
- return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
2951
- }
2952
- var _cloneSymbol = cloneSymbol$1;
2953
- var cloneArrayBuffer$1 = _cloneArrayBuffer;
2954
- function cloneTypedArray$1(typedArray, isDeep) {
2955
- var buffer = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer;
2956
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
2957
- }
2958
- var _cloneTypedArray = cloneTypedArray$1;
2959
- var cloneArrayBuffer = _cloneArrayBuffer, cloneDataView = _cloneDataView, cloneRegExp = _cloneRegExp, cloneSymbol = _cloneSymbol, cloneTypedArray = _cloneTypedArray;
2960
- 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]";
2961
- 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]";
2962
- function initCloneByTag$1(object, tag, isDeep) {
2963
- var Ctor = object.constructor;
2964
- switch (tag) {
2965
- case arrayBufferTag$1:
2966
- return cloneArrayBuffer(object);
2967
- case boolTag$1:
2968
- case dateTag$1:
2969
- return new Ctor(+object);
2970
- case dataViewTag$1:
2971
- return cloneDataView(object, isDeep);
2972
- case float32Tag$1:
2973
- case float64Tag$1:
2974
- case int8Tag$1:
2975
- case int16Tag$1:
2976
- case int32Tag$1:
2977
- case uint8Tag$1:
2978
- case uint8ClampedTag$1:
2979
- case uint16Tag$1:
2980
- case uint32Tag$1:
2981
- return cloneTypedArray(object, isDeep);
2982
- case mapTag$2:
2983
- return new Ctor();
2984
- case numberTag$1:
2985
- case stringTag$1:
2986
- return new Ctor(object);
2987
- case regexpTag$1:
2988
- return cloneRegExp(object);
2989
- case setTag$2:
2990
- return new Ctor();
2991
- case symbolTag$1:
2992
- return cloneSymbol(object);
2993
- }
2994
- }
2995
- var _initCloneByTag = initCloneByTag$1;
2996
- var isObject$1 = isObject_1;
2997
- var objectCreate = Object.create;
2998
- var baseCreate$1 = /* @__PURE__ */ function() {
2999
- function object() {
3000
- }
3001
- return function(proto) {
3002
- if (!isObject$1(proto)) {
3003
- return {};
3004
- }
3005
- if (objectCreate) {
3006
- return objectCreate(proto);
3007
- }
3008
- object.prototype = proto;
3009
- var result = new object();
3010
- object.prototype = void 0;
3011
- return result;
3012
- };
3013
- }();
3014
- var _baseCreate = baseCreate$1;
3015
- var baseCreate = _baseCreate, getPrototype = _getPrototype, isPrototype = _isPrototype;
3016
- function initCloneObject$1(object) {
3017
- return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
3018
- }
3019
- var _initCloneObject = initCloneObject$1;
3020
- var getTag$2 = _getTag, isObjectLike$1 = isObjectLike_1;
3021
- var mapTag$1 = "[object Map]";
3022
- function baseIsMap$1(value) {
3023
- return isObjectLike$1(value) && getTag$2(value) == mapTag$1;
3024
- }
3025
- var _baseIsMap = baseIsMap$1;
3026
- var baseIsMap = _baseIsMap, baseUnary$1 = _baseUnary, nodeUtil$1 = _nodeUtilExports;
3027
- var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
3028
- var isMap$1 = nodeIsMap ? baseUnary$1(nodeIsMap) : baseIsMap;
3029
- var isMap_1 = isMap$1;
3030
- var getTag$1 = _getTag, isObjectLike = isObjectLike_1;
3031
- var setTag$1 = "[object Set]";
3032
- function baseIsSet$1(value) {
3033
- return isObjectLike(value) && getTag$1(value) == setTag$1;
3034
- }
3035
- var _baseIsSet = baseIsSet$1;
3036
- var baseIsSet = _baseIsSet, baseUnary = _baseUnary, nodeUtil = _nodeUtilExports;
3037
- var nodeIsSet = nodeUtil && nodeUtil.isSet;
3038
- var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
3039
- var isSet_1 = isSet$1;
3040
- 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;
3041
- var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4;
3042
- 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]";
3043
- 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]";
3044
- var cloneableTags = {};
3045
- 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;
3046
- cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
3047
- function baseClone$1(value, bitmask, customizer, key, object, stack) {
3048
- var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
3049
- if (customizer) {
3050
- result = object ? customizer(value, key, object, stack) : customizer(value);
3051
- }
3052
- if (result !== void 0) {
3053
- return result;
3054
- }
3055
- if (!isObject(value)) {
3056
- return value;
3057
- }
3058
- var isArr = isArray(value);
3059
- if (isArr) {
3060
- result = initCloneArray(value);
3061
- if (!isDeep) {
3062
- return copyArray(value, result);
3063
- }
3064
- } else {
3065
- var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
3066
- if (isBuffer(value)) {
3067
- return cloneBuffer(value, isDeep);
3068
- }
3069
- if (tag == objectTag || tag == argsTag || isFunc && !object) {
3070
- result = isFlat || isFunc ? {} : initCloneObject(value);
3071
- if (!isDeep) {
3072
- return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
3073
- }
3074
- } else {
3075
- if (!cloneableTags[tag]) {
3076
- return object ? value : {};
3077
- }
3078
- result = initCloneByTag(value, tag, isDeep);
3079
- }
3080
- }
3081
- stack || (stack = new Stack());
3082
- var stacked = stack.get(value);
3083
- if (stacked) {
3084
- return stacked;
3085
- }
3086
- stack.set(value, result);
3087
- if (isSet(value)) {
3088
- value.forEach(function(subValue) {
3089
- result.add(baseClone$1(subValue, bitmask, customizer, subValue, value, stack));
3090
- });
3091
- } else if (isMap(value)) {
3092
- value.forEach(function(subValue, key2) {
3093
- result.set(key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
3094
- });
3095
- }
3096
- var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
3097
- var props = isArr ? void 0 : keysFunc(value);
3098
- arrayEach(props || value, function(subValue, key2) {
3099
- if (props) {
3100
- key2 = subValue;
3101
- subValue = value[key2];
3102
- }
3103
- assignValue(result, key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
3104
- });
3105
- return result;
3106
- }
3107
- var _baseClone = baseClone$1;
3108
- var baseClone = _baseClone;
3109
- var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
3110
- function cloneDeep(value) {
3111
- return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
3112
- }
3113
- var cloneDeep_1 = cloneDeep;
3114
- const cloneDeep$1 = /* @__PURE__ */ getDefaultExportFromCjs(cloneDeep_1);
3115
2227
  class CollectionRegistry {
3116
2228
  // Normalized runtime layer (used by Data Grid / UI)
3117
2229
  collectionsByTableName = /* @__PURE__ */ new Map();
@@ -3159,7 +2271,7 @@ class CollectionRegistry {
3159
2271
  ...c
3160
2272
  }));
3161
2273
  normalizedCollections.forEach((c, index) => {
3162
- const raw = cloneDeep$1(collections[index]);
2274
+ const raw = deepClone(collections[index]);
3163
2275
  this.rootCollections.push(c);
3164
2276
  this.rawRootCollections.push(raw);
3165
2277
  const normalized = this.normalizeCollection(c);
@@ -3179,7 +2291,7 @@ class CollectionRegistry {
3179
2291
  if (!subCollection) return;
3180
2292
  this._registerRecursively(this.normalizeCollection({
3181
2293
  ...subCollection
3182
- }), cloneDeep$1(subCollection));
2294
+ }), deepClone(subCollection));
3183
2295
  });
3184
2296
  }
3185
2297
  });
@@ -3187,7 +2299,7 @@ class CollectionRegistry {
3187
2299
  return true;
3188
2300
  }
3189
2301
  register(collection, rawCollection) {
3190
- const raw = rawCollection ? cloneDeep$1(rawCollection) : cloneDeep$1(collection);
2302
+ const raw = rawCollection ? deepClone(rawCollection) : deepClone(collection);
3191
2303
  this.rootCollections.push(collection);
3192
2304
  this.rawRootCollections.push(raw);
3193
2305
  this._registerRecursively(collection, raw);
@@ -3211,7 +2323,7 @@ class CollectionRegistry {
3211
2323
  if (!subCollection) return;
3212
2324
  this._registerRecursively(this.normalizeCollection({
3213
2325
  ...subCollection
3214
- }), cloneDeep$1(subCollection));
2326
+ }), deepClone(subCollection));
3215
2327
  });
3216
2328
  }
3217
2329
  }
@@ -3672,7 +2784,7 @@ class DrizzleConditionBuilder {
3672
2784
  static buildSingleFilterCondition(column, op, value) {
3673
2785
  switch (op) {
3674
2786
  case "==":
3675
- return eq$3(column, value);
2787
+ return eq(column, value);
3676
2788
  case "!=":
3677
2789
  return sql`${column} != ${value}`;
3678
2790
  case ">":
@@ -3802,7 +2914,7 @@ class DrizzleConditionBuilder {
3802
2914
  throw new Error(`Join path did not result in connecting to parent table. Current: ${currentTableName}, Parent: ${parentTableName}`);
3803
2915
  }
3804
2916
  }
3805
- const finalCondition = Array.isArray(parentEntityId) ? inArray(parentIdColumn, parentEntityId) : eq$3(parentIdColumn, parentEntityId);
2917
+ const finalCondition = Array.isArray(parentEntityId) ? inArray(parentIdColumn, parentEntityId) : eq(parentIdColumn, parentEntityId);
3806
2918
  return {
3807
2919
  joins,
3808
2920
  finalCondition
@@ -3828,7 +2940,7 @@ class DrizzleConditionBuilder {
3828
2940
  throw new Error(`Join columns not found: ${fromTableName}.${fromColName} = ${toTableName}.${toColName}`);
3829
2941
  }
3830
2942
  joinTable = fromTable;
3831
- condition = eq$3(left, right);
2943
+ condition = eq(left, right);
3832
2944
  } else if (currentTable === fromTable) {
3833
2945
  const left = toTable[toColName];
3834
2946
  const right = currentTable[fromColName];
@@ -3842,7 +2954,7 @@ class DrizzleConditionBuilder {
3842
2954
  throw new Error(`Join columns not found: ${toTableName}.${toColName} = ${fromTableName}.${fromColName}`);
3843
2955
  }
3844
2956
  joinTable = toTable;
3845
- condition = eq$3(left, right);
2957
+ condition = eq(left, right);
3846
2958
  } else {
3847
2959
  throw new Error(`Join step does not match current table. Current table does not match from: ${fromTableName} or to: ${toTableName}`);
3848
2960
  }
@@ -3873,19 +2985,19 @@ class DrizzleConditionBuilder {
3873
2985
  if (currentTable === targetTable) {
3874
2986
  return {
3875
2987
  joinTable: targetTable,
3876
- condition: eq$3(targetTableIdCol, junctionTargetCol),
2988
+ condition: eq(targetTableIdCol, junctionTargetCol),
3877
2989
  additionalJoins: [{
3878
2990
  table: junctionTable,
3879
- condition: eq$3(currentTableIdCol, junctionSourceCol)
2991
+ condition: eq(currentTableIdCol, junctionSourceCol)
3880
2992
  }]
3881
2993
  };
3882
2994
  } else {
3883
2995
  return {
3884
2996
  joinTable: junctionTable,
3885
- condition: eq$3(currentTableIdCol, junctionSourceCol),
2997
+ condition: eq(currentTableIdCol, junctionSourceCol),
3886
2998
  additionalJoins: [{
3887
2999
  table: targetTable,
3888
- condition: eq$3(targetTableIdCol, junctionTargetCol)
3000
+ condition: eq(targetTableIdCol, junctionTargetCol)
3889
3001
  }]
3890
3002
  };
3891
3003
  }
@@ -3910,11 +3022,11 @@ class DrizzleConditionBuilder {
3910
3022
  if (!junctionTargetCol) {
3911
3023
  throw new Error(`Target column '${through.targetColumn}' not found in junction table '${through.table}'`);
3912
3024
  }
3913
- const condition = Array.isArray(parentEntityId) ? inArray(junctionSourceCol, parentEntityId) : eq$3(junctionSourceCol, parentEntityId);
3025
+ const condition = Array.isArray(parentEntityId) ? inArray(junctionSourceCol, parentEntityId) : eq(junctionSourceCol, parentEntityId);
3914
3026
  return {
3915
3027
  join: {
3916
3028
  table: junctionTable,
3917
- condition: eq$3(targetIdColumn, junctionTargetCol)
3029
+ condition: eq(targetIdColumn, junctionTargetCol)
3918
3030
  },
3919
3031
  condition
3920
3032
  };
@@ -3935,11 +3047,11 @@ class DrizzleConditionBuilder {
3935
3047
  if (!junctionTargetCol) {
3936
3048
  throw new Error(`Target column '${through.targetColumn}' not found in junction table '${through.table}'`);
3937
3049
  }
3938
- const condition = Array.isArray(parentEntityId) ? inArray(junctionSourceCol, parentEntityId) : eq$3(junctionSourceCol, parentEntityId);
3050
+ const condition = Array.isArray(parentEntityId) ? inArray(junctionSourceCol, parentEntityId) : eq(junctionSourceCol, parentEntityId);
3939
3051
  return {
3940
3052
  join: {
3941
3053
  table: junctionTable,
3942
- condition: eq$3(targetIdColumn, junctionTargetCol)
3054
+ condition: eq(targetIdColumn, junctionTargetCol)
3943
3055
  },
3944
3056
  condition
3945
3057
  };
@@ -3955,15 +3067,15 @@ class DrizzleConditionBuilder {
3955
3067
  if (!idCol) {
3956
3068
  throw new Error('No primary key or "id" column found in target table');
3957
3069
  }
3958
- return Array.isArray(parentEntityId) ? inArray(idCol, parentEntityId) : eq$3(idCol, parentEntityId);
3070
+ return Array.isArray(parentEntityId) ? inArray(idCol, parentEntityId) : eq(idCol, parentEntityId);
3959
3071
  }
3960
- return Array.isArray(parentEntityId) ? inArray(targetIdCol, parentEntityId) : eq$3(targetIdCol, parentEntityId);
3072
+ return Array.isArray(parentEntityId) ? inArray(targetIdCol, parentEntityId) : eq(targetIdCol, parentEntityId);
3961
3073
  } else if (relation.direction === "inverse" && relation.foreignKeyOnTarget) {
3962
3074
  const foreignKeyCol = targetTable[relation.foreignKeyOnTarget];
3963
3075
  if (!foreignKeyCol) {
3964
3076
  throw new Error(`Foreign key column '${relation.foreignKeyOnTarget}' not found in target table. This might be a many-to-many relationship that requires a junction table. Consider using 'through' property or ensure the corresponding owning relation exists with junction table configuration.`);
3965
3077
  }
3966
- return Array.isArray(parentEntityId) ? inArray(foreignKeyCol, parentEntityId) : eq$3(foreignKeyCol, parentEntityId);
3078
+ return Array.isArray(parentEntityId) ? inArray(foreignKeyCol, parentEntityId) : eq(foreignKeyCol, parentEntityId);
3967
3079
  } else if (relation.direction === "inverse" && relation.cardinality === "many" && relation.inverseRelationName) {
3968
3080
  throw new Error(`Inverse many-to-many relation '${relation.relationName}' requires a junction table. Either specify 'through' property or ensure the corresponding owning relation exists with junction table configuration.`);
3969
3081
  } else if (relation.direction === "inverse" && relation.cardinality === "one" && relation.inverseRelationName) {
@@ -3973,7 +3085,7 @@ class DrizzleConditionBuilder {
3973
3085
  throw new Error(`Auto-inferred foreign key column '${inferredForeignKeyName}' not found in target table for inverse relation '${relation.relationName}'. Please specify 'foreignKeyOnTarget' explicitly.`);
3974
3086
  }
3975
3087
  console.debug(`🔍 [DrizzleConditionBuilder] Auto-inferred foreign key '${inferredForeignKeyName}' for inverse relation '${relation.relationName}'`);
3976
- return Array.isArray(parentEntityId) ? inArray(foreignKeyCol, parentEntityId) : eq$3(foreignKeyCol, parentEntityId);
3088
+ return Array.isArray(parentEntityId) ? inArray(foreignKeyCol, parentEntityId) : eq(foreignKeyCol, parentEntityId);
3977
3089
  } else {
3978
3090
  throw new Error(`Relation '${relation.relationName}' lacks proper configuration. For many-to-many relations, use 'through' property. For simple relations, use 'localKey' or 'foreignKeyOnTarget'.`);
3979
3091
  }
@@ -4014,7 +3126,7 @@ class DrizzleConditionBuilder {
4014
3126
  * Build a unique field check condition
4015
3127
  */
4016
3128
  static buildUniqueFieldCondition(fieldColumn, value, idColumn, excludeId) {
4017
- const conditions = [eq$3(fieldColumn, value)];
3129
+ const conditions = [eq(fieldColumn, value)];
4018
3130
  if (excludeId && idColumn) {
4019
3131
  conditions.push(sql`${idColumn} != ${excludeId}`);
4020
3132
  }
@@ -4089,7 +3201,7 @@ class DrizzleConditionBuilder {
4089
3201
  if (currentTable !== parentTable) {
4090
3202
  throw new Error("Join path did not result in connecting to parent table");
4091
3203
  }
4092
- const allConditions = [eq$3(parentIdColumn, parentEntityId)];
3204
+ const allConditions = [eq(parentIdColumn, parentEntityId)];
4093
3205
  if (additionalFilters) {
4094
3206
  allConditions.push(...additionalFilters);
4095
3207
  }
@@ -4111,11 +3223,11 @@ class DrizzleConditionBuilder {
4111
3223
  if (!junctionTargetCol) {
4112
3224
  throw new Error(`Target column '${through.targetColumn}' not found in junction table '${through.table}'`);
4113
3225
  }
4114
- const baseConditions = [eq$3(junctionSourceCol, parentEntityId)];
3226
+ const baseConditions = [eq(junctionSourceCol, parentEntityId)];
4115
3227
  if (additionalFilters && additionalFilters.length > 0) {
4116
3228
  baseConditions.push(...additionalFilters);
4117
3229
  }
4118
- return baseCountQuery.innerJoin(junctionTable, eq$3(targetIdColumn, junctionTargetCol)).where(and(...baseConditions));
3230
+ return baseCountQuery.innerJoin(junctionTable, eq(targetIdColumn, junctionTargetCol)).where(and(...baseConditions));
4119
3231
  }
4120
3232
  /**
4121
3233
  * Build inverse junction table conditions for count queries
@@ -4133,11 +3245,11 @@ class DrizzleConditionBuilder {
4133
3245
  if (!junctionTargetCol) {
4134
3246
  throw new Error(`Target column '${through.targetColumn}' not found in junction table '${through.table}'`);
4135
3247
  }
4136
- const baseConditions = [eq$3(junctionSourceCol, parentEntityId)];
3248
+ const baseConditions = [eq(junctionSourceCol, parentEntityId)];
4137
3249
  if (additionalFilters && additionalFilters.length > 0) {
4138
3250
  baseConditions.push(...additionalFilters);
4139
3251
  }
4140
- return baseCountQuery.innerJoin(junctionTable, eq$3(targetIdColumn, junctionTargetCol)).where(and(...baseConditions));
3252
+ return baseCountQuery.innerJoin(junctionTable, eq(targetIdColumn, junctionTargetCol)).where(and(...baseConditions));
4141
3253
  }
4142
3254
  /**
4143
3255
  * Helper method to extract table names from columns
@@ -4477,7 +3589,25 @@ function serializePropertyToServer(value, property) {
4477
3589
  return result;
4478
3590
  }
4479
3591
  return value;
3592
+ case "string":
3593
+ if (typeof value === "string") {
3594
+ if (value.startsWith("data:application/octet-stream;base64,")) {
3595
+ const base64Data = value.split(",")[1];
3596
+ if (base64Data) {
3597
+ return Buffer.from(base64Data, "base64");
3598
+ }
3599
+ }
3600
+ }
3601
+ return value;
4480
3602
  default:
3603
+ if (typeof value === "string") {
3604
+ if (value.startsWith("data:application/octet-stream;base64,")) {
3605
+ const base64Data = value.split(",")[1];
3606
+ if (base64Data) {
3607
+ return Buffer.from(base64Data, "base64");
3608
+ }
3609
+ }
3610
+ }
4481
3611
  return value;
4482
3612
  }
4483
3613
  }
@@ -4511,7 +3641,7 @@ async function parseDataFromServer(data, collection, db, registry) {
4511
3641
  if (targetTable && currentEntityId) {
4512
3642
  const foreignKeyColumn = targetTable[relation.foreignKeyOnTarget];
4513
3643
  if (foreignKeyColumn) {
4514
- const relatedEntities = await db.select().from(targetTable).where(eq$3(foreignKeyColumn, currentEntityId)).limit(relation.cardinality === "one" ? 1 : 100);
3644
+ const relatedEntities = await db.select().from(targetTable).where(eq(foreignKeyColumn, currentEntityId)).limit(relation.cardinality === "one" ? 1 : 100);
4515
3645
  if (relatedEntities.length > 0) {
4516
3646
  if (relation.cardinality === "one") {
4517
3647
  const targetPks = getPrimaryKeys(targetCollection, registry);
@@ -4558,12 +3688,12 @@ async function parseDataFromServer(data, collection, db, registry) {
4558
3688
  console.warn(`Join columns not found: ${fromColumn} -> ${toColumn}`);
4559
3689
  break;
4560
3690
  }
4561
- query = query.innerJoin(joinTable, eq$3(fromCol, toCol));
3691
+ query = query.innerJoin(joinTable, eq(fromCol, toCol));
4562
3692
  currentTable = joinTable;
4563
3693
  }
4564
3694
  if (pks.length === 1) {
4565
3695
  const sourceIdField = sourceTable[pks[0].fieldName];
4566
- query = query.where(eq$3(sourceIdField, currentEntityId));
3696
+ query = query.where(eq(sourceIdField, currentEntityId));
4567
3697
  } else {
4568
3698
  console.warn(`Join path resolution for composite primary keys is not yet fully supported: ${collection.slug}`);
4569
3699
  }
@@ -4571,7 +3701,7 @@ async function parseDataFromServer(data, collection, db, registry) {
4571
3701
  let combinedWhere;
4572
3702
  if (pks.length === 1) {
4573
3703
  const sourceIdField = sourceTable[pks[0].fieldName];
4574
- combinedWhere = DrizzleConditionBuilder.combineConditionsWithAnd([eq$3(sourceIdField, currentEntityId), ...additionalFilters].filter(Boolean));
3704
+ combinedWhere = DrizzleConditionBuilder.combineConditionsWithAnd([eq(sourceIdField, currentEntityId), ...additionalFilters].filter(Boolean));
4575
3705
  }
4576
3706
  const joinResults = await query.where(combinedWhere).limit(relation.cardinality === "one" ? 1 : 100);
4577
3707
  if (joinResults.length > 0) {
@@ -4603,6 +3733,37 @@ function parsePropertyFromServer(value, property, collection, propertyKey) {
4603
3733
  return value;
4604
3734
  }
4605
3735
  switch (property.type) {
3736
+ case "string": {
3737
+ if (typeof value === "string") return value;
3738
+ let isBuffer = false;
3739
+ let buf = null;
3740
+ if (Buffer.isBuffer(value)) {
3741
+ isBuffer = true;
3742
+ buf = value;
3743
+ } else if (typeof value === "object" && value !== null && value.type === "Buffer" && Array.isArray(value.data)) {
3744
+ isBuffer = true;
3745
+ buf = Buffer.from(value.data);
3746
+ }
3747
+ if (isBuffer && buf) {
3748
+ let isPrintable = true;
3749
+ for (let i = 0; i < buf.length; i++) {
3750
+ const b = buf[i];
3751
+ if ((b < 32 || b > 126) && b !== 9 && b !== 10 && b !== 13) {
3752
+ isPrintable = false;
3753
+ break;
3754
+ }
3755
+ }
3756
+ return isPrintable ? buf.toString("utf8") : `data:application/octet-stream;base64,${buf.toString("base64")}`;
3757
+ }
3758
+ if (typeof value === "object" && value !== null) {
3759
+ try {
3760
+ return JSON.stringify(value);
3761
+ } catch {
3762
+ return String(value);
3763
+ }
3764
+ }
3765
+ return String(value);
3766
+ }
4606
3767
  case "relation":
4607
3768
  if (typeof value === "string" || typeof value === "number") {
4608
3769
  let relationDef = property.relation;
@@ -4686,8 +3847,29 @@ function parsePropertyFromServer(value, property, collection, propertyKey) {
4686
3847
  }
4687
3848
  return null;
4688
3849
  }
4689
- default:
3850
+ default: {
3851
+ let isBuffer = false;
3852
+ let buf = null;
3853
+ if (Buffer.isBuffer(value)) {
3854
+ isBuffer = true;
3855
+ buf = value;
3856
+ } else if (typeof value === "object" && value !== null && value.type === "Buffer" && Array.isArray(value.data)) {
3857
+ isBuffer = true;
3858
+ buf = Buffer.from(value.data);
3859
+ }
3860
+ if (isBuffer && buf) {
3861
+ let isPrintable = true;
3862
+ for (let i = 0; i < buf.length; i++) {
3863
+ const b = buf[i];
3864
+ if ((b < 32 || b > 126) && b !== 9 && b !== 10 && b !== 13) {
3865
+ isPrintable = false;
3866
+ break;
3867
+ }
3868
+ }
3869
+ return isPrintable ? buf.toString("utf8") : `data:application/octet-stream;base64,${buf.toString("base64")}`;
3870
+ }
4690
3871
  return value;
3872
+ }
4691
3873
  }
4692
3874
  }
4693
3875
  function normalizeScalarValues(data, properties, collection, resolvedRelations, options) {
@@ -4770,11 +3952,11 @@ class RelationService {
4770
3952
  if (!fromCol || !toCol) {
4771
3953
  throw new Error(`Join columns not found: ${fromColumn} -> ${toColumn}`);
4772
3954
  }
4773
- query2 = query2.innerJoin(joinTable, eq$3(fromCol, toCol));
3955
+ query2 = query2.innerJoin(joinTable, eq(fromCol, toCol));
4774
3956
  currentTable = joinTable;
4775
3957
  }
4776
3958
  const parentIdField = parentTable[getPrimaryKeys(parentCollection, this.registry)[0].fieldName];
4777
- query2 = query2.where(eq$3(parentIdField, parsedParentId));
3959
+ query2 = query2.where(eq(parentIdField, parsedParentId));
4778
3960
  if (options.limit) {
4779
3961
  query2 = query2.limit(options.limit);
4780
3962
  }
@@ -4893,7 +4075,7 @@ class RelationService {
4893
4075
  if (!fromCol || !toCol) {
4894
4076
  throw new Error(`Join columns not found: ${fromColumn} -> ${toColumn}`);
4895
4077
  }
4896
- query2 = query2.innerJoin(joinTable, eq$3(fromCol, toCol));
4078
+ query2 = query2.innerJoin(joinTable, eq(fromCol, toCol));
4897
4079
  currentTable = joinTable;
4898
4080
  }
4899
4081
  const parentIdField = parentTable[getPrimaryKeys(parentCollection, this.registry)[0].fieldName];
@@ -5024,7 +4206,7 @@ class RelationService {
5024
4206
  const fromCol = currentTable[fromColName];
5025
4207
  const toCol = joinTable[toColName];
5026
4208
  if (!fromCol || !toCol) throw new Error(`Join columns not found: ${fromColumn} -> ${toColumn}`);
5027
- query2 = query2.innerJoin(joinTable, eq$3(fromCol, toCol));
4209
+ query2 = query2.innerJoin(joinTable, eq(fromCol, toCol));
5028
4210
  currentTable = joinTable;
5029
4211
  }
5030
4212
  const parentIdField = parentTable[getPrimaryKeys(parentCollection, this.registry)[0].fieldName];
@@ -5059,7 +4241,7 @@ class RelationService {
5059
4241
  console.warn(`[batchFetchRelatedEntitiesMany] Junction columns not found in '${relation.through.table}'`);
5060
4242
  return /* @__PURE__ */ new Map();
5061
4243
  }
5062
- const query2 = this.db.select().from(junctionTable).innerJoin(targetTable, eq$3(targetJunctionCol, targetIdField)).where(inArray(sourceJunctionCol, parsedParentIds));
4244
+ const query2 = this.db.select().from(junctionTable).innerJoin(targetTable, eq(targetJunctionCol, targetIdField)).where(inArray(sourceJunctionCol, parsedParentIds));
5063
4245
  const results2 = await query2;
5064
4246
  const resultMap2 = /* @__PURE__ */ new Map();
5065
4247
  const targetTableName = getTableName(targetCollection);
@@ -5157,7 +4339,7 @@ class RelationService {
5157
4339
  const parentIdInfo = parentPks[0];
5158
4340
  const parsedParentIdObj = parseIdValues(entityId, parentPks);
5159
4341
  const parsedParentId = parsedParentIdObj[parentIdInfo.fieldName];
5160
- await tx.delete(junctionTable).where(eq$3(sourceJunctionColumn, parsedParentId));
4342
+ await tx.delete(junctionTable).where(eq(sourceJunctionColumn, parsedParentId));
5161
4343
  if (targetEntityIds.length > 0) {
5162
4344
  const targetPks = getPrimaryKeys(targetCollection, this.registry);
5163
4345
  const targetIdInfo = targetPks[0];
@@ -5186,7 +4368,7 @@ class RelationService {
5186
4368
  const parentIdInfo = parentPks[0];
5187
4369
  const parsedParentIdObj = parseIdValues(entityId, parentPks);
5188
4370
  const parsedParentId = parsedParentIdObj[parentIdInfo.fieldName];
5189
- await tx.delete(junctionTable).where(eq$3(sourceJunctionColumn, parsedParentId));
4371
+ await tx.delete(junctionTable).where(eq(sourceJunctionColumn, parsedParentId));
5190
4372
  if (targetEntityIds.length > 0) {
5191
4373
  const targetPks = getPrimaryKeys(targetCollection, this.registry);
5192
4374
  const targetIdInfo = targetPks[0];
@@ -5219,14 +4401,14 @@ class RelationService {
5219
4401
  const parsedTargetIds = targetEntityIds.map((id) => parseIdValues(id, targetPks)[targetIdInfo.fieldName]);
5220
4402
  await tx.update(targetTable).set({
5221
4403
  [relation.foreignKeyOnTarget]: null
5222
- }).where(and(eq$3(fkCol, parsedParentId), sql`${targetIdCol} NOT IN (${sql.join(parsedTargetIds)})`));
4404
+ }).where(and(eq(fkCol, parsedParentId), sql`${targetIdCol} NOT IN (${sql.join(parsedTargetIds)})`));
5223
4405
  await tx.update(targetTable).set({
5224
4406
  [relation.foreignKeyOnTarget]: parsedParentId
5225
4407
  }).where(inArray(targetIdCol, parsedTargetIds));
5226
4408
  } else {
5227
4409
  await tx.update(targetTable).set({
5228
4410
  [relation.foreignKeyOnTarget]: null
5229
- }).where(eq$3(fkCol, parsedParentId));
4411
+ }).where(eq(fkCol, parsedParentId));
5230
4412
  }
5231
4413
  } else {
5232
4414
  console.warn(`Many relation '${key}' in collection '${collection.slug}' lacks write configuration and will be skipped during save.`);
@@ -5285,17 +4467,17 @@ class RelationService {
5285
4467
  if (newValue === null || newValue === void 0) {
5286
4468
  await tx.update(targetTable).set({
5287
4469
  [relation.foreignKeyOnTarget]: null
5288
- }).where(eq$3(foreignKeyColumn, parsedSourceId));
4470
+ }).where(eq(foreignKeyColumn, parsedSourceId));
5289
4471
  } else {
5290
4472
  const parsedNewTargetIdObj = parseIdValues(newValue, targetPks);
5291
4473
  const parsedNewTargetId = parsedNewTargetIdObj[targetIdInfo.fieldName];
5292
4474
  const targetIdField = targetTable[targetIdInfo.fieldName];
5293
4475
  await tx.update(targetTable).set({
5294
4476
  [relation.foreignKeyOnTarget]: null
5295
- }).where(eq$3(foreignKeyColumn, parsedSourceId));
4477
+ }).where(eq(foreignKeyColumn, parsedSourceId));
5296
4478
  await tx.update(targetTable).set({
5297
4479
  [relation.foreignKeyOnTarget]: parsedSourceId
5298
- }).where(eq$3(targetIdField, parsedNewTargetId));
4480
+ }).where(eq(targetIdField, parsedNewTargetId));
5299
4481
  }
5300
4482
  } catch (e) {
5301
4483
  console.warn(`Failed to update inverse relation '${relation.relationName}':`, e);
@@ -5350,7 +4532,7 @@ class RelationService {
5350
4532
  const sourceIdInfo = sourcePks[0];
5351
4533
  const parsedSourceIdObj = parseIdValues(sourceEntityId, sourcePks);
5352
4534
  const parsedSourceId = parsedSourceIdObj[sourceIdInfo.fieldName];
5353
- await tx.delete(junctionTable).where(eq$3(sourceJunctionColumn, parsedSourceId));
4535
+ await tx.delete(junctionTable).where(eq(sourceJunctionColumn, parsedSourceId));
5354
4536
  if (newValue && Array.isArray(newValue) && newValue.length > 0) {
5355
4537
  const targetPks = getPrimaryKeys(targetCollection, this.registry);
5356
4538
  const targetIdInfo = targetPks[0];
@@ -5401,7 +4583,7 @@ class RelationService {
5401
4583
  const sourceIdInfo = sourcePks[0];
5402
4584
  const parsedSourceIdObj = parseIdValues(sourceEntityId, sourcePks);
5403
4585
  const parsedSourceId = parsedSourceIdObj[sourceIdInfo.fieldName];
5404
- await tx.delete(junctionTable).where(eq$3(sourceJunctionColumn, parsedSourceId));
4586
+ await tx.delete(junctionTable).where(eq(sourceJunctionColumn, parsedSourceId));
5405
4587
  if (newValue && Array.isArray(newValue) && newValue.length > 0) {
5406
4588
  const targetPks = getPrimaryKeys(targetCollection, this.registry);
5407
4589
  const targetIdInfo = targetPks[0];
@@ -5456,14 +4638,14 @@ class RelationService {
5456
4638
  }
5457
4639
  const parentRows = await tx.select({
5458
4640
  val: parentSourceCol
5459
- }).from(parentTable).where(eq$3(parentIdCol, parsedParentId)).limit(1);
4641
+ }).from(parentTable).where(eq(parentIdCol, parsedParentId)).limit(1);
5460
4642
  if (parentRows.length === 0) continue;
5461
4643
  const parentFKValue = parentRows[0].val;
5462
4644
  if (newTargetId === null || newTargetId === void 0) {
5463
4645
  if (parentFKValue !== null && parentFKValue !== void 0) {
5464
4646
  await tx.update(targetTable).set({
5465
4647
  [targetFKColName]: null
5466
- }).where(eq$3(targetFKCol, parentFKValue));
4648
+ }).where(eq(targetFKCol, parentFKValue));
5467
4649
  }
5468
4650
  continue;
5469
4651
  }
@@ -5472,14 +4654,14 @@ class RelationService {
5472
4654
  if (parentFKValue !== null && parentFKValue !== void 0) {
5473
4655
  await tx.update(targetTable).set({
5474
4656
  [targetFKColName]: null
5475
- }).where(eq$3(targetFKCol, parentFKValue));
4657
+ }).where(eq(targetFKCol, parentFKValue));
5476
4658
  } else {
5477
4659
  console.warn(`Cannot set joinPath relation '${relation.relationName}' because parent FK value is null/undefined`);
5478
4660
  continue;
5479
4661
  }
5480
4662
  await tx.update(targetTable).set({
5481
4663
  [targetFKColName]: parentFKValue
5482
- }).where(eq$3(targetIdCol, parsedTargetId));
4664
+ }).where(eq(targetIdCol, parsedTargetId));
5483
4665
  }
5484
4666
  }
5485
4667
  /**
@@ -5864,7 +5046,7 @@ class EntityFetchService {
5864
5046
  const collection = getCollectionByPath(collectionPath, this.registry);
5865
5047
  const searchConditions = DrizzleConditionBuilder.buildSearchConditions(options.searchString, collection.properties, table);
5866
5048
  if (searchConditions.length === 0) {
5867
- queryOpts.where = and(eq$3(idField, -99999999));
5049
+ queryOpts.where = and(eq(idField, -99999999));
5868
5050
  return queryOpts;
5869
5051
  }
5870
5052
  allConditions.push(DrizzleConditionBuilder.combineConditionsWithOr(searchConditions));
@@ -5911,9 +5093,9 @@ class EntityFetchService {
5911
5093
  const startAfterId = cursor.id ?? cursor[idInfo.fieldName];
5912
5094
  if (startAfterOrderValue !== void 0 && startAfterId !== void 0) {
5913
5095
  if (options.order === "asc") {
5914
- return [or(gt(orderByField, startAfterOrderValue), and(eq$3(orderByField, startAfterOrderValue), gt(idField, startAfterId)))];
5096
+ return [or(gt(orderByField, startAfterOrderValue), and(eq(orderByField, startAfterOrderValue), gt(idField, startAfterId)))];
5915
5097
  } else {
5916
- return [or(lt(orderByField, startAfterOrderValue), and(eq$3(orderByField, startAfterOrderValue), lt(idField, startAfterId)))];
5098
+ return [or(lt(orderByField, startAfterOrderValue), and(eq(orderByField, startAfterOrderValue), lt(idField, startAfterId)))];
5917
5099
  }
5918
5100
  }
5919
5101
  }
@@ -5947,7 +5129,7 @@ class EntityFetchService {
5947
5129
  try {
5948
5130
  const withConfig = this.buildWithConfig(collection);
5949
5131
  const row = await qb.findFirst({
5950
- where: eq$3(idField, parsedId),
5132
+ where: eq(idField, parsedId),
5951
5133
  with: withConfig
5952
5134
  });
5953
5135
  if (!row) return void 0;
@@ -5955,10 +5137,14 @@ class EntityFetchService {
5955
5137
  await this.resolveJoinPathRelations(entity, collection, collectionPath, parsedId, databaseId);
5956
5138
  return entity;
5957
5139
  } catch (e) {
5140
+ if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
5141
+ console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
5142
+ 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.`);
5143
+ }
5958
5144
  console.warn(`[EntityFetchService] db.query.findFirst failed for ${collectionPath}, falling back to db.select:`, e);
5959
5145
  }
5960
5146
  }
5961
- const result = await this.db.select().from(table).where(eq$3(idField, parsedId)).limit(1);
5147
+ const result = await this.db.select().from(table).where(eq(idField, parsedId)).limit(1);
5962
5148
  if (result.length === 0) return void 0;
5963
5149
  const raw = result[0];
5964
5150
  const values = await parseDataFromServer(raw, collection, this.db, this.registry);
@@ -6015,6 +5201,10 @@ class EntityFetchService {
6015
5201
  const entities = results2.map((row) => this.drizzleResultToEntity(row, collection, collectionPath, idInfo, options.databaseId, idInfoArray));
6016
5202
  return entities;
6017
5203
  } catch (e) {
5204
+ if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
5205
+ console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
5206
+ 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.`);
5207
+ }
6018
5208
  console.warn(`[EntityFetchService] db.query.findMany failed for ${collectionPath}, falling back to db.select:`, e);
6019
5209
  }
6020
5210
  }
@@ -6284,6 +5474,10 @@ class EntityFetchService {
6284
5474
  await this.resolveJoinPathRelationsBatchRest(restRows, collection, collectionPath, idInfoArray, include);
6285
5475
  return restRows;
6286
5476
  } catch (e) {
5477
+ if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
5478
+ console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
5479
+ 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.`);
5480
+ }
6287
5481
  console.warn(`[fetchCollectionForRest] db.query.findMany failed for ${collectionPath}, falling back:`, e);
6288
5482
  }
6289
5483
  }
@@ -6354,7 +5548,7 @@ class EntityFetchService {
6354
5548
  try {
6355
5549
  const withConfig = include && include.length > 0 ? this.buildWithConfig(collection, include) : void 0;
6356
5550
  const row = await qb.findFirst({
6357
- where: eq$3(idField, parsedId),
5551
+ where: eq(idField, parsedId),
6358
5552
  ...withConfig ? {
6359
5553
  with: withConfig
6360
5554
  } : {}
@@ -6364,10 +5558,14 @@ class EntityFetchService {
6364
5558
  await this.resolveJoinPathRelationsBatchRest([restRow], collection, collectionPath, idInfoArray, include);
6365
5559
  return restRow;
6366
5560
  } catch (e) {
5561
+ if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
5562
+ console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
5563
+ 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.`);
5564
+ }
6367
5565
  console.warn(`[fetchEntityForRest] db.query.findFirst failed for ${collectionPath}, falling back:`, e);
6368
5566
  }
6369
5567
  }
6370
- const result = await this.db.select().from(table).where(eq$3(idField, parsedId)).limit(1);
5568
+ const result = await this.db.select().from(table).where(eq(idField, parsedId)).limit(1);
6371
5569
  if (result.length === 0) return null;
6372
5570
  const raw = result[0];
6373
5571
  const flatEntity = {
@@ -6576,7 +5774,7 @@ class EntityPersistService {
6576
5774
  }
6577
5775
  const parsedIdObj = parseIdValues(entityId, idInfoArray);
6578
5776
  const parsedId = parsedIdObj[idInfo.fieldName];
6579
- await this.db.delete(table).where(eq$3(idField, parsedId));
5777
+ await this.db.delete(table).where(eq(idField, parsedId));
6580
5778
  }
6581
5779
  /**
6582
5780
  * Save an entity (create or update)
@@ -6700,7 +5898,7 @@ class EntityPersistService {
6700
5898
  const conditions = [];
6701
5899
  for (const info of idInfoArray) {
6702
5900
  const field = table[info.fieldName];
6703
- conditions.push(eq$3(field, idValues[info.fieldName]));
5901
+ conditions.push(eq(field, idValues[info.fieldName]));
6704
5902
  }
6705
5903
  await updateQuery.where(and(...conditions));
6706
5904
  }
@@ -6757,22 +5955,78 @@ class EntityPersistService {
6757
5955
  const pgError = this.extractPgError(error);
6758
5956
  if (pgError) {
6759
5957
  const detail = pgError.detail;
5958
+ const hint = pgError.hint;
6760
5959
  const constraint = pgError.constraint;
6761
5960
  const column = pgError.column;
6762
5961
  const table = pgError.table;
5962
+ const dataType = pgError.dataType;
5963
+ const pgMessage = pgError.message || "Unknown database error";
5964
+ const suffix = hint ? ` Hint: ${hint}` : "";
5965
+ const tableRef = table ?? collectionSlug;
6763
5966
  switch (pgError.code) {
6764
5967
  case "23503":
6765
- return new Error(detail ? `Foreign key constraint violated: ${detail}` : `Cannot save: a foreign key constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".`);
5968
+ return new Error(detail ? `Foreign key constraint violated: ${detail}${suffix}` : `Cannot save: a foreign key constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".${suffix}`);
6766
5969
  case "23505":
6767
- return new Error(detail ? `Duplicate value: ${detail}` : `Cannot save: a unique constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".`);
5970
+ return new Error(detail ? `Duplicate value: ${detail}${suffix}` : `Cannot save: a unique constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".${suffix}`);
6768
5971
  case "23502":
6769
- return new Error(`Missing required field: "${column ?? "unknown"}" in "${table ?? collectionSlug}" cannot be empty.`);
5972
+ return new Error(`Missing required field: "${column ?? "unknown"}" in "${tableRef}" cannot be empty.${suffix}`);
6770
5973
  case "23514":
6771
- return new Error(`Validation failed: a check constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".`);
5974
+ return new Error(`Validation failed: a check constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".${suffix}`);
5975
+ case "22P02":
5976
+ return new Error(`Invalid data format in "${collectionSlug}": ${pgMessage}${suffix}`);
5977
+ case "22001":
5978
+ return new Error(`Value too long for column "${column ?? "unknown"}" in "${tableRef}": ${pgMessage}${suffix}`);
5979
+ case "22003":
5980
+ return new Error(`Numeric value out of range for column "${column ?? "unknown"}" in "${tableRef}": ${pgMessage}${suffix}`);
5981
+ case "42703":
5982
+ return new Error(`Unknown column in "${tableRef}": ${pgMessage}. Check if your schema is up to date (run migrations).${suffix}`);
5983
+ case "42P01":
5984
+ return new Error(`Table not found for "${collectionSlug}": ${pgMessage}. Check if your schema is up to date (run migrations).${suffix}`);
5985
+ default: {
5986
+ const parts = [`Database error in "${collectionSlug}" [${pgError.code}]: ${pgMessage}`];
5987
+ if (detail) parts.push(`Detail: ${detail}`);
5988
+ if (column) parts.push(`Column: ${column}`);
5989
+ if (dataType) parts.push(`Data type: ${dataType}`);
5990
+ if (constraint) parts.push(`Constraint: ${constraint}`);
5991
+ if (hint) parts.push(`Hint: ${hint}`);
5992
+ return new Error(parts.join(". "));
5993
+ }
5994
+ }
5995
+ }
5996
+ const causeMessage = this.extractCauseMessage(error);
5997
+ if (causeMessage) {
5998
+ return new Error(`Database error in "${collectionSlug}": ${causeMessage}`);
5999
+ }
6000
+ if (error instanceof Error) {
6001
+ const cleaned = this.stripSqlFromMessage(error.message, collectionSlug);
6002
+ return new Error(cleaned);
6003
+ }
6004
+ return new Error(`Database error in "${collectionSlug}": ${String(error)}`);
6005
+ }
6006
+ /**
6007
+ * Walk the error cause chain and return the deepest meaningful message.
6008
+ */
6009
+ extractCauseMessage(error) {
6010
+ if (!error || typeof error !== "object") return null;
6011
+ const err = error;
6012
+ if (err.cause && typeof err.cause === "object") {
6013
+ const deeper = this.extractCauseMessage(err.cause);
6014
+ if (deeper) return deeper;
6015
+ if (err.cause instanceof Error && err.cause.message) {
6016
+ return err.cause.message;
6772
6017
  }
6773
6018
  }
6774
- if (error instanceof Error) return error;
6775
- return new Error(String(error));
6019
+ return null;
6020
+ }
6021
+ /**
6022
+ * Strip the raw SQL query from a Drizzle "Failed query: ..." message,
6023
+ * keeping only the error description.
6024
+ */
6025
+ stripSqlFromMessage(message, collectionSlug) {
6026
+ if (message.startsWith("Failed query:")) {
6027
+ return `Failed to save entity in "${collectionSlug}". Check server logs for details.`;
6028
+ }
6029
+ return message;
6776
6030
  }
6777
6031
  /**
6778
6032
  * Extract the underlying PostgreSQL error from a Drizzle wrapper.
@@ -6781,7 +6035,7 @@ class EntityPersistService {
6781
6035
  extractPgError(error) {
6782
6036
  if (!error || typeof error !== "object") return null;
6783
6037
  const err = error;
6784
- if (err.code && /^[0-9]{5}$/.test(err.code)) {
6038
+ if (err.code && /^[0-9A-Z]{5}$/.test(err.code)) {
6785
6039
  return err;
6786
6040
  }
6787
6041
  if (err.cause && typeof err.cause === "object") {
@@ -7069,6 +6323,7 @@ class PostgresBackendDriver {
7069
6323
  branchService;
7070
6324
  user;
7071
6325
  data;
6326
+ client;
7072
6327
  /**
7073
6328
  * When true, realtime notifications are deferred until after the
7074
6329
  * wrapping transaction commits. Set by `withAuth` → `withTransaction`.
@@ -7158,7 +6413,8 @@ class PostgresBackendDriver {
7158
6413
  const contextForCallback = {
7159
6414
  user: this.user,
7160
6415
  driver: this,
7161
- data: this.data
6416
+ data: this.data,
6417
+ client: this.client
7162
6418
  };
7163
6419
  return Promise.all(entities.map(async (entity) => {
7164
6420
  let fetched = entity;
@@ -7252,7 +6508,8 @@ class PostgresBackendDriver {
7252
6508
  const contextForCallback = {
7253
6509
  user: this.user,
7254
6510
  driver: this,
7255
- data: this.data
6511
+ data: this.data,
6512
+ client: this.client
7256
6513
  };
7257
6514
  if (callbacks?.afterRead) {
7258
6515
  entity = await callbacks.afterRead({
@@ -7321,7 +6578,8 @@ class PostgresBackendDriver {
7321
6578
  const contextForCallback = {
7322
6579
  user: this.user,
7323
6580
  driver: this,
7324
- data: this.data
6581
+ data: this.data,
6582
+ client: this.client
7325
6583
  };
7326
6584
  let previousValuesForHistory;
7327
6585
  if (status === "existing" && entityId) {
@@ -7356,6 +6614,14 @@ class PostgresBackendDriver {
7356
6614
  if (result) updatedValues = mergeDeep(updatedValues, result);
7357
6615
  }
7358
6616
  }
6617
+ if (resolvedCollection?.properties) {
6618
+ updatedValues = updateDateAutoValues({
6619
+ inputValues: updatedValues,
6620
+ properties: resolvedCollection.properties,
6621
+ status: status ?? "new",
6622
+ timestampNowValue: /* @__PURE__ */ new Date()
6623
+ });
6624
+ }
7359
6625
  try {
7360
6626
  let savedEntity = await this.entityService.saveEntity(path2, updatedValues, entityId, resolvedCollection?.databaseId);
7361
6627
  if (savedEntity && (callbacks?.afterRead || propertyCallbacks?.afterRead)) {
@@ -7461,7 +6727,8 @@ class PostgresBackendDriver {
7461
6727
  const contextForCallback = {
7462
6728
  user: this.user,
7463
6729
  driver: this,
7464
- data: this.data
6730
+ data: this.data,
6731
+ client: this.client
7465
6732
  };
7466
6733
  if (callbacks?.beforeDelete || propertyCallbacks?.beforeDelete) {
7467
6734
  if (callbacks?.beforeDelete) {
@@ -7788,6 +7055,7 @@ class AuthenticatedPostgresBackendDriver {
7788
7055
  txDelegate.entityService = txEntityService;
7789
7056
  txDelegate._deferNotifications = true;
7790
7057
  txDelegate._pendingNotifications = pendingNotifications;
7058
+ txDelegate.client = this.delegate.client;
7791
7059
  return await operation(txDelegate);
7792
7060
  });
7793
7061
  for (const notification of pendingNotifications) {
@@ -8069,6 +7337,12 @@ const userIdentitiesRelations = relations(userIdentities, ({
8069
7337
  references: [users.id]
8070
7338
  })
8071
7339
  }));
7340
+ const resolveColumnName = (propName, prop) => {
7341
+ if (prop && "columnName" in prop && typeof prop.columnName === "string") {
7342
+ return prop.columnName;
7343
+ }
7344
+ return toSnakeCase(propName);
7345
+ };
8072
7346
  const getPrimaryKeyProp = (collection) => {
8073
7347
  if (collection.properties) {
8074
7348
  const idPropEntry = Object.entries(collection.properties).find(([_, prop]) => "isId" in prop && Boolean(prop.isId));
@@ -8109,7 +7383,7 @@ const isIdProperty = (propName, prop, collection) => {
8109
7383
  return !hasExplicitId && propName === "id";
8110
7384
  };
8111
7385
  const getDrizzleColumn = (propName, prop, collection, collections) => {
8112
- const colName = toSnakeCase(propName);
7386
+ const colName = resolveColumnName(propName, prop);
8113
7387
  let columnDefinition;
8114
7388
  switch (prop.type) {
8115
7389
  case "string": {
@@ -8181,6 +7455,9 @@ const getDrizzleColumn = (propName, prop, collection, collections) => {
8181
7455
  } else {
8182
7456
  columnDefinition = `timestamp("${colName}", { withTimezone: true, mode: 'string' })`;
8183
7457
  }
7458
+ if (dateProp.autoValue === "on_create" || dateProp.autoValue === "on_update") {
7459
+ columnDefinition += `.default(sql\`now()\`)`;
7460
+ }
8184
7461
  break;
8185
7462
  }
8186
7463
  case "map":
@@ -8213,7 +7490,7 @@ const getDrizzleColumn = (propName, prop, collection, collections) => {
8213
7490
  } catch {
8214
7491
  return null;
8215
7492
  }
8216
- const fkColumnName = toSnakeCase(relation.localKey);
7493
+ const fkColumnName = relation.localKey;
8217
7494
  const targetTableVar = getTableVarName(getTableName(targetCollection));
8218
7495
  const pkProp = getPrimaryKeyProp(targetCollection);
8219
7496
  const targetIdField = pkProp.name;
@@ -8401,7 +7678,7 @@ const generateSchema = async (collections, stripPolicies = false) => {
8401
7678
  Object.entries(collection.properties ?? {}).forEach(([propName, prop]) => {
8402
7679
  if ("enum" in prop && (prop.type === "string" || prop.type === "number") && prop.enum) {
8403
7680
  const enumVarName = getEnumVarName(collectionPath, propName);
8404
- const enumDbName = `${collectionPath}_${toSnakeCase(propName)}`;
7681
+ const enumDbName = `${collectionPath}_${resolveColumnName(propName, prop)}`;
8405
7682
  const values = Array.isArray(prop.enum) ? prop.enum.map((v) => String(v.id ?? v)) : Object.keys(prop.enum);
8406
7683
  if (values.length > 0) {
8407
7684
  schemaContent += `export const ${enumVarName} = pgEnum("${enumDbName}", [${values.map((v) => `'${v}'`).join(", ")}]);
@@ -8458,9 +7735,9 @@ const generateSchema = async (collections, stripPolicies = false) => {
8458
7735
  const targetId = getPrimaryKeyName(targetCollection);
8459
7736
  schemaContent += `export const ${tableVarName} = pgTable("${tableName}", {
8460
7737
  `;
8461
- schemaContent += ` ${sourceColumn}: ${sourceColType}("${toSnakeCase(sourceColumn)}").notNull().references(() => ${getTableVarName(getTableName(sourceCollection))}.${sourceId}, ${refOptions}),
7738
+ schemaContent += ` ${sourceColumn}: ${sourceColType}("${sourceColumn}").notNull().references(() => ${getTableVarName(getTableName(sourceCollection))}.${sourceId}, ${refOptions}),
8462
7739
  `;
8463
- schemaContent += ` ${targetColumn}: ${targetColType}("${toSnakeCase(targetColumn)}").notNull().references(() => ${getTableVarName(getTableName(targetCollection))}.${targetId}, ${refOptions}),
7740
+ schemaContent += ` ${targetColumn}: ${targetColType}("${targetColumn}").notNull().references(() => ${getTableVarName(getTableName(targetCollection))}.${targetId}, ${refOptions}),
8464
7741
  `;
8465
7742
  schemaContent += "}, (table) => ({\n";
8466
7743
  schemaContent += ` pk: primaryKey({ columns: [table.${sourceColumn}, table.${targetColumn}] })
@@ -8584,6 +7861,32 @@ const generateSchema = async (collections, stripPolicies = false) => {
8584
7861
  console.warn(`Could not generate relation ${relationKey} for ${collection.name}:`, e);
8585
7862
  }
8586
7863
  }
7864
+ for (const otherCollection of collections) {
7865
+ if (otherCollection.slug === collection.slug) continue;
7866
+ const otherRelations = resolveCollectionRelations(otherCollection);
7867
+ for (const [otherKey, otherRel] of Object.entries(otherRelations)) {
7868
+ if (otherRel.direction === "inverse" && otherRel.foreignKeyOnTarget) {
7869
+ try {
7870
+ const otherTarget = otherRel.target();
7871
+ if (otherTarget.slug === collection.slug) {
7872
+ const drizzleRelationName = computeSharedRelationName(otherRel, otherCollection, collections);
7873
+ const deduplicationKey = `${drizzleRelationName}::owning`;
7874
+ if (!emittedRelationNames.has(deduplicationKey)) {
7875
+ const otherTableVar = getTableVarName(getTableName(otherCollection));
7876
+ const synthKey = `_synth_${otherTableVar}_${otherRel.foreignKeyOnTarget}`;
7877
+ tableRelations.push(` "${synthKey}": one(${otherTableVar}, {
7878
+ fields: [${tableVarName}.${otherRel.foreignKeyOnTarget}],
7879
+ references: [${otherTableVar}.${getPrimaryKeyName(otherCollection)}],
7880
+ relationName: "${drizzleRelationName}"
7881
+ })`);
7882
+ emittedRelationNames.add(deduplicationKey);
7883
+ }
7884
+ }
7885
+ } catch (e) {
7886
+ }
7887
+ }
7888
+ }
7889
+ }
8587
7890
  }
8588
7891
  if (tableRelations.length > 0) {
8589
7892
  const relVarName = `${tableVarName}Relations`;
@@ -10362,11 +9665,11 @@ class UserService {
10362
9665
  return user;
10363
9666
  }
10364
9667
  async getUserById(id) {
10365
- const [user] = await this.db.select().from(users).where(eq$3(users.id, id));
9668
+ const [user] = await this.db.select().from(users).where(eq(users.id, id));
10366
9669
  return user || null;
10367
9670
  }
10368
9671
  async getUserByEmail(email) {
10369
- const [user] = await this.db.select().from(users).where(eq$3(users.email, email.toLowerCase()));
9672
+ const [user] = await this.db.select().from(users).where(eq(users.email, email.toLowerCase()));
10370
9673
  return user || null;
10371
9674
  }
10372
9675
  async getUserByIdentity(provider, providerId) {
@@ -10422,11 +9725,11 @@ class UserService {
10422
9725
  const [user] = await this.db.update(users).set({
10423
9726
  ...data,
10424
9727
  updatedAt: /* @__PURE__ */ new Date()
10425
- }).where(eq$3(users.id, id)).returning();
9728
+ }).where(eq(users.id, id)).returning();
10426
9729
  return user || null;
10427
9730
  }
10428
9731
  async deleteUser(id) {
10429
- await this.db.delete(users).where(eq$3(users.id, id));
9732
+ await this.db.delete(users).where(eq(users.id, id));
10430
9733
  }
10431
9734
  async listUsers() {
10432
9735
  return this.db.select().from(users);
@@ -10495,7 +9798,7 @@ class UserService {
10495
9798
  await this.db.update(users).set({
10496
9799
  passwordHash,
10497
9800
  updatedAt: /* @__PURE__ */ new Date()
10498
- }).where(eq$3(users.id, id));
9801
+ }).where(eq(users.id, id));
10499
9802
  }
10500
9803
  /**
10501
9804
  * Set email verification status
@@ -10505,7 +9808,7 @@ class UserService {
10505
9808
  emailVerified: verified,
10506
9809
  emailVerificationToken: null,
10507
9810
  updatedAt: /* @__PURE__ */ new Date()
10508
- }).where(eq$3(users.id, id));
9811
+ }).where(eq(users.id, id));
10509
9812
  }
10510
9813
  /**
10511
9814
  * Set email verification token
@@ -10515,13 +9818,13 @@ class UserService {
10515
9818
  emailVerificationToken: token,
10516
9819
  emailVerificationSentAt: token ? /* @__PURE__ */ new Date() : null,
10517
9820
  updatedAt: /* @__PURE__ */ new Date()
10518
- }).where(eq$3(users.id, id));
9821
+ }).where(eq(users.id, id));
10519
9822
  }
10520
9823
  /**
10521
9824
  * Find user by email verification token
10522
9825
  */
10523
9826
  async getUserByVerificationToken(token) {
10524
- const [user] = await this.db.select().from(users).where(eq$3(users.emailVerificationToken, token));
9827
+ const [user] = await this.db.select().from(users).where(eq(users.emailVerificationToken, token));
10525
9828
  return user || null;
10526
9829
  }
10527
9830
  /**
@@ -10694,14 +9997,14 @@ class RefreshTokenService {
10694
9997
  createdAt: refreshTokens.createdAt,
10695
9998
  userAgent: refreshTokens.userAgent,
10696
9999
  ipAddress: refreshTokens.ipAddress
10697
- }).from(refreshTokens).where(eq$3(refreshTokens.tokenHash, tokenHash));
10000
+ }).from(refreshTokens).where(eq(refreshTokens.tokenHash, tokenHash));
10698
10001
  return token || null;
10699
10002
  }
10700
10003
  async deleteByHash(tokenHash) {
10701
- await this.db.delete(refreshTokens).where(eq$3(refreshTokens.tokenHash, tokenHash));
10004
+ await this.db.delete(refreshTokens).where(eq(refreshTokens.tokenHash, tokenHash));
10702
10005
  }
10703
10006
  async deleteAllForUser(userId) {
10704
- await this.db.delete(refreshTokens).where(eq$3(refreshTokens.userId, userId));
10007
+ await this.db.delete(refreshTokens).where(eq(refreshTokens.userId, userId));
10705
10008
  }
10706
10009
  async listForUser(userId) {
10707
10010
  const tokens = await this.db.select({
@@ -10712,7 +10015,7 @@ class RefreshTokenService {
10712
10015
  createdAt: refreshTokens.createdAt,
10713
10016
  userAgent: refreshTokens.userAgent,
10714
10017
  ipAddress: refreshTokens.ipAddress
10715
- }).from(refreshTokens).where(eq$3(refreshTokens.userId, userId)).orderBy(refreshTokens.createdAt);
10018
+ }).from(refreshTokens).where(eq(refreshTokens.userId, userId)).orderBy(refreshTokens.createdAt);
10716
10019
  return tokens;
10717
10020
  }
10718
10021
  async deleteById(id, userId) {
@@ -10744,7 +10047,7 @@ class PasswordResetTokenService {
10744
10047
  const [token] = await this.db.select({
10745
10048
  userId: passwordResetTokens.userId,
10746
10049
  expiresAt: passwordResetTokens.expiresAt
10747
- }).from(passwordResetTokens).where(eq$3(passwordResetTokens.tokenHash, tokenHash));
10050
+ }).from(passwordResetTokens).where(eq(passwordResetTokens.tokenHash, tokenHash));
10748
10051
  if (!token) return null;
10749
10052
  const result = await this.db.execute(sql`
10750
10053
  SELECT user_id, expires_at
@@ -10766,13 +10069,13 @@ class PasswordResetTokenService {
10766
10069
  async markAsUsed(tokenHash) {
10767
10070
  await this.db.update(passwordResetTokens).set({
10768
10071
  usedAt: /* @__PURE__ */ new Date()
10769
- }).where(eq$3(passwordResetTokens.tokenHash, tokenHash));
10072
+ }).where(eq(passwordResetTokens.tokenHash, tokenHash));
10770
10073
  }
10771
10074
  /**
10772
10075
  * Delete all tokens for a user
10773
10076
  */
10774
10077
  async deleteAllForUser(userId) {
10775
- await this.db.delete(passwordResetTokens).where(eq$3(passwordResetTokens.userId, userId));
10078
+ await this.db.delete(passwordResetTokens).where(eq(passwordResetTokens.userId, userId));
10776
10079
  }
10777
10080
  /**
10778
10081
  * Clean up expired tokens