@squidcloud/client 1.0.185 → 1.0.187
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
|
@@ -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,20 @@ 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
|
|
|
29493
|
+
|
|
29291
29494
|
function getInPath(obj, path, delimiter = '.') {
|
|
29292
29495
|
const splitPath = path.split(delimiter);
|
|
29293
29496
|
let value = undefined;
|
|
29294
29497
|
let currentObj = obj;
|
|
29295
29498
|
while (currentObj && splitPath.length) {
|
|
29296
29499
|
const key = (0,dist.truthy)(splitPath.shift());
|
|
29297
|
-
if (
|
|
29500
|
+
if (typeof currentObj !== 'object' || !(key in currentObj)) {
|
|
29298
29501
|
return undefined;
|
|
29299
29502
|
}
|
|
29300
29503
|
value = currentObj[key];
|
|
@@ -29303,9 +29506,7 @@ function getInPath(obj, path, delimiter = '.') {
|
|
|
29303
29506
|
return value;
|
|
29304
29507
|
}
|
|
29305
29508
|
function isJsObject(obj) {
|
|
29306
|
-
|
|
29307
|
-
return false;
|
|
29308
|
-
return obj !== null && Reflect.getPrototypeOf(obj) === Object.prototype;
|
|
29509
|
+
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
|
29309
29510
|
}
|
|
29310
29511
|
function isDateObject(value) {
|
|
29311
29512
|
return Object.prototype.toString.call(value) === '[object Date]';
|
|
@@ -29317,7 +29518,8 @@ function setInPath(obj, path, value, delimiter = '.') {
|
|
|
29317
29518
|
while (splitPath.length) {
|
|
29318
29519
|
const key = (0,dist.truthy)(splitPath.shift());
|
|
29319
29520
|
if (splitPath.length) {
|
|
29320
|
-
const
|
|
29521
|
+
const fieldValue = currentObj[key];
|
|
29522
|
+
const newCurrentObj = isJsObject(fieldValue) ? (_a = lodash.clone(fieldValue)) !== null && _a !== void 0 ? _a : {} : {};
|
|
29321
29523
|
currentObj[key] = newCurrentObj;
|
|
29322
29524
|
currentObj = newCurrentObj;
|
|
29323
29525
|
}
|
|
@@ -29364,10 +29566,10 @@ function isEqual(a, b) {
|
|
|
29364
29566
|
return true;
|
|
29365
29567
|
if (a === null || b === null)
|
|
29366
29568
|
return false;
|
|
29367
|
-
const
|
|
29368
|
-
if (
|
|
29569
|
+
const typeOfA = typeof a;
|
|
29570
|
+
if (typeOfA !== typeof b)
|
|
29369
29571
|
return false;
|
|
29370
|
-
if (
|
|
29572
|
+
if (typeOfA !== 'object')
|
|
29371
29573
|
return a === b;
|
|
29372
29574
|
if (a instanceof Date && b instanceof Date) {
|
|
29373
29575
|
return a.getTime() === b.getTime();
|
|
@@ -29401,7 +29603,7 @@ function isEmpty(a) {
|
|
|
29401
29603
|
if (a instanceof Map || a instanceof Set) {
|
|
29402
29604
|
return a.size === 0;
|
|
29403
29605
|
}
|
|
29404
|
-
if (typeof a === 'object'
|
|
29606
|
+
if (typeof a === 'object') {
|
|
29405
29607
|
return Object.keys(a).length === 0;
|
|
29406
29608
|
}
|
|
29407
29609
|
return false;
|
|
@@ -29419,6 +29621,13 @@ function omit(object, ...paths) {
|
|
|
29419
29621
|
});
|
|
29420
29622
|
return result;
|
|
29421
29623
|
}
|
|
29624
|
+
/** Creates a deep copy of the object. Copies all Date, Map, Set fields. */
|
|
29625
|
+
function cloneDeep(value) {
|
|
29626
|
+
// Can't use 'structuredClone' function here because it does not process prototype chains:
|
|
29627
|
+
// array fields of the object cloned with the 'structuredClone' have prototype different from Array.prototype,
|
|
29628
|
+
// and it cases some tests to fail.
|
|
29629
|
+
return rfdc_default()()(value);
|
|
29630
|
+
}
|
|
29422
29631
|
|
|
29423
29632
|
;// CONCATENATED MODULE: ../internal-common/src/public-types/mutation.public-context.ts
|
|
29424
29633
|
|
|
@@ -29510,35 +29719,34 @@ class Pagination {
|
|
|
29510
29719
|
this.snapshotSubject.next(firstPageSnapshot);
|
|
29511
29720
|
}
|
|
29512
29721
|
static compareValues(a, b) {
|
|
29513
|
-
if (isNil(a)) {
|
|
29514
|
-
return
|
|
29722
|
+
if (a === b || (isNil(a) && isNil(b))) {
|
|
29723
|
+
return 0;
|
|
29515
29724
|
}
|
|
29516
|
-
if (isNil(
|
|
29517
|
-
return 1;
|
|
29725
|
+
else if (isNil(a)) {
|
|
29726
|
+
return -1;
|
|
29518
29727
|
}
|
|
29519
|
-
if (
|
|
29728
|
+
else if (isNil(b)) {
|
|
29520
29729
|
return 1;
|
|
29521
29730
|
}
|
|
29522
|
-
|
|
29523
|
-
|
|
29524
|
-
|
|
29525
|
-
|
|
29731
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
29732
|
+
}
|
|
29733
|
+
compareObjects(doc1, doc2) {
|
|
29734
|
+
if (doc1 === doc2 || (isNil(doc1) && isNil(doc2))) {
|
|
29526
29735
|
return 0;
|
|
29527
29736
|
}
|
|
29528
|
-
|
|
29529
|
-
|
|
29530
|
-
|
|
29737
|
+
else if (isNil(doc1)) {
|
|
29738
|
+
return -1;
|
|
29739
|
+
}
|
|
29740
|
+
else if (isNil(doc2)) {
|
|
29531
29741
|
return 1;
|
|
29532
29742
|
}
|
|
29533
|
-
|
|
29534
|
-
|
|
29535
|
-
|
|
29536
|
-
|
|
29537
|
-
|
|
29538
|
-
|
|
29539
|
-
|
|
29540
|
-
return -currentComparison;
|
|
29541
|
-
}
|
|
29743
|
+
const sortOrders = this.templateSnapshotEmitter.getSortOrders();
|
|
29744
|
+
for (const { fieldName, asc } of sortOrders) {
|
|
29745
|
+
const value1 = getInPath(doc1, fieldName);
|
|
29746
|
+
const value2 = getInPath(doc2, fieldName);
|
|
29747
|
+
const rc = Pagination.compareValues(value1, value2);
|
|
29748
|
+
if (rc !== 0) {
|
|
29749
|
+
return asc ? rc : -rc;
|
|
29542
29750
|
}
|
|
29543
29751
|
}
|
|
29544
29752
|
return 0;
|
|
@@ -29560,7 +29768,7 @@ class Pagination {
|
|
|
29560
29768
|
if (this.lastElement !== null) {
|
|
29561
29769
|
// We just executed a `prev` and we know what the last element is on the page but not the first.
|
|
29562
29770
|
// We need to find the first element on the page instead, because that's our anchor.
|
|
29563
|
-
const numAfter = extractedData.filter(s => this.
|
|
29771
|
+
const numAfter = extractedData.filter(s => this.compareObjects(s, this.lastElement) === 1).length;
|
|
29564
29772
|
this.firstElement = extractedData[data.length - numAfter - this.options.pageSize];
|
|
29565
29773
|
this.lastElement = null;
|
|
29566
29774
|
}
|
|
@@ -29570,7 +29778,7 @@ class Pagination {
|
|
|
29570
29778
|
this.navigatingToLastPage = false;
|
|
29571
29779
|
}
|
|
29572
29780
|
}
|
|
29573
|
-
const numBefore = extractedData.filter(s => this.
|
|
29781
|
+
const numBefore = extractedData.filter(s => this.compareObjects(s, this.firstElement) === -1).length;
|
|
29574
29782
|
const numAfter = Math.max(0, data.length - numBefore - this.options.pageSize);
|
|
29575
29783
|
// Current page is empty, go to previous page
|
|
29576
29784
|
if (numBefore === data.length) {
|
|
@@ -29631,7 +29839,7 @@ class Pagination {
|
|
|
29631
29839
|
const { data, numBefore, numAfter, extractedData } = internalState;
|
|
29632
29840
|
return {
|
|
29633
29841
|
data: data
|
|
29634
|
-
.filter((_, i) => this.
|
|
29842
|
+
.filter((_, i) => this.compareObjects(extractedData[i], this.firstElement) !== -1)
|
|
29635
29843
|
.slice(0, this.options.pageSize),
|
|
29636
29844
|
hasNext: numAfter > 0,
|
|
29637
29845
|
hasPrev: numBefore > 0,
|
|
@@ -30269,6 +30477,7 @@ function getSquidDocId(...args) {
|
|
|
30269
30477
|
|
|
30270
30478
|
|
|
30271
30479
|
|
|
30480
|
+
|
|
30272
30481
|
/**
|
|
30273
30482
|
* A query builder that can participate in a join.
|
|
30274
30483
|
* To learn more about join queries, see the
|
|
@@ -30351,7 +30560,7 @@ class JoinQueryBuilder extends BaseQueryBuilder {
|
|
|
30351
30560
|
return new external_rxjs_.BehaviorSubject([]);
|
|
30352
30561
|
}
|
|
30353
30562
|
return this.querySubscriptionManager
|
|
30354
|
-
.processQuery(this.build(), this.rootAlias,
|
|
30563
|
+
.processQuery(this.build(), this.rootAlias, cloneDeep(this.joins), cloneDeep(this.joinConditions), subscribe, false)
|
|
30355
30564
|
.pipe(map(docs => docs.map(docRecord => {
|
|
30356
30565
|
const result = {};
|
|
30357
30566
|
for (const [alias, doc] of Object.entries(docRecord)) {
|
|
@@ -30389,7 +30598,7 @@ class JoinQueryBuilder extends BaseQueryBuilder {
|
|
|
30389
30598
|
return this.queryBuilder.getSortOrders();
|
|
30390
30599
|
}
|
|
30391
30600
|
clone() {
|
|
30392
|
-
const res = new JoinQueryBuilder(this.collectionName, this.integrationId, this.querySubscriptionManager, this.documentReferenceFactory, this.queryBuilderFactory, this.rootAlias, this.latestAlias,
|
|
30601
|
+
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
30602
|
res.containsEmptyInCondition = this.containsEmptyInCondition;
|
|
30394
30603
|
return res;
|
|
30395
30604
|
}
|
|
@@ -30911,7 +31120,7 @@ class DocumentReference {
|
|
|
30911
31120
|
* @throws Error if the document does not exist.
|
|
30912
31121
|
*/
|
|
30913
31122
|
get data() {
|
|
30914
|
-
return
|
|
31123
|
+
return cloneDeep(this.dataRef);
|
|
30915
31124
|
}
|
|
30916
31125
|
/**
|
|
30917
31126
|
* Returns a read-only internal copy of the document data. This works similar to `this.data`, except it does not
|
|
@@ -31038,7 +31247,7 @@ class DocumentReference {
|
|
|
31038
31247
|
async setInPath(path, value, transactionId) {
|
|
31039
31248
|
// Not sure why TypeScript doesn't understand that `path` below is restricted, but we need the explicit type
|
|
31040
31249
|
// assertion to make it compile.
|
|
31041
|
-
return this.update({ [path]:
|
|
31250
|
+
return this.update({ [path]: cloneDeep(value) }, transactionId);
|
|
31042
31251
|
}
|
|
31043
31252
|
/**
|
|
31044
31253
|
* Similar to `update`, but only deletes the given path.
|
|
@@ -36614,7 +36823,7 @@ var cloneDeep_toString = Object.prototype.toString;
|
|
|
36614
36823
|
/**
|
|
36615
36824
|
* Deeply clones a value to create a new instance.
|
|
36616
36825
|
*/
|
|
36617
|
-
function
|
|
36826
|
+
function cloneDeep_cloneDeep(value) {
|
|
36618
36827
|
return cloneDeepHelper(value);
|
|
36619
36828
|
}
|
|
36620
36829
|
function cloneDeepHelper(val, seen) {
|
|
@@ -37304,7 +37513,7 @@ var ObservableQuery = /** @class */ (function (_super) {
|
|
|
37304
37513
|
}
|
|
37305
37514
|
return (this.last = tslib_es6_assign({ result: this.queryManager.assumeImmutableResults ?
|
|
37306
37515
|
newResult
|
|
37307
|
-
:
|
|
37516
|
+
: cloneDeep_cloneDeep(newResult), variables: variables }, (error ? { error: error } : null)));
|
|
37308
37517
|
};
|
|
37309
37518
|
ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {
|
|
37310
37519
|
var _this = this;
|
|
@@ -43231,7 +43440,7 @@ var StoreWriter = /** @class */ (function () {
|
|
|
43231
43440
|
// In development, we need to clone scalar values so that they can be
|
|
43232
43441
|
// safely frozen with maybeDeepFreeze in readFromStore.ts. In production,
|
|
43233
43442
|
// it's cheaper to store the scalar values directly in the cache.
|
|
43234
|
-
return globalThis.__DEV__ !== false ?
|
|
43443
|
+
return globalThis.__DEV__ !== false ? cloneDeep_cloneDeep(value) : value;
|
|
43235
43444
|
}
|
|
43236
43445
|
if (isArray(value)) {
|
|
43237
43446
|
return value.map(function (item, i) {
|
|
@@ -47787,7 +47996,7 @@ class QueryBuilder extends BaseQueryBuilder {
|
|
|
47787
47996
|
}
|
|
47788
47997
|
clone() {
|
|
47789
47998
|
const res = new QueryBuilder(this.collectionName, this.integrationId, this.querySubscriptionManager, this.localQueryManager, this.documentReferenceFactory, this.queryBuilderFactory, this.documentIdentityService);
|
|
47790
|
-
res.query =
|
|
47999
|
+
res.query = cloneDeep(this.query);
|
|
47791
48000
|
res.containsEmptyInCondition = this.containsEmptyInCondition;
|
|
47792
48001
|
return res;
|
|
47793
48002
|
}
|
|
@@ -48195,7 +48404,7 @@ function mergeMutations(mutationA, mutationB) {
|
|
|
48195
48404
|
(0,dist.assertTruthy)(mutationB.type === 'update', 'Invalid mutation type');
|
|
48196
48405
|
if (mutationA.type === 'update')
|
|
48197
48406
|
return mergeUpdateMutations(mutationA, mutationB);
|
|
48198
|
-
const result =
|
|
48407
|
+
const result = cloneDeep(mutationA);
|
|
48199
48408
|
for (const [fieldName, propertyMutationsAr] of sortUpdateMutationProperties(mutationB)) {
|
|
48200
48409
|
const propertyMutations = propertyMutationsAr;
|
|
48201
48410
|
for (const propertyMutation of propertyMutations) {
|
|
@@ -48211,8 +48420,8 @@ function mergeMutations(mutationA, mutationB) {
|
|
|
48211
48420
|
return result;
|
|
48212
48421
|
}
|
|
48213
48422
|
function mergeUpdateMutations(mutationA, mutationB) {
|
|
48214
|
-
const result =
|
|
48215
|
-
mutationB =
|
|
48423
|
+
const result = cloneDeep(mutationA);
|
|
48424
|
+
mutationB = cloneDeep(mutationB);
|
|
48216
48425
|
for (const [aPropName] of sortUpdateMutationProperties(result)) {
|
|
48217
48426
|
const aPropNameDots = aPropName.split('.').length;
|
|
48218
48427
|
const isOverriddenByMutationB = Object.entries(mutationB.properties).some(([bPropName]) => {
|
|
@@ -49206,7 +49415,7 @@ class DocumentStore {
|
|
|
49206
49415
|
if (doc !== undefined) {
|
|
49207
49416
|
// Update
|
|
49208
49417
|
if (properties) {
|
|
49209
|
-
const updateDoc =
|
|
49418
|
+
const updateDoc = cloneDeep(properties);
|
|
49210
49419
|
const data = this.removeInternalProperties(updateDoc);
|
|
49211
49420
|
this.squidDocIdToDoc.set(squidDocId, data);
|
|
49212
49421
|
return data;
|
|
@@ -49466,7 +49675,6 @@ const arrayMergeCustomizer = (a, b) => {
|
|
|
49466
49675
|
|
|
49467
49676
|
|
|
49468
49677
|
|
|
49469
|
-
|
|
49470
49678
|
// See limitUnderflowState below.
|
|
49471
49679
|
// Exported only for tests
|
|
49472
49680
|
const FETCH_BEYOND_LIMIT = 100;
|
|
@@ -49971,7 +50179,7 @@ class QuerySubscriptionManager {
|
|
|
49971
50179
|
if (allNeededValues.size === 0) {
|
|
49972
50180
|
return false;
|
|
49973
50181
|
}
|
|
49974
|
-
const newQuery =
|
|
50182
|
+
const newQuery = cloneDeep(query);
|
|
49975
50183
|
newQuery.conditions = newQuery.conditions.filter(cond => !isSimpleCondition(cond) || cond.fieldName !== joinCondition.right);
|
|
49976
50184
|
[...allNeededValues].forEach(value => {
|
|
49977
50185
|
newQuery.conditions.push({
|
|
@@ -50418,6 +50626,7 @@ async function performFetchRequest({ headers, files, filesFieldName, message: bo
|
|
|
50418
50626
|
const requestOptionHeaders = new Headers(headers);
|
|
50419
50627
|
const requestOptions = { method: 'POST', headers: requestOptionHeaders, body: undefined };
|
|
50420
50628
|
if (files.length) {
|
|
50629
|
+
// noinspection DuplicatedCode
|
|
50421
50630
|
const formData = new FormData();
|
|
50422
50631
|
for (const file of files) {
|
|
50423
50632
|
const blob = file instanceof Blob ? file : file.blob;
|
|
@@ -50431,34 +50640,43 @@ async function performFetchRequest({ headers, files, filesFieldName, message: bo
|
|
|
50431
50640
|
requestOptionHeaders.append('Content-Type', 'application/json');
|
|
50432
50641
|
requestOptions.body = serializeObj(body);
|
|
50433
50642
|
}
|
|
50434
|
-
|
|
50435
|
-
|
|
50436
|
-
|
|
50437
|
-
|
|
50438
|
-
|
|
50439
|
-
|
|
50440
|
-
|
|
50441
|
-
|
|
50442
|
-
|
|
50443
|
-
|
|
50444
|
-
|
|
50445
|
-
|
|
50446
|
-
|
|
50447
|
-
|
|
50643
|
+
try {
|
|
50644
|
+
const response = await fetch(url, requestOptions);
|
|
50645
|
+
const responseHeaders = {};
|
|
50646
|
+
response.headers.forEach((value, key) => {
|
|
50647
|
+
responseHeaders[key] = value;
|
|
50648
|
+
});
|
|
50649
|
+
if (!response.ok) {
|
|
50650
|
+
const rawBody = await response.text();
|
|
50651
|
+
// noinspection DuplicatedCode
|
|
50652
|
+
const parsedBody = tryDeserializing(rawBody);
|
|
50653
|
+
if (!extractErrorMessage) {
|
|
50654
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
50655
|
+
throw new RpcError(response.status, response.statusText, url, responseHeaders, parsedBody, rawBody);
|
|
50656
|
+
}
|
|
50657
|
+
let message;
|
|
50658
|
+
try {
|
|
50659
|
+
message = typeof parsedBody === 'string' ? parsedBody : (parsedBody === null || parsedBody === void 0 ? void 0 : parsedBody['message']) || rawBody;
|
|
50660
|
+
}
|
|
50661
|
+
catch (_a) { }
|
|
50662
|
+
if (!message)
|
|
50663
|
+
message = response.statusText;
|
|
50664
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
50665
|
+
throw new RpcError(response.status, response.statusText, url, responseHeaders, parsedBody, message);
|
|
50448
50666
|
}
|
|
50449
|
-
|
|
50450
|
-
|
|
50451
|
-
|
|
50452
|
-
|
|
50667
|
+
const responseBody = await response.text();
|
|
50668
|
+
DebugLogger.debug(`received response: ${JSON.stringify(responseBody)}`);
|
|
50669
|
+
return {
|
|
50670
|
+
body: responseBody,
|
|
50671
|
+
headers: responseHeaders,
|
|
50672
|
+
status: response.status,
|
|
50673
|
+
statusText: response.statusText,
|
|
50674
|
+
};
|
|
50675
|
+
}
|
|
50676
|
+
catch (e) {
|
|
50677
|
+
console.error(`Unable to perform fetch request to url: ${url}`, e);
|
|
50678
|
+
throw e;
|
|
50453
50679
|
}
|
|
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
50680
|
}
|
|
50463
50681
|
function extractAxiosResponseHeaders(response) {
|
|
50464
50682
|
return Object.entries(response.headers).reduce((acc, [key, value]) => {
|
|
@@ -50470,6 +50688,7 @@ async function performAxiosRequest({ files, filesFieldName, message: body, url,
|
|
|
50470
50688
|
let axiosResponse;
|
|
50471
50689
|
try {
|
|
50472
50690
|
if (files.length) {
|
|
50691
|
+
// noinspection DuplicatedCode
|
|
50473
50692
|
const formData = new FormData();
|
|
50474
50693
|
for (const file of files) {
|
|
50475
50694
|
const blob = file instanceof Blob ? file : file.blob;
|
|
@@ -50497,6 +50716,7 @@ async function performAxiosRequest({ files, filesFieldName, message: body, url,
|
|
|
50497
50716
|
throw error;
|
|
50498
50717
|
const responseHeaders = extractAxiosResponseHeaders(response);
|
|
50499
50718
|
const rawBody = response.data;
|
|
50719
|
+
// noinspection DuplicatedCode
|
|
50500
50720
|
const parsedBody = tryDeserializing(rawBody);
|
|
50501
50721
|
if (!extractErrorMessage) {
|
|
50502
50722
|
throw new RpcError(response.status, response.statusText, url, responseHeaders, parsedBody, rawBody);
|
|
@@ -50526,7 +50746,7 @@ async function performAxiosRequest({ files, filesFieldName, message: body, url,
|
|
|
50526
50746
|
/**
|
|
50527
50747
|
* @internal.
|
|
50528
50748
|
*
|
|
50529
|
-
*
|
|
50749
|
+
* note: this method hides potential error.
|
|
50530
50750
|
* Every endpoint call should know what kind result to expect
|
|
50531
50751
|
* and call 'deserializeObj' directly.
|
|
50532
50752
|
*/
|
|
@@ -8,3 +8,5 @@ export declare function isNil(obj: unknown): obj is null | undefined;
|
|
|
8
8
|
export declare function isEqual(a: unknown, b: unknown): boolean;
|
|
9
9
|
export declare function isEmpty(a: unknown): boolean;
|
|
10
10
|
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]>>;
|
|
11
|
+
/** Creates a deep copy of the object. Copies all Date, Map, Set fields. */
|
|
12
|
+
export declare function cloneDeep<T>(value: T): T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.187",
|
|
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",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"json-schema-typed": "^8.0.1",
|
|
49
49
|
"lodash": "^4.17.21",
|
|
50
50
|
"otrie": "1.1.2",
|
|
51
|
+
"rfdc": "^1.3.1",
|
|
51
52
|
"utf-8-validate": "^6.0.3",
|
|
52
53
|
"ws": "^8.13.0"
|
|
53
54
|
},
|