@squidcloud/client 1.0.186 → 1.0.188
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 +340 -190
- package/dist/internal-common/src/public-types/pagination.public-types.d.ts +1 -2
- package/dist/internal-common/src/utils/object.d.ts +7 -1
- package/dist/internal-common/src/utils/squid-private-options.d.ts +0 -7
- package/dist/typescript-client/src/client-id.service.d.ts +1 -1
- package/dist/typescript-client/src/document-store.d.ts +2 -3
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -19910,6 +19910,205 @@ exports.Trie = Trie;
|
|
|
19910
19910
|
Trie.StopFillToken = Symbol('Trie.StopFillToken');
|
|
19911
19911
|
//# sourceMappingURL=Trie.js.map
|
|
19912
19912
|
|
|
19913
|
+
/***/ }),
|
|
19914
|
+
|
|
19915
|
+
/***/ 7795:
|
|
19916
|
+
/***/ ((module) => {
|
|
19917
|
+
|
|
19918
|
+
"use strict";
|
|
19919
|
+
|
|
19920
|
+
module.exports = rfdc
|
|
19921
|
+
|
|
19922
|
+
function copyBuffer (cur) {
|
|
19923
|
+
if (cur instanceof Buffer) {
|
|
19924
|
+
return Buffer.from(cur)
|
|
19925
|
+
}
|
|
19926
|
+
|
|
19927
|
+
return new cur.constructor(cur.buffer.slice(), cur.byteOffset, cur.length)
|
|
19928
|
+
}
|
|
19929
|
+
|
|
19930
|
+
function rfdc (opts) {
|
|
19931
|
+
opts = opts || {}
|
|
19932
|
+
|
|
19933
|
+
if (opts.circles) return rfdcCircles(opts)
|
|
19934
|
+
return opts.proto ? cloneProto : clone
|
|
19935
|
+
|
|
19936
|
+
function cloneArray (a, fn) {
|
|
19937
|
+
var keys = Object.keys(a)
|
|
19938
|
+
var a2 = new Array(keys.length)
|
|
19939
|
+
for (var i = 0; i < keys.length; i++) {
|
|
19940
|
+
var k = keys[i]
|
|
19941
|
+
var cur = a[k]
|
|
19942
|
+
if (typeof cur !== 'object' || cur === null) {
|
|
19943
|
+
a2[k] = cur
|
|
19944
|
+
} else if (cur instanceof Date) {
|
|
19945
|
+
a2[k] = new Date(cur)
|
|
19946
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
19947
|
+
a2[k] = copyBuffer(cur)
|
|
19948
|
+
} else {
|
|
19949
|
+
a2[k] = fn(cur)
|
|
19950
|
+
}
|
|
19951
|
+
}
|
|
19952
|
+
return a2
|
|
19953
|
+
}
|
|
19954
|
+
|
|
19955
|
+
function clone (o) {
|
|
19956
|
+
if (typeof o !== 'object' || o === null) return o
|
|
19957
|
+
if (o instanceof Date) return new Date(o)
|
|
19958
|
+
if (Array.isArray(o)) return cloneArray(o, clone)
|
|
19959
|
+
if (o instanceof Map) return new Map(cloneArray(Array.from(o), clone))
|
|
19960
|
+
if (o instanceof Set) return new Set(cloneArray(Array.from(o), clone))
|
|
19961
|
+
var o2 = {}
|
|
19962
|
+
for (var k in o) {
|
|
19963
|
+
if (Object.hasOwnProperty.call(o, k) === false) continue
|
|
19964
|
+
var cur = o[k]
|
|
19965
|
+
if (typeof cur !== 'object' || cur === null) {
|
|
19966
|
+
o2[k] = cur
|
|
19967
|
+
} else if (cur instanceof Date) {
|
|
19968
|
+
o2[k] = new Date(cur)
|
|
19969
|
+
} else if (cur instanceof Map) {
|
|
19970
|
+
o2[k] = new Map(cloneArray(Array.from(cur), clone))
|
|
19971
|
+
} else if (cur instanceof Set) {
|
|
19972
|
+
o2[k] = new Set(cloneArray(Array.from(cur), clone))
|
|
19973
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
19974
|
+
o2[k] = copyBuffer(cur)
|
|
19975
|
+
} else {
|
|
19976
|
+
o2[k] = clone(cur)
|
|
19977
|
+
}
|
|
19978
|
+
}
|
|
19979
|
+
return o2
|
|
19980
|
+
}
|
|
19981
|
+
|
|
19982
|
+
function cloneProto (o) {
|
|
19983
|
+
if (typeof o !== 'object' || o === null) return o
|
|
19984
|
+
if (o instanceof Date) return new Date(o)
|
|
19985
|
+
if (Array.isArray(o)) return cloneArray(o, cloneProto)
|
|
19986
|
+
if (o instanceof Map) return new Map(cloneArray(Array.from(o), cloneProto))
|
|
19987
|
+
if (o instanceof Set) return new Set(cloneArray(Array.from(o), cloneProto))
|
|
19988
|
+
var o2 = {}
|
|
19989
|
+
for (var k in o) {
|
|
19990
|
+
var cur = o[k]
|
|
19991
|
+
if (typeof cur !== 'object' || cur === null) {
|
|
19992
|
+
o2[k] = cur
|
|
19993
|
+
} else if (cur instanceof Date) {
|
|
19994
|
+
o2[k] = new Date(cur)
|
|
19995
|
+
} else if (cur instanceof Map) {
|
|
19996
|
+
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto))
|
|
19997
|
+
} else if (cur instanceof Set) {
|
|
19998
|
+
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto))
|
|
19999
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
20000
|
+
o2[k] = copyBuffer(cur)
|
|
20001
|
+
} else {
|
|
20002
|
+
o2[k] = cloneProto(cur)
|
|
20003
|
+
}
|
|
20004
|
+
}
|
|
20005
|
+
return o2
|
|
20006
|
+
}
|
|
20007
|
+
}
|
|
20008
|
+
|
|
20009
|
+
function rfdcCircles (opts) {
|
|
20010
|
+
var refs = []
|
|
20011
|
+
var refsNew = []
|
|
20012
|
+
|
|
20013
|
+
return opts.proto ? cloneProto : clone
|
|
20014
|
+
|
|
20015
|
+
function cloneArray (a, fn) {
|
|
20016
|
+
var keys = Object.keys(a)
|
|
20017
|
+
var a2 = new Array(keys.length)
|
|
20018
|
+
for (var i = 0; i < keys.length; i++) {
|
|
20019
|
+
var k = keys[i]
|
|
20020
|
+
var cur = a[k]
|
|
20021
|
+
if (typeof cur !== 'object' || cur === null) {
|
|
20022
|
+
a2[k] = cur
|
|
20023
|
+
} else if (cur instanceof Date) {
|
|
20024
|
+
a2[k] = new Date(cur)
|
|
20025
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
20026
|
+
a2[k] = copyBuffer(cur)
|
|
20027
|
+
} else {
|
|
20028
|
+
var index = refs.indexOf(cur)
|
|
20029
|
+
if (index !== -1) {
|
|
20030
|
+
a2[k] = refsNew[index]
|
|
20031
|
+
} else {
|
|
20032
|
+
a2[k] = fn(cur)
|
|
20033
|
+
}
|
|
20034
|
+
}
|
|
20035
|
+
}
|
|
20036
|
+
return a2
|
|
20037
|
+
}
|
|
20038
|
+
|
|
20039
|
+
function clone (o) {
|
|
20040
|
+
if (typeof o !== 'object' || o === null) return o
|
|
20041
|
+
if (o instanceof Date) return new Date(o)
|
|
20042
|
+
if (Array.isArray(o)) return cloneArray(o, clone)
|
|
20043
|
+
if (o instanceof Map) return new Map(cloneArray(Array.from(o), clone))
|
|
20044
|
+
if (o instanceof Set) return new Set(cloneArray(Array.from(o), clone))
|
|
20045
|
+
var o2 = {}
|
|
20046
|
+
refs.push(o)
|
|
20047
|
+
refsNew.push(o2)
|
|
20048
|
+
for (var k in o) {
|
|
20049
|
+
if (Object.hasOwnProperty.call(o, k) === false) continue
|
|
20050
|
+
var cur = o[k]
|
|
20051
|
+
if (typeof cur !== 'object' || cur === null) {
|
|
20052
|
+
o2[k] = cur
|
|
20053
|
+
} else if (cur instanceof Date) {
|
|
20054
|
+
o2[k] = new Date(cur)
|
|
20055
|
+
} else if (cur instanceof Map) {
|
|
20056
|
+
o2[k] = new Map(cloneArray(Array.from(cur), clone))
|
|
20057
|
+
} else if (cur instanceof Set) {
|
|
20058
|
+
o2[k] = new Set(cloneArray(Array.from(cur), clone))
|
|
20059
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
20060
|
+
o2[k] = copyBuffer(cur)
|
|
20061
|
+
} else {
|
|
20062
|
+
var i = refs.indexOf(cur)
|
|
20063
|
+
if (i !== -1) {
|
|
20064
|
+
o2[k] = refsNew[i]
|
|
20065
|
+
} else {
|
|
20066
|
+
o2[k] = clone(cur)
|
|
20067
|
+
}
|
|
20068
|
+
}
|
|
20069
|
+
}
|
|
20070
|
+
refs.pop()
|
|
20071
|
+
refsNew.pop()
|
|
20072
|
+
return o2
|
|
20073
|
+
}
|
|
20074
|
+
|
|
20075
|
+
function cloneProto (o) {
|
|
20076
|
+
if (typeof o !== 'object' || o === null) return o
|
|
20077
|
+
if (o instanceof Date) return new Date(o)
|
|
20078
|
+
if (Array.isArray(o)) return cloneArray(o, cloneProto)
|
|
20079
|
+
if (o instanceof Map) return new Map(cloneArray(Array.from(o), cloneProto))
|
|
20080
|
+
if (o instanceof Set) return new Set(cloneArray(Array.from(o), cloneProto))
|
|
20081
|
+
var o2 = {}
|
|
20082
|
+
refs.push(o)
|
|
20083
|
+
refsNew.push(o2)
|
|
20084
|
+
for (var k in o) {
|
|
20085
|
+
var cur = o[k]
|
|
20086
|
+
if (typeof cur !== 'object' || cur === null) {
|
|
20087
|
+
o2[k] = cur
|
|
20088
|
+
} else if (cur instanceof Date) {
|
|
20089
|
+
o2[k] = new Date(cur)
|
|
20090
|
+
} else if (cur instanceof Map) {
|
|
20091
|
+
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto))
|
|
20092
|
+
} else if (cur instanceof Set) {
|
|
20093
|
+
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto))
|
|
20094
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
20095
|
+
o2[k] = copyBuffer(cur)
|
|
20096
|
+
} else {
|
|
20097
|
+
var i = refs.indexOf(cur)
|
|
20098
|
+
if (i !== -1) {
|
|
20099
|
+
o2[k] = refsNew[i]
|
|
20100
|
+
} else {
|
|
20101
|
+
o2[k] = cloneProto(cur)
|
|
20102
|
+
}
|
|
20103
|
+
}
|
|
20104
|
+
}
|
|
20105
|
+
refs.pop()
|
|
20106
|
+
refsNew.pop()
|
|
20107
|
+
return o2
|
|
20108
|
+
}
|
|
20109
|
+
}
|
|
20110
|
+
|
|
20111
|
+
|
|
19913
20112
|
/***/ }),
|
|
19914
20113
|
|
|
19915
20114
|
/***/ 7257:
|
|
@@ -29285,16 +29484,28 @@ var lodash = __webpack_require__(8784);
|
|
|
29285
29484
|
var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);
|
|
29286
29485
|
// EXTERNAL MODULE: ../node_modules/assertic/dist/index.js
|
|
29287
29486
|
var dist = __webpack_require__(8975);
|
|
29487
|
+
// EXTERNAL MODULE: ../node_modules/rfdc/index.js
|
|
29488
|
+
var rfdc = __webpack_require__(7795);
|
|
29489
|
+
var rfdc_default = /*#__PURE__*/__webpack_require__.n(rfdc);
|
|
29288
29490
|
;// CONCATENATED MODULE: ../internal-common/src/utils/object.ts
|
|
29289
29491
|
|
|
29290
29492
|
|
|
29291
|
-
|
|
29292
|
-
|
|
29493
|
+
|
|
29494
|
+
const SPLIT_REGEX_FOR_GET_IN_PATH = /[.\[\]]/;
|
|
29495
|
+
/** Returns a value by the `path`. Works with array indexes, like a.b[0]. */
|
|
29496
|
+
function getInPath(obj, path) {
|
|
29497
|
+
if (!obj) {
|
|
29498
|
+
return undefined;
|
|
29499
|
+
}
|
|
29500
|
+
const splitPath = path.split(SPLIT_REGEX_FOR_GET_IN_PATH);
|
|
29293
29501
|
let value = undefined;
|
|
29294
29502
|
let currentObj = obj;
|
|
29295
29503
|
while (currentObj && splitPath.length) {
|
|
29296
|
-
const key =
|
|
29297
|
-
if (!
|
|
29504
|
+
const key = splitPath.shift();
|
|
29505
|
+
if (!key) {
|
|
29506
|
+
continue;
|
|
29507
|
+
}
|
|
29508
|
+
if (typeof currentObj !== 'object' || !(key in currentObj)) {
|
|
29298
29509
|
return undefined;
|
|
29299
29510
|
}
|
|
29300
29511
|
value = currentObj[key];
|
|
@@ -29303,13 +29514,12 @@ function getInPath(obj, path, delimiter = '.') {
|
|
|
29303
29514
|
return value;
|
|
29304
29515
|
}
|
|
29305
29516
|
function isJsObject(obj) {
|
|
29306
|
-
|
|
29307
|
-
return false;
|
|
29308
|
-
return obj !== null && Reflect.getPrototypeOf(obj) === Object.prototype;
|
|
29517
|
+
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
|
29309
29518
|
}
|
|
29310
29519
|
function isDateObject(value) {
|
|
29311
29520
|
return Object.prototype.toString.call(value) === '[object Date]';
|
|
29312
29521
|
}
|
|
29522
|
+
/** Sets a value by path . Does not support array indexes. */
|
|
29313
29523
|
function setInPath(obj, path, value, delimiter = '.') {
|
|
29314
29524
|
var _a;
|
|
29315
29525
|
const splitPath = path.split(delimiter);
|
|
@@ -29317,7 +29527,8 @@ function setInPath(obj, path, value, delimiter = '.') {
|
|
|
29317
29527
|
while (splitPath.length) {
|
|
29318
29528
|
const key = (0,dist.truthy)(splitPath.shift());
|
|
29319
29529
|
if (splitPath.length) {
|
|
29320
|
-
const
|
|
29530
|
+
const fieldValue = currentObj[key];
|
|
29531
|
+
const newCurrentObj = isJsObject(fieldValue) ? (_a = lodash.clone(fieldValue)) !== null && _a !== void 0 ? _a : {} : {};
|
|
29321
29532
|
currentObj[key] = newCurrentObj;
|
|
29322
29533
|
currentObj = newCurrentObj;
|
|
29323
29534
|
}
|
|
@@ -29364,10 +29575,10 @@ function isEqual(a, b) {
|
|
|
29364
29575
|
return true;
|
|
29365
29576
|
if (a === null || b === null)
|
|
29366
29577
|
return false;
|
|
29367
|
-
const
|
|
29368
|
-
if (
|
|
29578
|
+
const typeOfA = typeof a;
|
|
29579
|
+
if (typeOfA !== typeof b)
|
|
29369
29580
|
return false;
|
|
29370
|
-
if (
|
|
29581
|
+
if (typeOfA !== 'object')
|
|
29371
29582
|
return a === b;
|
|
29372
29583
|
if (a instanceof Date && b instanceof Date) {
|
|
29373
29584
|
return a.getTime() === b.getTime();
|
|
@@ -29401,7 +29612,7 @@ function isEmpty(a) {
|
|
|
29401
29612
|
if (a instanceof Map || a instanceof Set) {
|
|
29402
29613
|
return a.size === 0;
|
|
29403
29614
|
}
|
|
29404
|
-
if (typeof a === 'object'
|
|
29615
|
+
if (typeof a === 'object') {
|
|
29405
29616
|
return Object.keys(a).length === 0;
|
|
29406
29617
|
}
|
|
29407
29618
|
return false;
|
|
@@ -29419,10 +29630,30 @@ function omit(object, ...paths) {
|
|
|
29419
29630
|
});
|
|
29420
29631
|
return result;
|
|
29421
29632
|
}
|
|
29633
|
+
/** Creates a deep copy of the object. Copies all Date, Map, Set fields. */
|
|
29634
|
+
function cloneDeep(value) {
|
|
29635
|
+
// Can't use 'structuredClone' function here because it does not process prototype chains:
|
|
29636
|
+
// array fields of the object cloned with the 'structuredClone' have prototype different from Array.prototype,
|
|
29637
|
+
// and it cases some tests to fail.
|
|
29638
|
+
return rfdc_default()()(value);
|
|
29639
|
+
}
|
|
29640
|
+
/** Compares 2 values. 'null' and 'undefined' values are considered equal and are less than any other values. */
|
|
29641
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
29642
|
+
function compareValues(a, b) {
|
|
29643
|
+
if (a === b || (isNil(a) && isNil(b))) {
|
|
29644
|
+
return 0;
|
|
29645
|
+
}
|
|
29646
|
+
else if (isNil(a)) {
|
|
29647
|
+
return -1;
|
|
29648
|
+
}
|
|
29649
|
+
else if (isNil(b)) {
|
|
29650
|
+
return 1;
|
|
29651
|
+
}
|
|
29652
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
29653
|
+
}
|
|
29422
29654
|
|
|
29423
29655
|
;// CONCATENATED MODULE: ../internal-common/src/public-types/mutation.public-context.ts
|
|
29424
29656
|
|
|
29425
|
-
|
|
29426
29657
|
/** The mutation context that will be provided to the security function. */
|
|
29427
29658
|
class MutationContext {
|
|
29428
29659
|
/**
|
|
@@ -29444,8 +29675,8 @@ class MutationContext {
|
|
|
29444
29675
|
}
|
|
29445
29676
|
/** Returns true if the mutation affects the provided path. */
|
|
29446
29677
|
affectsPath(path) {
|
|
29447
|
-
const before =
|
|
29448
|
-
const after =
|
|
29678
|
+
const before = getInPath(this.before, path);
|
|
29679
|
+
const after = getInPath(this.after, path);
|
|
29449
29680
|
return !isEqual(before, after);
|
|
29450
29681
|
}
|
|
29451
29682
|
}
|
|
@@ -29509,36 +29740,23 @@ class Pagination {
|
|
|
29509
29740
|
.snapshots(this.options.subscribe);
|
|
29510
29741
|
this.snapshotSubject.next(firstPageSnapshot);
|
|
29511
29742
|
}
|
|
29512
|
-
|
|
29513
|
-
if (isNil(
|
|
29514
|
-
return
|
|
29515
|
-
}
|
|
29516
|
-
if (isNil(b)) {
|
|
29517
|
-
return 1;
|
|
29518
|
-
}
|
|
29519
|
-
if (a > b) {
|
|
29520
|
-
return 1;
|
|
29743
|
+
compareObjects(doc1, doc2) {
|
|
29744
|
+
if (doc1 === doc2 || (isNil(doc1) && isNil(doc2))) {
|
|
29745
|
+
return 0;
|
|
29521
29746
|
}
|
|
29522
|
-
else if (
|
|
29747
|
+
else if (isNil(doc1)) {
|
|
29523
29748
|
return -1;
|
|
29524
29749
|
}
|
|
29525
|
-
else {
|
|
29526
|
-
return 0;
|
|
29527
|
-
}
|
|
29528
|
-
}
|
|
29529
|
-
compare(doc1, doc2) {
|
|
29530
|
-
if (isNil(doc2)) {
|
|
29750
|
+
else if (isNil(doc2)) {
|
|
29531
29751
|
return 1;
|
|
29532
29752
|
}
|
|
29533
|
-
|
|
29534
|
-
|
|
29535
|
-
|
|
29536
|
-
|
|
29537
|
-
|
|
29538
|
-
|
|
29539
|
-
|
|
29540
|
-
return -currentComparison;
|
|
29541
|
-
}
|
|
29753
|
+
const sortOrders = this.templateSnapshotEmitter.getSortOrders();
|
|
29754
|
+
for (const { fieldName, asc } of sortOrders) {
|
|
29755
|
+
const value1 = getInPath(doc1, fieldName);
|
|
29756
|
+
const value2 = getInPath(doc2, fieldName);
|
|
29757
|
+
const rc = compareValues(value1, value2);
|
|
29758
|
+
if (rc !== 0) {
|
|
29759
|
+
return asc ? rc : -rc;
|
|
29542
29760
|
}
|
|
29543
29761
|
}
|
|
29544
29762
|
return 0;
|
|
@@ -29560,7 +29778,7 @@ class Pagination {
|
|
|
29560
29778
|
if (this.lastElement !== null) {
|
|
29561
29779
|
// We just executed a `prev` and we know what the last element is on the page but not the first.
|
|
29562
29780
|
// We need to find the first element on the page instead, because that's our anchor.
|
|
29563
|
-
const numAfter = extractedData.filter(s => this.
|
|
29781
|
+
const numAfter = extractedData.filter(s => this.compareObjects(s, this.lastElement) === 1).length;
|
|
29564
29782
|
this.firstElement = extractedData[data.length - numAfter - this.options.pageSize];
|
|
29565
29783
|
this.lastElement = null;
|
|
29566
29784
|
}
|
|
@@ -29570,7 +29788,7 @@ class Pagination {
|
|
|
29570
29788
|
this.navigatingToLastPage = false;
|
|
29571
29789
|
}
|
|
29572
29790
|
}
|
|
29573
|
-
const numBefore = extractedData.filter(s => this.
|
|
29791
|
+
const numBefore = extractedData.filter(s => this.compareObjects(s, this.firstElement) === -1).length;
|
|
29574
29792
|
const numAfter = Math.max(0, data.length - numBefore - this.options.pageSize);
|
|
29575
29793
|
// Current page is empty, go to previous page
|
|
29576
29794
|
if (numBefore === data.length) {
|
|
@@ -29631,7 +29849,7 @@ class Pagination {
|
|
|
29631
29849
|
const { data, numBefore, numAfter, extractedData } = internalState;
|
|
29632
29850
|
return {
|
|
29633
29851
|
data: data
|
|
29634
|
-
.filter((_, i) => this.
|
|
29852
|
+
.filter((_, i) => this.compareObjects(extractedData[i], this.firstElement) !== -1)
|
|
29635
29853
|
.slice(0, this.options.pageSize),
|
|
29636
29854
|
hasNext: numAfter > 0,
|
|
29637
29855
|
hasPrev: numBefore > 0,
|
|
@@ -29930,7 +30148,6 @@ function parseQuerySubscriptionId(querySubscriptionId) {
|
|
|
29930
30148
|
|
|
29931
30149
|
|
|
29932
30150
|
|
|
29933
|
-
|
|
29934
30151
|
/**
|
|
29935
30152
|
* The compare table is used to determine whether one condition (conditionA)
|
|
29936
30153
|
* is a subset of another condition (conditionB).
|
|
@@ -30106,7 +30323,7 @@ class QueryContext {
|
|
|
30106
30323
|
for (const contextCondition of this.parsedConditions) {
|
|
30107
30324
|
const fieldNameOrPath = contextCondition.fieldName;
|
|
30108
30325
|
const operator = contextCondition.operator;
|
|
30109
|
-
const valueInDoc =
|
|
30326
|
+
const valueInDoc = getInPath(doc, fieldNameOrPath);
|
|
30110
30327
|
if (operator === 'in') {
|
|
30111
30328
|
if (contextCondition.value.includes(valueInDoc)) {
|
|
30112
30329
|
continue;
|
|
@@ -30269,6 +30486,7 @@ function getSquidDocId(...args) {
|
|
|
30269
30486
|
|
|
30270
30487
|
|
|
30271
30488
|
|
|
30489
|
+
|
|
30272
30490
|
/**
|
|
30273
30491
|
* A query builder that can participate in a join.
|
|
30274
30492
|
* To learn more about join queries, see the
|
|
@@ -30351,7 +30569,7 @@ class JoinQueryBuilder extends BaseQueryBuilder {
|
|
|
30351
30569
|
return new external_rxjs_.BehaviorSubject([]);
|
|
30352
30570
|
}
|
|
30353
30571
|
return this.querySubscriptionManager
|
|
30354
|
-
.processQuery(this.build(), this.rootAlias,
|
|
30572
|
+
.processQuery(this.build(), this.rootAlias, cloneDeep(this.joins), cloneDeep(this.joinConditions), subscribe, false)
|
|
30355
30573
|
.pipe(map(docs => docs.map(docRecord => {
|
|
30356
30574
|
const result = {};
|
|
30357
30575
|
for (const [alias, doc] of Object.entries(docRecord)) {
|
|
@@ -30389,7 +30607,7 @@ class JoinQueryBuilder extends BaseQueryBuilder {
|
|
|
30389
30607
|
return this.queryBuilder.getSortOrders();
|
|
30390
30608
|
}
|
|
30391
30609
|
clone() {
|
|
30392
|
-
const res = new JoinQueryBuilder(this.collectionName, this.integrationId, this.querySubscriptionManager, this.documentReferenceFactory, this.queryBuilderFactory, this.rootAlias, this.latestAlias,
|
|
30610
|
+
const res = new JoinQueryBuilder(this.collectionName, this.integrationId, this.querySubscriptionManager, this.documentReferenceFactory, this.queryBuilderFactory, this.rootAlias, this.latestAlias, cloneDeep(this.leftToRight), cloneDeep(this.joins), cloneDeep(this.joinConditions), this.queryBuilder.clone());
|
|
30393
30611
|
res.containsEmptyInCondition = this.containsEmptyInCondition;
|
|
30394
30612
|
return res;
|
|
30395
30613
|
}
|
|
@@ -30911,7 +31129,7 @@ class DocumentReference {
|
|
|
30911
31129
|
* @throws Error if the document does not exist.
|
|
30912
31130
|
*/
|
|
30913
31131
|
get data() {
|
|
30914
|
-
return
|
|
31132
|
+
return cloneDeep(this.dataRef);
|
|
30915
31133
|
}
|
|
30916
31134
|
/**
|
|
30917
31135
|
* Returns a read-only internal copy of the document data. This works similar to `this.data`, except it does not
|
|
@@ -31038,7 +31256,7 @@ class DocumentReference {
|
|
|
31038
31256
|
async setInPath(path, value, transactionId) {
|
|
31039
31257
|
// Not sure why TypeScript doesn't understand that `path` below is restricted, but we need the explicit type
|
|
31040
31258
|
// assertion to make it compile.
|
|
31041
|
-
return this.update({ [path]:
|
|
31259
|
+
return this.update({ [path]: cloneDeep(value) }, transactionId);
|
|
31042
31260
|
}
|
|
31043
31261
|
/**
|
|
31044
31262
|
* Similar to `update`, but only deletes the given path.
|
|
@@ -36614,7 +36832,7 @@ var cloneDeep_toString = Object.prototype.toString;
|
|
|
36614
36832
|
/**
|
|
36615
36833
|
* Deeply clones a value to create a new instance.
|
|
36616
36834
|
*/
|
|
36617
|
-
function
|
|
36835
|
+
function cloneDeep_cloneDeep(value) {
|
|
36618
36836
|
return cloneDeepHelper(value);
|
|
36619
36837
|
}
|
|
36620
36838
|
function cloneDeepHelper(val, seen) {
|
|
@@ -37304,7 +37522,7 @@ var ObservableQuery = /** @class */ (function (_super) {
|
|
|
37304
37522
|
}
|
|
37305
37523
|
return (this.last = tslib_es6_assign({ result: this.queryManager.assumeImmutableResults ?
|
|
37306
37524
|
newResult
|
|
37307
|
-
:
|
|
37525
|
+
: cloneDeep_cloneDeep(newResult), variables: variables }, (error ? { error: error } : null)));
|
|
37308
37526
|
};
|
|
37309
37527
|
ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {
|
|
37310
37528
|
var _this = this;
|
|
@@ -43231,7 +43449,7 @@ var StoreWriter = /** @class */ (function () {
|
|
|
43231
43449
|
// In development, we need to clone scalar values so that they can be
|
|
43232
43450
|
// safely frozen with maybeDeepFreeze in readFromStore.ts. In production,
|
|
43233
43451
|
// it's cheaper to store the scalar values directly in the cache.
|
|
43234
|
-
return globalThis.__DEV__ !== false ?
|
|
43452
|
+
return globalThis.__DEV__ !== false ? cloneDeep_cloneDeep(value) : value;
|
|
43235
43453
|
}
|
|
43236
43454
|
if (isArray(value)) {
|
|
43237
43455
|
return value.map(function (item, i) {
|
|
@@ -47120,13 +47338,6 @@ function setSquidPrivateOption(optionName, value) {
|
|
|
47120
47338
|
function getSquidPrivateOption(optionName) {
|
|
47121
47339
|
return getSquidPrivateOptions()[optionName];
|
|
47122
47340
|
}
|
|
47123
|
-
/*** Set of constants for private options. */
|
|
47124
|
-
/**
|
|
47125
|
-
* When set to 'true' (boolean), the RPC manager in Squid uses new 'fetch' based
|
|
47126
|
-
* HTTP client instead of axios library.
|
|
47127
|
-
* The option will be removed after the migration is tested and all issues are fixed.
|
|
47128
|
-
*/
|
|
47129
|
-
const SQUID_PRIVATE_OPTION_USE_FETCH_IN_RPC_MANAGER = 'useFetchInRpcManager';
|
|
47130
47341
|
/**
|
|
47131
47342
|
* When set to 'true' (boolean), the Graphql client in Squid uses new 'fetch' based
|
|
47132
47343
|
* HTTP client instead of cross-fetch library.
|
|
@@ -47787,7 +47998,7 @@ class QueryBuilder extends BaseQueryBuilder {
|
|
|
47787
47998
|
}
|
|
47788
47999
|
clone() {
|
|
47789
48000
|
const res = new QueryBuilder(this.collectionName, this.integrationId, this.querySubscriptionManager, this.localQueryManager, this.documentReferenceFactory, this.queryBuilderFactory, this.documentIdentityService);
|
|
47790
|
-
res.query =
|
|
48001
|
+
res.query = cloneDeep(this.query);
|
|
47791
48002
|
res.containsEmptyInCondition = this.containsEmptyInCondition;
|
|
47792
48003
|
return res;
|
|
47793
48004
|
}
|
|
@@ -48047,7 +48258,7 @@ class ClientIdService {
|
|
|
48047
48258
|
this.clientTooOldSubject.next(true);
|
|
48048
48259
|
this.clientIdSubject.next(this.generateClientId());
|
|
48049
48260
|
}
|
|
48050
|
-
|
|
48261
|
+
notifyClientNotTooOld() {
|
|
48051
48262
|
this.clientTooOldSubject.next(false);
|
|
48052
48263
|
}
|
|
48053
48264
|
observeClientReadyToBeRegenerated() {
|
|
@@ -48195,7 +48406,7 @@ function mergeMutations(mutationA, mutationB) {
|
|
|
48195
48406
|
(0,dist.assertTruthy)(mutationB.type === 'update', 'Invalid mutation type');
|
|
48196
48407
|
if (mutationA.type === 'update')
|
|
48197
48408
|
return mergeUpdateMutations(mutationA, mutationB);
|
|
48198
|
-
const result =
|
|
48409
|
+
const result = cloneDeep(mutationA);
|
|
48199
48410
|
for (const [fieldName, propertyMutationsAr] of sortUpdateMutationProperties(mutationB)) {
|
|
48200
48411
|
const propertyMutations = propertyMutationsAr;
|
|
48201
48412
|
for (const propertyMutation of propertyMutations) {
|
|
@@ -48211,8 +48422,8 @@ function mergeMutations(mutationA, mutationB) {
|
|
|
48211
48422
|
return result;
|
|
48212
48423
|
}
|
|
48213
48424
|
function mergeUpdateMutations(mutationA, mutationB) {
|
|
48214
|
-
const result =
|
|
48215
|
-
mutationB =
|
|
48425
|
+
const result = cloneDeep(mutationA);
|
|
48426
|
+
mutationB = cloneDeep(mutationB);
|
|
48216
48427
|
for (const [aPropName] of sortUpdateMutationProperties(result)) {
|
|
48217
48428
|
const aPropNameDots = aPropName.split('.').length;
|
|
48218
48429
|
const isOverriddenByMutationB = Object.entries(mutationB.properties).some(([bPropName]) => {
|
|
@@ -49206,7 +49417,7 @@ class DocumentStore {
|
|
|
49206
49417
|
if (doc !== undefined) {
|
|
49207
49418
|
// Update
|
|
49208
49419
|
if (properties) {
|
|
49209
|
-
const updateDoc =
|
|
49420
|
+
const updateDoc = cloneDeep(properties);
|
|
49210
49421
|
const data = this.removeInternalProperties(updateDoc);
|
|
49211
49422
|
this.squidDocIdToDoc.set(squidDocId, data);
|
|
49212
49423
|
return data;
|
|
@@ -49230,21 +49441,13 @@ class DocumentStore {
|
|
|
49230
49441
|
getDocumentOrUndefined(squidDocId) {
|
|
49231
49442
|
return this.squidDocIdToDoc.get(squidDocId);
|
|
49232
49443
|
}
|
|
49233
|
-
|
|
49234
|
-
|
|
49235
|
-
|
|
49236
|
-
|
|
49237
|
-
|
|
49238
|
-
|
|
49239
|
-
|
|
49240
|
-
return 0;
|
|
49241
|
-
return a > b ? 1 : -1;
|
|
49242
|
-
}
|
|
49243
|
-
compareSquidDocs(a, b, sortFieldNames, sortOrders) {
|
|
49244
|
-
for (const [i, fieldName] of sortFieldNames.entries()) {
|
|
49245
|
-
const compare = this.compareValues(lodash_default().get(a, fieldName), lodash_default().get(b, fieldName));
|
|
49246
|
-
if (compare !== 0) {
|
|
49247
|
-
return sortOrders[i] === 'asc' ? compare : -1 * compare;
|
|
49444
|
+
compareSquidDocs(a, b, sortOrders) {
|
|
49445
|
+
for (const { fieldName, asc } of sortOrders) {
|
|
49446
|
+
const valueA = getInPath(a, fieldName);
|
|
49447
|
+
const valueB = getInPath(b, fieldName);
|
|
49448
|
+
const rc = compareValues(valueA, valueB);
|
|
49449
|
+
if (rc !== 0) {
|
|
49450
|
+
return asc ? rc : -rc;
|
|
49248
49451
|
}
|
|
49249
49452
|
}
|
|
49250
49453
|
return 0;
|
|
@@ -49260,11 +49463,7 @@ class DocumentStore {
|
|
|
49260
49463
|
}
|
|
49261
49464
|
const docs = [...docIdSet].map(id => this.squidDocIdToDoc.get(id)).filter(dist.isNonNullable);
|
|
49262
49465
|
const { sortOrder, limitBy } = query;
|
|
49263
|
-
const
|
|
49264
|
-
const sortOrders = sortOrder.map(s => (s.asc ? 'asc' : 'desc'));
|
|
49265
|
-
const sortedDocs = docs.sort((a, b) => {
|
|
49266
|
-
return this.compareSquidDocs(a, b, sortFieldNames, sortOrders);
|
|
49267
|
-
});
|
|
49466
|
+
const sortedDocs = docs.sort((a, b) => this.compareSquidDocs(a, b, sortOrder));
|
|
49268
49467
|
const mainLimit = query.limit < 0 ? 2000 : query.limit;
|
|
49269
49468
|
if (!limitBy) {
|
|
49270
49469
|
return sortedDocs.slice(0, mainLimit);
|
|
@@ -49466,7 +49665,6 @@ const arrayMergeCustomizer = (a, b) => {
|
|
|
49466
49665
|
|
|
49467
49666
|
|
|
49468
49667
|
|
|
49469
|
-
|
|
49470
49668
|
// See limitUnderflowState below.
|
|
49471
49669
|
// Exported only for tests
|
|
49472
49670
|
const FETCH_BEYOND_LIMIT = 100;
|
|
@@ -49971,7 +50169,7 @@ class QuerySubscriptionManager {
|
|
|
49971
50169
|
if (allNeededValues.size === 0) {
|
|
49972
50170
|
return false;
|
|
49973
50171
|
}
|
|
49974
|
-
const newQuery =
|
|
50172
|
+
const newQuery = cloneDeep(query);
|
|
49975
50173
|
newQuery.conditions = newQuery.conditions.filter(cond => !isSimpleCondition(cond) || cond.fieldName !== joinCondition.right);
|
|
49976
50174
|
[...allNeededValues].forEach(value => {
|
|
49977
50175
|
newQuery.conditions.push({
|
|
@@ -50379,13 +50577,9 @@ class RateLimiter {
|
|
|
50379
50577
|
}
|
|
50380
50578
|
}
|
|
50381
50579
|
|
|
50382
|
-
;// CONCATENATED MODULE: external "axios"
|
|
50383
|
-
const external_axios_namespaceObject = require("axios");
|
|
50384
|
-
var external_axios_default = /*#__PURE__*/__webpack_require__.n(external_axios_namespaceObject);
|
|
50385
50580
|
;// CONCATENATED MODULE: ./src/squid-http-client.ts
|
|
50386
50581
|
|
|
50387
50582
|
|
|
50388
|
-
|
|
50389
50583
|
class RpcError extends Error {
|
|
50390
50584
|
/** @internal */
|
|
50391
50585
|
constructor(statusCode, statusText, url, headers, body, message) {
|
|
@@ -50397,20 +50591,12 @@ class RpcError extends Error {
|
|
|
50397
50591
|
this.body = body;
|
|
50398
50592
|
}
|
|
50399
50593
|
}
|
|
50400
|
-
function isFetchMode() {
|
|
50401
|
-
// Temporary (1 week) keep the old code to simplify rollback.
|
|
50402
|
-
return true;
|
|
50403
|
-
// Native fetch is used in json request mode or when the corresponding private Squid option is enabled.
|
|
50404
|
-
// This option is enabled in console-local and console-dev modes both in Web & Backend.
|
|
50405
|
-
// return files.length === 0 || !!getSquidPrivateOption(SQUID_PRIVATE_OPTION_USE_FETCH_IN_RPC_MANAGER);
|
|
50406
|
-
}
|
|
50407
50594
|
/**
|
|
50408
50595
|
* Runs a post request to the given URL.
|
|
50409
50596
|
* @internal.
|
|
50410
50597
|
*/
|
|
50411
50598
|
async function rawSquidHttpPost(input) {
|
|
50412
|
-
const
|
|
50413
|
-
const response = await (isFetch ? performFetchRequest(input) : performAxiosRequest(input));
|
|
50599
|
+
const response = await performFetchRequest(input);
|
|
50414
50600
|
response.body = tryDeserializing(response.body);
|
|
50415
50601
|
return response;
|
|
50416
50602
|
}
|
|
@@ -50431,74 +50617,17 @@ async function performFetchRequest({ headers, files, filesFieldName, message: bo
|
|
|
50431
50617
|
requestOptionHeaders.append('Content-Type', 'application/json');
|
|
50432
50618
|
requestOptions.body = serializeObj(body);
|
|
50433
50619
|
}
|
|
50434
|
-
const response = await fetch(url, requestOptions);
|
|
50435
|
-
const responseHeaders = {};
|
|
50436
|
-
response.headers.forEach((value, key) => {
|
|
50437
|
-
responseHeaders[key] = value;
|
|
50438
|
-
});
|
|
50439
|
-
if (!response.ok) {
|
|
50440
|
-
const rawBody = await response.text();
|
|
50441
|
-
const parsedBody = tryDeserializing(rawBody);
|
|
50442
|
-
if (!extractErrorMessage) {
|
|
50443
|
-
throw new RpcError(response.status, response.statusText, url, responseHeaders, parsedBody, rawBody);
|
|
50444
|
-
}
|
|
50445
|
-
let message;
|
|
50446
|
-
try {
|
|
50447
|
-
message = typeof parsedBody === 'string' ? parsedBody : (parsedBody === null || parsedBody === void 0 ? void 0 : parsedBody['message']) || rawBody;
|
|
50448
|
-
}
|
|
50449
|
-
catch (_a) { }
|
|
50450
|
-
if (!message)
|
|
50451
|
-
message = response.statusText;
|
|
50452
|
-
throw new RpcError(response.status, response.statusText, url, responseHeaders, parsedBody, message);
|
|
50453
|
-
}
|
|
50454
|
-
const responseBody = await response.text();
|
|
50455
|
-
DebugLogger.debug(`received response: ${JSON.stringify(responseBody)}`);
|
|
50456
|
-
return {
|
|
50457
|
-
body: responseBody,
|
|
50458
|
-
headers: responseHeaders,
|
|
50459
|
-
status: response.status,
|
|
50460
|
-
statusText: response.statusText,
|
|
50461
|
-
};
|
|
50462
|
-
}
|
|
50463
|
-
function extractAxiosResponseHeaders(response) {
|
|
50464
|
-
return Object.entries(response.headers).reduce((acc, [key, value]) => {
|
|
50465
|
-
acc[key] = value;
|
|
50466
|
-
return acc;
|
|
50467
|
-
}, {});
|
|
50468
|
-
}
|
|
50469
|
-
async function performAxiosRequest({ files, filesFieldName, message: body, url, headers, extractErrorMessage, }) {
|
|
50470
|
-
let axiosResponse;
|
|
50471
50620
|
try {
|
|
50472
|
-
|
|
50473
|
-
|
|
50474
|
-
|
|
50475
|
-
|
|
50476
|
-
|
|
50477
|
-
|
|
50478
|
-
|
|
50479
|
-
formData.append('body', serializeObj(body));
|
|
50480
|
-
// Make the axios call
|
|
50481
|
-
axiosResponse = await external_axios_default().post(url, formData, {
|
|
50482
|
-
headers,
|
|
50483
|
-
responseType: 'text',
|
|
50484
|
-
});
|
|
50485
|
-
}
|
|
50486
|
-
else {
|
|
50487
|
-
axiosResponse = await external_axios_default().post(url, serializeObj(body), {
|
|
50488
|
-
headers: Object.assign(Object.assign({}, headers), { 'Content-Type': 'application/json' }),
|
|
50489
|
-
responseType: 'text',
|
|
50490
|
-
});
|
|
50491
|
-
}
|
|
50492
|
-
}
|
|
50493
|
-
catch (error) {
|
|
50494
|
-
if ((0,external_axios_namespaceObject.isAxiosError)(error)) {
|
|
50495
|
-
const { response } = error;
|
|
50496
|
-
if (!response)
|
|
50497
|
-
throw error;
|
|
50498
|
-
const responseHeaders = extractAxiosResponseHeaders(response);
|
|
50499
|
-
const rawBody = response.data;
|
|
50621
|
+
const response = await fetch(url, requestOptions);
|
|
50622
|
+
const responseHeaders = {};
|
|
50623
|
+
response.headers.forEach((value, key) => {
|
|
50624
|
+
responseHeaders[key] = value;
|
|
50625
|
+
});
|
|
50626
|
+
if (!response.ok) {
|
|
50627
|
+
const rawBody = await response.text();
|
|
50500
50628
|
const parsedBody = tryDeserializing(rawBody);
|
|
50501
50629
|
if (!extractErrorMessage) {
|
|
50630
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
50502
50631
|
throw new RpcError(response.status, response.statusText, url, responseHeaders, parsedBody, rawBody);
|
|
50503
50632
|
}
|
|
50504
50633
|
let message;
|
|
@@ -50508,20 +50637,22 @@ async function performAxiosRequest({ files, filesFieldName, message: body, url,
|
|
|
50508
50637
|
catch (_a) { }
|
|
50509
50638
|
if (!message)
|
|
50510
50639
|
message = response.statusText;
|
|
50640
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
50511
50641
|
throw new RpcError(response.status, response.statusText, url, responseHeaders, parsedBody, message);
|
|
50512
50642
|
}
|
|
50513
|
-
|
|
50514
|
-
|
|
50515
|
-
|
|
50643
|
+
const responseBody = await response.text();
|
|
50644
|
+
DebugLogger.debug(`received response: ${JSON.stringify(responseBody)}`);
|
|
50645
|
+
return {
|
|
50646
|
+
body: responseBody,
|
|
50647
|
+
headers: responseHeaders,
|
|
50648
|
+
status: response.status,
|
|
50649
|
+
statusText: response.statusText,
|
|
50650
|
+
};
|
|
50651
|
+
}
|
|
50652
|
+
catch (e) {
|
|
50653
|
+
console.error(`Unable to perform fetch request to url: ${url}`, e);
|
|
50654
|
+
throw e;
|
|
50516
50655
|
}
|
|
50517
|
-
const responseHeaders = extractAxiosResponseHeaders(axiosResponse);
|
|
50518
|
-
DebugLogger.debug(`received response: ${JSON.stringify(axiosResponse.data)}`);
|
|
50519
|
-
return {
|
|
50520
|
-
body: axiosResponse.data,
|
|
50521
|
-
headers: responseHeaders,
|
|
50522
|
-
status: axiosResponse.status,
|
|
50523
|
-
statusText: axiosResponse.statusText,
|
|
50524
|
-
};
|
|
50525
50656
|
}
|
|
50526
50657
|
/**
|
|
50527
50658
|
* @internal.
|
|
@@ -50818,28 +50949,30 @@ class SocketManager {
|
|
|
50818
50949
|
}))
|
|
50819
50950
|
.subscribe(() => {
|
|
50820
50951
|
if (this.connectionReady.value) {
|
|
50821
|
-
DebugLogger.debug(
|
|
50952
|
+
DebugLogger.debug(`Client reconnected before becoming too old. Ignoring... ${this.clientIdService.getClientId()}`);
|
|
50822
50953
|
return;
|
|
50823
50954
|
}
|
|
50955
|
+
DebugLogger.debug(`Client disconnected for a long period - refreshing ${this.clientIdService.getClientId()}`);
|
|
50824
50956
|
this.refreshClient();
|
|
50825
50957
|
});
|
|
50826
50958
|
this.observeConnectionReady()
|
|
50827
50959
|
.pipe((0,external_rxjs_.filter)(Boolean))
|
|
50828
50960
|
.subscribe(() => {
|
|
50829
50961
|
if (this.clientIdService.isClientTooOld()) {
|
|
50830
|
-
this.clientIdService.
|
|
50962
|
+
this.clientIdService.notifyClientNotTooOld();
|
|
50831
50963
|
}
|
|
50832
50964
|
});
|
|
50833
50965
|
}
|
|
50834
50966
|
refreshClient() {
|
|
50835
50967
|
if (this.destructManager.isDestructing) {
|
|
50836
|
-
DebugLogger.debug(
|
|
50968
|
+
DebugLogger.debug(`Client too old but is destructed. Ignoring... ${this.clientIdService.getClientId()}`);
|
|
50837
50969
|
return;
|
|
50838
50970
|
}
|
|
50839
50971
|
else if (this.clientIdService.isClientTooOld()) {
|
|
50840
|
-
DebugLogger.debug(
|
|
50972
|
+
DebugLogger.debug(`Client is already marked as too old. Ignoring... ${this.clientIdService.getClientId()}`);
|
|
50841
50973
|
return;
|
|
50842
50974
|
}
|
|
50975
|
+
DebugLogger.debug(`Notifying client too old ${this.clientIdService.getClientId()}`);
|
|
50843
50976
|
this.clientIdService.notifyClientTooOld();
|
|
50844
50977
|
DebugLogger.debug('Client too old. Reconnecting...');
|
|
50845
50978
|
this.connect();
|
|
@@ -50847,6 +50980,7 @@ class SocketManager {
|
|
|
50847
50980
|
tick() {
|
|
50848
50981
|
const diff = Math.abs(Date.now() - this.lastTick.getTime());
|
|
50849
50982
|
if (diff > this.clientTooOldThreshold) {
|
|
50983
|
+
DebugLogger.debug('Tick: Client not responding for a long time. Refreshing...', this.clientIdService.getClientId());
|
|
50850
50984
|
this.refreshClient();
|
|
50851
50985
|
}
|
|
50852
50986
|
this.lastTick = new Date();
|
|
@@ -50895,29 +51029,45 @@ class SocketManager {
|
|
|
50895
51029
|
connect() {
|
|
50896
51030
|
var _a;
|
|
50897
51031
|
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.close();
|
|
51032
|
+
if (this.connectionReady.value) {
|
|
51033
|
+
this.connectionReady.next(false);
|
|
51034
|
+
}
|
|
50898
51035
|
const endpoint = getApplicationUrl(this.region, this.appId, 'ws/general')
|
|
50899
51036
|
.replace('https', 'wss')
|
|
50900
51037
|
.replace('http', 'ws');
|
|
50901
|
-
|
|
50902
|
-
|
|
51038
|
+
const clientId = this.clientIdService.getClientId();
|
|
51039
|
+
DebugLogger.debug('Connecting to socket at:', endpoint, 'clientId:', clientId);
|
|
51040
|
+
const socketUri = `${endpoint}?clientId=${clientId}`;
|
|
50903
51041
|
this.socket = createWebSocketWrapper(socketUri, {
|
|
50904
51042
|
timeout: 5000, // 5 seconds
|
|
50905
51043
|
onmessage: (e) => this.onMessage(e.data),
|
|
50906
51044
|
onopen: () => {
|
|
50907
|
-
DebugLogger.debug(`Connection to socket established. Endpoint: ${endpoint}`);
|
|
51045
|
+
DebugLogger.debug(`Connection to socket established. Endpoint: ${endpoint} ${this.clientIdService.getClientId()}`);
|
|
50908
51046
|
},
|
|
50909
51047
|
onreconnect: () => {
|
|
50910
|
-
DebugLogger.debug(`WebSocket reconnect event triggered`);
|
|
50911
|
-
this.
|
|
51048
|
+
DebugLogger.debug(`WebSocket reconnect event triggered ${clientId}`);
|
|
51049
|
+
if (this.clientIdService.getClientId() !== clientId) {
|
|
51050
|
+
DebugLogger.debug(`WebSocket reconnect event triggered - ignored because the client id changed. Old: ${clientId}, new: ${this.clientIdService.getClientId()}`);
|
|
51051
|
+
return;
|
|
51052
|
+
}
|
|
51053
|
+
if (this.connectionReady.value) {
|
|
51054
|
+
this.connectionReady.next(false);
|
|
51055
|
+
}
|
|
50912
51056
|
},
|
|
50913
51057
|
onclose: () => {
|
|
50914
|
-
DebugLogger.debug(`WebSocket onclose event triggered`);
|
|
50915
|
-
this.
|
|
51058
|
+
DebugLogger.debug(`WebSocket onclose event triggered ${clientId}`);
|
|
51059
|
+
if (this.clientIdService.getClientId() !== clientId) {
|
|
51060
|
+
DebugLogger.debug(`WebSocket onclose event triggered - ignored because the client id changed. Old: ${clientId}, new: ${this.clientIdService.getClientId()}`);
|
|
51061
|
+
return;
|
|
51062
|
+
}
|
|
51063
|
+
if (this.connectionReady.value) {
|
|
51064
|
+
this.connectionReady.next(false);
|
|
51065
|
+
}
|
|
50916
51066
|
},
|
|
50917
51067
|
onerror: (e) => console.error('WebSocket error:', e),
|
|
50918
51068
|
});
|
|
50919
51069
|
}
|
|
50920
|
-
|
|
51070
|
+
disconnectForTest() {
|
|
50921
51071
|
var _a;
|
|
50922
51072
|
this.connectionReady.next(false);
|
|
50923
51073
|
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.close(4998);
|
|
@@ -50928,7 +51078,7 @@ class SocketManager {
|
|
|
50928
51078
|
}
|
|
50929
51079
|
onMessage(messagesStr) {
|
|
50930
51080
|
if (messagesStr === 'connectionReady') {
|
|
50931
|
-
DebugLogger.debug(
|
|
51081
|
+
DebugLogger.debug(`Got socket message: connectionReady ${this.clientIdService.getClientId()}`);
|
|
50932
51082
|
this.onConnectionReady();
|
|
50933
51083
|
return;
|
|
50934
51084
|
}
|
|
@@ -50939,7 +51089,7 @@ class SocketManager {
|
|
|
50939
51089
|
continue;
|
|
50940
51090
|
}
|
|
50941
51091
|
this.seenMessageIds.add(message.messageId);
|
|
50942
|
-
DebugLogger.debug(new Date(),
|
|
51092
|
+
DebugLogger.debug(new Date(), `Got socket message: (${this.clientIdService.getClientId()})`, JSON.stringify(message, null, 2));
|
|
50943
51093
|
this.messageNotificationWrapper(() => {
|
|
50944
51094
|
this.webSocketObserver.next(message);
|
|
50945
51095
|
});
|
|
@@ -32,8 +32,7 @@ export declare class Pagination<ReturnType> {
|
|
|
32
32
|
private navigatingToLastPage;
|
|
33
33
|
private lastElement;
|
|
34
34
|
private goToFirstPage;
|
|
35
|
-
private
|
|
36
|
-
private compare;
|
|
35
|
+
private compareObjects;
|
|
37
36
|
private dataReceived;
|
|
38
37
|
private doNewQuery;
|
|
39
38
|
private waitForInternalState;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/** Returns a value by the `path`. Works with array indexes, like a.b[0]. */
|
|
2
|
+
export declare function getInPath(obj: unknown, path: string): any;
|
|
2
3
|
export declare function isDateObject(value: unknown): value is Date;
|
|
4
|
+
/** Sets a value by path . Does not support array indexes. */
|
|
3
5
|
export declare function setInPath(obj: object, path: string, value: unknown, delimiter?: string): void;
|
|
4
6
|
export declare function deleteInPath(obj: object, path: string, delimiter?: string): void;
|
|
5
7
|
export declare function replaceKeyInMap<K, T>(map: Map<K, T | undefined>, a: K, b: K): void;
|
|
@@ -8,3 +10,7 @@ export declare function isNil(obj: unknown): obj is null | undefined;
|
|
|
8
10
|
export declare function isEqual(a: unknown, b: unknown): boolean;
|
|
9
11
|
export declare function isEmpty(a: unknown): boolean;
|
|
10
12
|
export declare function omit<T extends object, K extends (string | number | symbol)[]>(object: T | null | undefined, ...paths: K): Pick<T, Exclude<keyof T, K[number]>>;
|
|
13
|
+
/** Creates a deep copy of the object. Copies all Date, Map, Set fields. */
|
|
14
|
+
export declare function cloneDeep<T>(value: T): T;
|
|
15
|
+
/** Compares 2 values. 'null' and 'undefined' values are considered equal and are less than any other values. */
|
|
16
|
+
export declare function compareValues(a: any, b: any): number;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
export declare function setSquidPrivateOption<T = unknown>(optionName: string, value: T): void;
|
|
2
2
|
export declare function getSquidPrivateOption<T = unknown>(optionName: string): T | undefined;
|
|
3
|
-
/*** Set of constants for private options. */
|
|
4
|
-
/**
|
|
5
|
-
* When set to 'true' (boolean), the RPC manager in Squid uses new 'fetch' based
|
|
6
|
-
* HTTP client instead of axios library.
|
|
7
|
-
* The option will be removed after the migration is tested and all issues are fixed.
|
|
8
|
-
*/
|
|
9
|
-
export declare const SQUID_PRIVATE_OPTION_USE_FETCH_IN_RPC_MANAGER = "useFetchInRpcManager";
|
|
10
3
|
/**
|
|
11
4
|
* When set to 'true' (boolean), the Graphql client in Squid uses new 'fetch' based
|
|
12
5
|
* HTTP client instead of cross-fetch library.
|
|
@@ -19,7 +19,7 @@ export declare class ClientIdService {
|
|
|
19
19
|
observeClientTooOld(): Observable<void>;
|
|
20
20
|
/** there was a long-term disconnection of the socket */
|
|
21
21
|
notifyClientTooOld(): void;
|
|
22
|
-
|
|
22
|
+
notifyClientNotTooOld(): void;
|
|
23
23
|
observeClientReadyToBeRegenerated(): Observable<void>;
|
|
24
24
|
getClientId(): ClientId;
|
|
25
25
|
isClientTooOld(): boolean;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Query, SquidDocId, SquidDocument } from './public-types';
|
|
2
2
|
export declare class DocumentStore {
|
|
3
3
|
private readonly squidDocIdToDoc;
|
|
4
4
|
saveDocument(squidDocId: SquidDocId, properties: SquidDocument | undefined): SquidDocument | undefined;
|
|
5
5
|
hasData(squidDocId: SquidDocId): boolean;
|
|
6
6
|
getDocument(squidDocId: SquidDocId): SquidDocument;
|
|
7
7
|
getDocumentOrUndefined(squidDocId: SquidDocId): SquidDocument | undefined;
|
|
8
|
-
|
|
9
|
-
compareSquidDocs(a: SquidDocument, b: SquidDocument, sortFieldNames: string[], sortOrders: ('asc' | 'desc')[]): number;
|
|
8
|
+
private compareSquidDocs;
|
|
10
9
|
group(sortedDocs: SquidDocument[], sortFieldNames: string[]): SquidDocument[][];
|
|
11
10
|
sortAndLimitDocs(docIdSet: Set<SquidDocId>, query: Query): Array<SquidDocument>;
|
|
12
11
|
private removeInternalProperties;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.188",
|
|
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",
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"@supercharge/promise-pool": "^2.3.2",
|
|
40
40
|
"ajv": "^8.11.2",
|
|
41
41
|
"ajv-formats": "^2.1.1",
|
|
42
|
-
"axios": "^1.6.2",
|
|
43
42
|
"bufferutil": "^4.0.7",
|
|
44
43
|
"cross-fetch": "^3.1.5",
|
|
45
44
|
"date-fns": "^2.30.0",
|
|
@@ -48,6 +47,7 @@
|
|
|
48
47
|
"json-schema-typed": "^8.0.1",
|
|
49
48
|
"lodash": "^4.17.21",
|
|
50
49
|
"otrie": "1.1.2",
|
|
50
|
+
"rfdc": "^1.3.1",
|
|
51
51
|
"utf-8-validate": "^6.0.3",
|
|
52
52
|
"ws": "^8.13.0"
|
|
53
53
|
},
|