@rebasepro/server-postgresql 0.0.1-canary.892f711 → 0.0.1-canary.a6becfb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +381 -1074
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +312 -1005
- package/dist/index.umd.js.map +1 -1
- package/dist/server-postgresql/src/PostgresBackendDriver.d.ts +2 -1
- package/dist/server-postgresql/src/schema/introspect-db-inference.d.ts +5 -0
- package/dist/server-postgresql/src/schema/introspect-db-logic.d.ts +44 -9
- package/dist/server-postgresql/src/services/EntityPersistService.d.ts +9 -0
- package/dist/types/src/controllers/auth.d.ts +8 -2
- package/dist/types/src/controllers/client.d.ts +13 -0
- package/dist/types/src/controllers/navigation.d.ts +18 -6
- package/dist/types/src/controllers/registry.d.ts +9 -1
- package/dist/types/src/controllers/side_entity_controller.d.ts +7 -0
- package/dist/types/src/rebase_context.d.ts +17 -0
- package/dist/types/src/types/collections.d.ts +64 -1
- package/dist/types/src/types/component_ref.d.ts +47 -0
- package/dist/types/src/types/entity_views.d.ts +2 -1
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/properties.d.ts +3 -3
- package/dist/types/src/types/translations.d.ts +8 -0
- package/package.json +5 -5
- package/src/PostgresBackendDriver.ts +23 -6
- package/src/cli.ts +9 -1
- package/src/data-transformer.ts +84 -1
- package/src/schema/generate-drizzle-schema-logic.ts +35 -0
- package/src/schema/introspect-db-inference.ts +238 -0
- package/src/schema/introspect-db-logic.ts +337 -36
- package/src/schema/introspect-db.ts +66 -23
- package/src/services/EntityFetchService.ts +16 -0
- package/src/services/EntityPersistService.ts +88 -12
- package/test/generate-drizzle-schema.test.ts +128 -0
- package/test/introspect-db-generation.test.ts +5 -5
- package/test/property-ordering.test.ts +395 -0
package/dist/index.umd.js
CHANGED
|
@@ -140,9 +140,6 @@
|
|
|
140
140
|
return regExpMatchArray.map((x) => x.toLowerCase()).join("_");
|
|
141
141
|
};
|
|
142
142
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
143
|
-
function getDefaultExportFromCjs(x) {
|
|
144
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
145
|
-
}
|
|
146
143
|
function commonjsRequire(path2) {
|
|
147
144
|
throw new Error('Could not dynamically require "' + path2 + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
148
145
|
}
|
|
@@ -929,7 +926,23 @@
|
|
|
929
926
|
}, { buffer: 3, lYpoI2: 11 }] }, {}, [1])(1);
|
|
930
927
|
});
|
|
931
928
|
})(object_hash);
|
|
932
|
-
function
|
|
929
|
+
function deepClone(value) {
|
|
930
|
+
if (value === null || value === void 0) return value;
|
|
931
|
+
if (typeof value === "function") return value;
|
|
932
|
+
if (typeof value !== "object") return value;
|
|
933
|
+
if (Array.isArray(value)) {
|
|
934
|
+
return value.map((item) => deepClone(item));
|
|
935
|
+
}
|
|
936
|
+
if (Object.getPrototypeOf(value) !== Object.prototype) {
|
|
937
|
+
return value;
|
|
938
|
+
}
|
|
939
|
+
const result = {};
|
|
940
|
+
for (const key of Object.keys(value)) {
|
|
941
|
+
result[key] = deepClone(value[key]);
|
|
942
|
+
}
|
|
943
|
+
return result;
|
|
944
|
+
}
|
|
945
|
+
function isObject(item) {
|
|
933
946
|
return !!item && typeof item === "object" && !Array.isArray(item);
|
|
934
947
|
}
|
|
935
948
|
function isPlainObject(obj) {
|
|
@@ -940,13 +953,13 @@
|
|
|
940
953
|
return proto === Object.prototype;
|
|
941
954
|
}
|
|
942
955
|
function mergeDeep(target, source, ignoreUndefined = false) {
|
|
943
|
-
if (!isObject
|
|
956
|
+
if (!isObject(target)) {
|
|
944
957
|
return target;
|
|
945
958
|
}
|
|
946
959
|
const output = {
|
|
947
960
|
...target
|
|
948
961
|
};
|
|
949
|
-
if (!isObject
|
|
962
|
+
if (!isObject(source)) {
|
|
950
963
|
return output;
|
|
951
964
|
}
|
|
952
965
|
for (const key in source) {
|
|
@@ -987,7 +1000,7 @@
|
|
|
987
1000
|
} else {
|
|
988
1001
|
output[key] = sourceValue;
|
|
989
1002
|
}
|
|
990
|
-
} else if (isObject
|
|
1003
|
+
} else if (isObject(sourceValue)) {
|
|
991
1004
|
output[key] = sourceValue;
|
|
992
1005
|
} else {
|
|
993
1006
|
output[key] = sourceValue;
|
|
@@ -1030,6 +1043,80 @@
|
|
|
1030
1043
|
const singularName = snakeCaseName.endsWith("s") ? snakeCaseName.slice(0, -1) : snakeCaseName;
|
|
1031
1044
|
return `${singularName}_id`;
|
|
1032
1045
|
}
|
|
1046
|
+
function updateDateAutoValues({
|
|
1047
|
+
inputValues,
|
|
1048
|
+
properties,
|
|
1049
|
+
status,
|
|
1050
|
+
timestampNowValue
|
|
1051
|
+
}) {
|
|
1052
|
+
return traverseValuesProperties(inputValues, properties, (inputValue, property) => {
|
|
1053
|
+
if (property.type === "date") {
|
|
1054
|
+
if (status === "existing" && property.autoValue === "on_update") {
|
|
1055
|
+
return timestampNowValue;
|
|
1056
|
+
} else if ((status === "new" || status === "copy") && (property.autoValue === "on_update" || property.autoValue === "on_create")) {
|
|
1057
|
+
return timestampNowValue;
|
|
1058
|
+
} else {
|
|
1059
|
+
return inputValue;
|
|
1060
|
+
}
|
|
1061
|
+
} else {
|
|
1062
|
+
return inputValue;
|
|
1063
|
+
}
|
|
1064
|
+
}) ?? {};
|
|
1065
|
+
}
|
|
1066
|
+
function traverseValuesProperties(inputValues, properties, operation) {
|
|
1067
|
+
const safeInputValues = inputValues ?? {};
|
|
1068
|
+
const updatedValues = Object.entries(properties).map(([key, property]) => {
|
|
1069
|
+
const inputValue = safeInputValues && safeInputValues[key];
|
|
1070
|
+
const updatedValue = traverseValueProperty(inputValue, property, operation);
|
|
1071
|
+
if (updatedValue === null) return null;
|
|
1072
|
+
if (updatedValue === void 0) return void 0;
|
|
1073
|
+
return {
|
|
1074
|
+
[key]: updatedValue
|
|
1075
|
+
};
|
|
1076
|
+
}).reduce((a, b) => ({
|
|
1077
|
+
...a,
|
|
1078
|
+
...b
|
|
1079
|
+
}), {});
|
|
1080
|
+
const result = mergeDeep(safeInputValues, updatedValues);
|
|
1081
|
+
if (!result || Object.keys(result).length === 0) return void 0;
|
|
1082
|
+
return result;
|
|
1083
|
+
}
|
|
1084
|
+
function traverseValueProperty(inputValue, property, operation) {
|
|
1085
|
+
let value;
|
|
1086
|
+
if (property.type === "map" && property.properties) {
|
|
1087
|
+
value = traverseValuesProperties(inputValue, property.properties, operation);
|
|
1088
|
+
} else if (property.type === "array") {
|
|
1089
|
+
const of = property.of;
|
|
1090
|
+
if (of && Array.isArray(inputValue) && !Array.isArray(of)) {
|
|
1091
|
+
value = inputValue.map((e) => traverseValueProperty(e, of, operation));
|
|
1092
|
+
} else if (of && Array.isArray(inputValue) && Array.isArray(of)) {
|
|
1093
|
+
value = inputValue.map((e, i) => {
|
|
1094
|
+
if (i < of.length) return traverseValueProperty(e, of[i], operation);
|
|
1095
|
+
return null;
|
|
1096
|
+
}).filter(Boolean);
|
|
1097
|
+
} else if (property.oneOf && Array.isArray(inputValue)) {
|
|
1098
|
+
const typeField = property.oneOf?.typeField ?? DEFAULT_ONE_OF_TYPE;
|
|
1099
|
+
const valueField = property.oneOf?.valueField ?? DEFAULT_ONE_OF_VALUE;
|
|
1100
|
+
value = inputValue.map((e) => {
|
|
1101
|
+
if (e === null) return null;
|
|
1102
|
+
if (typeof e !== "object") return e;
|
|
1103
|
+
const rec = e;
|
|
1104
|
+
const type = rec[typeField];
|
|
1105
|
+
const childProperty = property.oneOf?.properties[type];
|
|
1106
|
+
if (!type || !childProperty) return e;
|
|
1107
|
+
return {
|
|
1108
|
+
[typeField]: type,
|
|
1109
|
+
[valueField]: traverseValueProperty(rec[valueField], childProperty, operation)
|
|
1110
|
+
};
|
|
1111
|
+
});
|
|
1112
|
+
} else {
|
|
1113
|
+
value = inputValue;
|
|
1114
|
+
}
|
|
1115
|
+
} else {
|
|
1116
|
+
value = operation(inputValue, property);
|
|
1117
|
+
}
|
|
1118
|
+
return value;
|
|
1119
|
+
}
|
|
1033
1120
|
function createRelationRef(id, path2) {
|
|
1034
1121
|
return {
|
|
1035
1122
|
id,
|
|
@@ -1236,6 +1323,17 @@
|
|
|
1236
1323
|
break;
|
|
1237
1324
|
}
|
|
1238
1325
|
}
|
|
1326
|
+
if (!isManyToManyInverse && targetCollection.properties) {
|
|
1327
|
+
for (const [propKey, prop] of Object.entries(targetCollection.properties)) {
|
|
1328
|
+
if (prop.type !== "relation") continue;
|
|
1329
|
+
const relProp = prop;
|
|
1330
|
+
const relName = relProp.relationName || propKey;
|
|
1331
|
+
if (relName === newRelation.inverseRelationName && relProp.cardinality === "many" && (relProp.direction === "owning" || !relProp.direction)) {
|
|
1332
|
+
isManyToManyInverse = true;
|
|
1333
|
+
break;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1239
1337
|
} catch (e) {
|
|
1240
1338
|
}
|
|
1241
1339
|
}
|
|
@@ -1359,7 +1457,7 @@
|
|
|
1359
1457
|
}
|
|
1360
1458
|
var logic = { exports: {} };
|
|
1361
1459
|
(function(module2, exports$1) {
|
|
1362
|
-
(function(
|
|
1460
|
+
(function(root, factory) {
|
|
1363
1461
|
{
|
|
1364
1462
|
module2.exports = factory();
|
|
1365
1463
|
}
|
|
@@ -1727,7 +1825,7 @@
|
|
|
1727
1825
|
});
|
|
1728
1826
|
})(logic);
|
|
1729
1827
|
const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
1730
|
-
const { hasOwnProperty
|
|
1828
|
+
const { hasOwnProperty } = Object.prototype;
|
|
1731
1829
|
function combineComparators(comparatorA, comparatorB) {
|
|
1732
1830
|
return function isEqual(a, b, state) {
|
|
1733
1831
|
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
@@ -1757,12 +1855,12 @@
|
|
|
1757
1855
|
}
|
|
1758
1856
|
const hasOwn = (
|
|
1759
1857
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1760
|
-
Object.hasOwn || ((object, property) => hasOwnProperty
|
|
1858
|
+
Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property))
|
|
1761
1859
|
);
|
|
1762
1860
|
const PREACT_VNODE = "__v";
|
|
1763
1861
|
const PREACT_OWNER = "__o";
|
|
1764
1862
|
const REACT_OWNER = "_owner";
|
|
1765
|
-
const { getOwnPropertyDescriptor, keys
|
|
1863
|
+
const { getOwnPropertyDescriptor, keys } = Object;
|
|
1766
1864
|
const sameValueEqual = (
|
|
1767
1865
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1768
1866
|
Object.is || function sameValueEqual2(a, b) {
|
|
@@ -1840,9 +1938,9 @@
|
|
|
1840
1938
|
return true;
|
|
1841
1939
|
}
|
|
1842
1940
|
function areObjectsEqual(a, b, state) {
|
|
1843
|
-
const properties = keys
|
|
1941
|
+
const properties = keys(a);
|
|
1844
1942
|
let index = properties.length;
|
|
1845
|
-
if (keys
|
|
1943
|
+
if (keys(b).length !== index) {
|
|
1846
1944
|
return false;
|
|
1847
1945
|
}
|
|
1848
1946
|
while (index-- > 0) {
|
|
@@ -2145,982 +2243,6 @@
|
|
|
2145
2243
|
const equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
|
2146
2244
|
return createIsEqual({ circular, comparator, createState, equals, strict });
|
|
2147
2245
|
}
|
|
2148
|
-
function listCacheClear$1() {
|
|
2149
|
-
this.__data__ = [];
|
|
2150
|
-
this.size = 0;
|
|
2151
|
-
}
|
|
2152
|
-
var _listCacheClear = listCacheClear$1;
|
|
2153
|
-
function eq$2(value, other) {
|
|
2154
|
-
return value === other || value !== value && other !== other;
|
|
2155
|
-
}
|
|
2156
|
-
var eq_1 = eq$2;
|
|
2157
|
-
var eq$1 = eq_1;
|
|
2158
|
-
function assocIndexOf$4(array, key) {
|
|
2159
|
-
var length = array.length;
|
|
2160
|
-
while (length--) {
|
|
2161
|
-
if (eq$1(array[length][0], key)) {
|
|
2162
|
-
return length;
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
return -1;
|
|
2166
|
-
}
|
|
2167
|
-
var _assocIndexOf = assocIndexOf$4;
|
|
2168
|
-
var assocIndexOf$3 = _assocIndexOf;
|
|
2169
|
-
var arrayProto = Array.prototype;
|
|
2170
|
-
var splice = arrayProto.splice;
|
|
2171
|
-
function listCacheDelete$1(key) {
|
|
2172
|
-
var data = this.__data__, index = assocIndexOf$3(data, key);
|
|
2173
|
-
if (index < 0) {
|
|
2174
|
-
return false;
|
|
2175
|
-
}
|
|
2176
|
-
var lastIndex = data.length - 1;
|
|
2177
|
-
if (index == lastIndex) {
|
|
2178
|
-
data.pop();
|
|
2179
|
-
} else {
|
|
2180
|
-
splice.call(data, index, 1);
|
|
2181
|
-
}
|
|
2182
|
-
--this.size;
|
|
2183
|
-
return true;
|
|
2184
|
-
}
|
|
2185
|
-
var _listCacheDelete = listCacheDelete$1;
|
|
2186
|
-
var assocIndexOf$2 = _assocIndexOf;
|
|
2187
|
-
function listCacheGet$1(key) {
|
|
2188
|
-
var data = this.__data__, index = assocIndexOf$2(data, key);
|
|
2189
|
-
return index < 0 ? void 0 : data[index][1];
|
|
2190
|
-
}
|
|
2191
|
-
var _listCacheGet = listCacheGet$1;
|
|
2192
|
-
var assocIndexOf$1 = _assocIndexOf;
|
|
2193
|
-
function listCacheHas$1(key) {
|
|
2194
|
-
return assocIndexOf$1(this.__data__, key) > -1;
|
|
2195
|
-
}
|
|
2196
|
-
var _listCacheHas = listCacheHas$1;
|
|
2197
|
-
var assocIndexOf = _assocIndexOf;
|
|
2198
|
-
function listCacheSet$1(key, value) {
|
|
2199
|
-
var data = this.__data__, index = assocIndexOf(data, key);
|
|
2200
|
-
if (index < 0) {
|
|
2201
|
-
++this.size;
|
|
2202
|
-
data.push([key, value]);
|
|
2203
|
-
} else {
|
|
2204
|
-
data[index][1] = value;
|
|
2205
|
-
}
|
|
2206
|
-
return this;
|
|
2207
|
-
}
|
|
2208
|
-
var _listCacheSet = listCacheSet$1;
|
|
2209
|
-
var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
|
|
2210
|
-
function ListCache$4(entries) {
|
|
2211
|
-
var index = -1, length = entries == null ? 0 : entries.length;
|
|
2212
|
-
this.clear();
|
|
2213
|
-
while (++index < length) {
|
|
2214
|
-
var entry = entries[index];
|
|
2215
|
-
this.set(entry[0], entry[1]);
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
ListCache$4.prototype.clear = listCacheClear;
|
|
2219
|
-
ListCache$4.prototype["delete"] = listCacheDelete;
|
|
2220
|
-
ListCache$4.prototype.get = listCacheGet;
|
|
2221
|
-
ListCache$4.prototype.has = listCacheHas;
|
|
2222
|
-
ListCache$4.prototype.set = listCacheSet;
|
|
2223
|
-
var _ListCache = ListCache$4;
|
|
2224
|
-
var ListCache$3 = _ListCache;
|
|
2225
|
-
function stackClear$1() {
|
|
2226
|
-
this.__data__ = new ListCache$3();
|
|
2227
|
-
this.size = 0;
|
|
2228
|
-
}
|
|
2229
|
-
var _stackClear = stackClear$1;
|
|
2230
|
-
function stackDelete$1(key) {
|
|
2231
|
-
var data = this.__data__, result = data["delete"](key);
|
|
2232
|
-
this.size = data.size;
|
|
2233
|
-
return result;
|
|
2234
|
-
}
|
|
2235
|
-
var _stackDelete = stackDelete$1;
|
|
2236
|
-
function stackGet$1(key) {
|
|
2237
|
-
return this.__data__.get(key);
|
|
2238
|
-
}
|
|
2239
|
-
var _stackGet = stackGet$1;
|
|
2240
|
-
function stackHas$1(key) {
|
|
2241
|
-
return this.__data__.has(key);
|
|
2242
|
-
}
|
|
2243
|
-
var _stackHas = stackHas$1;
|
|
2244
|
-
var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
2245
|
-
var _freeGlobal = freeGlobal$1;
|
|
2246
|
-
var freeGlobal = _freeGlobal;
|
|
2247
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
2248
|
-
var root$8 = freeGlobal || freeSelf || Function("return this")();
|
|
2249
|
-
var _root = root$8;
|
|
2250
|
-
var root$7 = _root;
|
|
2251
|
-
var Symbol$4 = root$7.Symbol;
|
|
2252
|
-
var _Symbol = Symbol$4;
|
|
2253
|
-
var Symbol$3 = _Symbol;
|
|
2254
|
-
var objectProto$c = Object.prototype;
|
|
2255
|
-
var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
|
|
2256
|
-
var nativeObjectToString$1 = objectProto$c.toString;
|
|
2257
|
-
var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : void 0;
|
|
2258
|
-
function getRawTag$1(value) {
|
|
2259
|
-
var isOwn = hasOwnProperty$9.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
2260
|
-
try {
|
|
2261
|
-
value[symToStringTag$1] = void 0;
|
|
2262
|
-
var unmasked = true;
|
|
2263
|
-
} catch (e) {
|
|
2264
|
-
}
|
|
2265
|
-
var result = nativeObjectToString$1.call(value);
|
|
2266
|
-
if (unmasked) {
|
|
2267
|
-
if (isOwn) {
|
|
2268
|
-
value[symToStringTag$1] = tag;
|
|
2269
|
-
} else {
|
|
2270
|
-
delete value[symToStringTag$1];
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
return result;
|
|
2274
|
-
}
|
|
2275
|
-
var _getRawTag = getRawTag$1;
|
|
2276
|
-
var objectProto$b = Object.prototype;
|
|
2277
|
-
var nativeObjectToString = objectProto$b.toString;
|
|
2278
|
-
function objectToString$1(value) {
|
|
2279
|
-
return nativeObjectToString.call(value);
|
|
2280
|
-
}
|
|
2281
|
-
var _objectToString = objectToString$1;
|
|
2282
|
-
var Symbol$2 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
|
|
2283
|
-
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
2284
|
-
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
2285
|
-
function baseGetTag$4(value) {
|
|
2286
|
-
if (value == null) {
|
|
2287
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
2288
|
-
}
|
|
2289
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
2290
|
-
}
|
|
2291
|
-
var _baseGetTag = baseGetTag$4;
|
|
2292
|
-
function isObject$5(value) {
|
|
2293
|
-
var type = typeof value;
|
|
2294
|
-
return value != null && (type == "object" || type == "function");
|
|
2295
|
-
}
|
|
2296
|
-
var isObject_1 = isObject$5;
|
|
2297
|
-
var baseGetTag$3 = _baseGetTag, isObject$4 = isObject_1;
|
|
2298
|
-
var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
2299
|
-
function isFunction$2(value) {
|
|
2300
|
-
if (!isObject$4(value)) {
|
|
2301
|
-
return false;
|
|
2302
|
-
}
|
|
2303
|
-
var tag = baseGetTag$3(value);
|
|
2304
|
-
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
|
|
2305
|
-
}
|
|
2306
|
-
var isFunction_1 = isFunction$2;
|
|
2307
|
-
var root$6 = _root;
|
|
2308
|
-
var coreJsData$1 = root$6["__core-js_shared__"];
|
|
2309
|
-
var _coreJsData = coreJsData$1;
|
|
2310
|
-
var coreJsData = _coreJsData;
|
|
2311
|
-
var maskSrcKey = function() {
|
|
2312
|
-
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
2313
|
-
return uid ? "Symbol(src)_1." + uid : "";
|
|
2314
|
-
}();
|
|
2315
|
-
function isMasked$1(func) {
|
|
2316
|
-
return !!maskSrcKey && maskSrcKey in func;
|
|
2317
|
-
}
|
|
2318
|
-
var _isMasked = isMasked$1;
|
|
2319
|
-
var funcProto$1 = Function.prototype;
|
|
2320
|
-
var funcToString$1 = funcProto$1.toString;
|
|
2321
|
-
function toSource$2(func) {
|
|
2322
|
-
if (func != null) {
|
|
2323
|
-
try {
|
|
2324
|
-
return funcToString$1.call(func);
|
|
2325
|
-
} catch (e) {
|
|
2326
|
-
}
|
|
2327
|
-
try {
|
|
2328
|
-
return func + "";
|
|
2329
|
-
} catch (e) {
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2332
|
-
return "";
|
|
2333
|
-
}
|
|
2334
|
-
var _toSource = toSource$2;
|
|
2335
|
-
var isFunction$1 = isFunction_1, isMasked = _isMasked, isObject$3 = isObject_1, toSource$1 = _toSource;
|
|
2336
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
2337
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
2338
|
-
var funcProto = Function.prototype, objectProto$a = Object.prototype;
|
|
2339
|
-
var funcToString = funcProto.toString;
|
|
2340
|
-
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
|
2341
|
-
var reIsNative = RegExp(
|
|
2342
|
-
"^" + funcToString.call(hasOwnProperty$8).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
2343
|
-
);
|
|
2344
|
-
function baseIsNative$1(value) {
|
|
2345
|
-
if (!isObject$3(value) || isMasked(value)) {
|
|
2346
|
-
return false;
|
|
2347
|
-
}
|
|
2348
|
-
var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
|
|
2349
|
-
return pattern.test(toSource$1(value));
|
|
2350
|
-
}
|
|
2351
|
-
var _baseIsNative = baseIsNative$1;
|
|
2352
|
-
function getValue$1(object, key) {
|
|
2353
|
-
return object == null ? void 0 : object[key];
|
|
2354
|
-
}
|
|
2355
|
-
var _getValue = getValue$1;
|
|
2356
|
-
var baseIsNative = _baseIsNative, getValue = _getValue;
|
|
2357
|
-
function getNative$7(object, key) {
|
|
2358
|
-
var value = getValue(object, key);
|
|
2359
|
-
return baseIsNative(value) ? value : void 0;
|
|
2360
|
-
}
|
|
2361
|
-
var _getNative = getNative$7;
|
|
2362
|
-
var getNative$6 = _getNative, root$5 = _root;
|
|
2363
|
-
var Map$4 = getNative$6(root$5, "Map");
|
|
2364
|
-
var _Map = Map$4;
|
|
2365
|
-
var getNative$5 = _getNative;
|
|
2366
|
-
var nativeCreate$4 = getNative$5(Object, "create");
|
|
2367
|
-
var _nativeCreate = nativeCreate$4;
|
|
2368
|
-
var nativeCreate$3 = _nativeCreate;
|
|
2369
|
-
function hashClear$1() {
|
|
2370
|
-
this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
|
|
2371
|
-
this.size = 0;
|
|
2372
|
-
}
|
|
2373
|
-
var _hashClear = hashClear$1;
|
|
2374
|
-
function hashDelete$1(key) {
|
|
2375
|
-
var result = this.has(key) && delete this.__data__[key];
|
|
2376
|
-
this.size -= result ? 1 : 0;
|
|
2377
|
-
return result;
|
|
2378
|
-
}
|
|
2379
|
-
var _hashDelete = hashDelete$1;
|
|
2380
|
-
var nativeCreate$2 = _nativeCreate;
|
|
2381
|
-
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
|
|
2382
|
-
var objectProto$9 = Object.prototype;
|
|
2383
|
-
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
2384
|
-
function hashGet$1(key) {
|
|
2385
|
-
var data = this.__data__;
|
|
2386
|
-
if (nativeCreate$2) {
|
|
2387
|
-
var result = data[key];
|
|
2388
|
-
return result === HASH_UNDEFINED$1 ? void 0 : result;
|
|
2389
|
-
}
|
|
2390
|
-
return hasOwnProperty$7.call(data, key) ? data[key] : void 0;
|
|
2391
|
-
}
|
|
2392
|
-
var _hashGet = hashGet$1;
|
|
2393
|
-
var nativeCreate$1 = _nativeCreate;
|
|
2394
|
-
var objectProto$8 = Object.prototype;
|
|
2395
|
-
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
|
2396
|
-
function hashHas$1(key) {
|
|
2397
|
-
var data = this.__data__;
|
|
2398
|
-
return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$6.call(data, key);
|
|
2399
|
-
}
|
|
2400
|
-
var _hashHas = hashHas$1;
|
|
2401
|
-
var nativeCreate = _nativeCreate;
|
|
2402
|
-
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
2403
|
-
function hashSet$1(key, value) {
|
|
2404
|
-
var data = this.__data__;
|
|
2405
|
-
this.size += this.has(key) ? 0 : 1;
|
|
2406
|
-
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
|
2407
|
-
return this;
|
|
2408
|
-
}
|
|
2409
|
-
var _hashSet = hashSet$1;
|
|
2410
|
-
var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
|
|
2411
|
-
function Hash$1(entries) {
|
|
2412
|
-
var index = -1, length = entries == null ? 0 : entries.length;
|
|
2413
|
-
this.clear();
|
|
2414
|
-
while (++index < length) {
|
|
2415
|
-
var entry = entries[index];
|
|
2416
|
-
this.set(entry[0], entry[1]);
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
Hash$1.prototype.clear = hashClear;
|
|
2420
|
-
Hash$1.prototype["delete"] = hashDelete;
|
|
2421
|
-
Hash$1.prototype.get = hashGet;
|
|
2422
|
-
Hash$1.prototype.has = hashHas;
|
|
2423
|
-
Hash$1.prototype.set = hashSet;
|
|
2424
|
-
var _Hash = Hash$1;
|
|
2425
|
-
var Hash = _Hash, ListCache$2 = _ListCache, Map$3 = _Map;
|
|
2426
|
-
function mapCacheClear$1() {
|
|
2427
|
-
this.size = 0;
|
|
2428
|
-
this.__data__ = {
|
|
2429
|
-
"hash": new Hash(),
|
|
2430
|
-
"map": new (Map$3 || ListCache$2)(),
|
|
2431
|
-
"string": new Hash()
|
|
2432
|
-
};
|
|
2433
|
-
}
|
|
2434
|
-
var _mapCacheClear = mapCacheClear$1;
|
|
2435
|
-
function isKeyable$1(value) {
|
|
2436
|
-
var type = typeof value;
|
|
2437
|
-
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
2438
|
-
}
|
|
2439
|
-
var _isKeyable = isKeyable$1;
|
|
2440
|
-
var isKeyable = _isKeyable;
|
|
2441
|
-
function getMapData$4(map, key) {
|
|
2442
|
-
var data = map.__data__;
|
|
2443
|
-
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
2444
|
-
}
|
|
2445
|
-
var _getMapData = getMapData$4;
|
|
2446
|
-
var getMapData$3 = _getMapData;
|
|
2447
|
-
function mapCacheDelete$1(key) {
|
|
2448
|
-
var result = getMapData$3(this, key)["delete"](key);
|
|
2449
|
-
this.size -= result ? 1 : 0;
|
|
2450
|
-
return result;
|
|
2451
|
-
}
|
|
2452
|
-
var _mapCacheDelete = mapCacheDelete$1;
|
|
2453
|
-
var getMapData$2 = _getMapData;
|
|
2454
|
-
function mapCacheGet$1(key) {
|
|
2455
|
-
return getMapData$2(this, key).get(key);
|
|
2456
|
-
}
|
|
2457
|
-
var _mapCacheGet = mapCacheGet$1;
|
|
2458
|
-
var getMapData$1 = _getMapData;
|
|
2459
|
-
function mapCacheHas$1(key) {
|
|
2460
|
-
return getMapData$1(this, key).has(key);
|
|
2461
|
-
}
|
|
2462
|
-
var _mapCacheHas = mapCacheHas$1;
|
|
2463
|
-
var getMapData = _getMapData;
|
|
2464
|
-
function mapCacheSet$1(key, value) {
|
|
2465
|
-
var data = getMapData(this, key), size = data.size;
|
|
2466
|
-
data.set(key, value);
|
|
2467
|
-
this.size += data.size == size ? 0 : 1;
|
|
2468
|
-
return this;
|
|
2469
|
-
}
|
|
2470
|
-
var _mapCacheSet = mapCacheSet$1;
|
|
2471
|
-
var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
|
|
2472
|
-
function MapCache$1(entries) {
|
|
2473
|
-
var index = -1, length = entries == null ? 0 : entries.length;
|
|
2474
|
-
this.clear();
|
|
2475
|
-
while (++index < length) {
|
|
2476
|
-
var entry = entries[index];
|
|
2477
|
-
this.set(entry[0], entry[1]);
|
|
2478
|
-
}
|
|
2479
|
-
}
|
|
2480
|
-
MapCache$1.prototype.clear = mapCacheClear;
|
|
2481
|
-
MapCache$1.prototype["delete"] = mapCacheDelete;
|
|
2482
|
-
MapCache$1.prototype.get = mapCacheGet;
|
|
2483
|
-
MapCache$1.prototype.has = mapCacheHas;
|
|
2484
|
-
MapCache$1.prototype.set = mapCacheSet;
|
|
2485
|
-
var _MapCache = MapCache$1;
|
|
2486
|
-
var ListCache$1 = _ListCache, Map$2 = _Map, MapCache = _MapCache;
|
|
2487
|
-
var LARGE_ARRAY_SIZE = 200;
|
|
2488
|
-
function stackSet$1(key, value) {
|
|
2489
|
-
var data = this.__data__;
|
|
2490
|
-
if (data instanceof ListCache$1) {
|
|
2491
|
-
var pairs = data.__data__;
|
|
2492
|
-
if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
2493
|
-
pairs.push([key, value]);
|
|
2494
|
-
this.size = ++data.size;
|
|
2495
|
-
return this;
|
|
2496
|
-
}
|
|
2497
|
-
data = this.__data__ = new MapCache(pairs);
|
|
2498
|
-
}
|
|
2499
|
-
data.set(key, value);
|
|
2500
|
-
this.size = data.size;
|
|
2501
|
-
return this;
|
|
2502
|
-
}
|
|
2503
|
-
var _stackSet = stackSet$1;
|
|
2504
|
-
var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet;
|
|
2505
|
-
function Stack$1(entries) {
|
|
2506
|
-
var data = this.__data__ = new ListCache(entries);
|
|
2507
|
-
this.size = data.size;
|
|
2508
|
-
}
|
|
2509
|
-
Stack$1.prototype.clear = stackClear;
|
|
2510
|
-
Stack$1.prototype["delete"] = stackDelete;
|
|
2511
|
-
Stack$1.prototype.get = stackGet;
|
|
2512
|
-
Stack$1.prototype.has = stackHas;
|
|
2513
|
-
Stack$1.prototype.set = stackSet;
|
|
2514
|
-
var _Stack = Stack$1;
|
|
2515
|
-
function arrayEach$1(array, iteratee) {
|
|
2516
|
-
var index = -1, length = array == null ? 0 : array.length;
|
|
2517
|
-
while (++index < length) {
|
|
2518
|
-
if (iteratee(array[index], index, array) === false) {
|
|
2519
|
-
break;
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
return array;
|
|
2523
|
-
}
|
|
2524
|
-
var _arrayEach = arrayEach$1;
|
|
2525
|
-
var getNative$4 = _getNative;
|
|
2526
|
-
var defineProperty$1 = function() {
|
|
2527
|
-
try {
|
|
2528
|
-
var func = getNative$4(Object, "defineProperty");
|
|
2529
|
-
func({}, "", {});
|
|
2530
|
-
return func;
|
|
2531
|
-
} catch (e) {
|
|
2532
|
-
}
|
|
2533
|
-
}();
|
|
2534
|
-
var _defineProperty = defineProperty$1;
|
|
2535
|
-
var defineProperty = _defineProperty;
|
|
2536
|
-
function baseAssignValue$2(object, key, value) {
|
|
2537
|
-
if (key == "__proto__" && defineProperty) {
|
|
2538
|
-
defineProperty(object, key, {
|
|
2539
|
-
"configurable": true,
|
|
2540
|
-
"enumerable": true,
|
|
2541
|
-
"value": value,
|
|
2542
|
-
"writable": true
|
|
2543
|
-
});
|
|
2544
|
-
} else {
|
|
2545
|
-
object[key] = value;
|
|
2546
|
-
}
|
|
2547
|
-
}
|
|
2548
|
-
var _baseAssignValue = baseAssignValue$2;
|
|
2549
|
-
var baseAssignValue$1 = _baseAssignValue, eq = eq_1;
|
|
2550
|
-
var objectProto$7 = Object.prototype;
|
|
2551
|
-
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
|
2552
|
-
function assignValue$2(object, key, value) {
|
|
2553
|
-
var objValue = object[key];
|
|
2554
|
-
if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
2555
|
-
baseAssignValue$1(object, key, value);
|
|
2556
|
-
}
|
|
2557
|
-
}
|
|
2558
|
-
var _assignValue = assignValue$2;
|
|
2559
|
-
var assignValue$1 = _assignValue, baseAssignValue = _baseAssignValue;
|
|
2560
|
-
function copyObject$4(source, props, object, customizer) {
|
|
2561
|
-
var isNew = !object;
|
|
2562
|
-
object || (object = {});
|
|
2563
|
-
var index = -1, length = props.length;
|
|
2564
|
-
while (++index < length) {
|
|
2565
|
-
var key = props[index];
|
|
2566
|
-
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
|
|
2567
|
-
if (newValue === void 0) {
|
|
2568
|
-
newValue = source[key];
|
|
2569
|
-
}
|
|
2570
|
-
if (isNew) {
|
|
2571
|
-
baseAssignValue(object, key, newValue);
|
|
2572
|
-
} else {
|
|
2573
|
-
assignValue$1(object, key, newValue);
|
|
2574
|
-
}
|
|
2575
|
-
}
|
|
2576
|
-
return object;
|
|
2577
|
-
}
|
|
2578
|
-
var _copyObject = copyObject$4;
|
|
2579
|
-
function baseTimes$1(n, iteratee) {
|
|
2580
|
-
var index = -1, result = Array(n);
|
|
2581
|
-
while (++index < n) {
|
|
2582
|
-
result[index] = iteratee(index);
|
|
2583
|
-
}
|
|
2584
|
-
return result;
|
|
2585
|
-
}
|
|
2586
|
-
var _baseTimes = baseTimes$1;
|
|
2587
|
-
function isObjectLike$5(value) {
|
|
2588
|
-
return value != null && typeof value == "object";
|
|
2589
|
-
}
|
|
2590
|
-
var isObjectLike_1 = isObjectLike$5;
|
|
2591
|
-
var baseGetTag$2 = _baseGetTag, isObjectLike$4 = isObjectLike_1;
|
|
2592
|
-
var argsTag$2 = "[object Arguments]";
|
|
2593
|
-
function baseIsArguments$1(value) {
|
|
2594
|
-
return isObjectLike$4(value) && baseGetTag$2(value) == argsTag$2;
|
|
2595
|
-
}
|
|
2596
|
-
var _baseIsArguments = baseIsArguments$1;
|
|
2597
|
-
var baseIsArguments = _baseIsArguments, isObjectLike$3 = isObjectLike_1;
|
|
2598
|
-
var objectProto$6 = Object.prototype;
|
|
2599
|
-
var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
|
|
2600
|
-
var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
|
|
2601
|
-
var isArguments$1 = baseIsArguments(/* @__PURE__ */ function() {
|
|
2602
|
-
return arguments;
|
|
2603
|
-
}()) ? baseIsArguments : function(value) {
|
|
2604
|
-
return isObjectLike$3(value) && hasOwnProperty$4.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
2605
|
-
};
|
|
2606
|
-
var isArguments_1 = isArguments$1;
|
|
2607
|
-
var isArray$3 = Array.isArray;
|
|
2608
|
-
var isArray_1 = isArray$3;
|
|
2609
|
-
var isBuffer$2 = { exports: {} };
|
|
2610
|
-
function stubFalse() {
|
|
2611
|
-
return false;
|
|
2612
|
-
}
|
|
2613
|
-
var stubFalse_1 = stubFalse;
|
|
2614
|
-
isBuffer$2.exports;
|
|
2615
|
-
(function(module2, exports$1) {
|
|
2616
|
-
var root2 = _root, stubFalse2 = stubFalse_1;
|
|
2617
|
-
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
2618
|
-
var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
|
|
2619
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2620
|
-
var Buffer = moduleExports ? root2.Buffer : void 0;
|
|
2621
|
-
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
|
|
2622
|
-
var isBuffer2 = nativeIsBuffer || stubFalse2;
|
|
2623
|
-
module2.exports = isBuffer2;
|
|
2624
|
-
})(isBuffer$2, isBuffer$2.exports);
|
|
2625
|
-
var isBufferExports = isBuffer$2.exports;
|
|
2626
|
-
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
2627
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
2628
|
-
function isIndex$1(value, length) {
|
|
2629
|
-
var type = typeof value;
|
|
2630
|
-
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
2631
|
-
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
2632
|
-
}
|
|
2633
|
-
var _isIndex = isIndex$1;
|
|
2634
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
2635
|
-
function isLength$2(value) {
|
|
2636
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
2637
|
-
}
|
|
2638
|
-
var isLength_1 = isLength$2;
|
|
2639
|
-
var baseGetTag$1 = _baseGetTag, isLength$1 = isLength_1, isObjectLike$2 = isObjectLike_1;
|
|
2640
|
-
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]";
|
|
2641
|
-
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]";
|
|
2642
|
-
var typedArrayTags = {};
|
|
2643
|
-
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;
|
|
2644
|
-
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;
|
|
2645
|
-
function baseIsTypedArray$1(value) {
|
|
2646
|
-
return isObjectLike$2(value) && isLength$1(value.length) && !!typedArrayTags[baseGetTag$1(value)];
|
|
2647
|
-
}
|
|
2648
|
-
var _baseIsTypedArray = baseIsTypedArray$1;
|
|
2649
|
-
function baseUnary$3(func) {
|
|
2650
|
-
return function(value) {
|
|
2651
|
-
return func(value);
|
|
2652
|
-
};
|
|
2653
|
-
}
|
|
2654
|
-
var _baseUnary = baseUnary$3;
|
|
2655
|
-
var _nodeUtil = { exports: {} };
|
|
2656
|
-
_nodeUtil.exports;
|
|
2657
|
-
(function(module2, exports$1) {
|
|
2658
|
-
var freeGlobal2 = _freeGlobal;
|
|
2659
|
-
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
2660
|
-
var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
|
|
2661
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2662
|
-
var freeProcess = moduleExports && freeGlobal2.process;
|
|
2663
|
-
var nodeUtil2 = function() {
|
|
2664
|
-
try {
|
|
2665
|
-
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
|
2666
|
-
if (types) {
|
|
2667
|
-
return types;
|
|
2668
|
-
}
|
|
2669
|
-
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
2670
|
-
} catch (e) {
|
|
2671
|
-
}
|
|
2672
|
-
}();
|
|
2673
|
-
module2.exports = nodeUtil2;
|
|
2674
|
-
})(_nodeUtil, _nodeUtil.exports);
|
|
2675
|
-
var _nodeUtilExports = _nodeUtil.exports;
|
|
2676
|
-
var baseIsTypedArray = _baseIsTypedArray, baseUnary$2 = _baseUnary, nodeUtil$2 = _nodeUtilExports;
|
|
2677
|
-
var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray;
|
|
2678
|
-
var isTypedArray$1 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray;
|
|
2679
|
-
var isTypedArray_1 = isTypedArray$1;
|
|
2680
|
-
var baseTimes = _baseTimes, isArguments = isArguments_1, isArray$2 = isArray_1, isBuffer$1 = isBufferExports, isIndex = _isIndex, isTypedArray = isTypedArray_1;
|
|
2681
|
-
var objectProto$5 = Object.prototype;
|
|
2682
|
-
var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
|
|
2683
|
-
function arrayLikeKeys$2(value, inherited) {
|
|
2684
|
-
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;
|
|
2685
|
-
for (var key in value) {
|
|
2686
|
-
if ((inherited || hasOwnProperty$3.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
2687
|
-
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
2688
|
-
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
2689
|
-
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
2690
|
-
isIndex(key, length)))) {
|
|
2691
|
-
result.push(key);
|
|
2692
|
-
}
|
|
2693
|
-
}
|
|
2694
|
-
return result;
|
|
2695
|
-
}
|
|
2696
|
-
var _arrayLikeKeys = arrayLikeKeys$2;
|
|
2697
|
-
var objectProto$4 = Object.prototype;
|
|
2698
|
-
function isPrototype$3(value) {
|
|
2699
|
-
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$4;
|
|
2700
|
-
return value === proto;
|
|
2701
|
-
}
|
|
2702
|
-
var _isPrototype = isPrototype$3;
|
|
2703
|
-
function overArg$2(func, transform) {
|
|
2704
|
-
return function(arg) {
|
|
2705
|
-
return func(transform(arg));
|
|
2706
|
-
};
|
|
2707
|
-
}
|
|
2708
|
-
var _overArg = overArg$2;
|
|
2709
|
-
var overArg$1 = _overArg;
|
|
2710
|
-
var nativeKeys$1 = overArg$1(Object.keys, Object);
|
|
2711
|
-
var _nativeKeys = nativeKeys$1;
|
|
2712
|
-
var isPrototype$2 = _isPrototype, nativeKeys = _nativeKeys;
|
|
2713
|
-
var objectProto$3 = Object.prototype;
|
|
2714
|
-
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
2715
|
-
function baseKeys$1(object) {
|
|
2716
|
-
if (!isPrototype$2(object)) {
|
|
2717
|
-
return nativeKeys(object);
|
|
2718
|
-
}
|
|
2719
|
-
var result = [];
|
|
2720
|
-
for (var key in Object(object)) {
|
|
2721
|
-
if (hasOwnProperty$2.call(object, key) && key != "constructor") {
|
|
2722
|
-
result.push(key);
|
|
2723
|
-
}
|
|
2724
|
-
}
|
|
2725
|
-
return result;
|
|
2726
|
-
}
|
|
2727
|
-
var _baseKeys = baseKeys$1;
|
|
2728
|
-
var isFunction = isFunction_1, isLength = isLength_1;
|
|
2729
|
-
function isArrayLike$2(value) {
|
|
2730
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
2731
|
-
}
|
|
2732
|
-
var isArrayLike_1 = isArrayLike$2;
|
|
2733
|
-
var arrayLikeKeys$1 = _arrayLikeKeys, baseKeys = _baseKeys, isArrayLike$1 = isArrayLike_1;
|
|
2734
|
-
function keys$3(object) {
|
|
2735
|
-
return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys(object);
|
|
2736
|
-
}
|
|
2737
|
-
var keys_1 = keys$3;
|
|
2738
|
-
var copyObject$3 = _copyObject, keys$2 = keys_1;
|
|
2739
|
-
function baseAssign$1(object, source) {
|
|
2740
|
-
return object && copyObject$3(source, keys$2(source), object);
|
|
2741
|
-
}
|
|
2742
|
-
var _baseAssign = baseAssign$1;
|
|
2743
|
-
function nativeKeysIn$1(object) {
|
|
2744
|
-
var result = [];
|
|
2745
|
-
if (object != null) {
|
|
2746
|
-
for (var key in Object(object)) {
|
|
2747
|
-
result.push(key);
|
|
2748
|
-
}
|
|
2749
|
-
}
|
|
2750
|
-
return result;
|
|
2751
|
-
}
|
|
2752
|
-
var _nativeKeysIn = nativeKeysIn$1;
|
|
2753
|
-
var isObject$2 = isObject_1, isPrototype$1 = _isPrototype, nativeKeysIn = _nativeKeysIn;
|
|
2754
|
-
var objectProto$2 = Object.prototype;
|
|
2755
|
-
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
|
|
2756
|
-
function baseKeysIn$1(object) {
|
|
2757
|
-
if (!isObject$2(object)) {
|
|
2758
|
-
return nativeKeysIn(object);
|
|
2759
|
-
}
|
|
2760
|
-
var isProto = isPrototype$1(object), result = [];
|
|
2761
|
-
for (var key in object) {
|
|
2762
|
-
if (!(key == "constructor" && (isProto || !hasOwnProperty$1.call(object, key)))) {
|
|
2763
|
-
result.push(key);
|
|
2764
|
-
}
|
|
2765
|
-
}
|
|
2766
|
-
return result;
|
|
2767
|
-
}
|
|
2768
|
-
var _baseKeysIn = baseKeysIn$1;
|
|
2769
|
-
var arrayLikeKeys = _arrayLikeKeys, baseKeysIn = _baseKeysIn, isArrayLike = isArrayLike_1;
|
|
2770
|
-
function keysIn$3(object) {
|
|
2771
|
-
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
2772
|
-
}
|
|
2773
|
-
var keysIn_1 = keysIn$3;
|
|
2774
|
-
var copyObject$2 = _copyObject, keysIn$2 = keysIn_1;
|
|
2775
|
-
function baseAssignIn$1(object, source) {
|
|
2776
|
-
return object && copyObject$2(source, keysIn$2(source), object);
|
|
2777
|
-
}
|
|
2778
|
-
var _baseAssignIn = baseAssignIn$1;
|
|
2779
|
-
var _cloneBuffer = { exports: {} };
|
|
2780
|
-
_cloneBuffer.exports;
|
|
2781
|
-
(function(module2, exports$1) {
|
|
2782
|
-
var root2 = _root;
|
|
2783
|
-
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
2784
|
-
var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
|
|
2785
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2786
|
-
var Buffer = moduleExports ? root2.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
|
|
2787
|
-
function cloneBuffer2(buffer, isDeep) {
|
|
2788
|
-
if (isDeep) {
|
|
2789
|
-
return buffer.slice();
|
|
2790
|
-
}
|
|
2791
|
-
var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
2792
|
-
buffer.copy(result);
|
|
2793
|
-
return result;
|
|
2794
|
-
}
|
|
2795
|
-
module2.exports = cloneBuffer2;
|
|
2796
|
-
})(_cloneBuffer, _cloneBuffer.exports);
|
|
2797
|
-
var _cloneBufferExports = _cloneBuffer.exports;
|
|
2798
|
-
function copyArray$1(source, array) {
|
|
2799
|
-
var index = -1, length = source.length;
|
|
2800
|
-
array || (array = Array(length));
|
|
2801
|
-
while (++index < length) {
|
|
2802
|
-
array[index] = source[index];
|
|
2803
|
-
}
|
|
2804
|
-
return array;
|
|
2805
|
-
}
|
|
2806
|
-
var _copyArray = copyArray$1;
|
|
2807
|
-
function arrayFilter$1(array, predicate) {
|
|
2808
|
-
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
2809
|
-
while (++index < length) {
|
|
2810
|
-
var value = array[index];
|
|
2811
|
-
if (predicate(value, index, array)) {
|
|
2812
|
-
result[resIndex++] = value;
|
|
2813
|
-
}
|
|
2814
|
-
}
|
|
2815
|
-
return result;
|
|
2816
|
-
}
|
|
2817
|
-
var _arrayFilter = arrayFilter$1;
|
|
2818
|
-
function stubArray$2() {
|
|
2819
|
-
return [];
|
|
2820
|
-
}
|
|
2821
|
-
var stubArray_1 = stubArray$2;
|
|
2822
|
-
var arrayFilter = _arrayFilter, stubArray$1 = stubArray_1;
|
|
2823
|
-
var objectProto$1 = Object.prototype;
|
|
2824
|
-
var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
|
|
2825
|
-
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
|
|
2826
|
-
var getSymbols$3 = !nativeGetSymbols$1 ? stubArray$1 : function(object) {
|
|
2827
|
-
if (object == null) {
|
|
2828
|
-
return [];
|
|
2829
|
-
}
|
|
2830
|
-
object = Object(object);
|
|
2831
|
-
return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
|
|
2832
|
-
return propertyIsEnumerable.call(object, symbol);
|
|
2833
|
-
});
|
|
2834
|
-
};
|
|
2835
|
-
var _getSymbols = getSymbols$3;
|
|
2836
|
-
var copyObject$1 = _copyObject, getSymbols$2 = _getSymbols;
|
|
2837
|
-
function copySymbols$1(source, object) {
|
|
2838
|
-
return copyObject$1(source, getSymbols$2(source), object);
|
|
2839
|
-
}
|
|
2840
|
-
var _copySymbols = copySymbols$1;
|
|
2841
|
-
function arrayPush$2(array, values) {
|
|
2842
|
-
var index = -1, length = values.length, offset = array.length;
|
|
2843
|
-
while (++index < length) {
|
|
2844
|
-
array[offset + index] = values[index];
|
|
2845
|
-
}
|
|
2846
|
-
return array;
|
|
2847
|
-
}
|
|
2848
|
-
var _arrayPush = arrayPush$2;
|
|
2849
|
-
var overArg = _overArg;
|
|
2850
|
-
var getPrototype$2 = overArg(Object.getPrototypeOf, Object);
|
|
2851
|
-
var _getPrototype = getPrototype$2;
|
|
2852
|
-
var arrayPush$1 = _arrayPush, getPrototype$1 = _getPrototype, getSymbols$1 = _getSymbols, stubArray = stubArray_1;
|
|
2853
|
-
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
2854
|
-
var getSymbolsIn$2 = !nativeGetSymbols ? stubArray : function(object) {
|
|
2855
|
-
var result = [];
|
|
2856
|
-
while (object) {
|
|
2857
|
-
arrayPush$1(result, getSymbols$1(object));
|
|
2858
|
-
object = getPrototype$1(object);
|
|
2859
|
-
}
|
|
2860
|
-
return result;
|
|
2861
|
-
};
|
|
2862
|
-
var _getSymbolsIn = getSymbolsIn$2;
|
|
2863
|
-
var copyObject = _copyObject, getSymbolsIn$1 = _getSymbolsIn;
|
|
2864
|
-
function copySymbolsIn$1(source, object) {
|
|
2865
|
-
return copyObject(source, getSymbolsIn$1(source), object);
|
|
2866
|
-
}
|
|
2867
|
-
var _copySymbolsIn = copySymbolsIn$1;
|
|
2868
|
-
var arrayPush = _arrayPush, isArray$1 = isArray_1;
|
|
2869
|
-
function baseGetAllKeys$2(object, keysFunc, symbolsFunc) {
|
|
2870
|
-
var result = keysFunc(object);
|
|
2871
|
-
return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
2872
|
-
}
|
|
2873
|
-
var _baseGetAllKeys = baseGetAllKeys$2;
|
|
2874
|
-
var baseGetAllKeys$1 = _baseGetAllKeys, getSymbols = _getSymbols, keys$1 = keys_1;
|
|
2875
|
-
function getAllKeys$1(object) {
|
|
2876
|
-
return baseGetAllKeys$1(object, keys$1, getSymbols);
|
|
2877
|
-
}
|
|
2878
|
-
var _getAllKeys = getAllKeys$1;
|
|
2879
|
-
var baseGetAllKeys = _baseGetAllKeys, getSymbolsIn = _getSymbolsIn, keysIn$1 = keysIn_1;
|
|
2880
|
-
function getAllKeysIn$1(object) {
|
|
2881
|
-
return baseGetAllKeys(object, keysIn$1, getSymbolsIn);
|
|
2882
|
-
}
|
|
2883
|
-
var _getAllKeysIn = getAllKeysIn$1;
|
|
2884
|
-
var getNative$3 = _getNative, root$4 = _root;
|
|
2885
|
-
var DataView$1 = getNative$3(root$4, "DataView");
|
|
2886
|
-
var _DataView = DataView$1;
|
|
2887
|
-
var getNative$2 = _getNative, root$3 = _root;
|
|
2888
|
-
var Promise$2 = getNative$2(root$3, "Promise");
|
|
2889
|
-
var _Promise = Promise$2;
|
|
2890
|
-
var getNative$1 = _getNative, root$2 = _root;
|
|
2891
|
-
var Set$2 = getNative$1(root$2, "Set");
|
|
2892
|
-
var _Set = Set$2;
|
|
2893
|
-
var getNative = _getNative, root$1 = _root;
|
|
2894
|
-
var WeakMap$2 = getNative(root$1, "WeakMap");
|
|
2895
|
-
var _WeakMap = WeakMap$2;
|
|
2896
|
-
var DataView = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$1 = _Set, WeakMap$1 = _WeakMap, baseGetTag = _baseGetTag, toSource = _toSource;
|
|
2897
|
-
var mapTag$3 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$3 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
|
|
2898
|
-
var dataViewTag$2 = "[object DataView]";
|
|
2899
|
-
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1);
|
|
2900
|
-
var getTag$3 = baseGetTag;
|
|
2901
|
-
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) {
|
|
2902
|
-
getTag$3 = function(value) {
|
|
2903
|
-
var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
2904
|
-
if (ctorString) {
|
|
2905
|
-
switch (ctorString) {
|
|
2906
|
-
case dataViewCtorString:
|
|
2907
|
-
return dataViewTag$2;
|
|
2908
|
-
case mapCtorString:
|
|
2909
|
-
return mapTag$3;
|
|
2910
|
-
case promiseCtorString:
|
|
2911
|
-
return promiseTag;
|
|
2912
|
-
case setCtorString:
|
|
2913
|
-
return setTag$3;
|
|
2914
|
-
case weakMapCtorString:
|
|
2915
|
-
return weakMapTag$1;
|
|
2916
|
-
}
|
|
2917
|
-
}
|
|
2918
|
-
return result;
|
|
2919
|
-
};
|
|
2920
|
-
}
|
|
2921
|
-
var _getTag = getTag$3;
|
|
2922
|
-
var objectProto = Object.prototype;
|
|
2923
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
2924
|
-
function initCloneArray$1(array) {
|
|
2925
|
-
var length = array.length, result = new array.constructor(length);
|
|
2926
|
-
if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
|
|
2927
|
-
result.index = array.index;
|
|
2928
|
-
result.input = array.input;
|
|
2929
|
-
}
|
|
2930
|
-
return result;
|
|
2931
|
-
}
|
|
2932
|
-
var _initCloneArray = initCloneArray$1;
|
|
2933
|
-
var root = _root;
|
|
2934
|
-
var Uint8Array$2 = root.Uint8Array;
|
|
2935
|
-
var _Uint8Array = Uint8Array$2;
|
|
2936
|
-
var Uint8Array$1 = _Uint8Array;
|
|
2937
|
-
function cloneArrayBuffer$3(arrayBuffer) {
|
|
2938
|
-
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
2939
|
-
new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
|
|
2940
|
-
return result;
|
|
2941
|
-
}
|
|
2942
|
-
var _cloneArrayBuffer = cloneArrayBuffer$3;
|
|
2943
|
-
var cloneArrayBuffer$2 = _cloneArrayBuffer;
|
|
2944
|
-
function cloneDataView$1(dataView, isDeep) {
|
|
2945
|
-
var buffer = isDeep ? cloneArrayBuffer$2(dataView.buffer) : dataView.buffer;
|
|
2946
|
-
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
2947
|
-
}
|
|
2948
|
-
var _cloneDataView = cloneDataView$1;
|
|
2949
|
-
var reFlags = /\w*$/;
|
|
2950
|
-
function cloneRegExp$1(regexp) {
|
|
2951
|
-
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
2952
|
-
result.lastIndex = regexp.lastIndex;
|
|
2953
|
-
return result;
|
|
2954
|
-
}
|
|
2955
|
-
var _cloneRegExp = cloneRegExp$1;
|
|
2956
|
-
var Symbol$1 = _Symbol;
|
|
2957
|
-
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
2958
|
-
function cloneSymbol$1(symbol) {
|
|
2959
|
-
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
2960
|
-
}
|
|
2961
|
-
var _cloneSymbol = cloneSymbol$1;
|
|
2962
|
-
var cloneArrayBuffer$1 = _cloneArrayBuffer;
|
|
2963
|
-
function cloneTypedArray$1(typedArray, isDeep) {
|
|
2964
|
-
var buffer = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer;
|
|
2965
|
-
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
2966
|
-
}
|
|
2967
|
-
var _cloneTypedArray = cloneTypedArray$1;
|
|
2968
|
-
var cloneArrayBuffer = _cloneArrayBuffer, cloneDataView = _cloneDataView, cloneRegExp = _cloneRegExp, cloneSymbol = _cloneSymbol, cloneTypedArray = _cloneTypedArray;
|
|
2969
|
-
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]";
|
|
2970
|
-
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]";
|
|
2971
|
-
function initCloneByTag$1(object, tag, isDeep) {
|
|
2972
|
-
var Ctor = object.constructor;
|
|
2973
|
-
switch (tag) {
|
|
2974
|
-
case arrayBufferTag$1:
|
|
2975
|
-
return cloneArrayBuffer(object);
|
|
2976
|
-
case boolTag$1:
|
|
2977
|
-
case dateTag$1:
|
|
2978
|
-
return new Ctor(+object);
|
|
2979
|
-
case dataViewTag$1:
|
|
2980
|
-
return cloneDataView(object, isDeep);
|
|
2981
|
-
case float32Tag$1:
|
|
2982
|
-
case float64Tag$1:
|
|
2983
|
-
case int8Tag$1:
|
|
2984
|
-
case int16Tag$1:
|
|
2985
|
-
case int32Tag$1:
|
|
2986
|
-
case uint8Tag$1:
|
|
2987
|
-
case uint8ClampedTag$1:
|
|
2988
|
-
case uint16Tag$1:
|
|
2989
|
-
case uint32Tag$1:
|
|
2990
|
-
return cloneTypedArray(object, isDeep);
|
|
2991
|
-
case mapTag$2:
|
|
2992
|
-
return new Ctor();
|
|
2993
|
-
case numberTag$1:
|
|
2994
|
-
case stringTag$1:
|
|
2995
|
-
return new Ctor(object);
|
|
2996
|
-
case regexpTag$1:
|
|
2997
|
-
return cloneRegExp(object);
|
|
2998
|
-
case setTag$2:
|
|
2999
|
-
return new Ctor();
|
|
3000
|
-
case symbolTag$1:
|
|
3001
|
-
return cloneSymbol(object);
|
|
3002
|
-
}
|
|
3003
|
-
}
|
|
3004
|
-
var _initCloneByTag = initCloneByTag$1;
|
|
3005
|
-
var isObject$1 = isObject_1;
|
|
3006
|
-
var objectCreate = Object.create;
|
|
3007
|
-
var baseCreate$1 = /* @__PURE__ */ function() {
|
|
3008
|
-
function object() {
|
|
3009
|
-
}
|
|
3010
|
-
return function(proto) {
|
|
3011
|
-
if (!isObject$1(proto)) {
|
|
3012
|
-
return {};
|
|
3013
|
-
}
|
|
3014
|
-
if (objectCreate) {
|
|
3015
|
-
return objectCreate(proto);
|
|
3016
|
-
}
|
|
3017
|
-
object.prototype = proto;
|
|
3018
|
-
var result = new object();
|
|
3019
|
-
object.prototype = void 0;
|
|
3020
|
-
return result;
|
|
3021
|
-
};
|
|
3022
|
-
}();
|
|
3023
|
-
var _baseCreate = baseCreate$1;
|
|
3024
|
-
var baseCreate = _baseCreate, getPrototype = _getPrototype, isPrototype = _isPrototype;
|
|
3025
|
-
function initCloneObject$1(object) {
|
|
3026
|
-
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
|
3027
|
-
}
|
|
3028
|
-
var _initCloneObject = initCloneObject$1;
|
|
3029
|
-
var getTag$2 = _getTag, isObjectLike$1 = isObjectLike_1;
|
|
3030
|
-
var mapTag$1 = "[object Map]";
|
|
3031
|
-
function baseIsMap$1(value) {
|
|
3032
|
-
return isObjectLike$1(value) && getTag$2(value) == mapTag$1;
|
|
3033
|
-
}
|
|
3034
|
-
var _baseIsMap = baseIsMap$1;
|
|
3035
|
-
var baseIsMap = _baseIsMap, baseUnary$1 = _baseUnary, nodeUtil$1 = _nodeUtilExports;
|
|
3036
|
-
var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
|
|
3037
|
-
var isMap$1 = nodeIsMap ? baseUnary$1(nodeIsMap) : baseIsMap;
|
|
3038
|
-
var isMap_1 = isMap$1;
|
|
3039
|
-
var getTag$1 = _getTag, isObjectLike = isObjectLike_1;
|
|
3040
|
-
var setTag$1 = "[object Set]";
|
|
3041
|
-
function baseIsSet$1(value) {
|
|
3042
|
-
return isObjectLike(value) && getTag$1(value) == setTag$1;
|
|
3043
|
-
}
|
|
3044
|
-
var _baseIsSet = baseIsSet$1;
|
|
3045
|
-
var baseIsSet = _baseIsSet, baseUnary = _baseUnary, nodeUtil = _nodeUtilExports;
|
|
3046
|
-
var nodeIsSet = nodeUtil && nodeUtil.isSet;
|
|
3047
|
-
var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
3048
|
-
var isSet_1 = isSet$1;
|
|
3049
|
-
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;
|
|
3050
|
-
var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4;
|
|
3051
|
-
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]";
|
|
3052
|
-
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]";
|
|
3053
|
-
var cloneableTags = {};
|
|
3054
|
-
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;
|
|
3055
|
-
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
|
|
3056
|
-
function baseClone$1(value, bitmask, customizer, key, object, stack) {
|
|
3057
|
-
var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
|
|
3058
|
-
if (customizer) {
|
|
3059
|
-
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
3060
|
-
}
|
|
3061
|
-
if (result !== void 0) {
|
|
3062
|
-
return result;
|
|
3063
|
-
}
|
|
3064
|
-
if (!isObject(value)) {
|
|
3065
|
-
return value;
|
|
3066
|
-
}
|
|
3067
|
-
var isArr = isArray(value);
|
|
3068
|
-
if (isArr) {
|
|
3069
|
-
result = initCloneArray(value);
|
|
3070
|
-
if (!isDeep) {
|
|
3071
|
-
return copyArray(value, result);
|
|
3072
|
-
}
|
|
3073
|
-
} else {
|
|
3074
|
-
var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
|
|
3075
|
-
if (isBuffer(value)) {
|
|
3076
|
-
return cloneBuffer(value, isDeep);
|
|
3077
|
-
}
|
|
3078
|
-
if (tag == objectTag || tag == argsTag || isFunc && !object) {
|
|
3079
|
-
result = isFlat || isFunc ? {} : initCloneObject(value);
|
|
3080
|
-
if (!isDeep) {
|
|
3081
|
-
return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
|
|
3082
|
-
}
|
|
3083
|
-
} else {
|
|
3084
|
-
if (!cloneableTags[tag]) {
|
|
3085
|
-
return object ? value : {};
|
|
3086
|
-
}
|
|
3087
|
-
result = initCloneByTag(value, tag, isDeep);
|
|
3088
|
-
}
|
|
3089
|
-
}
|
|
3090
|
-
stack || (stack = new Stack());
|
|
3091
|
-
var stacked = stack.get(value);
|
|
3092
|
-
if (stacked) {
|
|
3093
|
-
return stacked;
|
|
3094
|
-
}
|
|
3095
|
-
stack.set(value, result);
|
|
3096
|
-
if (isSet(value)) {
|
|
3097
|
-
value.forEach(function(subValue) {
|
|
3098
|
-
result.add(baseClone$1(subValue, bitmask, customizer, subValue, value, stack));
|
|
3099
|
-
});
|
|
3100
|
-
} else if (isMap(value)) {
|
|
3101
|
-
value.forEach(function(subValue, key2) {
|
|
3102
|
-
result.set(key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
|
|
3103
|
-
});
|
|
3104
|
-
}
|
|
3105
|
-
var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
|
|
3106
|
-
var props = isArr ? void 0 : keysFunc(value);
|
|
3107
|
-
arrayEach(props || value, function(subValue, key2) {
|
|
3108
|
-
if (props) {
|
|
3109
|
-
key2 = subValue;
|
|
3110
|
-
subValue = value[key2];
|
|
3111
|
-
}
|
|
3112
|
-
assignValue(result, key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
|
|
3113
|
-
});
|
|
3114
|
-
return result;
|
|
3115
|
-
}
|
|
3116
|
-
var _baseClone = baseClone$1;
|
|
3117
|
-
var baseClone = _baseClone;
|
|
3118
|
-
var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
|
|
3119
|
-
function cloneDeep$1(value) {
|
|
3120
|
-
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
3121
|
-
}
|
|
3122
|
-
var cloneDeep_1 = cloneDeep$1;
|
|
3123
|
-
const cloneDeep = /* @__PURE__ */ getDefaultExportFromCjs(cloneDeep_1);
|
|
3124
2246
|
class CollectionRegistry {
|
|
3125
2247
|
// Normalized runtime layer (used by Data Grid / UI)
|
|
3126
2248
|
collectionsByTableName = /* @__PURE__ */ new Map();
|
|
@@ -3168,7 +2290,7 @@
|
|
|
3168
2290
|
...c
|
|
3169
2291
|
}));
|
|
3170
2292
|
normalizedCollections.forEach((c, index) => {
|
|
3171
|
-
const raw =
|
|
2293
|
+
const raw = deepClone(collections[index]);
|
|
3172
2294
|
this.rootCollections.push(c);
|
|
3173
2295
|
this.rawRootCollections.push(raw);
|
|
3174
2296
|
const normalized = this.normalizeCollection(c);
|
|
@@ -3188,7 +2310,7 @@
|
|
|
3188
2310
|
if (!subCollection) return;
|
|
3189
2311
|
this._registerRecursively(this.normalizeCollection({
|
|
3190
2312
|
...subCollection
|
|
3191
|
-
}),
|
|
2313
|
+
}), deepClone(subCollection));
|
|
3192
2314
|
});
|
|
3193
2315
|
}
|
|
3194
2316
|
});
|
|
@@ -3196,7 +2318,7 @@
|
|
|
3196
2318
|
return true;
|
|
3197
2319
|
}
|
|
3198
2320
|
register(collection, rawCollection) {
|
|
3199
|
-
const raw = rawCollection ?
|
|
2321
|
+
const raw = rawCollection ? deepClone(rawCollection) : deepClone(collection);
|
|
3200
2322
|
this.rootCollections.push(collection);
|
|
3201
2323
|
this.rawRootCollections.push(raw);
|
|
3202
2324
|
this._registerRecursively(collection, raw);
|
|
@@ -3220,7 +2342,7 @@
|
|
|
3220
2342
|
if (!subCollection) return;
|
|
3221
2343
|
this._registerRecursively(this.normalizeCollection({
|
|
3222
2344
|
...subCollection
|
|
3223
|
-
}),
|
|
2345
|
+
}), deepClone(subCollection));
|
|
3224
2346
|
});
|
|
3225
2347
|
}
|
|
3226
2348
|
}
|
|
@@ -4486,7 +3608,25 @@
|
|
|
4486
3608
|
return result;
|
|
4487
3609
|
}
|
|
4488
3610
|
return value;
|
|
3611
|
+
case "string":
|
|
3612
|
+
if (typeof value === "string") {
|
|
3613
|
+
if (value.startsWith("data:application/octet-stream;base64,")) {
|
|
3614
|
+
const base64Data = value.split(",")[1];
|
|
3615
|
+
if (base64Data) {
|
|
3616
|
+
return Buffer.from(base64Data, "base64");
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
return value;
|
|
4489
3621
|
default:
|
|
3622
|
+
if (typeof value === "string") {
|
|
3623
|
+
if (value.startsWith("data:application/octet-stream;base64,")) {
|
|
3624
|
+
const base64Data = value.split(",")[1];
|
|
3625
|
+
if (base64Data) {
|
|
3626
|
+
return Buffer.from(base64Data, "base64");
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
4490
3630
|
return value;
|
|
4491
3631
|
}
|
|
4492
3632
|
}
|
|
@@ -4612,6 +3752,37 @@
|
|
|
4612
3752
|
return value;
|
|
4613
3753
|
}
|
|
4614
3754
|
switch (property.type) {
|
|
3755
|
+
case "string": {
|
|
3756
|
+
if (typeof value === "string") return value;
|
|
3757
|
+
let isBuffer = false;
|
|
3758
|
+
let buf = null;
|
|
3759
|
+
if (Buffer.isBuffer(value)) {
|
|
3760
|
+
isBuffer = true;
|
|
3761
|
+
buf = value;
|
|
3762
|
+
} else if (typeof value === "object" && value !== null && value.type === "Buffer" && Array.isArray(value.data)) {
|
|
3763
|
+
isBuffer = true;
|
|
3764
|
+
buf = Buffer.from(value.data);
|
|
3765
|
+
}
|
|
3766
|
+
if (isBuffer && buf) {
|
|
3767
|
+
let isPrintable = true;
|
|
3768
|
+
for (let i = 0; i < buf.length; i++) {
|
|
3769
|
+
const b = buf[i];
|
|
3770
|
+
if ((b < 32 || b > 126) && b !== 9 && b !== 10 && b !== 13) {
|
|
3771
|
+
isPrintable = false;
|
|
3772
|
+
break;
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
return isPrintable ? buf.toString("utf8") : `data:application/octet-stream;base64,${buf.toString("base64")}`;
|
|
3776
|
+
}
|
|
3777
|
+
if (typeof value === "object" && value !== null) {
|
|
3778
|
+
try {
|
|
3779
|
+
return JSON.stringify(value);
|
|
3780
|
+
} catch {
|
|
3781
|
+
return String(value);
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
return String(value);
|
|
3785
|
+
}
|
|
4615
3786
|
case "relation":
|
|
4616
3787
|
if (typeof value === "string" || typeof value === "number") {
|
|
4617
3788
|
let relationDef = property.relation;
|
|
@@ -4695,8 +3866,29 @@
|
|
|
4695
3866
|
}
|
|
4696
3867
|
return null;
|
|
4697
3868
|
}
|
|
4698
|
-
default:
|
|
3869
|
+
default: {
|
|
3870
|
+
let isBuffer = false;
|
|
3871
|
+
let buf = null;
|
|
3872
|
+
if (Buffer.isBuffer(value)) {
|
|
3873
|
+
isBuffer = true;
|
|
3874
|
+
buf = value;
|
|
3875
|
+
} else if (typeof value === "object" && value !== null && value.type === "Buffer" && Array.isArray(value.data)) {
|
|
3876
|
+
isBuffer = true;
|
|
3877
|
+
buf = Buffer.from(value.data);
|
|
3878
|
+
}
|
|
3879
|
+
if (isBuffer && buf) {
|
|
3880
|
+
let isPrintable = true;
|
|
3881
|
+
for (let i = 0; i < buf.length; i++) {
|
|
3882
|
+
const b = buf[i];
|
|
3883
|
+
if ((b < 32 || b > 126) && b !== 9 && b !== 10 && b !== 13) {
|
|
3884
|
+
isPrintable = false;
|
|
3885
|
+
break;
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3888
|
+
return isPrintable ? buf.toString("utf8") : `data:application/octet-stream;base64,${buf.toString("base64")}`;
|
|
3889
|
+
}
|
|
4699
3890
|
return value;
|
|
3891
|
+
}
|
|
4700
3892
|
}
|
|
4701
3893
|
}
|
|
4702
3894
|
function normalizeScalarValues(data, properties, collection, resolvedRelations, options) {
|
|
@@ -5964,6 +5156,10 @@
|
|
|
5964
5156
|
await this.resolveJoinPathRelations(entity, collection, collectionPath, parsedId, databaseId);
|
|
5965
5157
|
return entity;
|
|
5966
5158
|
} catch (e) {
|
|
5159
|
+
if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
|
|
5160
|
+
console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
|
|
5161
|
+
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.`);
|
|
5162
|
+
}
|
|
5967
5163
|
console.warn(`[EntityFetchService] db.query.findFirst failed for ${collectionPath}, falling back to db.select:`, e);
|
|
5968
5164
|
}
|
|
5969
5165
|
}
|
|
@@ -6024,6 +5220,10 @@
|
|
|
6024
5220
|
const entities = results2.map((row) => this.drizzleResultToEntity(row, collection, collectionPath, idInfo, options.databaseId, idInfoArray));
|
|
6025
5221
|
return entities;
|
|
6026
5222
|
} catch (e) {
|
|
5223
|
+
if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
|
|
5224
|
+
console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
|
|
5225
|
+
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.`);
|
|
5226
|
+
}
|
|
6027
5227
|
console.warn(`[EntityFetchService] db.query.findMany failed for ${collectionPath}, falling back to db.select:`, e);
|
|
6028
5228
|
}
|
|
6029
5229
|
}
|
|
@@ -6293,6 +5493,10 @@
|
|
|
6293
5493
|
await this.resolveJoinPathRelationsBatchRest(restRows, collection, collectionPath, idInfoArray, include);
|
|
6294
5494
|
return restRows;
|
|
6295
5495
|
} catch (e) {
|
|
5496
|
+
if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
|
|
5497
|
+
console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
|
|
5498
|
+
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.`);
|
|
5499
|
+
}
|
|
6296
5500
|
console.warn(`[fetchCollectionForRest] db.query.findMany failed for ${collectionPath}, falling back:`, e);
|
|
6297
5501
|
}
|
|
6298
5502
|
}
|
|
@@ -6373,6 +5577,10 @@
|
|
|
6373
5577
|
await this.resolveJoinPathRelationsBatchRest([restRow], collection, collectionPath, idInfoArray, include);
|
|
6374
5578
|
return restRow;
|
|
6375
5579
|
} catch (e) {
|
|
5580
|
+
if (e instanceof Error && e.message.includes("not enough information to infer relation")) {
|
|
5581
|
+
console.error(`[EntityFetchService] Relation inference error for collection '${collectionPath}': ${e.message}`);
|
|
5582
|
+
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.`);
|
|
5583
|
+
}
|
|
6376
5584
|
console.warn(`[fetchEntityForRest] db.query.findFirst failed for ${collectionPath}, falling back:`, e);
|
|
6377
5585
|
}
|
|
6378
5586
|
}
|
|
@@ -6766,22 +5974,78 @@
|
|
|
6766
5974
|
const pgError = this.extractPgError(error);
|
|
6767
5975
|
if (pgError) {
|
|
6768
5976
|
const detail = pgError.detail;
|
|
5977
|
+
const hint = pgError.hint;
|
|
6769
5978
|
const constraint = pgError.constraint;
|
|
6770
5979
|
const column = pgError.column;
|
|
6771
5980
|
const table = pgError.table;
|
|
5981
|
+
const dataType = pgError.dataType;
|
|
5982
|
+
const pgMessage = pgError.message || "Unknown database error";
|
|
5983
|
+
const suffix = hint ? ` Hint: ${hint}` : "";
|
|
5984
|
+
const tableRef = table ?? collectionSlug;
|
|
6772
5985
|
switch (pgError.code) {
|
|
6773
5986
|
case "23503":
|
|
6774
|
-
return new Error(detail ? `Foreign key constraint violated: ${detail}` : `Cannot save: a foreign key constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}"
|
|
5987
|
+
return new Error(detail ? `Foreign key constraint violated: ${detail}${suffix}` : `Cannot save: a foreign key constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".${suffix}`);
|
|
6775
5988
|
case "23505":
|
|
6776
|
-
return new Error(detail ? `Duplicate value: ${detail}` : `Cannot save: a unique constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}"
|
|
5989
|
+
return new Error(detail ? `Duplicate value: ${detail}${suffix}` : `Cannot save: a unique constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".${suffix}`);
|
|
6777
5990
|
case "23502":
|
|
6778
|
-
return new Error(`Missing required field: "${column ?? "unknown"}" in "${
|
|
5991
|
+
return new Error(`Missing required field: "${column ?? "unknown"}" in "${tableRef}" cannot be empty.${suffix}`);
|
|
6779
5992
|
case "23514":
|
|
6780
|
-
return new Error(`Validation failed: a check constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}"
|
|
5993
|
+
return new Error(`Validation failed: a check constraint${constraint ? ` (${constraint})` : ""} was violated in "${collectionSlug}".${suffix}`);
|
|
5994
|
+
case "22P02":
|
|
5995
|
+
return new Error(`Invalid data format in "${collectionSlug}": ${pgMessage}${suffix}`);
|
|
5996
|
+
case "22001":
|
|
5997
|
+
return new Error(`Value too long for column "${column ?? "unknown"}" in "${tableRef}": ${pgMessage}${suffix}`);
|
|
5998
|
+
case "22003":
|
|
5999
|
+
return new Error(`Numeric value out of range for column "${column ?? "unknown"}" in "${tableRef}": ${pgMessage}${suffix}`);
|
|
6000
|
+
case "42703":
|
|
6001
|
+
return new Error(`Unknown column in "${tableRef}": ${pgMessage}. Check if your schema is up to date (run migrations).${suffix}`);
|
|
6002
|
+
case "42P01":
|
|
6003
|
+
return new Error(`Table not found for "${collectionSlug}": ${pgMessage}. Check if your schema is up to date (run migrations).${suffix}`);
|
|
6004
|
+
default: {
|
|
6005
|
+
const parts = [`Database error in "${collectionSlug}" [${pgError.code}]: ${pgMessage}`];
|
|
6006
|
+
if (detail) parts.push(`Detail: ${detail}`);
|
|
6007
|
+
if (column) parts.push(`Column: ${column}`);
|
|
6008
|
+
if (dataType) parts.push(`Data type: ${dataType}`);
|
|
6009
|
+
if (constraint) parts.push(`Constraint: ${constraint}`);
|
|
6010
|
+
if (hint) parts.push(`Hint: ${hint}`);
|
|
6011
|
+
return new Error(parts.join(". "));
|
|
6012
|
+
}
|
|
6013
|
+
}
|
|
6014
|
+
}
|
|
6015
|
+
const causeMessage = this.extractCauseMessage(error);
|
|
6016
|
+
if (causeMessage) {
|
|
6017
|
+
return new Error(`Database error in "${collectionSlug}": ${causeMessage}`);
|
|
6018
|
+
}
|
|
6019
|
+
if (error instanceof Error) {
|
|
6020
|
+
const cleaned = this.stripSqlFromMessage(error.message, collectionSlug);
|
|
6021
|
+
return new Error(cleaned);
|
|
6022
|
+
}
|
|
6023
|
+
return new Error(`Database error in "${collectionSlug}": ${String(error)}`);
|
|
6024
|
+
}
|
|
6025
|
+
/**
|
|
6026
|
+
* Walk the error cause chain and return the deepest meaningful message.
|
|
6027
|
+
*/
|
|
6028
|
+
extractCauseMessage(error) {
|
|
6029
|
+
if (!error || typeof error !== "object") return null;
|
|
6030
|
+
const err = error;
|
|
6031
|
+
if (err.cause && typeof err.cause === "object") {
|
|
6032
|
+
const deeper = this.extractCauseMessage(err.cause);
|
|
6033
|
+
if (deeper) return deeper;
|
|
6034
|
+
if (err.cause instanceof Error && err.cause.message) {
|
|
6035
|
+
return err.cause.message;
|
|
6781
6036
|
}
|
|
6782
6037
|
}
|
|
6783
|
-
|
|
6784
|
-
|
|
6038
|
+
return null;
|
|
6039
|
+
}
|
|
6040
|
+
/**
|
|
6041
|
+
* Strip the raw SQL query from a Drizzle "Failed query: ..." message,
|
|
6042
|
+
* keeping only the error description.
|
|
6043
|
+
*/
|
|
6044
|
+
stripSqlFromMessage(message, collectionSlug) {
|
|
6045
|
+
if (message.startsWith("Failed query:")) {
|
|
6046
|
+
return `Failed to save entity in "${collectionSlug}". Check server logs for details.`;
|
|
6047
|
+
}
|
|
6048
|
+
return message;
|
|
6785
6049
|
}
|
|
6786
6050
|
/**
|
|
6787
6051
|
* Extract the underlying PostgreSQL error from a Drizzle wrapper.
|
|
@@ -6790,7 +6054,7 @@
|
|
|
6790
6054
|
extractPgError(error) {
|
|
6791
6055
|
if (!error || typeof error !== "object") return null;
|
|
6792
6056
|
const err = error;
|
|
6793
|
-
if (err.code && /^[0-
|
|
6057
|
+
if (err.code && /^[0-9A-Z]{5}$/.test(err.code)) {
|
|
6794
6058
|
return err;
|
|
6795
6059
|
}
|
|
6796
6060
|
if (err.cause && typeof err.cause === "object") {
|
|
@@ -7078,6 +6342,7 @@
|
|
|
7078
6342
|
branchService;
|
|
7079
6343
|
user;
|
|
7080
6344
|
data;
|
|
6345
|
+
client;
|
|
7081
6346
|
/**
|
|
7082
6347
|
* When true, realtime notifications are deferred until after the
|
|
7083
6348
|
* wrapping transaction commits. Set by `withAuth` → `withTransaction`.
|
|
@@ -7167,7 +6432,8 @@
|
|
|
7167
6432
|
const contextForCallback = {
|
|
7168
6433
|
user: this.user,
|
|
7169
6434
|
driver: this,
|
|
7170
|
-
data: this.data
|
|
6435
|
+
data: this.data,
|
|
6436
|
+
client: this.client
|
|
7171
6437
|
};
|
|
7172
6438
|
return Promise.all(entities.map(async (entity) => {
|
|
7173
6439
|
let fetched = entity;
|
|
@@ -7261,7 +6527,8 @@
|
|
|
7261
6527
|
const contextForCallback = {
|
|
7262
6528
|
user: this.user,
|
|
7263
6529
|
driver: this,
|
|
7264
|
-
data: this.data
|
|
6530
|
+
data: this.data,
|
|
6531
|
+
client: this.client
|
|
7265
6532
|
};
|
|
7266
6533
|
if (callbacks?.afterRead) {
|
|
7267
6534
|
entity = await callbacks.afterRead({
|
|
@@ -7330,7 +6597,8 @@
|
|
|
7330
6597
|
const contextForCallback = {
|
|
7331
6598
|
user: this.user,
|
|
7332
6599
|
driver: this,
|
|
7333
|
-
data: this.data
|
|
6600
|
+
data: this.data,
|
|
6601
|
+
client: this.client
|
|
7334
6602
|
};
|
|
7335
6603
|
let previousValuesForHistory;
|
|
7336
6604
|
if (status === "existing" && entityId) {
|
|
@@ -7365,6 +6633,14 @@
|
|
|
7365
6633
|
if (result) updatedValues = mergeDeep(updatedValues, result);
|
|
7366
6634
|
}
|
|
7367
6635
|
}
|
|
6636
|
+
if (resolvedCollection?.properties) {
|
|
6637
|
+
updatedValues = updateDateAutoValues({
|
|
6638
|
+
inputValues: updatedValues,
|
|
6639
|
+
properties: resolvedCollection.properties,
|
|
6640
|
+
status: status ?? "new",
|
|
6641
|
+
timestampNowValue: /* @__PURE__ */ new Date()
|
|
6642
|
+
});
|
|
6643
|
+
}
|
|
7368
6644
|
try {
|
|
7369
6645
|
let savedEntity = await this.entityService.saveEntity(path2, updatedValues, entityId, resolvedCollection?.databaseId);
|
|
7370
6646
|
if (savedEntity && (callbacks?.afterRead || propertyCallbacks?.afterRead)) {
|
|
@@ -7470,7 +6746,8 @@
|
|
|
7470
6746
|
const contextForCallback = {
|
|
7471
6747
|
user: this.user,
|
|
7472
6748
|
driver: this,
|
|
7473
|
-
data: this.data
|
|
6749
|
+
data: this.data,
|
|
6750
|
+
client: this.client
|
|
7474
6751
|
};
|
|
7475
6752
|
if (callbacks?.beforeDelete || propertyCallbacks?.beforeDelete) {
|
|
7476
6753
|
if (callbacks?.beforeDelete) {
|
|
@@ -7797,6 +7074,7 @@
|
|
|
7797
7074
|
txDelegate.entityService = txEntityService;
|
|
7798
7075
|
txDelegate._deferNotifications = true;
|
|
7799
7076
|
txDelegate._pendingNotifications = pendingNotifications;
|
|
7077
|
+
txDelegate.client = this.delegate.client;
|
|
7800
7078
|
return await operation(txDelegate);
|
|
7801
7079
|
});
|
|
7802
7080
|
for (const notification of pendingNotifications) {
|
|
@@ -8196,6 +7474,9 @@
|
|
|
8196
7474
|
} else {
|
|
8197
7475
|
columnDefinition = `timestamp("${colName}", { withTimezone: true, mode: 'string' })`;
|
|
8198
7476
|
}
|
|
7477
|
+
if (dateProp.autoValue === "on_create" || dateProp.autoValue === "on_update") {
|
|
7478
|
+
columnDefinition += `.default(sql\`now()\`)`;
|
|
7479
|
+
}
|
|
8199
7480
|
break;
|
|
8200
7481
|
}
|
|
8201
7482
|
case "map":
|
|
@@ -8599,6 +7880,32 @@
|
|
|
8599
7880
|
console.warn(`Could not generate relation ${relationKey} for ${collection.name}:`, e);
|
|
8600
7881
|
}
|
|
8601
7882
|
}
|
|
7883
|
+
for (const otherCollection of collections) {
|
|
7884
|
+
if (otherCollection.slug === collection.slug) continue;
|
|
7885
|
+
const otherRelations = resolveCollectionRelations(otherCollection);
|
|
7886
|
+
for (const [otherKey, otherRel] of Object.entries(otherRelations)) {
|
|
7887
|
+
if (otherRel.direction === "inverse" && otherRel.foreignKeyOnTarget) {
|
|
7888
|
+
try {
|
|
7889
|
+
const otherTarget = otherRel.target();
|
|
7890
|
+
if (otherTarget.slug === collection.slug) {
|
|
7891
|
+
const drizzleRelationName = computeSharedRelationName(otherRel, otherCollection, collections);
|
|
7892
|
+
const deduplicationKey = `${drizzleRelationName}::owning`;
|
|
7893
|
+
if (!emittedRelationNames.has(deduplicationKey)) {
|
|
7894
|
+
const otherTableVar = getTableVarName(getTableName(otherCollection));
|
|
7895
|
+
const synthKey = `_synth_${otherTableVar}_${otherRel.foreignKeyOnTarget}`;
|
|
7896
|
+
tableRelations.push(` "${synthKey}": one(${otherTableVar}, {
|
|
7897
|
+
fields: [${tableVarName}.${otherRel.foreignKeyOnTarget}],
|
|
7898
|
+
references: [${otherTableVar}.${getPrimaryKeyName(otherCollection)}],
|
|
7899
|
+
relationName: "${drizzleRelationName}"
|
|
7900
|
+
})`);
|
|
7901
|
+
emittedRelationNames.add(deduplicationKey);
|
|
7902
|
+
}
|
|
7903
|
+
}
|
|
7904
|
+
} catch (e) {
|
|
7905
|
+
}
|
|
7906
|
+
}
|
|
7907
|
+
}
|
|
7908
|
+
}
|
|
8602
7909
|
}
|
|
8603
7910
|
if (tableRelations.length > 0) {
|
|
8604
7911
|
const relVarName = `${tableVarName}Relations`;
|