@squidcloud/client 1.0.187 → 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 +73 -143
- package/dist/internal-common/src/public-types/pagination.public-types.d.ts +0 -1
- package/dist/internal-common/src/utils/object.d.ts +5 -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 +1 -2
package/dist/cjs/index.js
CHANGED
|
@@ -29491,12 +29491,20 @@ var rfdc_default = /*#__PURE__*/__webpack_require__.n(rfdc);
|
|
|
29491
29491
|
|
|
29492
29492
|
|
|
29493
29493
|
|
|
29494
|
-
|
|
29495
|
-
|
|
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);
|
|
29496
29501
|
let value = undefined;
|
|
29497
29502
|
let currentObj = obj;
|
|
29498
29503
|
while (currentObj && splitPath.length) {
|
|
29499
|
-
const key =
|
|
29504
|
+
const key = splitPath.shift();
|
|
29505
|
+
if (!key) {
|
|
29506
|
+
continue;
|
|
29507
|
+
}
|
|
29500
29508
|
if (typeof currentObj !== 'object' || !(key in currentObj)) {
|
|
29501
29509
|
return undefined;
|
|
29502
29510
|
}
|
|
@@ -29511,6 +29519,7 @@ function isJsObject(obj) {
|
|
|
29511
29519
|
function isDateObject(value) {
|
|
29512
29520
|
return Object.prototype.toString.call(value) === '[object Date]';
|
|
29513
29521
|
}
|
|
29522
|
+
/** Sets a value by path . Does not support array indexes. */
|
|
29514
29523
|
function setInPath(obj, path, value, delimiter = '.') {
|
|
29515
29524
|
var _a;
|
|
29516
29525
|
const splitPath = path.split(delimiter);
|
|
@@ -29628,10 +29637,23 @@ function cloneDeep(value) {
|
|
|
29628
29637
|
// and it cases some tests to fail.
|
|
29629
29638
|
return rfdc_default()()(value);
|
|
29630
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
|
+
}
|
|
29631
29654
|
|
|
29632
29655
|
;// CONCATENATED MODULE: ../internal-common/src/public-types/mutation.public-context.ts
|
|
29633
29656
|
|
|
29634
|
-
|
|
29635
29657
|
/** The mutation context that will be provided to the security function. */
|
|
29636
29658
|
class MutationContext {
|
|
29637
29659
|
/**
|
|
@@ -29653,8 +29675,8 @@ class MutationContext {
|
|
|
29653
29675
|
}
|
|
29654
29676
|
/** Returns true if the mutation affects the provided path. */
|
|
29655
29677
|
affectsPath(path) {
|
|
29656
|
-
const before =
|
|
29657
|
-
const after =
|
|
29678
|
+
const before = getInPath(this.before, path);
|
|
29679
|
+
const after = getInPath(this.after, path);
|
|
29658
29680
|
return !isEqual(before, after);
|
|
29659
29681
|
}
|
|
29660
29682
|
}
|
|
@@ -29718,18 +29740,6 @@ class Pagination {
|
|
|
29718
29740
|
.snapshots(this.options.subscribe);
|
|
29719
29741
|
this.snapshotSubject.next(firstPageSnapshot);
|
|
29720
29742
|
}
|
|
29721
|
-
static compareValues(a, b) {
|
|
29722
|
-
if (a === b || (isNil(a) && isNil(b))) {
|
|
29723
|
-
return 0;
|
|
29724
|
-
}
|
|
29725
|
-
else if (isNil(a)) {
|
|
29726
|
-
return -1;
|
|
29727
|
-
}
|
|
29728
|
-
else if (isNil(b)) {
|
|
29729
|
-
return 1;
|
|
29730
|
-
}
|
|
29731
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
29732
|
-
}
|
|
29733
29743
|
compareObjects(doc1, doc2) {
|
|
29734
29744
|
if (doc1 === doc2 || (isNil(doc1) && isNil(doc2))) {
|
|
29735
29745
|
return 0;
|
|
@@ -29744,7 +29754,7 @@ class Pagination {
|
|
|
29744
29754
|
for (const { fieldName, asc } of sortOrders) {
|
|
29745
29755
|
const value1 = getInPath(doc1, fieldName);
|
|
29746
29756
|
const value2 = getInPath(doc2, fieldName);
|
|
29747
|
-
const rc =
|
|
29757
|
+
const rc = compareValues(value1, value2);
|
|
29748
29758
|
if (rc !== 0) {
|
|
29749
29759
|
return asc ? rc : -rc;
|
|
29750
29760
|
}
|
|
@@ -30138,7 +30148,6 @@ function parseQuerySubscriptionId(querySubscriptionId) {
|
|
|
30138
30148
|
|
|
30139
30149
|
|
|
30140
30150
|
|
|
30141
|
-
|
|
30142
30151
|
/**
|
|
30143
30152
|
* The compare table is used to determine whether one condition (conditionA)
|
|
30144
30153
|
* is a subset of another condition (conditionB).
|
|
@@ -30314,7 +30323,7 @@ class QueryContext {
|
|
|
30314
30323
|
for (const contextCondition of this.parsedConditions) {
|
|
30315
30324
|
const fieldNameOrPath = contextCondition.fieldName;
|
|
30316
30325
|
const operator = contextCondition.operator;
|
|
30317
|
-
const valueInDoc =
|
|
30326
|
+
const valueInDoc = getInPath(doc, fieldNameOrPath);
|
|
30318
30327
|
if (operator === 'in') {
|
|
30319
30328
|
if (contextCondition.value.includes(valueInDoc)) {
|
|
30320
30329
|
continue;
|
|
@@ -47329,13 +47338,6 @@ function setSquidPrivateOption(optionName, value) {
|
|
|
47329
47338
|
function getSquidPrivateOption(optionName) {
|
|
47330
47339
|
return getSquidPrivateOptions()[optionName];
|
|
47331
47340
|
}
|
|
47332
|
-
/*** Set of constants for private options. */
|
|
47333
|
-
/**
|
|
47334
|
-
* When set to 'true' (boolean), the RPC manager in Squid uses new 'fetch' based
|
|
47335
|
-
* HTTP client instead of axios library.
|
|
47336
|
-
* The option will be removed after the migration is tested and all issues are fixed.
|
|
47337
|
-
*/
|
|
47338
|
-
const SQUID_PRIVATE_OPTION_USE_FETCH_IN_RPC_MANAGER = 'useFetchInRpcManager';
|
|
47339
47341
|
/**
|
|
47340
47342
|
* When set to 'true' (boolean), the Graphql client in Squid uses new 'fetch' based
|
|
47341
47343
|
* HTTP client instead of cross-fetch library.
|
|
@@ -48256,7 +48258,7 @@ class ClientIdService {
|
|
|
48256
48258
|
this.clientTooOldSubject.next(true);
|
|
48257
48259
|
this.clientIdSubject.next(this.generateClientId());
|
|
48258
48260
|
}
|
|
48259
|
-
|
|
48261
|
+
notifyClientNotTooOld() {
|
|
48260
48262
|
this.clientTooOldSubject.next(false);
|
|
48261
48263
|
}
|
|
48262
48264
|
observeClientReadyToBeRegenerated() {
|
|
@@ -49439,21 +49441,13 @@ class DocumentStore {
|
|
|
49439
49441
|
getDocumentOrUndefined(squidDocId) {
|
|
49440
49442
|
return this.squidDocIdToDoc.get(squidDocId);
|
|
49441
49443
|
}
|
|
49442
|
-
|
|
49443
|
-
|
|
49444
|
-
|
|
49445
|
-
|
|
49446
|
-
|
|
49447
|
-
|
|
49448
|
-
|
|
49449
|
-
return 0;
|
|
49450
|
-
return a > b ? 1 : -1;
|
|
49451
|
-
}
|
|
49452
|
-
compareSquidDocs(a, b, sortFieldNames, sortOrders) {
|
|
49453
|
-
for (const [i, fieldName] of sortFieldNames.entries()) {
|
|
49454
|
-
const compare = this.compareValues(lodash_default().get(a, fieldName), lodash_default().get(b, fieldName));
|
|
49455
|
-
if (compare !== 0) {
|
|
49456
|
-
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;
|
|
49457
49451
|
}
|
|
49458
49452
|
}
|
|
49459
49453
|
return 0;
|
|
@@ -49469,11 +49463,7 @@ class DocumentStore {
|
|
|
49469
49463
|
}
|
|
49470
49464
|
const docs = [...docIdSet].map(id => this.squidDocIdToDoc.get(id)).filter(dist.isNonNullable);
|
|
49471
49465
|
const { sortOrder, limitBy } = query;
|
|
49472
|
-
const
|
|
49473
|
-
const sortOrders = sortOrder.map(s => (s.asc ? 'asc' : 'desc'));
|
|
49474
|
-
const sortedDocs = docs.sort((a, b) => {
|
|
49475
|
-
return this.compareSquidDocs(a, b, sortFieldNames, sortOrders);
|
|
49476
|
-
});
|
|
49466
|
+
const sortedDocs = docs.sort((a, b) => this.compareSquidDocs(a, b, sortOrder));
|
|
49477
49467
|
const mainLimit = query.limit < 0 ? 2000 : query.limit;
|
|
49478
49468
|
if (!limitBy) {
|
|
49479
49469
|
return sortedDocs.slice(0, mainLimit);
|
|
@@ -50587,13 +50577,9 @@ class RateLimiter {
|
|
|
50587
50577
|
}
|
|
50588
50578
|
}
|
|
50589
50579
|
|
|
50590
|
-
;// CONCATENATED MODULE: external "axios"
|
|
50591
|
-
const external_axios_namespaceObject = require("axios");
|
|
50592
|
-
var external_axios_default = /*#__PURE__*/__webpack_require__.n(external_axios_namespaceObject);
|
|
50593
50580
|
;// CONCATENATED MODULE: ./src/squid-http-client.ts
|
|
50594
50581
|
|
|
50595
50582
|
|
|
50596
|
-
|
|
50597
50583
|
class RpcError extends Error {
|
|
50598
50584
|
/** @internal */
|
|
50599
50585
|
constructor(statusCode, statusText, url, headers, body, message) {
|
|
@@ -50605,20 +50591,12 @@ class RpcError extends Error {
|
|
|
50605
50591
|
this.body = body;
|
|
50606
50592
|
}
|
|
50607
50593
|
}
|
|
50608
|
-
function isFetchMode() {
|
|
50609
|
-
// Temporary (1 week) keep the old code to simplify rollback.
|
|
50610
|
-
return true;
|
|
50611
|
-
// Native fetch is used in json request mode or when the corresponding private Squid option is enabled.
|
|
50612
|
-
// This option is enabled in console-local and console-dev modes both in Web & Backend.
|
|
50613
|
-
// return files.length === 0 || !!getSquidPrivateOption(SQUID_PRIVATE_OPTION_USE_FETCH_IN_RPC_MANAGER);
|
|
50614
|
-
}
|
|
50615
50594
|
/**
|
|
50616
50595
|
* Runs a post request to the given URL.
|
|
50617
50596
|
* @internal.
|
|
50618
50597
|
*/
|
|
50619
50598
|
async function rawSquidHttpPost(input) {
|
|
50620
|
-
const
|
|
50621
|
-
const response = await (isFetch ? performFetchRequest(input) : performAxiosRequest(input));
|
|
50599
|
+
const response = await performFetchRequest(input);
|
|
50622
50600
|
response.body = tryDeserializing(response.body);
|
|
50623
50601
|
return response;
|
|
50624
50602
|
}
|
|
@@ -50626,7 +50604,6 @@ async function performFetchRequest({ headers, files, filesFieldName, message: bo
|
|
|
50626
50604
|
const requestOptionHeaders = new Headers(headers);
|
|
50627
50605
|
const requestOptions = { method: 'POST', headers: requestOptionHeaders, body: undefined };
|
|
50628
50606
|
if (files.length) {
|
|
50629
|
-
// noinspection DuplicatedCode
|
|
50630
50607
|
const formData = new FormData();
|
|
50631
50608
|
for (const file of files) {
|
|
50632
50609
|
const blob = file instanceof Blob ? file : file.blob;
|
|
@@ -50648,7 +50625,6 @@ async function performFetchRequest({ headers, files, filesFieldName, message: bo
|
|
|
50648
50625
|
});
|
|
50649
50626
|
if (!response.ok) {
|
|
50650
50627
|
const rawBody = await response.text();
|
|
50651
|
-
// noinspection DuplicatedCode
|
|
50652
50628
|
const parsedBody = tryDeserializing(rawBody);
|
|
50653
50629
|
if (!extractErrorMessage) {
|
|
50654
50630
|
// noinspection ExceptionCaughtLocallyJS
|
|
@@ -50678,71 +50654,6 @@ async function performFetchRequest({ headers, files, filesFieldName, message: bo
|
|
|
50678
50654
|
throw e;
|
|
50679
50655
|
}
|
|
50680
50656
|
}
|
|
50681
|
-
function extractAxiosResponseHeaders(response) {
|
|
50682
|
-
return Object.entries(response.headers).reduce((acc, [key, value]) => {
|
|
50683
|
-
acc[key] = value;
|
|
50684
|
-
return acc;
|
|
50685
|
-
}, {});
|
|
50686
|
-
}
|
|
50687
|
-
async function performAxiosRequest({ files, filesFieldName, message: body, url, headers, extractErrorMessage, }) {
|
|
50688
|
-
let axiosResponse;
|
|
50689
|
-
try {
|
|
50690
|
-
if (files.length) {
|
|
50691
|
-
// noinspection DuplicatedCode
|
|
50692
|
-
const formData = new FormData();
|
|
50693
|
-
for (const file of files) {
|
|
50694
|
-
const blob = file instanceof Blob ? file : file.blob;
|
|
50695
|
-
const filename = file instanceof Blob ? undefined : file.name;
|
|
50696
|
-
formData.append(filesFieldName, blob, filename);
|
|
50697
|
-
}
|
|
50698
|
-
formData.append('body', serializeObj(body));
|
|
50699
|
-
// Make the axios call
|
|
50700
|
-
axiosResponse = await external_axios_default().post(url, formData, {
|
|
50701
|
-
headers,
|
|
50702
|
-
responseType: 'text',
|
|
50703
|
-
});
|
|
50704
|
-
}
|
|
50705
|
-
else {
|
|
50706
|
-
axiosResponse = await external_axios_default().post(url, serializeObj(body), {
|
|
50707
|
-
headers: Object.assign(Object.assign({}, headers), { 'Content-Type': 'application/json' }),
|
|
50708
|
-
responseType: 'text',
|
|
50709
|
-
});
|
|
50710
|
-
}
|
|
50711
|
-
}
|
|
50712
|
-
catch (error) {
|
|
50713
|
-
if ((0,external_axios_namespaceObject.isAxiosError)(error)) {
|
|
50714
|
-
const { response } = error;
|
|
50715
|
-
if (!response)
|
|
50716
|
-
throw error;
|
|
50717
|
-
const responseHeaders = extractAxiosResponseHeaders(response);
|
|
50718
|
-
const rawBody = response.data;
|
|
50719
|
-
// noinspection DuplicatedCode
|
|
50720
|
-
const parsedBody = tryDeserializing(rawBody);
|
|
50721
|
-
if (!extractErrorMessage) {
|
|
50722
|
-
throw new RpcError(response.status, response.statusText, url, responseHeaders, parsedBody, rawBody);
|
|
50723
|
-
}
|
|
50724
|
-
let message;
|
|
50725
|
-
try {
|
|
50726
|
-
message = typeof parsedBody === 'string' ? parsedBody : (parsedBody === null || parsedBody === void 0 ? void 0 : parsedBody['message']) || rawBody;
|
|
50727
|
-
}
|
|
50728
|
-
catch (_a) { }
|
|
50729
|
-
if (!message)
|
|
50730
|
-
message = response.statusText;
|
|
50731
|
-
throw new RpcError(response.status, response.statusText, url, responseHeaders, parsedBody, message);
|
|
50732
|
-
}
|
|
50733
|
-
else {
|
|
50734
|
-
throw error;
|
|
50735
|
-
}
|
|
50736
|
-
}
|
|
50737
|
-
const responseHeaders = extractAxiosResponseHeaders(axiosResponse);
|
|
50738
|
-
DebugLogger.debug(`received response: ${JSON.stringify(axiosResponse.data)}`);
|
|
50739
|
-
return {
|
|
50740
|
-
body: axiosResponse.data,
|
|
50741
|
-
headers: responseHeaders,
|
|
50742
|
-
status: axiosResponse.status,
|
|
50743
|
-
statusText: axiosResponse.statusText,
|
|
50744
|
-
};
|
|
50745
|
-
}
|
|
50746
50657
|
/**
|
|
50747
50658
|
* @internal.
|
|
50748
50659
|
*
|
|
@@ -51038,28 +50949,30 @@ class SocketManager {
|
|
|
51038
50949
|
}))
|
|
51039
50950
|
.subscribe(() => {
|
|
51040
50951
|
if (this.connectionReady.value) {
|
|
51041
|
-
DebugLogger.debug(
|
|
50952
|
+
DebugLogger.debug(`Client reconnected before becoming too old. Ignoring... ${this.clientIdService.getClientId()}`);
|
|
51042
50953
|
return;
|
|
51043
50954
|
}
|
|
50955
|
+
DebugLogger.debug(`Client disconnected for a long period - refreshing ${this.clientIdService.getClientId()}`);
|
|
51044
50956
|
this.refreshClient();
|
|
51045
50957
|
});
|
|
51046
50958
|
this.observeConnectionReady()
|
|
51047
50959
|
.pipe((0,external_rxjs_.filter)(Boolean))
|
|
51048
50960
|
.subscribe(() => {
|
|
51049
50961
|
if (this.clientIdService.isClientTooOld()) {
|
|
51050
|
-
this.clientIdService.
|
|
50962
|
+
this.clientIdService.notifyClientNotTooOld();
|
|
51051
50963
|
}
|
|
51052
50964
|
});
|
|
51053
50965
|
}
|
|
51054
50966
|
refreshClient() {
|
|
51055
50967
|
if (this.destructManager.isDestructing) {
|
|
51056
|
-
DebugLogger.debug(
|
|
50968
|
+
DebugLogger.debug(`Client too old but is destructed. Ignoring... ${this.clientIdService.getClientId()}`);
|
|
51057
50969
|
return;
|
|
51058
50970
|
}
|
|
51059
50971
|
else if (this.clientIdService.isClientTooOld()) {
|
|
51060
|
-
DebugLogger.debug(
|
|
50972
|
+
DebugLogger.debug(`Client is already marked as too old. Ignoring... ${this.clientIdService.getClientId()}`);
|
|
51061
50973
|
return;
|
|
51062
50974
|
}
|
|
50975
|
+
DebugLogger.debug(`Notifying client too old ${this.clientIdService.getClientId()}`);
|
|
51063
50976
|
this.clientIdService.notifyClientTooOld();
|
|
51064
50977
|
DebugLogger.debug('Client too old. Reconnecting...');
|
|
51065
50978
|
this.connect();
|
|
@@ -51067,6 +50980,7 @@ class SocketManager {
|
|
|
51067
50980
|
tick() {
|
|
51068
50981
|
const diff = Math.abs(Date.now() - this.lastTick.getTime());
|
|
51069
50982
|
if (diff > this.clientTooOldThreshold) {
|
|
50983
|
+
DebugLogger.debug('Tick: Client not responding for a long time. Refreshing...', this.clientIdService.getClientId());
|
|
51070
50984
|
this.refreshClient();
|
|
51071
50985
|
}
|
|
51072
50986
|
this.lastTick = new Date();
|
|
@@ -51115,29 +51029,45 @@ class SocketManager {
|
|
|
51115
51029
|
connect() {
|
|
51116
51030
|
var _a;
|
|
51117
51031
|
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.close();
|
|
51032
|
+
if (this.connectionReady.value) {
|
|
51033
|
+
this.connectionReady.next(false);
|
|
51034
|
+
}
|
|
51118
51035
|
const endpoint = getApplicationUrl(this.region, this.appId, 'ws/general')
|
|
51119
51036
|
.replace('https', 'wss')
|
|
51120
51037
|
.replace('http', 'ws');
|
|
51121
|
-
|
|
51122
|
-
|
|
51038
|
+
const clientId = this.clientIdService.getClientId();
|
|
51039
|
+
DebugLogger.debug('Connecting to socket at:', endpoint, 'clientId:', clientId);
|
|
51040
|
+
const socketUri = `${endpoint}?clientId=${clientId}`;
|
|
51123
51041
|
this.socket = createWebSocketWrapper(socketUri, {
|
|
51124
51042
|
timeout: 5000, // 5 seconds
|
|
51125
51043
|
onmessage: (e) => this.onMessage(e.data),
|
|
51126
51044
|
onopen: () => {
|
|
51127
|
-
DebugLogger.debug(`Connection to socket established. Endpoint: ${endpoint}`);
|
|
51045
|
+
DebugLogger.debug(`Connection to socket established. Endpoint: ${endpoint} ${this.clientIdService.getClientId()}`);
|
|
51128
51046
|
},
|
|
51129
51047
|
onreconnect: () => {
|
|
51130
|
-
DebugLogger.debug(`WebSocket reconnect event triggered`);
|
|
51131
|
-
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
|
+
}
|
|
51132
51056
|
},
|
|
51133
51057
|
onclose: () => {
|
|
51134
|
-
DebugLogger.debug(`WebSocket onclose event triggered`);
|
|
51135
|
-
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
|
+
}
|
|
51136
51066
|
},
|
|
51137
51067
|
onerror: (e) => console.error('WebSocket error:', e),
|
|
51138
51068
|
});
|
|
51139
51069
|
}
|
|
51140
|
-
|
|
51070
|
+
disconnectForTest() {
|
|
51141
51071
|
var _a;
|
|
51142
51072
|
this.connectionReady.next(false);
|
|
51143
51073
|
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.close(4998);
|
|
@@ -51148,7 +51078,7 @@ class SocketManager {
|
|
|
51148
51078
|
}
|
|
51149
51079
|
onMessage(messagesStr) {
|
|
51150
51080
|
if (messagesStr === 'connectionReady') {
|
|
51151
|
-
DebugLogger.debug(
|
|
51081
|
+
DebugLogger.debug(`Got socket message: connectionReady ${this.clientIdService.getClientId()}`);
|
|
51152
51082
|
this.onConnectionReady();
|
|
51153
51083
|
return;
|
|
51154
51084
|
}
|
|
@@ -51159,7 +51089,7 @@ class SocketManager {
|
|
|
51159
51089
|
continue;
|
|
51160
51090
|
}
|
|
51161
51091
|
this.seenMessageIds.add(message.messageId);
|
|
51162
|
-
DebugLogger.debug(new Date(),
|
|
51092
|
+
DebugLogger.debug(new Date(), `Got socket message: (${this.clientIdService.getClientId()})`, JSON.stringify(message, null, 2));
|
|
51163
51093
|
this.messageNotificationWrapper(() => {
|
|
51164
51094
|
this.webSocketObserver.next(message);
|
|
51165
51095
|
});
|
|
@@ -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;
|
|
@@ -10,3 +12,5 @@ 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]>>;
|
|
11
13
|
/** Creates a deep copy of the object. Copies all Date, Map, Set fields. */
|
|
12
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",
|