@squidcloud/client 1.0.169 → 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 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),
@@ -28401,6 +27881,7 @@ var IntegrationType;
28401
27881
  IntegrationType["built_in_db"] = "built_in_db";
28402
27882
  IntegrationType["mongo"] = "mongo";
28403
27883
  IntegrationType["mysql"] = "mysql";
27884
+ IntegrationType["clickhouse"] = "clickhouse";
28404
27885
  IntegrationType["mssql"] = "mssql";
28405
27886
  IntegrationType["postgres"] = "postgres";
28406
27887
  IntegrationType["cockroach"] = "cockroach";
@@ -28430,7 +27911,6 @@ var IntegrationType;
28430
27911
  IntegrationType["documentdb"] = "documentdb";
28431
27912
  IntegrationType["dynamodb"] = "dynamodb";
28432
27913
  IntegrationType["cassandra"] = "cassandra";
28433
- IntegrationType["clickhouse"] = "clickhouse";
28434
27914
  IntegrationType["alloydb"] = "alloydb";
28435
27915
  IntegrationType["spanner"] = "spanner";
28436
27916
  IntegrationType["db2"] = "db2";
@@ -28480,6 +27960,7 @@ const DatabaseIntegrationTypes = [
28480
27960
  IntegrationType.built_in_db,
28481
27961
  IntegrationType.mongo,
28482
27962
  IntegrationType.mysql,
27963
+ IntegrationType.clickhouse,
28483
27964
  IntegrationType.bigquery,
28484
27965
  IntegrationType.mssql,
28485
27966
  IntegrationType.postgres,
@@ -28905,7 +28386,7 @@ function sortKeys(json) {
28905
28386
  });
28906
28387
  return result;
28907
28388
  }
28908
- function serialization_normalizeJsonAsString(json) {
28389
+ function normalizeJsonAsString(json) {
28909
28390
  return serializeObj(sortKeys(json));
28910
28391
  }
28911
28392
  function serializeObj(obj) {
@@ -28983,7 +28464,7 @@ function decodeValueForMapping(encodedString) {
28983
28464
  */
28984
28465
  /** @internal */
28985
28466
  function encodeCondition(condition) {
28986
- return serialization_normalizeJsonAsString(condition);
28467
+ return normalizeJsonAsString(condition);
28987
28468
  }
28988
28469
  /** @internal */
28989
28470
  class QueryMappingManager {
@@ -29341,10 +28822,10 @@ class QueryContext {
29341
28822
  }
29342
28823
 
29343
28824
  ;// CONCATENATED MODULE: ../internal-common/src/public-types/regions.public-types.ts
29344
- /**
29345
- * The list of supported Squid regions.
29346
- */
29347
- const SUPPORTED_SQUID_REGIONS = ['us-east-1.aws'];
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;
29348
28829
 
29349
28830
  ;// CONCATENATED MODULE: ../internal-common/src/public-types/socket.public-types.ts
29350
28831
  var ClientConnectionState;
@@ -30721,7 +30202,7 @@ function assert_validateTruthy(value, message, statusCode = HttpStatus.BAD_REQUE
30721
30202
 
30722
30203
 
30723
30204
 
30724
- class validation_ValidationError extends (/* unused pure expression or super */ null && (Error)) {
30205
+ class validation_ValidationError extends Error {
30725
30206
  constructor(error, statusCode, details) {
30726
30207
  super(error);
30727
30208
  this.statusCode = statusCode;
@@ -30928,12 +30409,8 @@ function hasOnlyKeys(obj, keys) {
30928
30409
  return !Array.isArray(obj) && [...Object.keys(obj)].every(key => keys.includes(key));
30929
30410
  }
30930
30411
 
30931
- // EXTERNAL MODULE: ../node_modules/deep-diff/index.js
30932
- var deep_diff = __webpack_require__(2091);
30933
30412
  ;// CONCATENATED MODULE: ../internal-common/src/types/document.types.ts
30934
30413
 
30935
-
30936
-
30937
30414
  /** @internal */
30938
30415
  const SquidPlaceholderId = '__squidId';
30939
30416
  /** @internal */
@@ -30953,45 +30430,7 @@ function getSquidDocId(...args) {
30953
30430
  // Handle nulls and empty strings
30954
30431
  if (!squidDocIdObjObj.integrationId)
30955
30432
  squidDocIdObjObj.integrationId = undefined;
30956
- return serialization_normalizeJsonAsString(squidDocIdObjObj);
30957
- }
30958
- /**
30959
- * Determines whether a beforeDoc and an afterDoc have the same properties.
30960
- * Our internal properties such as __docId__ and __ts__ are excluded from the
30961
- * comparison, as well as any primary keys changes.
30962
- * @internal
30963
- */
30964
- function hasDocumentDiff(beforeDoc, afterDoc) {
30965
- const diffs = deepDiff(beforeDoc, afterDoc) || [];
30966
- const ignoredKeys = ['__docId__', '__ts__'];
30967
- const docIdDiff = diffs.find((diff) => {
30968
- var _a;
30969
- return ((_a = diff.path) === null || _a === void 0 ? void 0 : _a[0]) === '__docId__';
30970
- });
30971
- if (docIdDiff) {
30972
- if (docIdDiff.kind !== 'E' || !docIdDiff.rhs) {
30973
- throw new Error(`Unexpected diff for __docId__: ${normalizeJsonAsString(docIdDiff)}`);
30974
- }
30975
- const docIdObj = parseSquidDocId(docIdDiff.rhs + '');
30976
- ignoredKeys.push(...Object.keys(docIdObj));
30977
- }
30978
- const diff = diffs === null || diffs === void 0 ? void 0 : diffs.find((diff) => {
30979
- var _a;
30980
- // Ignore changes to the docId, ts and primaryKeys.
30981
- if (ignoredKeys.includes((_a = diff.path) === null || _a === void 0 ? void 0 : _a[0]))
30982
- return false;
30983
- switch (diff.kind) {
30984
- case 'N':
30985
- // If a new property has been added, and it's defined, the document is changed.
30986
- return isNonNullable(diff.rhs);
30987
- case 'E':
30988
- case 'D':
30989
- case 'A':
30990
- return true;
30991
- }
30992
- return false;
30993
- });
30994
- return !!diff;
30433
+ return normalizeJsonAsString(squidDocIdObjObj);
30995
30434
  }
30996
30435
 
30997
30436
  ;// CONCATENATED MODULE: ./src/query/query-builder.factory.ts
@@ -31804,9 +31243,9 @@ class CollectionReference {
31804
31243
  docId = { __id: docId || generateId() };
31805
31244
  }
31806
31245
  else {
31807
- docId = { __id: serialization_normalizeJsonAsString(docId) };
31246
+ docId = { __id: normalizeJsonAsString(docId) };
31808
31247
  }
31809
- const docIdAsJsonString = serialization_normalizeJsonAsString(docId);
31248
+ const docIdAsJsonString = normalizeJsonAsString(docId);
31810
31249
  const squidDocId = getSquidDocId(docIdAsJsonString, this.collectionName, this.integrationId);
31811
31250
  return this.documentReferenceFactory.create(squidDocId, this.queryBuilderFactory);
31812
31251
  }
@@ -48349,6 +47788,11 @@ function enableDebugLogs() {
48349
47788
  globalObj['SQUID_DEBUG_ENABLED'] = true;
48350
47789
  }
48351
47790
  /** @internal */
47791
+ function disableDebugLogs() {
47792
+ const globalObj = getGlobal();
47793
+ globalObj['SQUID_DEBUG_ENABLED'] = false;
47794
+ }
47795
+ /** @internal */
48352
47796
  class DebugLogger {
48353
47797
  static log(...args) {
48354
47798
  DebugLogger.info(...args);
@@ -49109,8 +48553,8 @@ class DataManager {
49109
48553
  if ((!existingDoc && !doc) || existingDoc === doc)
49110
48554
  return false;
49111
48555
  if (existingDoc && doc) {
49112
- const serializedDoc = serialization_normalizeJsonAsString(Object.assign(Object.assign({}, doc), { __ts__: undefined }));
49113
- const serializedExistingDoc = serialization_normalizeJsonAsString(existingDoc);
48556
+ const serializedDoc = normalizeJsonAsString(Object.assign(Object.assign({}, doc), { __ts__: undefined }));
48557
+ const serializedExistingDoc = normalizeJsonAsString(existingDoc);
49114
48558
  if (serializedDoc === serializedExistingDoc)
49115
48559
  return false;
49116
48560
  }
@@ -49611,7 +49055,7 @@ class DocumentStore {
49611
49055
  }
49612
49056
  group(sortedDocs, sortFieldNames) {
49613
49057
  return Object.values(lodash_default().groupBy(sortedDocs, doc => {
49614
- return serialization_normalizeJsonAsString(sortFieldNames.map(fieldName => getInPath(doc, fieldName)));
49058
+ return normalizeJsonAsString(sortFieldNames.map(fieldName => getInPath(doc, fieldName)));
49615
49059
  }));
49616
49060
  }
49617
49061
  sortAndLimitDocs(docIdSet, query) {
@@ -51158,7 +50602,7 @@ class SocketManager {
51158
50602
  DebugLogger.debug('Connecting to socket at:', endpoint);
51159
50603
  const socketUri = `${endpoint}?clientId=${this.clientIdService.getClientId()}`;
51160
50604
  this.socket = createWebSocketWrapper(socketUri, {
51161
- timeout: 5000,
50605
+ timeout: 5000, // 5 seconds
51162
50606
  onmessage: (e) => this.onMessage(e.data),
51163
50607
  onopen: () => {
51164
50608
  DebugLogger.debug(`Connection to socket established. Endpoint: ${endpoint}`);
@@ -51818,7 +51262,7 @@ class Squid {
51818
51262
  * @returns A global Squid instance with the given options.
51819
51263
  */
51820
51264
  static getInstance(options) {
51821
- const optionsStr = serialization_normalizeJsonAsString(options);
51265
+ const optionsStr = normalizeJsonAsString(options);
51822
51266
  let instance = Squid.squidInstancesMap[optionsStr];
51823
51267
  if (instance)
51824
51268
  return instance;
@@ -1,6 +1,6 @@
1
1
  import { AuthIntegrationType, DatabaseIntegrationType, IntegrationConfig, IntegrationConfigTypes, IntegrationSchema, IntegrationSchemaKeys, IntegrationSchemaTypes, IntegrationTypeWithConfig } from './integrations/schemas';
2
2
  import { IntegrationType } from './integration.public-types';
3
- import { AppId, EnvironmentId, IntegrationId } from './communication.public-types';
3
+ import { IntegrationId } from './communication.public-types';
4
4
  /** A type alias for a string that represents a webhook. */
5
5
  export type WebhookId = string;
6
6
  /** A type alias for a string that represents a trigger id. */
@@ -95,21 +95,6 @@ export declare enum CronExpression {
95
95
  MONDAY_TO_FRIDAY_AT_10PM = "0 0 22 * * 1-5",
96
96
  MONDAY_TO_FRIDAY_AT_11PM = "0 0 23 * * 1-5"
97
97
  }
98
- export interface DeleteIntegrationRequest {
99
- integrationId: IntegrationId;
100
- }
101
- export interface UpdateAllowedHostsRequest {
102
- allowedHosts: string[];
103
- }
104
- export interface CreateEnvironmentRequest {
105
- sourceAppId: AppId;
106
- environmentId: EnvironmentId;
107
- }
108
- export interface UpdateApplicationCodeRequest {
109
- appId: AppId;
110
- openApiSpecStr?: string;
111
- openApiControllersStr?: string;
112
- }
113
98
  interface BaseUpsertIntegrationRequest<T extends IntegrationTypeWithConfig, C extends IntegrationConfig> {
114
99
  id: IntegrationId;
115
100
  type: T;
@@ -143,7 +128,4 @@ export type UpsertIntegrationSchemaRequest = UpsertDataIntegrationSchemaRequest
143
128
  export type UpsertDataIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[DatabaseIntegrationType];
144
129
  export type UpsertGraphQLIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[IntegrationType.graphql];
145
130
  export type UpsertApiIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[IntegrationType.api];
146
- export interface GetSchemaRequest {
147
- integrationId: IntegrationId;
148
- }
149
131
  export {};
@@ -11,6 +11,7 @@ export declare enum IntegrationType {
11
11
  'built_in_db' = "built_in_db",
12
12
  'mongo' = "mongo",
13
13
  'mysql' = "mysql",
14
+ 'clickhouse' = "clickhouse",
14
15
  'mssql' = "mssql",
15
16
  'postgres' = "postgres",
16
17
  'cockroach' = "cockroach",
@@ -39,7 +40,6 @@ export declare enum IntegrationType {
39
40
  'documentdb' = "documentdb",
40
41
  'dynamodb' = "dynamodb",
41
42
  'cassandra' = "cassandra",
42
- 'clickhouse' = "clickhouse",
43
43
  'alloydb' = "alloydb",
44
44
  'spanner' = "spanner",
45
45
  'db2' = "db2",
@@ -24,6 +24,9 @@ export interface MongoConnectionOptions {
24
24
  export interface MySqlConnectionSecretOptions {
25
25
  password: string;
26
26
  }
27
+ export interface ClickHouseConnectionSecretOptions {
28
+ password: string;
29
+ }
27
30
  export interface BigQueryConnectionSecretOptions {
28
31
  privateKey: string;
29
32
  }
@@ -45,6 +48,14 @@ export interface MySqlConnectionOptions {
45
48
  connectionLimit?: number;
46
49
  sslEnabled?: boolean;
47
50
  }
51
+ export interface ClickHouseConnectionOptions {
52
+ secrets: ClickHouseConnectionSecretOptions;
53
+ host: string;
54
+ user: string;
55
+ database: string;
56
+ connectionLimit?: number;
57
+ sslEnabled?: boolean;
58
+ }
48
59
  export interface BigQueryConnectionOptions {
49
60
  secrets: BigQueryConnectionSecretOptions;
50
61
  projectId: string;
@@ -98,6 +109,9 @@ export interface BaseDatabaseIntegrationConfig extends BaseIntegrationConfig {
98
109
  export interface MySqlIntegrationConfiguration {
99
110
  connectionOptions: MySqlConnectionOptions;
100
111
  }
112
+ export interface ClickHouseIntegrationConfiguration {
113
+ connectionOptions: ClickHouseConnectionOptions;
114
+ }
101
115
  export interface BigQueryIntegrationConfiguration {
102
116
  connectionOptions: BigQueryConnectionOptions;
103
117
  }
@@ -120,6 +134,10 @@ export interface MySqlIntegrationConfig extends BaseDatabaseIntegrationConfig {
120
134
  type: IntegrationType.mysql;
121
135
  configuration: MySqlIntegrationConfiguration;
122
136
  }
137
+ export interface ClickHouseIntegrationConfig extends BaseDatabaseIntegrationConfig {
138
+ type: IntegrationType.clickhouse;
139
+ configuration: ClickHouseIntegrationConfiguration;
140
+ }
123
141
  export interface BigQueryIntegrationConfig extends BaseDatabaseIntegrationConfig {
124
142
  type: IntegrationType.bigquery;
125
143
  configuration: BigQueryIntegrationConfiguration;
@@ -174,6 +192,10 @@ interface DiscoverMysqlDataConnectionSchemaRequest {
174
192
  integrationType: IntegrationType.mysql;
175
193
  connectionOptions: MySqlConnectionOptions;
176
194
  }
195
+ interface DiscoverClickHouseDataConnectionSchemaRequest {
196
+ integrationType: IntegrationType.clickhouse;
197
+ connectionOptions: ClickHouseConnectionOptions;
198
+ }
177
199
  interface DiscoverBigQueryDataConnectionSchemaRequest {
178
200
  integrationType: IntegrationType.bigquery;
179
201
  connectionOptions: BigQueryConnectionOptions;
@@ -202,5 +224,5 @@ export interface TestDataConnectionResponse {
202
224
  success: boolean;
203
225
  errorMessage?: string;
204
226
  }
205
- export type DiscoverDataConnectionSchemaRequest = DiscoverMongoDataConnectionSchemaRequest | DiscoverInternalDataConnectionSchemaRequest | DiscoverMysqlDataConnectionSchemaRequest | DiscoverBigQueryDataConnectionSchemaRequest | DiscoverOracleDataConnectionSchemaRequest | DiscoverMssqlDataConnectionSchemaRequest | DiscoverCockroachDataConnectionSchemaRequest | DiscoverPostgresDataConnectionSchemaRequest | DiscoverSnowflakeDataConnectionSchemaRequest;
227
+ export type DiscoverDataConnectionSchemaRequest = DiscoverMongoDataConnectionSchemaRequest | DiscoverInternalDataConnectionSchemaRequest | DiscoverMysqlDataConnectionSchemaRequest | DiscoverClickHouseDataConnectionSchemaRequest | DiscoverBigQueryDataConnectionSchemaRequest | DiscoverOracleDataConnectionSchemaRequest | DiscoverMssqlDataConnectionSchemaRequest | DiscoverCockroachDataConnectionSchemaRequest | DiscoverPostgresDataConnectionSchemaRequest | DiscoverSnowflakeDataConnectionSchemaRequest;
206
228
  export {};
@@ -1,7 +1,7 @@
1
1
  import { AiChatbotIntegrationConfig } from './ai_chatbot.types';
2
2
  import { GraphQLIntegrationConfig, HttpApiIntegrationConfig, IntegrationApiSchema, IntegrationGraphQLSchema } from './api.types';
3
3
  import { Auth0IntegrationConfig, CognitoIntegrationConfig, DescopeIntegrationConfig, JwtHmacIntegrationConfig, JwtRsaIntegrationConfig, OktaIntegrationConfig } from './auth.types';
4
- import { BaseDatabaseIntegrationConfig, BigQueryIntegrationConfig, CockroachIntegrationConfig, IntegrationDataSchema, InternalIntegrationConfig, MongoIntegrationConfig, MssqlIntegrationConfig, MySqlIntegrationConfig, OracleIntegrationConfig, PostgresIntegrationConfig, SnowflakeIntegrationConfig } from './database.types';
4
+ import { BaseDatabaseIntegrationConfig, BigQueryIntegrationConfig, ClickHouseIntegrationConfig, CockroachIntegrationConfig, IntegrationDataSchema, InternalIntegrationConfig, MongoIntegrationConfig, MssqlIntegrationConfig, MySqlIntegrationConfig, OracleIntegrationConfig, PostgresIntegrationConfig, SnowflakeIntegrationConfig } from './database.types';
5
5
  import { DatadogIntegrationConfig, NewRelicIntegrationConfig } from './observability.types';
6
6
  import { IntegrationSchemaType, IntegrationType } from '../integration.public-types';
7
7
  import { BuiltInQueueIntegrationConfig, ConfluentIntegrationConfig, KafkaIntegrationConfig } from './queue-types';
@@ -10,6 +10,7 @@ export interface IntegrationConfigTypes {
10
10
  [IntegrationType.built_in_db]: InternalIntegrationConfig;
11
11
  [IntegrationType.mongo]: MongoIntegrationConfig;
12
12
  [IntegrationType.mysql]: MySqlIntegrationConfig;
13
+ [IntegrationType.clickhouse]: ClickHouseIntegrationConfig;
13
14
  [IntegrationType.bigquery]: BigQueryIntegrationConfig;
14
15
  [IntegrationType.oracledb]: OracleIntegrationConfig;
15
16
  [IntegrationType.mssql]: MssqlIntegrationConfig;
@@ -35,6 +36,7 @@ export interface IntegrationSchemaTypes {
35
36
  [IntegrationType.built_in_db]: IntegrationDataSchema;
36
37
  [IntegrationType.mongo]: IntegrationDataSchema;
37
38
  [IntegrationType.mysql]: IntegrationDataSchema;
39
+ [IntegrationType.clickhouse]: IntegrationDataSchema;
38
40
  [IntegrationType.oracledb]: IntegrationDataSchema;
39
41
  [IntegrationType.bigquery]: IntegrationDataSchema;
40
42
  [IntegrationType.mssql]: IntegrationDataSchema;
@@ -48,7 +50,7 @@ export type IntegrationTypeWithConfig = keyof IntegrationConfigTypes;
48
50
  export type IntegrationSchemaKeys = keyof IntegrationSchemaTypes;
49
51
  export type IntegrationConfig = IntegrationConfigTypes[IntegrationTypeWithConfig];
50
52
  export type IntegrationSchema = IntegrationSchemaTypes[IntegrationSchemaKeys];
51
- export declare const DatabaseIntegrationTypes: readonly [IntegrationType.built_in_db, IntegrationType.mongo, IntegrationType.mysql, IntegrationType.bigquery, IntegrationType.mssql, IntegrationType.postgres, IntegrationType.cockroach, IntegrationType.snowflake, IntegrationType.oracledb];
53
+ export declare const DatabaseIntegrationTypes: readonly [IntegrationType.built_in_db, IntegrationType.mongo, IntegrationType.mysql, IntegrationType.clickhouse, IntegrationType.bigquery, IntegrationType.mssql, IntegrationType.postgres, IntegrationType.cockroach, IntegrationType.snowflake, IntegrationType.oracledb];
52
54
  export type DatabaseIntegrationType = (typeof DatabaseIntegrationTypes)[number];
53
55
  export type DatabaseIntegrationConfig = IntegrationConfigTypes[DatabaseIntegrationType];
54
56
  export declare const AuthIntegrationTypes: readonly [IntegrationType.auth0, IntegrationType.jwt_rsa, IntegrationType.jwt_hmac, IntegrationType.cognito, IntegrationType.okta, IntegrationType.descope];
@@ -1,5 +1,8 @@
1
- /**
2
- * The list of supported Squid regions.
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
- export type SupportedSquidRegion = (typeof SUPPORTED_SQUID_REGIONS)[number];
7
+ /** @deprecated: Use 'SquidRegion'. */
8
+ export type SupportedSquidRegion = SquidRegion;
@@ -1,12 +1,12 @@
1
1
  import { RpcManager } from './rpc.manager';
2
- import { GraphQLRequest, IntegrationId, SupportedSquidRegion } from './public-types';
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: SupportedSquidRegion, appId: string);
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, SupportedSquidRegion } from './public-types';
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: SupportedSquidRegion, appId: string);
9
+ constructor(rpcManager: RpcManager, region: SquidRegion, appId: string);
10
10
  get(integrationId: IntegrationId): GraphQLClient;
11
11
  }
@@ -1,7 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
2
  export interface QueueManager {
3
3
  /** Publish messages to the queue */
4
- produce(messages: string[]): Promise<void>;
4
+ produce(messages: unknown[]): Promise<void>;
5
5
  /** Consume messages from the queue */
6
- consume(): Observable<string>;
6
+ consume<T>(): Observable<T>;
7
7
  }
@@ -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 { SupportedSquidRegion } from './public-types';
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: SupportedSquidRegion, appId: string, destructManager: DestructManager, headers: Record<string, string> | undefined, authManager: AuthManager, clientIdService: ClientIdService);
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, SupportedSquidRegion } from './public-types';
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: SupportedSquidRegion;
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
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.169",
3
+ "version": "1.0.171",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/typescript-client/src/index.d.ts",