@squidcloud/client 1.0.170 → 1.0.171
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/cjs/index.js +16 -578
- package/dist/internal-common/src/public-types/regions.public-types.d.ts +7 -4
- package/dist/typescript-client/src/graphql-client.d.ts +2 -2
- package/dist/typescript-client/src/graphql-client.factory.d.ts +2 -2
- package/dist/typescript-client/src/rpc.manager.d.ts +2 -2
- package/dist/typescript-client/src/squid.d.ts +2 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1973,527 +1973,6 @@ exports.Response = ctx.Response
|
|
|
1973
1973
|
module.exports = exports
|
|
1974
1974
|
|
|
1975
1975
|
|
|
1976
|
-
/***/ }),
|
|
1977
|
-
|
|
1978
|
-
/***/ 2091:
|
|
1979
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1980
|
-
|
|
1981
|
-
var __WEBPACK_AMD_DEFINE_RESULT__;;(function(root, factory) { // eslint-disable-line no-extra-semi
|
|
1982
|
-
var deepDiff = factory(root);
|
|
1983
|
-
// eslint-disable-next-line no-undef
|
|
1984
|
-
if (true) {
|
|
1985
|
-
// AMD
|
|
1986
|
-
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { // eslint-disable-line no-undef
|
|
1987
|
-
return deepDiff;
|
|
1988
|
-
}).call(exports, __webpack_require__, exports, module),
|
|
1989
|
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
1990
|
-
} else { var _deepdiff; }
|
|
1991
|
-
}(this, function(root) {
|
|
1992
|
-
var validKinds = ['N', 'E', 'A', 'D'];
|
|
1993
|
-
|
|
1994
|
-
// nodejs compatible on server side and in the browser.
|
|
1995
|
-
function inherits(ctor, superCtor) {
|
|
1996
|
-
ctor.super_ = superCtor;
|
|
1997
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
1998
|
-
constructor: {
|
|
1999
|
-
value: ctor,
|
|
2000
|
-
enumerable: false,
|
|
2001
|
-
writable: true,
|
|
2002
|
-
configurable: true
|
|
2003
|
-
}
|
|
2004
|
-
});
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
function Diff(kind, path) {
|
|
2008
|
-
Object.defineProperty(this, 'kind', {
|
|
2009
|
-
value: kind,
|
|
2010
|
-
enumerable: true
|
|
2011
|
-
});
|
|
2012
|
-
if (path && path.length) {
|
|
2013
|
-
Object.defineProperty(this, 'path', {
|
|
2014
|
-
value: path,
|
|
2015
|
-
enumerable: true
|
|
2016
|
-
});
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
function DiffEdit(path, origin, value) {
|
|
2021
|
-
DiffEdit.super_.call(this, 'E', path);
|
|
2022
|
-
Object.defineProperty(this, 'lhs', {
|
|
2023
|
-
value: origin,
|
|
2024
|
-
enumerable: true
|
|
2025
|
-
});
|
|
2026
|
-
Object.defineProperty(this, 'rhs', {
|
|
2027
|
-
value: value,
|
|
2028
|
-
enumerable: true
|
|
2029
|
-
});
|
|
2030
|
-
}
|
|
2031
|
-
inherits(DiffEdit, Diff);
|
|
2032
|
-
|
|
2033
|
-
function DiffNew(path, value) {
|
|
2034
|
-
DiffNew.super_.call(this, 'N', path);
|
|
2035
|
-
Object.defineProperty(this, 'rhs', {
|
|
2036
|
-
value: value,
|
|
2037
|
-
enumerable: true
|
|
2038
|
-
});
|
|
2039
|
-
}
|
|
2040
|
-
inherits(DiffNew, Diff);
|
|
2041
|
-
|
|
2042
|
-
function DiffDeleted(path, value) {
|
|
2043
|
-
DiffDeleted.super_.call(this, 'D', path);
|
|
2044
|
-
Object.defineProperty(this, 'lhs', {
|
|
2045
|
-
value: value,
|
|
2046
|
-
enumerable: true
|
|
2047
|
-
});
|
|
2048
|
-
}
|
|
2049
|
-
inherits(DiffDeleted, Diff);
|
|
2050
|
-
|
|
2051
|
-
function DiffArray(path, index, item) {
|
|
2052
|
-
DiffArray.super_.call(this, 'A', path);
|
|
2053
|
-
Object.defineProperty(this, 'index', {
|
|
2054
|
-
value: index,
|
|
2055
|
-
enumerable: true
|
|
2056
|
-
});
|
|
2057
|
-
Object.defineProperty(this, 'item', {
|
|
2058
|
-
value: item,
|
|
2059
|
-
enumerable: true
|
|
2060
|
-
});
|
|
2061
|
-
}
|
|
2062
|
-
inherits(DiffArray, Diff);
|
|
2063
|
-
|
|
2064
|
-
function arrayRemove(arr, from, to) {
|
|
2065
|
-
var rest = arr.slice((to || from) + 1 || arr.length);
|
|
2066
|
-
arr.length = from < 0 ? arr.length + from : from;
|
|
2067
|
-
arr.push.apply(arr, rest);
|
|
2068
|
-
return arr;
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
function realTypeOf(subject) {
|
|
2072
|
-
var type = typeof subject;
|
|
2073
|
-
if (type !== 'object') {
|
|
2074
|
-
return type;
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
if (subject === Math) {
|
|
2078
|
-
return 'math';
|
|
2079
|
-
} else if (subject === null) {
|
|
2080
|
-
return 'null';
|
|
2081
|
-
} else if (Array.isArray(subject)) {
|
|
2082
|
-
return 'array';
|
|
2083
|
-
} else if (Object.prototype.toString.call(subject) === '[object Date]') {
|
|
2084
|
-
return 'date';
|
|
2085
|
-
} else if (typeof subject.toString === 'function' && /^\/.*\//.test(subject.toString())) {
|
|
2086
|
-
return 'regexp';
|
|
2087
|
-
}
|
|
2088
|
-
return 'object';
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
|
-
// http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
|
|
2092
|
-
function hashThisString(string) {
|
|
2093
|
-
var hash = 0;
|
|
2094
|
-
if (string.length === 0) { return hash; }
|
|
2095
|
-
for (var i = 0; i < string.length; i++) {
|
|
2096
|
-
var char = string.charCodeAt(i);
|
|
2097
|
-
hash = ((hash << 5) - hash) + char;
|
|
2098
|
-
hash = hash & hash; // Convert to 32bit integer
|
|
2099
|
-
}
|
|
2100
|
-
return hash;
|
|
2101
|
-
}
|
|
2102
|
-
|
|
2103
|
-
// Gets a hash of the given object in an array order-independent fashion
|
|
2104
|
-
// also object key order independent (easier since they can be alphabetized)
|
|
2105
|
-
function getOrderIndependentHash(object) {
|
|
2106
|
-
var accum = 0;
|
|
2107
|
-
var type = realTypeOf(object);
|
|
2108
|
-
|
|
2109
|
-
if (type === 'array') {
|
|
2110
|
-
object.forEach(function (item) {
|
|
2111
|
-
// Addition is commutative so this is order indep
|
|
2112
|
-
accum += getOrderIndependentHash(item);
|
|
2113
|
-
});
|
|
2114
|
-
|
|
2115
|
-
var arrayString = '[type: array, hash: ' + accum + ']';
|
|
2116
|
-
return accum + hashThisString(arrayString);
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
if (type === 'object') {
|
|
2120
|
-
for (var key in object) {
|
|
2121
|
-
if (object.hasOwnProperty(key)) {
|
|
2122
|
-
var keyValueString = '[ type: object, key: ' + key + ', value hash: ' + getOrderIndependentHash(object[key]) + ']';
|
|
2123
|
-
accum += hashThisString(keyValueString);
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
return accum;
|
|
2128
|
-
}
|
|
2129
|
-
|
|
2130
|
-
// Non object, non array...should be good?
|
|
2131
|
-
var stringToHash = '[ type: ' + type + ' ; value: ' + object + ']';
|
|
2132
|
-
return accum + hashThisString(stringToHash);
|
|
2133
|
-
}
|
|
2134
|
-
|
|
2135
|
-
function deepDiff(lhs, rhs, changes, prefilter, path, key, stack, orderIndependent) {
|
|
2136
|
-
changes = changes || [];
|
|
2137
|
-
path = path || [];
|
|
2138
|
-
stack = stack || [];
|
|
2139
|
-
var currentPath = path.slice(0);
|
|
2140
|
-
if (typeof key !== 'undefined' && key !== null) {
|
|
2141
|
-
if (prefilter) {
|
|
2142
|
-
if (typeof (prefilter) === 'function' && prefilter(currentPath, key)) {
|
|
2143
|
-
return;
|
|
2144
|
-
} else if (typeof (prefilter) === 'object') {
|
|
2145
|
-
if (prefilter.prefilter && prefilter.prefilter(currentPath, key)) {
|
|
2146
|
-
return;
|
|
2147
|
-
}
|
|
2148
|
-
if (prefilter.normalize) {
|
|
2149
|
-
var alt = prefilter.normalize(currentPath, key, lhs, rhs);
|
|
2150
|
-
if (alt) {
|
|
2151
|
-
lhs = alt[0];
|
|
2152
|
-
rhs = alt[1];
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
}
|
|
2157
|
-
currentPath.push(key);
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
// Use string comparison for regexes
|
|
2161
|
-
if (realTypeOf(lhs) === 'regexp' && realTypeOf(rhs) === 'regexp') {
|
|
2162
|
-
lhs = lhs.toString();
|
|
2163
|
-
rhs = rhs.toString();
|
|
2164
|
-
}
|
|
2165
|
-
|
|
2166
|
-
var ltype = typeof lhs;
|
|
2167
|
-
var rtype = typeof rhs;
|
|
2168
|
-
var i, j, k, other;
|
|
2169
|
-
|
|
2170
|
-
var ldefined = ltype !== 'undefined' ||
|
|
2171
|
-
(stack && (stack.length > 0) && stack[stack.length - 1].lhs &&
|
|
2172
|
-
Object.getOwnPropertyDescriptor(stack[stack.length - 1].lhs, key));
|
|
2173
|
-
var rdefined = rtype !== 'undefined' ||
|
|
2174
|
-
(stack && (stack.length > 0) && stack[stack.length - 1].rhs &&
|
|
2175
|
-
Object.getOwnPropertyDescriptor(stack[stack.length - 1].rhs, key));
|
|
2176
|
-
|
|
2177
|
-
if (!ldefined && rdefined) {
|
|
2178
|
-
changes.push(new DiffNew(currentPath, rhs));
|
|
2179
|
-
} else if (!rdefined && ldefined) {
|
|
2180
|
-
changes.push(new DiffDeleted(currentPath, lhs));
|
|
2181
|
-
} else if (realTypeOf(lhs) !== realTypeOf(rhs)) {
|
|
2182
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
2183
|
-
} else if (realTypeOf(lhs) === 'date' && (lhs - rhs) !== 0) {
|
|
2184
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
2185
|
-
} else if (ltype === 'object' && lhs !== null && rhs !== null) {
|
|
2186
|
-
for (i = stack.length - 1; i > -1; --i) {
|
|
2187
|
-
if (stack[i].lhs === lhs) {
|
|
2188
|
-
other = true;
|
|
2189
|
-
break;
|
|
2190
|
-
}
|
|
2191
|
-
}
|
|
2192
|
-
if (!other) {
|
|
2193
|
-
stack.push({ lhs: lhs, rhs: rhs });
|
|
2194
|
-
if (Array.isArray(lhs)) {
|
|
2195
|
-
// If order doesn't matter, we need to sort our arrays
|
|
2196
|
-
if (orderIndependent) {
|
|
2197
|
-
lhs.sort(function (a, b) {
|
|
2198
|
-
return getOrderIndependentHash(a) - getOrderIndependentHash(b);
|
|
2199
|
-
});
|
|
2200
|
-
|
|
2201
|
-
rhs.sort(function (a, b) {
|
|
2202
|
-
return getOrderIndependentHash(a) - getOrderIndependentHash(b);
|
|
2203
|
-
});
|
|
2204
|
-
}
|
|
2205
|
-
i = rhs.length - 1;
|
|
2206
|
-
j = lhs.length - 1;
|
|
2207
|
-
while (i > j) {
|
|
2208
|
-
changes.push(new DiffArray(currentPath, i, new DiffNew(undefined, rhs[i--])));
|
|
2209
|
-
}
|
|
2210
|
-
while (j > i) {
|
|
2211
|
-
changes.push(new DiffArray(currentPath, j, new DiffDeleted(undefined, lhs[j--])));
|
|
2212
|
-
}
|
|
2213
|
-
for (; i >= 0; --i) {
|
|
2214
|
-
deepDiff(lhs[i], rhs[i], changes, prefilter, currentPath, i, stack, orderIndependent);
|
|
2215
|
-
}
|
|
2216
|
-
} else {
|
|
2217
|
-
var akeys = Object.keys(lhs);
|
|
2218
|
-
var pkeys = Object.keys(rhs);
|
|
2219
|
-
for (i = 0; i < akeys.length; ++i) {
|
|
2220
|
-
k = akeys[i];
|
|
2221
|
-
other = pkeys.indexOf(k);
|
|
2222
|
-
if (other >= 0) {
|
|
2223
|
-
deepDiff(lhs[k], rhs[k], changes, prefilter, currentPath, k, stack, orderIndependent);
|
|
2224
|
-
pkeys[other] = null;
|
|
2225
|
-
} else {
|
|
2226
|
-
deepDiff(lhs[k], undefined, changes, prefilter, currentPath, k, stack, orderIndependent);
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
for (i = 0; i < pkeys.length; ++i) {
|
|
2230
|
-
k = pkeys[i];
|
|
2231
|
-
if (k) {
|
|
2232
|
-
deepDiff(undefined, rhs[k], changes, prefilter, currentPath, k, stack, orderIndependent);
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
stack.length = stack.length - 1;
|
|
2237
|
-
} else if (lhs !== rhs) {
|
|
2238
|
-
// lhs is contains a cycle at this element and it differs from rhs
|
|
2239
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
2240
|
-
}
|
|
2241
|
-
} else if (lhs !== rhs) {
|
|
2242
|
-
if (!(ltype === 'number' && isNaN(lhs) && isNaN(rhs))) {
|
|
2243
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
|
|
2248
|
-
function observableDiff(lhs, rhs, observer, prefilter, orderIndependent) {
|
|
2249
|
-
var changes = [];
|
|
2250
|
-
deepDiff(lhs, rhs, changes, prefilter, null, null, null, orderIndependent);
|
|
2251
|
-
if (observer) {
|
|
2252
|
-
for (var i = 0; i < changes.length; ++i) {
|
|
2253
|
-
observer(changes[i]);
|
|
2254
|
-
}
|
|
2255
|
-
}
|
|
2256
|
-
return changes;
|
|
2257
|
-
}
|
|
2258
|
-
|
|
2259
|
-
function orderIndependentDeepDiff(lhs, rhs, changes, prefilter, path, key, stack) {
|
|
2260
|
-
return deepDiff(lhs, rhs, changes, prefilter, path, key, stack, true);
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
function accumulateDiff(lhs, rhs, prefilter, accum) {
|
|
2264
|
-
var observer = (accum) ?
|
|
2265
|
-
function (difference) {
|
|
2266
|
-
if (difference) {
|
|
2267
|
-
accum.push(difference);
|
|
2268
|
-
}
|
|
2269
|
-
} : undefined;
|
|
2270
|
-
var changes = observableDiff(lhs, rhs, observer, prefilter);
|
|
2271
|
-
return (accum) ? accum : (changes.length) ? changes : undefined;
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
function accumulateOrderIndependentDiff(lhs, rhs, prefilter, accum) {
|
|
2275
|
-
var observer = (accum) ?
|
|
2276
|
-
function (difference) {
|
|
2277
|
-
if (difference) {
|
|
2278
|
-
accum.push(difference);
|
|
2279
|
-
}
|
|
2280
|
-
} : undefined;
|
|
2281
|
-
var changes = observableDiff(lhs, rhs, observer, prefilter, true);
|
|
2282
|
-
return (accum) ? accum : (changes.length) ? changes : undefined;
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
function applyArrayChange(arr, index, change) {
|
|
2286
|
-
if (change.path && change.path.length) {
|
|
2287
|
-
var it = arr[index],
|
|
2288
|
-
i, u = change.path.length - 1;
|
|
2289
|
-
for (i = 0; i < u; i++) {
|
|
2290
|
-
it = it[change.path[i]];
|
|
2291
|
-
}
|
|
2292
|
-
switch (change.kind) {
|
|
2293
|
-
case 'A':
|
|
2294
|
-
applyArrayChange(it[change.path[i]], change.index, change.item);
|
|
2295
|
-
break;
|
|
2296
|
-
case 'D':
|
|
2297
|
-
delete it[change.path[i]];
|
|
2298
|
-
break;
|
|
2299
|
-
case 'E':
|
|
2300
|
-
case 'N':
|
|
2301
|
-
it[change.path[i]] = change.rhs;
|
|
2302
|
-
break;
|
|
2303
|
-
}
|
|
2304
|
-
} else {
|
|
2305
|
-
switch (change.kind) {
|
|
2306
|
-
case 'A':
|
|
2307
|
-
applyArrayChange(arr[index], change.index, change.item);
|
|
2308
|
-
break;
|
|
2309
|
-
case 'D':
|
|
2310
|
-
arr = arrayRemove(arr, index);
|
|
2311
|
-
break;
|
|
2312
|
-
case 'E':
|
|
2313
|
-
case 'N':
|
|
2314
|
-
arr[index] = change.rhs;
|
|
2315
|
-
break;
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
return arr;
|
|
2319
|
-
}
|
|
2320
|
-
|
|
2321
|
-
function applyChange(target, source, change) {
|
|
2322
|
-
if (typeof change === 'undefined' && source && ~validKinds.indexOf(source.kind)) {
|
|
2323
|
-
change = source;
|
|
2324
|
-
}
|
|
2325
|
-
if (target && change && change.kind) {
|
|
2326
|
-
var it = target,
|
|
2327
|
-
i = -1,
|
|
2328
|
-
last = change.path ? change.path.length - 1 : 0;
|
|
2329
|
-
while (++i < last) {
|
|
2330
|
-
if (typeof it[change.path[i]] === 'undefined') {
|
|
2331
|
-
it[change.path[i]] = (typeof change.path[i + 1] !== 'undefined' && typeof change.path[i + 1] === 'number') ? [] : {};
|
|
2332
|
-
}
|
|
2333
|
-
it = it[change.path[i]];
|
|
2334
|
-
}
|
|
2335
|
-
switch (change.kind) {
|
|
2336
|
-
case 'A':
|
|
2337
|
-
if (change.path && typeof it[change.path[i]] === 'undefined') {
|
|
2338
|
-
it[change.path[i]] = [];
|
|
2339
|
-
}
|
|
2340
|
-
applyArrayChange(change.path ? it[change.path[i]] : it, change.index, change.item);
|
|
2341
|
-
break;
|
|
2342
|
-
case 'D':
|
|
2343
|
-
delete it[change.path[i]];
|
|
2344
|
-
break;
|
|
2345
|
-
case 'E':
|
|
2346
|
-
case 'N':
|
|
2347
|
-
it[change.path[i]] = change.rhs;
|
|
2348
|
-
break;
|
|
2349
|
-
}
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
function revertArrayChange(arr, index, change) {
|
|
2354
|
-
if (change.path && change.path.length) {
|
|
2355
|
-
// the structure of the object at the index has changed...
|
|
2356
|
-
var it = arr[index],
|
|
2357
|
-
i, u = change.path.length - 1;
|
|
2358
|
-
for (i = 0; i < u; i++) {
|
|
2359
|
-
it = it[change.path[i]];
|
|
2360
|
-
}
|
|
2361
|
-
switch (change.kind) {
|
|
2362
|
-
case 'A':
|
|
2363
|
-
revertArrayChange(it[change.path[i]], change.index, change.item);
|
|
2364
|
-
break;
|
|
2365
|
-
case 'D':
|
|
2366
|
-
it[change.path[i]] = change.lhs;
|
|
2367
|
-
break;
|
|
2368
|
-
case 'E':
|
|
2369
|
-
it[change.path[i]] = change.lhs;
|
|
2370
|
-
break;
|
|
2371
|
-
case 'N':
|
|
2372
|
-
delete it[change.path[i]];
|
|
2373
|
-
break;
|
|
2374
|
-
}
|
|
2375
|
-
} else {
|
|
2376
|
-
// the array item is different...
|
|
2377
|
-
switch (change.kind) {
|
|
2378
|
-
case 'A':
|
|
2379
|
-
revertArrayChange(arr[index], change.index, change.item);
|
|
2380
|
-
break;
|
|
2381
|
-
case 'D':
|
|
2382
|
-
arr[index] = change.lhs;
|
|
2383
|
-
break;
|
|
2384
|
-
case 'E':
|
|
2385
|
-
arr[index] = change.lhs;
|
|
2386
|
-
break;
|
|
2387
|
-
case 'N':
|
|
2388
|
-
arr = arrayRemove(arr, index);
|
|
2389
|
-
break;
|
|
2390
|
-
}
|
|
2391
|
-
}
|
|
2392
|
-
return arr;
|
|
2393
|
-
}
|
|
2394
|
-
|
|
2395
|
-
function revertChange(target, source, change) {
|
|
2396
|
-
if (target && source && change && change.kind) {
|
|
2397
|
-
var it = target,
|
|
2398
|
-
i, u;
|
|
2399
|
-
u = change.path.length - 1;
|
|
2400
|
-
for (i = 0; i < u; i++) {
|
|
2401
|
-
if (typeof it[change.path[i]] === 'undefined') {
|
|
2402
|
-
it[change.path[i]] = {};
|
|
2403
|
-
}
|
|
2404
|
-
it = it[change.path[i]];
|
|
2405
|
-
}
|
|
2406
|
-
switch (change.kind) {
|
|
2407
|
-
case 'A':
|
|
2408
|
-
// Array was modified...
|
|
2409
|
-
// it will be an array...
|
|
2410
|
-
revertArrayChange(it[change.path[i]], change.index, change.item);
|
|
2411
|
-
break;
|
|
2412
|
-
case 'D':
|
|
2413
|
-
// Item was deleted...
|
|
2414
|
-
it[change.path[i]] = change.lhs;
|
|
2415
|
-
break;
|
|
2416
|
-
case 'E':
|
|
2417
|
-
// Item was edited...
|
|
2418
|
-
it[change.path[i]] = change.lhs;
|
|
2419
|
-
break;
|
|
2420
|
-
case 'N':
|
|
2421
|
-
// Item is new...
|
|
2422
|
-
delete it[change.path[i]];
|
|
2423
|
-
break;
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
}
|
|
2427
|
-
|
|
2428
|
-
function applyDiff(target, source, filter) {
|
|
2429
|
-
if (target && source) {
|
|
2430
|
-
var onChange = function (change) {
|
|
2431
|
-
if (!filter || filter(target, source, change)) {
|
|
2432
|
-
applyChange(target, source, change);
|
|
2433
|
-
}
|
|
2434
|
-
};
|
|
2435
|
-
observableDiff(target, source, onChange);
|
|
2436
|
-
}
|
|
2437
|
-
}
|
|
2438
|
-
|
|
2439
|
-
Object.defineProperties(accumulateDiff, {
|
|
2440
|
-
|
|
2441
|
-
diff: {
|
|
2442
|
-
value: accumulateDiff,
|
|
2443
|
-
enumerable: true
|
|
2444
|
-
},
|
|
2445
|
-
orderIndependentDiff: {
|
|
2446
|
-
value: accumulateOrderIndependentDiff,
|
|
2447
|
-
enumerable: true
|
|
2448
|
-
},
|
|
2449
|
-
observableDiff: {
|
|
2450
|
-
value: observableDiff,
|
|
2451
|
-
enumerable: true
|
|
2452
|
-
},
|
|
2453
|
-
orderIndependentObservableDiff: {
|
|
2454
|
-
value: orderIndependentDeepDiff,
|
|
2455
|
-
enumerable: true
|
|
2456
|
-
},
|
|
2457
|
-
orderIndepHash: {
|
|
2458
|
-
value: getOrderIndependentHash,
|
|
2459
|
-
enumerable: true
|
|
2460
|
-
},
|
|
2461
|
-
applyDiff: {
|
|
2462
|
-
value: applyDiff,
|
|
2463
|
-
enumerable: true
|
|
2464
|
-
},
|
|
2465
|
-
applyChange: {
|
|
2466
|
-
value: applyChange,
|
|
2467
|
-
enumerable: true
|
|
2468
|
-
},
|
|
2469
|
-
revertChange: {
|
|
2470
|
-
value: revertChange,
|
|
2471
|
-
enumerable: true
|
|
2472
|
-
},
|
|
2473
|
-
isConflict: {
|
|
2474
|
-
value: function () {
|
|
2475
|
-
return typeof $conflict !== 'undefined';
|
|
2476
|
-
},
|
|
2477
|
-
enumerable: true
|
|
2478
|
-
}
|
|
2479
|
-
});
|
|
2480
|
-
|
|
2481
|
-
// hackish...
|
|
2482
|
-
accumulateDiff.DeepDiff = accumulateDiff;
|
|
2483
|
-
// ...but works with:
|
|
2484
|
-
// import DeepDiff from 'deep-diff'
|
|
2485
|
-
// import { DeepDiff } from 'deep-diff'
|
|
2486
|
-
// const DeepDiff = require('deep-diff');
|
|
2487
|
-
// const { DeepDiff } = require('deep-diff');
|
|
2488
|
-
|
|
2489
|
-
if (root) {
|
|
2490
|
-
root.DeepDiff = accumulateDiff;
|
|
2491
|
-
}
|
|
2492
|
-
|
|
2493
|
-
return accumulateDiff;
|
|
2494
|
-
}));
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
1976
|
/***/ }),
|
|
2498
1977
|
|
|
2499
1978
|
/***/ 8784:
|
|
@@ -28041,6 +27520,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28041
27520
|
QueryBuilder: () => (/* reexport */ QueryBuilder),
|
|
28042
27521
|
QueryContext: () => (/* reexport */ QueryContext),
|
|
28043
27522
|
QueueIntegrationTypes: () => (/* reexport */ QueueIntegrationTypes),
|
|
27523
|
+
SQUID_REGIONS: () => (/* reexport */ SQUID_REGIONS),
|
|
28044
27524
|
SUPPORTED_SQUID_REGIONS: () => (/* reexport */ SUPPORTED_SQUID_REGIONS),
|
|
28045
27525
|
Squid: () => (/* reexport */ Squid),
|
|
28046
27526
|
allEnvironmentIds: () => (/* reexport */ allEnvironmentIds),
|
|
@@ -28906,7 +28386,7 @@ function sortKeys(json) {
|
|
|
28906
28386
|
});
|
|
28907
28387
|
return result;
|
|
28908
28388
|
}
|
|
28909
|
-
function
|
|
28389
|
+
function normalizeJsonAsString(json) {
|
|
28910
28390
|
return serializeObj(sortKeys(json));
|
|
28911
28391
|
}
|
|
28912
28392
|
function serializeObj(obj) {
|
|
@@ -28984,7 +28464,7 @@ function decodeValueForMapping(encodedString) {
|
|
|
28984
28464
|
*/
|
|
28985
28465
|
/** @internal */
|
|
28986
28466
|
function encodeCondition(condition) {
|
|
28987
|
-
return
|
|
28467
|
+
return normalizeJsonAsString(condition);
|
|
28988
28468
|
}
|
|
28989
28469
|
/** @internal */
|
|
28990
28470
|
class QueryMappingManager {
|
|
@@ -29342,10 +28822,10 @@ class QueryContext {
|
|
|
29342
28822
|
}
|
|
29343
28823
|
|
|
29344
28824
|
;// CONCATENATED MODULE: ../internal-common/src/public-types/regions.public-types.ts
|
|
29345
|
-
/**
|
|
29346
|
-
|
|
29347
|
-
*/
|
|
29348
|
-
const SUPPORTED_SQUID_REGIONS =
|
|
28825
|
+
/** The list of regions in Squid. */
|
|
28826
|
+
const SQUID_REGIONS = ['us-east-1.aws'];
|
|
28827
|
+
/** @deprecated: Use 'SQUID_REGIONS'. */
|
|
28828
|
+
const SUPPORTED_SQUID_REGIONS = SQUID_REGIONS;
|
|
29349
28829
|
|
|
29350
28830
|
;// CONCATENATED MODULE: ../internal-common/src/public-types/socket.public-types.ts
|
|
29351
28831
|
var ClientConnectionState;
|
|
@@ -30722,7 +30202,7 @@ function assert_validateTruthy(value, message, statusCode = HttpStatus.BAD_REQUE
|
|
|
30722
30202
|
|
|
30723
30203
|
|
|
30724
30204
|
|
|
30725
|
-
class validation_ValidationError extends
|
|
30205
|
+
class validation_ValidationError extends Error {
|
|
30726
30206
|
constructor(error, statusCode, details) {
|
|
30727
30207
|
super(error);
|
|
30728
30208
|
this.statusCode = statusCode;
|
|
@@ -30929,12 +30409,8 @@ function hasOnlyKeys(obj, keys) {
|
|
|
30929
30409
|
return !Array.isArray(obj) && [...Object.keys(obj)].every(key => keys.includes(key));
|
|
30930
30410
|
}
|
|
30931
30411
|
|
|
30932
|
-
// EXTERNAL MODULE: ../node_modules/deep-diff/index.js
|
|
30933
|
-
var deep_diff = __webpack_require__(2091);
|
|
30934
30412
|
;// CONCATENATED MODULE: ../internal-common/src/types/document.types.ts
|
|
30935
30413
|
|
|
30936
|
-
|
|
30937
|
-
|
|
30938
30414
|
/** @internal */
|
|
30939
30415
|
const SquidPlaceholderId = '__squidId';
|
|
30940
30416
|
/** @internal */
|
|
@@ -30954,45 +30430,7 @@ function getSquidDocId(...args) {
|
|
|
30954
30430
|
// Handle nulls and empty strings
|
|
30955
30431
|
if (!squidDocIdObjObj.integrationId)
|
|
30956
30432
|
squidDocIdObjObj.integrationId = undefined;
|
|
30957
|
-
return
|
|
30958
|
-
}
|
|
30959
|
-
/**
|
|
30960
|
-
* Determines whether a beforeDoc and an afterDoc have the same properties.
|
|
30961
|
-
* Our internal properties such as __docId__ and __ts__ are excluded from the
|
|
30962
|
-
* comparison, as well as any primary keys changes.
|
|
30963
|
-
* @internal
|
|
30964
|
-
*/
|
|
30965
|
-
function hasDocumentDiff(beforeDoc, afterDoc) {
|
|
30966
|
-
const diffs = deepDiff(beforeDoc, afterDoc) || [];
|
|
30967
|
-
const ignoredKeys = ['__docId__', '__ts__'];
|
|
30968
|
-
const docIdDiff = diffs.find((diff) => {
|
|
30969
|
-
var _a;
|
|
30970
|
-
return ((_a = diff.path) === null || _a === void 0 ? void 0 : _a[0]) === '__docId__';
|
|
30971
|
-
});
|
|
30972
|
-
if (docIdDiff) {
|
|
30973
|
-
if (docIdDiff.kind !== 'E' || !docIdDiff.rhs) {
|
|
30974
|
-
throw new Error(`Unexpected diff for __docId__: ${normalizeJsonAsString(docIdDiff)}`);
|
|
30975
|
-
}
|
|
30976
|
-
const docIdObj = parseSquidDocId(docIdDiff.rhs + '');
|
|
30977
|
-
ignoredKeys.push(...Object.keys(docIdObj));
|
|
30978
|
-
}
|
|
30979
|
-
const diff = diffs === null || diffs === void 0 ? void 0 : diffs.find((diff) => {
|
|
30980
|
-
var _a;
|
|
30981
|
-
// Ignore changes to the docId, ts and primaryKeys.
|
|
30982
|
-
if (ignoredKeys.includes((_a = diff.path) === null || _a === void 0 ? void 0 : _a[0]))
|
|
30983
|
-
return false;
|
|
30984
|
-
switch (diff.kind) {
|
|
30985
|
-
case 'N':
|
|
30986
|
-
// If a new property has been added, and it's defined, the document is changed.
|
|
30987
|
-
return isNonNullable(diff.rhs);
|
|
30988
|
-
case 'E':
|
|
30989
|
-
case 'D':
|
|
30990
|
-
case 'A':
|
|
30991
|
-
return true;
|
|
30992
|
-
}
|
|
30993
|
-
return false;
|
|
30994
|
-
});
|
|
30995
|
-
return !!diff;
|
|
30433
|
+
return normalizeJsonAsString(squidDocIdObjObj);
|
|
30996
30434
|
}
|
|
30997
30435
|
|
|
30998
30436
|
;// CONCATENATED MODULE: ./src/query/query-builder.factory.ts
|
|
@@ -31805,9 +31243,9 @@ class CollectionReference {
|
|
|
31805
31243
|
docId = { __id: docId || generateId() };
|
|
31806
31244
|
}
|
|
31807
31245
|
else {
|
|
31808
|
-
docId = { __id:
|
|
31246
|
+
docId = { __id: normalizeJsonAsString(docId) };
|
|
31809
31247
|
}
|
|
31810
|
-
const docIdAsJsonString =
|
|
31248
|
+
const docIdAsJsonString = normalizeJsonAsString(docId);
|
|
31811
31249
|
const squidDocId = getSquidDocId(docIdAsJsonString, this.collectionName, this.integrationId);
|
|
31812
31250
|
return this.documentReferenceFactory.create(squidDocId, this.queryBuilderFactory);
|
|
31813
31251
|
}
|
|
@@ -49115,8 +48553,8 @@ class DataManager {
|
|
|
49115
48553
|
if ((!existingDoc && !doc) || existingDoc === doc)
|
|
49116
48554
|
return false;
|
|
49117
48555
|
if (existingDoc && doc) {
|
|
49118
|
-
const serializedDoc =
|
|
49119
|
-
const serializedExistingDoc =
|
|
48556
|
+
const serializedDoc = normalizeJsonAsString(Object.assign(Object.assign({}, doc), { __ts__: undefined }));
|
|
48557
|
+
const serializedExistingDoc = normalizeJsonAsString(existingDoc);
|
|
49120
48558
|
if (serializedDoc === serializedExistingDoc)
|
|
49121
48559
|
return false;
|
|
49122
48560
|
}
|
|
@@ -49617,7 +49055,7 @@ class DocumentStore {
|
|
|
49617
49055
|
}
|
|
49618
49056
|
group(sortedDocs, sortFieldNames) {
|
|
49619
49057
|
return Object.values(lodash_default().groupBy(sortedDocs, doc => {
|
|
49620
|
-
return
|
|
49058
|
+
return normalizeJsonAsString(sortFieldNames.map(fieldName => getInPath(doc, fieldName)));
|
|
49621
49059
|
}));
|
|
49622
49060
|
}
|
|
49623
49061
|
sortAndLimitDocs(docIdSet, query) {
|
|
@@ -51164,7 +50602,7 @@ class SocketManager {
|
|
|
51164
50602
|
DebugLogger.debug('Connecting to socket at:', endpoint);
|
|
51165
50603
|
const socketUri = `${endpoint}?clientId=${this.clientIdService.getClientId()}`;
|
|
51166
50604
|
this.socket = createWebSocketWrapper(socketUri, {
|
|
51167
|
-
timeout: 5000,
|
|
50605
|
+
timeout: 5000, // 5 seconds
|
|
51168
50606
|
onmessage: (e) => this.onMessage(e.data),
|
|
51169
50607
|
onopen: () => {
|
|
51170
50608
|
DebugLogger.debug(`Connection to socket established. Endpoint: ${endpoint}`);
|
|
@@ -51824,7 +51262,7 @@ class Squid {
|
|
|
51824
51262
|
* @returns A global Squid instance with the given options.
|
|
51825
51263
|
*/
|
|
51826
51264
|
static getInstance(options) {
|
|
51827
|
-
const optionsStr =
|
|
51265
|
+
const optionsStr = normalizeJsonAsString(options);
|
|
51828
51266
|
let instance = Squid.squidInstancesMap[optionsStr];
|
|
51829
51267
|
if (instance)
|
|
51830
51268
|
return instance;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*/
|
|
1
|
+
/** The list of regions in Squid. */
|
|
2
|
+
export declare const SQUID_REGIONS: readonly ["us-east-1.aws"];
|
|
3
|
+
/** Region type used by Squid. */
|
|
4
|
+
export type SquidRegion = (typeof SQUID_REGIONS)[number];
|
|
5
|
+
/** @deprecated: Use 'SQUID_REGIONS'. */
|
|
4
6
|
export declare const SUPPORTED_SQUID_REGIONS: readonly ["us-east-1.aws"];
|
|
5
|
-
|
|
7
|
+
/** @deprecated: Use 'SquidRegion'. */
|
|
8
|
+
export type SupportedSquidRegion = SquidRegion;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { RpcManager } from './rpc.manager';
|
|
2
|
-
import { GraphQLRequest, IntegrationId,
|
|
2
|
+
import { GraphQLRequest, IntegrationId, SquidRegion } from './public-types';
|
|
3
3
|
/** A GraphQL client that can be used to query and mutate data. */
|
|
4
4
|
export declare class GraphQLClient {
|
|
5
5
|
private readonly rpcManager;
|
|
6
6
|
private readonly region;
|
|
7
7
|
private readonly appId;
|
|
8
8
|
private readonly client;
|
|
9
|
-
constructor(rpcManager: RpcManager, integrationId: IntegrationId, region:
|
|
9
|
+
constructor(rpcManager: RpcManager, integrationId: IntegrationId, region: SquidRegion, appId: string);
|
|
10
10
|
/** Executes a GraphQL query and returns a promise with the result. */
|
|
11
11
|
query<T = any>(request: GraphQLRequest): Promise<T>;
|
|
12
12
|
/** Executes a GraphQL mutation and returns a promise with the result. */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { GraphQLClient } from './graphql-client';
|
|
2
2
|
import { RpcManager } from './rpc.manager';
|
|
3
|
-
import { IntegrationId,
|
|
3
|
+
import { IntegrationId, SquidRegion } from './public-types';
|
|
4
4
|
export declare class GraphQLClientFactory {
|
|
5
5
|
private readonly rpcManager;
|
|
6
6
|
private readonly region;
|
|
7
7
|
private readonly appId;
|
|
8
8
|
private readonly clientsMap;
|
|
9
|
-
constructor(rpcManager: RpcManager, region:
|
|
9
|
+
constructor(rpcManager: RpcManager, region: SquidRegion, appId: string);
|
|
10
10
|
get(integrationId: IntegrationId): GraphQLClient;
|
|
11
11
|
}
|
|
@@ -2,7 +2,7 @@ import { AuthManager } from './auth.manager';
|
|
|
2
2
|
import { ClientIdService } from './client-id.service';
|
|
3
3
|
import { DestructManager } from './destruct.manager';
|
|
4
4
|
import { BlobAndFilename } from './types';
|
|
5
|
-
import {
|
|
5
|
+
import { SquidRegion } from './public-types';
|
|
6
6
|
export declare class RpcManager {
|
|
7
7
|
private readonly region;
|
|
8
8
|
private readonly appId;
|
|
@@ -11,7 +11,7 @@ export declare class RpcManager {
|
|
|
11
11
|
private readonly staticHeaders;
|
|
12
12
|
private readonly onGoingRpcCounter;
|
|
13
13
|
private readonly rateLimiters;
|
|
14
|
-
constructor(region:
|
|
14
|
+
constructor(region: SquidRegion, appId: string, destructManager: DestructManager, headers: Record<string, string> | undefined, authManager: AuthManager, clientIdService: ClientIdService);
|
|
15
15
|
private getAuthHeaders;
|
|
16
16
|
awaitAllSettled(): Promise<void>;
|
|
17
17
|
setStaticHeader(key: string, value: string): void;
|
|
@@ -5,7 +5,7 @@ import { GraphQLClient } from './graphql-client';
|
|
|
5
5
|
import { SecretClient } from './secret.client';
|
|
6
6
|
import { TransactionId } from './types';
|
|
7
7
|
import { AiClient } from './ai.types';
|
|
8
|
-
import { ApiEndpointId, ApiKey, AppId, CollectionName, DocumentData, EnvironmentId, IntegrationId, SquidDeveloperId,
|
|
8
|
+
import { ApiEndpointId, ApiKey, AppId, CollectionName, DocumentData, EnvironmentId, IntegrationId, SquidDeveloperId, SquidRegion } from './public-types';
|
|
9
9
|
import { QueueManager } from './queue.manager';
|
|
10
10
|
/** The different options that can be used to initialize a Squid instance. */
|
|
11
11
|
export interface SquidOptions {
|
|
@@ -39,7 +39,7 @@ export interface SquidOptions {
|
|
|
39
39
|
/**
|
|
40
40
|
* The region that the application is running in. This is used to determine the URL of the Squid Cloud API.
|
|
41
41
|
*/
|
|
42
|
-
region:
|
|
42
|
+
region: SquidRegion;
|
|
43
43
|
/**
|
|
44
44
|
* The environment ID to work with, if not specified the default environment (prod) will be used.
|
|
45
45
|
*/
|