@event-driven-io/emmett-postgresql 0.38.4 → 0.38.6
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.cjs +185 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +185 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -84,24 +84,117 @@ var ExpectedVersionConflictError = class _ExpectedVersionConflictError extends C
|
|
|
84
84
|
Object.setPrototypeOf(this, _ExpectedVersionConflictError.prototype);
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
var
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
var isPrimitive = (value) => {
|
|
88
|
+
const type = typeof value;
|
|
89
|
+
return value === null || value === void 0 || type === "boolean" || type === "number" || type === "string" || type === "symbol" || type === "bigint";
|
|
90
|
+
};
|
|
91
|
+
var compareArrays = (left, right) => {
|
|
92
|
+
if (left.length !== right.length) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
for (let i = 0; i < left.length; i++) {
|
|
96
|
+
const leftHas = i in left;
|
|
97
|
+
const rightHas = i in right;
|
|
98
|
+
if (leftHas !== rightHas) return false;
|
|
99
|
+
if (leftHas && !deepEquals(left[i], right[i])) return false;
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
};
|
|
103
|
+
var compareDates = (left, right) => {
|
|
104
|
+
return left.getTime() === right.getTime();
|
|
105
|
+
};
|
|
106
|
+
var compareRegExps = (left, right) => {
|
|
107
|
+
return left.toString() === right.toString();
|
|
108
|
+
};
|
|
109
|
+
var compareErrors = (left, right) => {
|
|
110
|
+
if (left.message !== right.message || left.name !== right.name) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
const leftKeys = Object.keys(left);
|
|
114
|
+
const rightKeys = Object.keys(right);
|
|
115
|
+
if (leftKeys.length !== rightKeys.length) return false;
|
|
116
|
+
const rightKeySet = new Set(rightKeys);
|
|
117
|
+
for (const key of leftKeys) {
|
|
118
|
+
if (!rightKeySet.has(key)) return false;
|
|
119
|
+
if (!deepEquals(left[key], right[key])) return false;
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
};
|
|
123
|
+
var compareMaps = (left, right) => {
|
|
124
|
+
if (left.size !== right.size) return false;
|
|
125
|
+
for (const [key, value] of left) {
|
|
126
|
+
if (isPrimitive(key)) {
|
|
127
|
+
if (!right.has(key) || !deepEquals(value, right.get(key))) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
let found = false;
|
|
132
|
+
for (const [rightKey, rightValue] of right) {
|
|
133
|
+
if (deepEquals(key, rightKey) && deepEquals(value, rightValue)) {
|
|
134
|
+
found = true;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (!found) return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
};
|
|
143
|
+
var compareSets = (left, right) => {
|
|
144
|
+
if (left.size !== right.size) return false;
|
|
145
|
+
for (const leftItem of left) {
|
|
146
|
+
if (isPrimitive(leftItem)) {
|
|
147
|
+
if (!right.has(leftItem)) return false;
|
|
148
|
+
} else {
|
|
149
|
+
let found = false;
|
|
150
|
+
for (const rightItem of right) {
|
|
151
|
+
if (deepEquals(leftItem, rightItem)) {
|
|
152
|
+
found = true;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (!found) return false;
|
|
157
|
+
}
|
|
90
158
|
}
|
|
91
|
-
|
|
92
|
-
|
|
159
|
+
return true;
|
|
160
|
+
};
|
|
161
|
+
var compareArrayBuffers = (left, right) => {
|
|
162
|
+
if (left.byteLength !== right.byteLength) return false;
|
|
163
|
+
const leftView = new Uint8Array(left);
|
|
164
|
+
const rightView = new Uint8Array(right);
|
|
165
|
+
for (let i = 0; i < leftView.length; i++) {
|
|
166
|
+
if (leftView[i] !== rightView[i]) return false;
|
|
93
167
|
}
|
|
94
|
-
|
|
95
|
-
|
|
168
|
+
return true;
|
|
169
|
+
};
|
|
170
|
+
var compareTypedArrays = (left, right) => {
|
|
171
|
+
if (left.constructor !== right.constructor) return false;
|
|
172
|
+
if (left.byteLength !== right.byteLength) return false;
|
|
173
|
+
const leftArray = new Uint8Array(
|
|
174
|
+
left.buffer,
|
|
175
|
+
left.byteOffset,
|
|
176
|
+
left.byteLength
|
|
177
|
+
);
|
|
178
|
+
const rightArray = new Uint8Array(
|
|
179
|
+
right.buffer,
|
|
180
|
+
right.byteOffset,
|
|
181
|
+
right.byteLength
|
|
182
|
+
);
|
|
183
|
+
for (let i = 0; i < leftArray.length; i++) {
|
|
184
|
+
if (leftArray[i] !== rightArray[i]) return false;
|
|
96
185
|
}
|
|
97
|
-
|
|
186
|
+
return true;
|
|
187
|
+
};
|
|
188
|
+
var compareObjects = (left, right) => {
|
|
98
189
|
const keys1 = Object.keys(left);
|
|
99
190
|
const keys2 = Object.keys(right);
|
|
100
|
-
if (keys1.length !== keys2.length
|
|
191
|
+
if (keys1.length !== keys2.length) {
|
|
101
192
|
return false;
|
|
102
|
-
|
|
103
|
-
|
|
193
|
+
}
|
|
194
|
+
for (const key of keys1) {
|
|
195
|
+
if (left[key] instanceof Function && right[key] instanceof Function) {
|
|
104
196
|
continue;
|
|
197
|
+
}
|
|
105
198
|
const isEqual = deepEquals(left[key], right[key]);
|
|
106
199
|
if (!isEqual) {
|
|
107
200
|
return false;
|
|
@@ -109,8 +202,88 @@ var deepEquals = (left, right) => {
|
|
|
109
202
|
}
|
|
110
203
|
return true;
|
|
111
204
|
};
|
|
205
|
+
var getType = (value) => {
|
|
206
|
+
if (value === null) return "null";
|
|
207
|
+
if (value === void 0) return "undefined";
|
|
208
|
+
const primitiveType = typeof value;
|
|
209
|
+
if (primitiveType !== "object") return primitiveType;
|
|
210
|
+
if (Array.isArray(value)) return "array";
|
|
211
|
+
if (value instanceof Boolean) return "boxed-boolean";
|
|
212
|
+
if (value instanceof Number) return "boxed-number";
|
|
213
|
+
if (value instanceof String) return "boxed-string";
|
|
214
|
+
if (value instanceof Date) return "date";
|
|
215
|
+
if (value instanceof RegExp) return "regexp";
|
|
216
|
+
if (value instanceof Error) return "error";
|
|
217
|
+
if (value instanceof Map) return "map";
|
|
218
|
+
if (value instanceof Set) return "set";
|
|
219
|
+
if (value instanceof ArrayBuffer) return "arraybuffer";
|
|
220
|
+
if (value instanceof DataView) return "dataview";
|
|
221
|
+
if (value instanceof WeakMap) return "weakmap";
|
|
222
|
+
if (value instanceof WeakSet) return "weakset";
|
|
223
|
+
if (ArrayBuffer.isView(value)) return "typedarray";
|
|
224
|
+
return "object";
|
|
225
|
+
};
|
|
226
|
+
var deepEquals = (left, right) => {
|
|
227
|
+
if (left === right) return true;
|
|
228
|
+
if (isEquatable(left)) {
|
|
229
|
+
return left.equals(right);
|
|
230
|
+
}
|
|
231
|
+
const leftType = getType(left);
|
|
232
|
+
const rightType = getType(right);
|
|
233
|
+
if (leftType !== rightType) return false;
|
|
234
|
+
switch (leftType) {
|
|
235
|
+
case "null":
|
|
236
|
+
case "undefined":
|
|
237
|
+
case "boolean":
|
|
238
|
+
case "number":
|
|
239
|
+
case "bigint":
|
|
240
|
+
case "string":
|
|
241
|
+
case "symbol":
|
|
242
|
+
case "function":
|
|
243
|
+
return left === right;
|
|
244
|
+
case "array":
|
|
245
|
+
return compareArrays(left, right);
|
|
246
|
+
case "date":
|
|
247
|
+
return compareDates(left, right);
|
|
248
|
+
case "regexp":
|
|
249
|
+
return compareRegExps(left, right);
|
|
250
|
+
case "error":
|
|
251
|
+
return compareErrors(left, right);
|
|
252
|
+
case "map":
|
|
253
|
+
return compareMaps(
|
|
254
|
+
left,
|
|
255
|
+
right
|
|
256
|
+
);
|
|
257
|
+
case "set":
|
|
258
|
+
return compareSets(left, right);
|
|
259
|
+
case "arraybuffer":
|
|
260
|
+
return compareArrayBuffers(left, right);
|
|
261
|
+
case "dataview":
|
|
262
|
+
case "weakmap":
|
|
263
|
+
case "weakset":
|
|
264
|
+
return false;
|
|
265
|
+
case "typedarray":
|
|
266
|
+
return compareTypedArrays(
|
|
267
|
+
left,
|
|
268
|
+
right
|
|
269
|
+
);
|
|
270
|
+
case "boxed-boolean":
|
|
271
|
+
return left.valueOf() === right.valueOf();
|
|
272
|
+
case "boxed-number":
|
|
273
|
+
return left.valueOf() === right.valueOf();
|
|
274
|
+
case "boxed-string":
|
|
275
|
+
return left.valueOf() === right.valueOf();
|
|
276
|
+
case "object":
|
|
277
|
+
return compareObjects(
|
|
278
|
+
left,
|
|
279
|
+
right
|
|
280
|
+
);
|
|
281
|
+
default:
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
};
|
|
112
285
|
var isEquatable = (left) => {
|
|
113
|
-
return left && typeof left === "object" && "equals" in left && typeof left["equals"] === "function";
|
|
286
|
+
return left !== null && left !== void 0 && typeof left === "object" && "equals" in left && typeof left["equals"] === "function";
|
|
114
287
|
};
|
|
115
288
|
var ParseError = class extends Error {
|
|
116
289
|
constructor(text) {
|