@squidcloud/client 1.0.144-beta → 1.0.145-beta
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 +748 -267
- package/dist/common/src/ai-chatbot.types.d.ts +3 -1
- package/dist/typescript-client/src/ai-assistant-client.d.ts +63 -1
- package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +0 -3
- package/dist/typescript-client/src/ai.types.d.ts +15 -1
- package/dist/typescript-client/src/auth.manager.d.ts +0 -7
- package/dist/typescript-client/src/rpc.manager.d.ts +3 -2
- package/dist/typescript-client/src/squid.d.ts +0 -14
- package/package.json +3 -2
package/dist/cjs/index.js
CHANGED
|
@@ -7361,6 +7361,567 @@ __exportStar(__webpack_require__(4356), exports);
|
|
|
7361
7361
|
__exportStar(__webpack_require__(9862), exports);
|
|
7362
7362
|
//# sourceMappingURL=index.js.map
|
|
7363
7363
|
|
|
7364
|
+
/***/ }),
|
|
7365
|
+
|
|
7366
|
+
/***/ 9372:
|
|
7367
|
+
/***/ (function(module, exports) {
|
|
7368
|
+
|
|
7369
|
+
var global = typeof self !== 'undefined' ? self : this;
|
|
7370
|
+
var __self__ = (function () {
|
|
7371
|
+
function F() {
|
|
7372
|
+
this.fetch = false;
|
|
7373
|
+
this.DOMException = global.DOMException
|
|
7374
|
+
}
|
|
7375
|
+
F.prototype = global;
|
|
7376
|
+
return new F();
|
|
7377
|
+
})();
|
|
7378
|
+
(function(self) {
|
|
7379
|
+
|
|
7380
|
+
var irrelevant = (function (exports) {
|
|
7381
|
+
|
|
7382
|
+
var support = {
|
|
7383
|
+
searchParams: 'URLSearchParams' in self,
|
|
7384
|
+
iterable: 'Symbol' in self && 'iterator' in Symbol,
|
|
7385
|
+
blob:
|
|
7386
|
+
'FileReader' in self &&
|
|
7387
|
+
'Blob' in self &&
|
|
7388
|
+
(function() {
|
|
7389
|
+
try {
|
|
7390
|
+
new Blob();
|
|
7391
|
+
return true
|
|
7392
|
+
} catch (e) {
|
|
7393
|
+
return false
|
|
7394
|
+
}
|
|
7395
|
+
})(),
|
|
7396
|
+
formData: 'FormData' in self,
|
|
7397
|
+
arrayBuffer: 'ArrayBuffer' in self
|
|
7398
|
+
};
|
|
7399
|
+
|
|
7400
|
+
function isDataView(obj) {
|
|
7401
|
+
return obj && DataView.prototype.isPrototypeOf(obj)
|
|
7402
|
+
}
|
|
7403
|
+
|
|
7404
|
+
if (support.arrayBuffer) {
|
|
7405
|
+
var viewClasses = [
|
|
7406
|
+
'[object Int8Array]',
|
|
7407
|
+
'[object Uint8Array]',
|
|
7408
|
+
'[object Uint8ClampedArray]',
|
|
7409
|
+
'[object Int16Array]',
|
|
7410
|
+
'[object Uint16Array]',
|
|
7411
|
+
'[object Int32Array]',
|
|
7412
|
+
'[object Uint32Array]',
|
|
7413
|
+
'[object Float32Array]',
|
|
7414
|
+
'[object Float64Array]'
|
|
7415
|
+
];
|
|
7416
|
+
|
|
7417
|
+
var isArrayBufferView =
|
|
7418
|
+
ArrayBuffer.isView ||
|
|
7419
|
+
function(obj) {
|
|
7420
|
+
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
|
7421
|
+
};
|
|
7422
|
+
}
|
|
7423
|
+
|
|
7424
|
+
function normalizeName(name) {
|
|
7425
|
+
if (typeof name !== 'string') {
|
|
7426
|
+
name = String(name);
|
|
7427
|
+
}
|
|
7428
|
+
if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
|
|
7429
|
+
throw new TypeError('Invalid character in header field name')
|
|
7430
|
+
}
|
|
7431
|
+
return name.toLowerCase()
|
|
7432
|
+
}
|
|
7433
|
+
|
|
7434
|
+
function normalizeValue(value) {
|
|
7435
|
+
if (typeof value !== 'string') {
|
|
7436
|
+
value = String(value);
|
|
7437
|
+
}
|
|
7438
|
+
return value
|
|
7439
|
+
}
|
|
7440
|
+
|
|
7441
|
+
// Build a destructive iterator for the value list
|
|
7442
|
+
function iteratorFor(items) {
|
|
7443
|
+
var iterator = {
|
|
7444
|
+
next: function() {
|
|
7445
|
+
var value = items.shift();
|
|
7446
|
+
return {done: value === undefined, value: value}
|
|
7447
|
+
}
|
|
7448
|
+
};
|
|
7449
|
+
|
|
7450
|
+
if (support.iterable) {
|
|
7451
|
+
iterator[Symbol.iterator] = function() {
|
|
7452
|
+
return iterator
|
|
7453
|
+
};
|
|
7454
|
+
}
|
|
7455
|
+
|
|
7456
|
+
return iterator
|
|
7457
|
+
}
|
|
7458
|
+
|
|
7459
|
+
function Headers(headers) {
|
|
7460
|
+
this.map = {};
|
|
7461
|
+
|
|
7462
|
+
if (headers instanceof Headers) {
|
|
7463
|
+
headers.forEach(function(value, name) {
|
|
7464
|
+
this.append(name, value);
|
|
7465
|
+
}, this);
|
|
7466
|
+
} else if (Array.isArray(headers)) {
|
|
7467
|
+
headers.forEach(function(header) {
|
|
7468
|
+
this.append(header[0], header[1]);
|
|
7469
|
+
}, this);
|
|
7470
|
+
} else if (headers) {
|
|
7471
|
+
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
|
7472
|
+
this.append(name, headers[name]);
|
|
7473
|
+
}, this);
|
|
7474
|
+
}
|
|
7475
|
+
}
|
|
7476
|
+
|
|
7477
|
+
Headers.prototype.append = function(name, value) {
|
|
7478
|
+
name = normalizeName(name);
|
|
7479
|
+
value = normalizeValue(value);
|
|
7480
|
+
var oldValue = this.map[name];
|
|
7481
|
+
this.map[name] = oldValue ? oldValue + ', ' + value : value;
|
|
7482
|
+
};
|
|
7483
|
+
|
|
7484
|
+
Headers.prototype['delete'] = function(name) {
|
|
7485
|
+
delete this.map[normalizeName(name)];
|
|
7486
|
+
};
|
|
7487
|
+
|
|
7488
|
+
Headers.prototype.get = function(name) {
|
|
7489
|
+
name = normalizeName(name);
|
|
7490
|
+
return this.has(name) ? this.map[name] : null
|
|
7491
|
+
};
|
|
7492
|
+
|
|
7493
|
+
Headers.prototype.has = function(name) {
|
|
7494
|
+
return this.map.hasOwnProperty(normalizeName(name))
|
|
7495
|
+
};
|
|
7496
|
+
|
|
7497
|
+
Headers.prototype.set = function(name, value) {
|
|
7498
|
+
this.map[normalizeName(name)] = normalizeValue(value);
|
|
7499
|
+
};
|
|
7500
|
+
|
|
7501
|
+
Headers.prototype.forEach = function(callback, thisArg) {
|
|
7502
|
+
for (var name in this.map) {
|
|
7503
|
+
if (this.map.hasOwnProperty(name)) {
|
|
7504
|
+
callback.call(thisArg, this.map[name], name, this);
|
|
7505
|
+
}
|
|
7506
|
+
}
|
|
7507
|
+
};
|
|
7508
|
+
|
|
7509
|
+
Headers.prototype.keys = function() {
|
|
7510
|
+
var items = [];
|
|
7511
|
+
this.forEach(function(value, name) {
|
|
7512
|
+
items.push(name);
|
|
7513
|
+
});
|
|
7514
|
+
return iteratorFor(items)
|
|
7515
|
+
};
|
|
7516
|
+
|
|
7517
|
+
Headers.prototype.values = function() {
|
|
7518
|
+
var items = [];
|
|
7519
|
+
this.forEach(function(value) {
|
|
7520
|
+
items.push(value);
|
|
7521
|
+
});
|
|
7522
|
+
return iteratorFor(items)
|
|
7523
|
+
};
|
|
7524
|
+
|
|
7525
|
+
Headers.prototype.entries = function() {
|
|
7526
|
+
var items = [];
|
|
7527
|
+
this.forEach(function(value, name) {
|
|
7528
|
+
items.push([name, value]);
|
|
7529
|
+
});
|
|
7530
|
+
return iteratorFor(items)
|
|
7531
|
+
};
|
|
7532
|
+
|
|
7533
|
+
if (support.iterable) {
|
|
7534
|
+
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
|
7535
|
+
}
|
|
7536
|
+
|
|
7537
|
+
function consumed(body) {
|
|
7538
|
+
if (body.bodyUsed) {
|
|
7539
|
+
return Promise.reject(new TypeError('Already read'))
|
|
7540
|
+
}
|
|
7541
|
+
body.bodyUsed = true;
|
|
7542
|
+
}
|
|
7543
|
+
|
|
7544
|
+
function fileReaderReady(reader) {
|
|
7545
|
+
return new Promise(function(resolve, reject) {
|
|
7546
|
+
reader.onload = function() {
|
|
7547
|
+
resolve(reader.result);
|
|
7548
|
+
};
|
|
7549
|
+
reader.onerror = function() {
|
|
7550
|
+
reject(reader.error);
|
|
7551
|
+
};
|
|
7552
|
+
})
|
|
7553
|
+
}
|
|
7554
|
+
|
|
7555
|
+
function readBlobAsArrayBuffer(blob) {
|
|
7556
|
+
var reader = new FileReader();
|
|
7557
|
+
var promise = fileReaderReady(reader);
|
|
7558
|
+
reader.readAsArrayBuffer(blob);
|
|
7559
|
+
return promise
|
|
7560
|
+
}
|
|
7561
|
+
|
|
7562
|
+
function readBlobAsText(blob) {
|
|
7563
|
+
var reader = new FileReader();
|
|
7564
|
+
var promise = fileReaderReady(reader);
|
|
7565
|
+
reader.readAsText(blob);
|
|
7566
|
+
return promise
|
|
7567
|
+
}
|
|
7568
|
+
|
|
7569
|
+
function readArrayBufferAsText(buf) {
|
|
7570
|
+
var view = new Uint8Array(buf);
|
|
7571
|
+
var chars = new Array(view.length);
|
|
7572
|
+
|
|
7573
|
+
for (var i = 0; i < view.length; i++) {
|
|
7574
|
+
chars[i] = String.fromCharCode(view[i]);
|
|
7575
|
+
}
|
|
7576
|
+
return chars.join('')
|
|
7577
|
+
}
|
|
7578
|
+
|
|
7579
|
+
function bufferClone(buf) {
|
|
7580
|
+
if (buf.slice) {
|
|
7581
|
+
return buf.slice(0)
|
|
7582
|
+
} else {
|
|
7583
|
+
var view = new Uint8Array(buf.byteLength);
|
|
7584
|
+
view.set(new Uint8Array(buf));
|
|
7585
|
+
return view.buffer
|
|
7586
|
+
}
|
|
7587
|
+
}
|
|
7588
|
+
|
|
7589
|
+
function Body() {
|
|
7590
|
+
this.bodyUsed = false;
|
|
7591
|
+
|
|
7592
|
+
this._initBody = function(body) {
|
|
7593
|
+
this._bodyInit = body;
|
|
7594
|
+
if (!body) {
|
|
7595
|
+
this._bodyText = '';
|
|
7596
|
+
} else if (typeof body === 'string') {
|
|
7597
|
+
this._bodyText = body;
|
|
7598
|
+
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
|
7599
|
+
this._bodyBlob = body;
|
|
7600
|
+
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
|
7601
|
+
this._bodyFormData = body;
|
|
7602
|
+
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
7603
|
+
this._bodyText = body.toString();
|
|
7604
|
+
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
|
7605
|
+
this._bodyArrayBuffer = bufferClone(body.buffer);
|
|
7606
|
+
// IE 10-11 can't handle a DataView body.
|
|
7607
|
+
this._bodyInit = new Blob([this._bodyArrayBuffer]);
|
|
7608
|
+
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
|
7609
|
+
this._bodyArrayBuffer = bufferClone(body);
|
|
7610
|
+
} else {
|
|
7611
|
+
this._bodyText = body = Object.prototype.toString.call(body);
|
|
7612
|
+
}
|
|
7613
|
+
|
|
7614
|
+
if (!this.headers.get('content-type')) {
|
|
7615
|
+
if (typeof body === 'string') {
|
|
7616
|
+
this.headers.set('content-type', 'text/plain;charset=UTF-8');
|
|
7617
|
+
} else if (this._bodyBlob && this._bodyBlob.type) {
|
|
7618
|
+
this.headers.set('content-type', this._bodyBlob.type);
|
|
7619
|
+
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
7620
|
+
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
|
7621
|
+
}
|
|
7622
|
+
}
|
|
7623
|
+
};
|
|
7624
|
+
|
|
7625
|
+
if (support.blob) {
|
|
7626
|
+
this.blob = function() {
|
|
7627
|
+
var rejected = consumed(this);
|
|
7628
|
+
if (rejected) {
|
|
7629
|
+
return rejected
|
|
7630
|
+
}
|
|
7631
|
+
|
|
7632
|
+
if (this._bodyBlob) {
|
|
7633
|
+
return Promise.resolve(this._bodyBlob)
|
|
7634
|
+
} else if (this._bodyArrayBuffer) {
|
|
7635
|
+
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
|
7636
|
+
} else if (this._bodyFormData) {
|
|
7637
|
+
throw new Error('could not read FormData body as blob')
|
|
7638
|
+
} else {
|
|
7639
|
+
return Promise.resolve(new Blob([this._bodyText]))
|
|
7640
|
+
}
|
|
7641
|
+
};
|
|
7642
|
+
|
|
7643
|
+
this.arrayBuffer = function() {
|
|
7644
|
+
if (this._bodyArrayBuffer) {
|
|
7645
|
+
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
|
|
7646
|
+
} else {
|
|
7647
|
+
return this.blob().then(readBlobAsArrayBuffer)
|
|
7648
|
+
}
|
|
7649
|
+
};
|
|
7650
|
+
}
|
|
7651
|
+
|
|
7652
|
+
this.text = function() {
|
|
7653
|
+
var rejected = consumed(this);
|
|
7654
|
+
if (rejected) {
|
|
7655
|
+
return rejected
|
|
7656
|
+
}
|
|
7657
|
+
|
|
7658
|
+
if (this._bodyBlob) {
|
|
7659
|
+
return readBlobAsText(this._bodyBlob)
|
|
7660
|
+
} else if (this._bodyArrayBuffer) {
|
|
7661
|
+
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
|
7662
|
+
} else if (this._bodyFormData) {
|
|
7663
|
+
throw new Error('could not read FormData body as text')
|
|
7664
|
+
} else {
|
|
7665
|
+
return Promise.resolve(this._bodyText)
|
|
7666
|
+
}
|
|
7667
|
+
};
|
|
7668
|
+
|
|
7669
|
+
if (support.formData) {
|
|
7670
|
+
this.formData = function() {
|
|
7671
|
+
return this.text().then(decode)
|
|
7672
|
+
};
|
|
7673
|
+
}
|
|
7674
|
+
|
|
7675
|
+
this.json = function() {
|
|
7676
|
+
return this.text().then(JSON.parse)
|
|
7677
|
+
};
|
|
7678
|
+
|
|
7679
|
+
return this
|
|
7680
|
+
}
|
|
7681
|
+
|
|
7682
|
+
// HTTP methods whose capitalization should be normalized
|
|
7683
|
+
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
|
7684
|
+
|
|
7685
|
+
function normalizeMethod(method) {
|
|
7686
|
+
var upcased = method.toUpperCase();
|
|
7687
|
+
return methods.indexOf(upcased) > -1 ? upcased : method
|
|
7688
|
+
}
|
|
7689
|
+
|
|
7690
|
+
function Request(input, options) {
|
|
7691
|
+
options = options || {};
|
|
7692
|
+
var body = options.body;
|
|
7693
|
+
|
|
7694
|
+
if (input instanceof Request) {
|
|
7695
|
+
if (input.bodyUsed) {
|
|
7696
|
+
throw new TypeError('Already read')
|
|
7697
|
+
}
|
|
7698
|
+
this.url = input.url;
|
|
7699
|
+
this.credentials = input.credentials;
|
|
7700
|
+
if (!options.headers) {
|
|
7701
|
+
this.headers = new Headers(input.headers);
|
|
7702
|
+
}
|
|
7703
|
+
this.method = input.method;
|
|
7704
|
+
this.mode = input.mode;
|
|
7705
|
+
this.signal = input.signal;
|
|
7706
|
+
if (!body && input._bodyInit != null) {
|
|
7707
|
+
body = input._bodyInit;
|
|
7708
|
+
input.bodyUsed = true;
|
|
7709
|
+
}
|
|
7710
|
+
} else {
|
|
7711
|
+
this.url = String(input);
|
|
7712
|
+
}
|
|
7713
|
+
|
|
7714
|
+
this.credentials = options.credentials || this.credentials || 'same-origin';
|
|
7715
|
+
if (options.headers || !this.headers) {
|
|
7716
|
+
this.headers = new Headers(options.headers);
|
|
7717
|
+
}
|
|
7718
|
+
this.method = normalizeMethod(options.method || this.method || 'GET');
|
|
7719
|
+
this.mode = options.mode || this.mode || null;
|
|
7720
|
+
this.signal = options.signal || this.signal;
|
|
7721
|
+
this.referrer = null;
|
|
7722
|
+
|
|
7723
|
+
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
|
7724
|
+
throw new TypeError('Body not allowed for GET or HEAD requests')
|
|
7725
|
+
}
|
|
7726
|
+
this._initBody(body);
|
|
7727
|
+
}
|
|
7728
|
+
|
|
7729
|
+
Request.prototype.clone = function() {
|
|
7730
|
+
return new Request(this, {body: this._bodyInit})
|
|
7731
|
+
};
|
|
7732
|
+
|
|
7733
|
+
function decode(body) {
|
|
7734
|
+
var form = new FormData();
|
|
7735
|
+
body
|
|
7736
|
+
.trim()
|
|
7737
|
+
.split('&')
|
|
7738
|
+
.forEach(function(bytes) {
|
|
7739
|
+
if (bytes) {
|
|
7740
|
+
var split = bytes.split('=');
|
|
7741
|
+
var name = split.shift().replace(/\+/g, ' ');
|
|
7742
|
+
var value = split.join('=').replace(/\+/g, ' ');
|
|
7743
|
+
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
|
7744
|
+
}
|
|
7745
|
+
});
|
|
7746
|
+
return form
|
|
7747
|
+
}
|
|
7748
|
+
|
|
7749
|
+
function parseHeaders(rawHeaders) {
|
|
7750
|
+
var headers = new Headers();
|
|
7751
|
+
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
|
7752
|
+
// https://tools.ietf.org/html/rfc7230#section-3.2
|
|
7753
|
+
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
|
|
7754
|
+
preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
|
|
7755
|
+
var parts = line.split(':');
|
|
7756
|
+
var key = parts.shift().trim();
|
|
7757
|
+
if (key) {
|
|
7758
|
+
var value = parts.join(':').trim();
|
|
7759
|
+
headers.append(key, value);
|
|
7760
|
+
}
|
|
7761
|
+
});
|
|
7762
|
+
return headers
|
|
7763
|
+
}
|
|
7764
|
+
|
|
7765
|
+
Body.call(Request.prototype);
|
|
7766
|
+
|
|
7767
|
+
function Response(bodyInit, options) {
|
|
7768
|
+
if (!options) {
|
|
7769
|
+
options = {};
|
|
7770
|
+
}
|
|
7771
|
+
|
|
7772
|
+
this.type = 'default';
|
|
7773
|
+
this.status = options.status === undefined ? 200 : options.status;
|
|
7774
|
+
this.ok = this.status >= 200 && this.status < 300;
|
|
7775
|
+
this.statusText = 'statusText' in options ? options.statusText : 'OK';
|
|
7776
|
+
this.headers = new Headers(options.headers);
|
|
7777
|
+
this.url = options.url || '';
|
|
7778
|
+
this._initBody(bodyInit);
|
|
7779
|
+
}
|
|
7780
|
+
|
|
7781
|
+
Body.call(Response.prototype);
|
|
7782
|
+
|
|
7783
|
+
Response.prototype.clone = function() {
|
|
7784
|
+
return new Response(this._bodyInit, {
|
|
7785
|
+
status: this.status,
|
|
7786
|
+
statusText: this.statusText,
|
|
7787
|
+
headers: new Headers(this.headers),
|
|
7788
|
+
url: this.url
|
|
7789
|
+
})
|
|
7790
|
+
};
|
|
7791
|
+
|
|
7792
|
+
Response.error = function() {
|
|
7793
|
+
var response = new Response(null, {status: 0, statusText: ''});
|
|
7794
|
+
response.type = 'error';
|
|
7795
|
+
return response
|
|
7796
|
+
};
|
|
7797
|
+
|
|
7798
|
+
var redirectStatuses = [301, 302, 303, 307, 308];
|
|
7799
|
+
|
|
7800
|
+
Response.redirect = function(url, status) {
|
|
7801
|
+
if (redirectStatuses.indexOf(status) === -1) {
|
|
7802
|
+
throw new RangeError('Invalid status code')
|
|
7803
|
+
}
|
|
7804
|
+
|
|
7805
|
+
return new Response(null, {status: status, headers: {location: url}})
|
|
7806
|
+
};
|
|
7807
|
+
|
|
7808
|
+
exports.DOMException = self.DOMException;
|
|
7809
|
+
try {
|
|
7810
|
+
new exports.DOMException();
|
|
7811
|
+
} catch (err) {
|
|
7812
|
+
exports.DOMException = function(message, name) {
|
|
7813
|
+
this.message = message;
|
|
7814
|
+
this.name = name;
|
|
7815
|
+
var error = Error(message);
|
|
7816
|
+
this.stack = error.stack;
|
|
7817
|
+
};
|
|
7818
|
+
exports.DOMException.prototype = Object.create(Error.prototype);
|
|
7819
|
+
exports.DOMException.prototype.constructor = exports.DOMException;
|
|
7820
|
+
}
|
|
7821
|
+
|
|
7822
|
+
function fetch(input, init) {
|
|
7823
|
+
return new Promise(function(resolve, reject) {
|
|
7824
|
+
var request = new Request(input, init);
|
|
7825
|
+
|
|
7826
|
+
if (request.signal && request.signal.aborted) {
|
|
7827
|
+
return reject(new exports.DOMException('Aborted', 'AbortError'))
|
|
7828
|
+
}
|
|
7829
|
+
|
|
7830
|
+
var xhr = new XMLHttpRequest();
|
|
7831
|
+
|
|
7832
|
+
function abortXhr() {
|
|
7833
|
+
xhr.abort();
|
|
7834
|
+
}
|
|
7835
|
+
|
|
7836
|
+
xhr.onload = function() {
|
|
7837
|
+
var options = {
|
|
7838
|
+
status: xhr.status,
|
|
7839
|
+
statusText: xhr.statusText,
|
|
7840
|
+
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
|
7841
|
+
};
|
|
7842
|
+
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
|
7843
|
+
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
|
7844
|
+
resolve(new Response(body, options));
|
|
7845
|
+
};
|
|
7846
|
+
|
|
7847
|
+
xhr.onerror = function() {
|
|
7848
|
+
reject(new TypeError('Network request failed'));
|
|
7849
|
+
};
|
|
7850
|
+
|
|
7851
|
+
xhr.ontimeout = function() {
|
|
7852
|
+
reject(new TypeError('Network request failed'));
|
|
7853
|
+
};
|
|
7854
|
+
|
|
7855
|
+
xhr.onabort = function() {
|
|
7856
|
+
reject(new exports.DOMException('Aborted', 'AbortError'));
|
|
7857
|
+
};
|
|
7858
|
+
|
|
7859
|
+
xhr.open(request.method, request.url, true);
|
|
7860
|
+
|
|
7861
|
+
if (request.credentials === 'include') {
|
|
7862
|
+
xhr.withCredentials = true;
|
|
7863
|
+
} else if (request.credentials === 'omit') {
|
|
7864
|
+
xhr.withCredentials = false;
|
|
7865
|
+
}
|
|
7866
|
+
|
|
7867
|
+
if ('responseType' in xhr && support.blob) {
|
|
7868
|
+
xhr.responseType = 'blob';
|
|
7869
|
+
}
|
|
7870
|
+
|
|
7871
|
+
request.headers.forEach(function(value, name) {
|
|
7872
|
+
xhr.setRequestHeader(name, value);
|
|
7873
|
+
});
|
|
7874
|
+
|
|
7875
|
+
if (request.signal) {
|
|
7876
|
+
request.signal.addEventListener('abort', abortXhr);
|
|
7877
|
+
|
|
7878
|
+
xhr.onreadystatechange = function() {
|
|
7879
|
+
// DONE (success or failure)
|
|
7880
|
+
if (xhr.readyState === 4) {
|
|
7881
|
+
request.signal.removeEventListener('abort', abortXhr);
|
|
7882
|
+
}
|
|
7883
|
+
};
|
|
7884
|
+
}
|
|
7885
|
+
|
|
7886
|
+
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
|
|
7887
|
+
})
|
|
7888
|
+
}
|
|
7889
|
+
|
|
7890
|
+
fetch.polyfill = true;
|
|
7891
|
+
|
|
7892
|
+
if (!self.fetch) {
|
|
7893
|
+
self.fetch = fetch;
|
|
7894
|
+
self.Headers = Headers;
|
|
7895
|
+
self.Request = Request;
|
|
7896
|
+
self.Response = Response;
|
|
7897
|
+
}
|
|
7898
|
+
|
|
7899
|
+
exports.Headers = Headers;
|
|
7900
|
+
exports.Request = Request;
|
|
7901
|
+
exports.Response = Response;
|
|
7902
|
+
exports.fetch = fetch;
|
|
7903
|
+
|
|
7904
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7905
|
+
|
|
7906
|
+
return exports;
|
|
7907
|
+
|
|
7908
|
+
})({});
|
|
7909
|
+
})(__self__);
|
|
7910
|
+
__self__.fetch.ponyfill = true;
|
|
7911
|
+
// Remove "polyfill" property added by whatwg-fetch
|
|
7912
|
+
delete __self__.fetch.polyfill;
|
|
7913
|
+
// Choose between native implementation (global) or custom implementation (__self__)
|
|
7914
|
+
// var ctx = global.fetch ? global : __self__;
|
|
7915
|
+
var ctx = __self__; // this line disable service worker support temporarily
|
|
7916
|
+
exports = ctx.fetch // To enable: import fetch from 'cross-fetch'
|
|
7917
|
+
exports["default"] = ctx.fetch // For TypeScript consumers without esModuleInterop.
|
|
7918
|
+
exports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'
|
|
7919
|
+
exports.Headers = ctx.Headers
|
|
7920
|
+
exports.Request = ctx.Request
|
|
7921
|
+
exports.Response = ctx.Response
|
|
7922
|
+
module.exports = exports
|
|
7923
|
+
|
|
7924
|
+
|
|
7364
7925
|
/***/ }),
|
|
7365
7926
|
|
|
7366
7927
|
/***/ 2091:
|
|
@@ -26754,6 +27315,8 @@ const AiChatbotChatRequestSchema = {
|
|
|
26754
27315
|
};
|
|
26755
27316
|
|
|
26756
27317
|
;// CONCATENATED MODULE: ../common/src/ai-chatbot.types.ts
|
|
27318
|
+
/** The supported AI model names. */
|
|
27319
|
+
const AI_MODEL_NAMES = (/* unused pure expression or super */ null && (['gpt-3.5-turbo', 'gpt-4', 'claude-2', 'gpt-4-1106-preview']));
|
|
26757
27320
|
/** @internal */
|
|
26758
27321
|
const AiModelData = {
|
|
26759
27322
|
'gpt-4': {
|
|
@@ -27073,60 +27636,6 @@ const OpenApiDiscoveryOptionsSchema = {
|
|
|
27073
27636
|
openApiSpecUrl: { type: 'string', nullable: true },
|
|
27074
27637
|
},
|
|
27075
27638
|
};
|
|
27076
|
-
/** Generated using openai */
|
|
27077
|
-
const ApiEndpointsSchema = {
|
|
27078
|
-
type: 'object',
|
|
27079
|
-
patternProperties: {
|
|
27080
|
-
'^\\S+$': {
|
|
27081
|
-
type: 'object',
|
|
27082
|
-
required: ['relativePath', 'method'],
|
|
27083
|
-
properties: {
|
|
27084
|
-
relativePath: {
|
|
27085
|
-
type: 'string',
|
|
27086
|
-
},
|
|
27087
|
-
method: {
|
|
27088
|
-
type: 'string',
|
|
27089
|
-
enum: ['post', 'get', 'delete', 'patch', 'put'],
|
|
27090
|
-
},
|
|
27091
|
-
requestSchema: {
|
|
27092
|
-
type: 'object',
|
|
27093
|
-
patternProperties: {
|
|
27094
|
-
'^\\S+$': {
|
|
27095
|
-
type: 'object',
|
|
27096
|
-
properties: {
|
|
27097
|
-
location: {
|
|
27098
|
-
type: 'string',
|
|
27099
|
-
enum: ['query', 'body', 'header', 'path'],
|
|
27100
|
-
},
|
|
27101
|
-
fieldNameInRequest: {
|
|
27102
|
-
type: 'string',
|
|
27103
|
-
},
|
|
27104
|
-
},
|
|
27105
|
-
},
|
|
27106
|
-
},
|
|
27107
|
-
},
|
|
27108
|
-
responseSchema: {
|
|
27109
|
-
type: 'object',
|
|
27110
|
-
patternProperties: {
|
|
27111
|
-
'^\\S+$': {
|
|
27112
|
-
type: 'object',
|
|
27113
|
-
required: ['location'],
|
|
27114
|
-
properties: {
|
|
27115
|
-
location: {
|
|
27116
|
-
type: 'string',
|
|
27117
|
-
enum: ['body', 'header'],
|
|
27118
|
-
},
|
|
27119
|
-
path: {
|
|
27120
|
-
type: 'string',
|
|
27121
|
-
},
|
|
27122
|
-
},
|
|
27123
|
-
},
|
|
27124
|
-
},
|
|
27125
|
-
},
|
|
27126
|
-
},
|
|
27127
|
-
},
|
|
27128
|
-
},
|
|
27129
|
-
};
|
|
27130
27639
|
const SnowflakeConnectionOptionsSchema = {
|
|
27131
27640
|
type: 'object',
|
|
27132
27641
|
required: [],
|
|
@@ -28138,80 +28647,6 @@ function isSimpleCondition(condition) {
|
|
|
28138
28647
|
function encodeCondition(condition) {
|
|
28139
28648
|
return serialization_normalizeJsonAsString(condition);
|
|
28140
28649
|
}
|
|
28141
|
-
const sampleQueryMapping = {
|
|
28142
|
-
unconditional: ['cid_123'],
|
|
28143
|
-
conditional: {
|
|
28144
|
-
[encodeCondition({
|
|
28145
|
-
fields: [
|
|
28146
|
-
{
|
|
28147
|
-
fieldName: 'name',
|
|
28148
|
-
operator: '>',
|
|
28149
|
-
value: 'Yossi',
|
|
28150
|
-
},
|
|
28151
|
-
{
|
|
28152
|
-
fieldName: 'age',
|
|
28153
|
-
operator: '<',
|
|
28154
|
-
value: 10,
|
|
28155
|
-
},
|
|
28156
|
-
],
|
|
28157
|
-
})]: ['cid_sort_order'],
|
|
28158
|
-
[encodeCondition({
|
|
28159
|
-
fieldName: 'age',
|
|
28160
|
-
operator: '==',
|
|
28161
|
-
value: 10,
|
|
28162
|
-
})]: ['cid_321'],
|
|
28163
|
-
[encodeCondition({
|
|
28164
|
-
fieldName: 'age',
|
|
28165
|
-
operator: '==',
|
|
28166
|
-
value: 11,
|
|
28167
|
-
})]: ['cid_321'],
|
|
28168
|
-
[encodeCondition({
|
|
28169
|
-
fieldName: 'age',
|
|
28170
|
-
operator: '==',
|
|
28171
|
-
value: 12,
|
|
28172
|
-
})]: ['cid_321'],
|
|
28173
|
-
[encodeCondition({
|
|
28174
|
-
fieldName: 'age',
|
|
28175
|
-
operator: '>',
|
|
28176
|
-
value: 20,
|
|
28177
|
-
})]: ['cid_456', 'cid_789'],
|
|
28178
|
-
[encodeCondition({
|
|
28179
|
-
fieldName: 'age',
|
|
28180
|
-
operator: '<',
|
|
28181
|
-
value: 20,
|
|
28182
|
-
})]: ['cid_789'],
|
|
28183
|
-
[encodeCondition({
|
|
28184
|
-
fieldName: 'name',
|
|
28185
|
-
operator: '!=',
|
|
28186
|
-
value: 'Yossi',
|
|
28187
|
-
})]: ['cid_not_in'],
|
|
28188
|
-
[encodeCondition({
|
|
28189
|
-
fieldName: 'name',
|
|
28190
|
-
operator: '!=',
|
|
28191
|
-
value: 'Nir',
|
|
28192
|
-
})]: ['cid_not_in'],
|
|
28193
|
-
},
|
|
28194
|
-
queriesMetadata: {
|
|
28195
|
-
cid_123: {
|
|
28196
|
-
condCount: 0,
|
|
28197
|
-
},
|
|
28198
|
-
cid_321: {
|
|
28199
|
-
condCount: 1,
|
|
28200
|
-
},
|
|
28201
|
-
cid_456: {
|
|
28202
|
-
condCount: 1,
|
|
28203
|
-
},
|
|
28204
|
-
cid_789: {
|
|
28205
|
-
condCount: 2,
|
|
28206
|
-
},
|
|
28207
|
-
cid_sort_order: {
|
|
28208
|
-
condCount: 1,
|
|
28209
|
-
},
|
|
28210
|
-
cid_not_in: {
|
|
28211
|
-
condCount: 2,
|
|
28212
|
-
},
|
|
28213
|
-
},
|
|
28214
|
-
};
|
|
28215
28650
|
/** @internal */
|
|
28216
28651
|
class QueryMappingManager {
|
|
28217
28652
|
}
|
|
@@ -28904,7 +29339,7 @@ class Pagination {
|
|
|
28904
29339
|
// It is possible that we get here and unsubscribe() was called. In that case we might not get any new state,
|
|
28905
29340
|
// so to avoid stalling we return an empty page in that situation. (We can't return the last page we saw
|
|
28906
29341
|
// because that has already been deleted, and also because it's possible that we've never seen any data.)
|
|
28907
|
-
this.isDestroyed.pipe((0,external_rxjs_namespaceObject.filter)(Boolean), (0,external_rxjs_namespaceObject.map)(
|
|
29342
|
+
this.isDestroyed.pipe((0,external_rxjs_namespaceObject.filter)(Boolean), (0,external_rxjs_namespaceObject.map)(() => ({
|
|
28908
29343
|
data: [],
|
|
28909
29344
|
extractedData: [],
|
|
28910
29345
|
numBefore: 0,
|
|
@@ -28929,7 +29364,7 @@ class Pagination {
|
|
|
28929
29364
|
this.snapshotSubject.complete();
|
|
28930
29365
|
}
|
|
28931
29366
|
prevInternal(internalState) {
|
|
28932
|
-
const { numBefore, numAfter,
|
|
29367
|
+
const { numBefore, numAfter, extractedData } = internalState;
|
|
28933
29368
|
this.firstElement = null;
|
|
28934
29369
|
this.lastElement = extractedData[numBefore - 1];
|
|
28935
29370
|
this.internalStateObserver.next(null);
|
|
@@ -29186,7 +29621,7 @@ function hasDocumentDiff(beforeDoc, afterDoc) {
|
|
|
29186
29621
|
const docIdObj = parseSquidDocId(docIdDiff.rhs + '');
|
|
29187
29622
|
ignoredKeys.push(...Object.keys(docIdObj));
|
|
29188
29623
|
}
|
|
29189
|
-
const diff = diffs === null || diffs === void 0 ? void 0 : diffs.find((diff
|
|
29624
|
+
const diff = diffs === null || diffs === void 0 ? void 0 : diffs.find((diff) => {
|
|
29190
29625
|
var _a;
|
|
29191
29626
|
// Ignore changes to the docId, ts and primaryKeys.
|
|
29192
29627
|
if (ignoredKeys.includes((_a = diff.path) === null || _a === void 0 ? void 0 : _a[0]))
|
|
@@ -29689,18 +30124,6 @@ function validateFieldName(fieldName) {
|
|
|
29689
30124
|
fieldName);
|
|
29690
30125
|
}
|
|
29691
30126
|
}
|
|
29692
|
-
// TODO: remove if not used
|
|
29693
|
-
function validateQueryCondition(condition) {
|
|
29694
|
-
if (!condition) {
|
|
29695
|
-
throw new Error('Condition cannot be empty');
|
|
29696
|
-
}
|
|
29697
|
-
if (!condition.operator ||
|
|
29698
|
-
!['==', '!=', '>', '>=', '<', '<=', 'like', 'not like', 'like_cs', 'not like_cs'].includes(condition.operator)) {
|
|
29699
|
-
throw new Error('Unsupported operator: ' + condition.operator);
|
|
29700
|
-
}
|
|
29701
|
-
validateFieldName(condition.fieldName);
|
|
29702
|
-
// TODO - figure out how to validate the value
|
|
29703
|
-
}
|
|
29704
30127
|
function validateFieldSort(fieldSort) {
|
|
29705
30128
|
if (!(fieldSort instanceof Object)) {
|
|
29706
30129
|
throw new Error('Field sort has to be an object');
|
|
@@ -29929,13 +30352,13 @@ schema_types_ajv.addKeyword({
|
|
|
29929
30352
|
});
|
|
29930
30353
|
schema_types_ajv.addKeyword({
|
|
29931
30354
|
keyword: 'applyDefaultValueOn',
|
|
29932
|
-
validate: (applyDefaultValueOn
|
|
30355
|
+
validate: (applyDefaultValueOn) => {
|
|
29933
30356
|
return applyDefaultValueOn ? ['always', 'empty', 'updateOrEmpty'].includes(applyDefaultValueOn) : true;
|
|
29934
30357
|
},
|
|
29935
30358
|
});
|
|
29936
30359
|
schema_types_ajv.addKeyword({
|
|
29937
30360
|
keyword: 'dataType',
|
|
29938
|
-
validate: (
|
|
30361
|
+
validate: () => {
|
|
29939
30362
|
return true;
|
|
29940
30363
|
},
|
|
29941
30364
|
});
|
|
@@ -30033,7 +30456,7 @@ function findMatchingPropertiesForKey(schema, key) {
|
|
|
30033
30456
|
.filter(([pattern]) => {
|
|
30034
30457
|
return new RegExp(pattern).test(key);
|
|
30035
30458
|
})
|
|
30036
|
-
.map(([
|
|
30459
|
+
.map(([, matchedProperty]) => matchedProperty));
|
|
30037
30460
|
}
|
|
30038
30461
|
return matchingProperties;
|
|
30039
30462
|
}
|
|
@@ -30135,6 +30558,18 @@ const SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR;
|
|
|
30135
30558
|
const SECONDS_PER_WEEK = 7 * SECONDS_PER_DAY;
|
|
30136
30559
|
/** @internal */
|
|
30137
30560
|
const SECONDS_PER_MONTH = 30 * SECONDS_PER_DAY;
|
|
30561
|
+
/** @internal */
|
|
30562
|
+
const MILLIS_PER_SECOND = 1000;
|
|
30563
|
+
/** @internal */
|
|
30564
|
+
const MILLIS_PER_MINUTE = SECONDS_PER_MINUTE * MILLIS_PER_SECOND;
|
|
30565
|
+
/** @internal */
|
|
30566
|
+
const MILLIS_PER_HOUR = SECONDS_PER_HOUR * MILLIS_PER_SECOND;
|
|
30567
|
+
/** @internal */
|
|
30568
|
+
const MILLIS_PER_DAY = SECONDS_PER_DAY * MILLIS_PER_SECOND;
|
|
30569
|
+
/** @internal */
|
|
30570
|
+
const MILLIS_PER_WEEK = SECONDS_PER_WEEK * MILLIS_PER_SECOND;
|
|
30571
|
+
/** @internal */
|
|
30572
|
+
const MILLIS_PER_MONTH = SECONDS_PER_MONTH * MILLIS_PER_SECOND;
|
|
30138
30573
|
|
|
30139
30574
|
;// CONCATENATED MODULE: ../common/src/utils/array.ts
|
|
30140
30575
|
|
|
@@ -30287,7 +30722,7 @@ class LockManager {
|
|
|
30287
30722
|
}
|
|
30288
30723
|
const relevantLocks = Object.entries(this.locks)
|
|
30289
30724
|
.filter(([mutex]) => mutexes.includes(mutex))
|
|
30290
|
-
.map(([
|
|
30725
|
+
.map(([, isLockedSubject]) => isLockedSubject);
|
|
30291
30726
|
await (0,external_rxjs_namespaceObject.lastValueFrom)((0,external_rxjs_namespaceObject.combineLatest)(relevantLocks).pipe((0,external_rxjs_namespaceObject.filter)((isLockedArray) => !isLockedArray.includes(true)), (0,external_rxjs_namespaceObject.take)(1)));
|
|
30292
30727
|
await this.lock(...mutexes);
|
|
30293
30728
|
}
|
|
@@ -30399,7 +30834,7 @@ function createWebSocketWrapper(url, opts = {}) {
|
|
|
30399
30834
|
};
|
|
30400
30835
|
ws.onclose = function (e) {
|
|
30401
30836
|
$.connected = false;
|
|
30402
|
-
if (e.code !== 4999) {
|
|
30837
|
+
if (e.code !== 4999 && e.code !== 4001) {
|
|
30403
30838
|
DebugLogger.debug('WebSocket closed. Reconnecting. Close code: ', e.code);
|
|
30404
30839
|
(opts.onclose || noop)(e);
|
|
30405
30840
|
$.reconnect(e);
|
|
@@ -32999,12 +33434,13 @@ class AiChatbotClientFactory {
|
|
|
32999
33434
|
this.socketManager = socketManager;
|
|
33000
33435
|
this.chatbotsMap = new Map();
|
|
33001
33436
|
}
|
|
33002
|
-
|
|
33003
|
-
|
|
33437
|
+
/** @internal */
|
|
33438
|
+
getChatbot(aiIntegrationId) {
|
|
33439
|
+
let client = this.chatbotsMap.get(aiIntegrationId);
|
|
33004
33440
|
if (client)
|
|
33005
33441
|
return client;
|
|
33006
|
-
client = new AiChatbotClient(this.rpcManager, this.socketManager,
|
|
33007
|
-
this.chatbotsMap.set(
|
|
33442
|
+
client = new AiChatbotClient(this.rpcManager, this.socketManager, aiIntegrationId);
|
|
33443
|
+
this.chatbotsMap.set(aiIntegrationId, client);
|
|
33008
33444
|
return client;
|
|
33009
33445
|
}
|
|
33010
33446
|
}
|
|
@@ -33027,11 +33463,12 @@ class ApiManager {
|
|
|
33027
33463
|
serverUrlOverride: this.apiServerUrlOverrideMapping[integrationId],
|
|
33028
33464
|
};
|
|
33029
33465
|
return (0,external_rxjs_namespaceObject.race)((0,external_rxjs_namespaceObject.from)(this.rpcManager.post('api/call', callApiRequest)).pipe(map_map(response => {
|
|
33466
|
+
const parsedPayload = response.payload ? deserializeObj(response.payload) : undefined;
|
|
33030
33467
|
if (response.success) {
|
|
33031
|
-
return
|
|
33468
|
+
return parsedPayload;
|
|
33032
33469
|
}
|
|
33033
33470
|
else {
|
|
33034
|
-
throw new Error(`Got error while calling API (HTTP Status ${response.httpStatus})`);
|
|
33471
|
+
throw new Error(`Got error while calling API (HTTP Status ${response.httpStatus}). Message: ${parsedPayload === null || parsedPayload === void 0 ? void 0 : parsedPayload['message']}`);
|
|
33035
33472
|
}
|
|
33036
33473
|
})), this.clientIdService.observeClientTooOld().pipe(map_map(() => {
|
|
33037
33474
|
throw new Error('CLIENT_NOT_CONNECTED');
|
|
@@ -33039,52 +33476,12 @@ class ApiManager {
|
|
|
33039
33476
|
}
|
|
33040
33477
|
}
|
|
33041
33478
|
|
|
33042
|
-
;// CONCATENATED MODULE: ../node_modules/rxjs/dist/esm5/internal/util/isPromise.js
|
|
33043
|
-
|
|
33044
|
-
function isPromise(value) {
|
|
33045
|
-
return isFunction(value === null || value === void 0 ? void 0 : value.then);
|
|
33046
|
-
}
|
|
33047
|
-
//# sourceMappingURL=isPromise.js.map
|
|
33048
33479
|
;// CONCATENATED MODULE: ./src/auth.manager.ts
|
|
33049
|
-
|
|
33050
|
-
|
|
33051
|
-
|
|
33052
33480
|
class AuthManager {
|
|
33053
33481
|
constructor(apiKey, authProvider) {
|
|
33054
33482
|
this.apiKey = apiKey;
|
|
33055
33483
|
this.authProvider = authProvider;
|
|
33056
33484
|
}
|
|
33057
|
-
/**
|
|
33058
|
-
* Sets a new ID token or an ID token provider.
|
|
33059
|
-
* @deprecated: Pass the provider via constructor options parameters or `setAuthTokenProvider()`.
|
|
33060
|
-
*/
|
|
33061
|
-
setAuthIdToken(tokenArg, integrationId) {
|
|
33062
|
-
// Using this warning in Datadog, we can track how many active clients use the deprecated API.
|
|
33063
|
-
console.warn('Using a deprecated setAuthIdToken method.');
|
|
33064
|
-
// Convert the input into AuthTokenProvider.
|
|
33065
|
-
if (typeof tokenArg === 'string' || tokenArg === undefined) {
|
|
33066
|
-
this.setAuthProviderForDeprecatedCode(async () => tokenArg, integrationId);
|
|
33067
|
-
return;
|
|
33068
|
-
}
|
|
33069
|
-
if (typeof tokenArg === 'function') {
|
|
33070
|
-
this.setAuthProviderForDeprecatedCode(tokenArg, integrationId);
|
|
33071
|
-
return;
|
|
33072
|
-
}
|
|
33073
|
-
(0,dist.assertTruthy)(typeof tokenArg === 'object');
|
|
33074
|
-
if ((0,external_rxjs_namespaceObject.isObservable)(tokenArg)) {
|
|
33075
|
-
this.setAuthProviderForDeprecatedCode(() => (0,external_rxjs_namespaceObject.firstValueFrom)(tokenArg), integrationId);
|
|
33076
|
-
return;
|
|
33077
|
-
}
|
|
33078
|
-
if (isPromise(tokenArg)) {
|
|
33079
|
-
this.setAuthProviderForDeprecatedCode(() => tokenArg, integrationId);
|
|
33080
|
-
return;
|
|
33081
|
-
}
|
|
33082
|
-
// tokenArg is AuthTokenProvider.
|
|
33083
|
-
this.setAuthProviderForDeprecatedCode(tokenArg.getToken, tokenArg.integrationId || integrationId);
|
|
33084
|
-
}
|
|
33085
|
-
setAuthProviderForDeprecatedCode(getToken, integrationId) {
|
|
33086
|
-
this.authProvider = { getToken, integrationId };
|
|
33087
|
-
}
|
|
33088
33485
|
/**
|
|
33089
33486
|
* Sets a new auth-token provider to Squid.
|
|
33090
33487
|
* All future squid backend requests will use this token provider.
|
|
@@ -33184,7 +33581,7 @@ class ClientIdService {
|
|
|
33184
33581
|
observeClientReadyToBeRegenerated() {
|
|
33185
33582
|
return this.clientTooOldSubject.pipe(
|
|
33186
33583
|
// skip the initial connection
|
|
33187
|
-
(0,external_rxjs_namespaceObject.skip)(1), (0,external_rxjs_namespaceObject.filter)(v => !v), (0,external_rxjs_namespaceObject.map)(
|
|
33584
|
+
(0,external_rxjs_namespaceObject.skip)(1), (0,external_rxjs_namespaceObject.filter)(v => !v), (0,external_rxjs_namespaceObject.map)(() => undefined));
|
|
33188
33585
|
}
|
|
33189
33586
|
getClientId() {
|
|
33190
33587
|
return this.clientIdSubject.value;
|
|
@@ -33845,7 +34242,7 @@ class DataManager {
|
|
|
33845
34242
|
}
|
|
33846
34243
|
groupOutgoingMutationsByIntegrationId() {
|
|
33847
34244
|
const outgoingMutationsByIntegrationId = {};
|
|
33848
|
-
for (const [
|
|
34245
|
+
for (const [, outgoingMutations] of [...this.pendingOutgoingMutations.entries()]) {
|
|
33849
34246
|
const latestOutgoingMutation = outgoingMutations[outgoingMutations.length - 1];
|
|
33850
34247
|
if (latestOutgoingMutation && !latestOutgoingMutation.sentToServer) {
|
|
33851
34248
|
const integrationId = latestOutgoingMutation.mutation.squidDocIdObj.integrationId;
|
|
@@ -34132,7 +34529,7 @@ class DocumentReferenceFactory {
|
|
|
34132
34529
|
* @internal
|
|
34133
34530
|
*/
|
|
34134
34531
|
migrateDocIds(idResolutionMap) {
|
|
34135
|
-
for (const [
|
|
34532
|
+
for (const [, reference] of this.documents) {
|
|
34136
34533
|
reference.migrateDocIds(idResolutionMap);
|
|
34137
34534
|
}
|
|
34138
34535
|
Object.entries(idResolutionMap).forEach(([squidDocId, newSquidDocId]) => {
|
|
@@ -47446,9 +47843,9 @@ var extras = {
|
|
|
47446
47843
|
gql["default"] = gql;
|
|
47447
47844
|
/* harmony default export */ const lib = ((/* unused pure expression or super */ null && (gql)));
|
|
47448
47845
|
//# sourceMappingURL=index.js.map
|
|
47449
|
-
|
|
47450
|
-
|
|
47451
|
-
var
|
|
47846
|
+
// EXTERNAL MODULE: ../node_modules/cross-fetch/dist/browser-ponyfill.js
|
|
47847
|
+
var browser_ponyfill = __webpack_require__(9372);
|
|
47848
|
+
var browser_ponyfill_default = /*#__PURE__*/__webpack_require__.n(browser_ponyfill);
|
|
47452
47849
|
;// CONCATENATED MODULE: ./src/graphql-client.ts
|
|
47453
47850
|
|
|
47454
47851
|
|
|
@@ -47464,7 +47861,7 @@ class GraphQLClient {
|
|
|
47464
47861
|
link: new HttpLink({
|
|
47465
47862
|
uri: url,
|
|
47466
47863
|
headers: this.rpcManager.getStaticHeaders(),
|
|
47467
|
-
fetch: (
|
|
47864
|
+
fetch: (browser_ponyfill_default()),
|
|
47468
47865
|
}),
|
|
47469
47866
|
cache: new InMemoryCache(),
|
|
47470
47867
|
});
|
|
@@ -48377,7 +48774,7 @@ class QuerySubscriptionManager {
|
|
|
48377
48774
|
return this.allOngoingQueriesGotInitialResult(rootOngoingQuery);
|
|
48378
48775
|
}), (0,external_rxjs_namespaceObject.startWith)(undefined), (0,external_rxjs_namespaceObject.pairwise)(), filter(([before, after]) => {
|
|
48379
48776
|
return !lodash.isEqual(before, after);
|
|
48380
|
-
}), map_map(([
|
|
48777
|
+
}), map_map(([, after]) => after),
|
|
48381
48778
|
// This handles 'subscribe = false'
|
|
48382
48779
|
subscribe ? (0,external_rxjs_namespaceObject.tap)() : (0,external_rxjs_namespaceObject.take)(1), (0,external_rxjs_namespaceObject.finalize)(() => {
|
|
48383
48780
|
var _a;
|
|
@@ -49021,6 +49418,9 @@ class RateLimiter {
|
|
|
49021
49418
|
}
|
|
49022
49419
|
}
|
|
49023
49420
|
|
|
49421
|
+
;// CONCATENATED MODULE: external "axios"
|
|
49422
|
+
const external_axios_namespaceObject = require("axios");
|
|
49423
|
+
var external_axios_default = /*#__PURE__*/__webpack_require__.n(external_axios_namespaceObject);
|
|
49024
49424
|
;// CONCATENATED MODULE: ./src/rpc.manager.ts
|
|
49025
49425
|
|
|
49026
49426
|
|
|
@@ -49083,7 +49483,7 @@ class RpcManager {
|
|
|
49083
49483
|
getStaticHeaders() {
|
|
49084
49484
|
return this.staticHeaders;
|
|
49085
49485
|
}
|
|
49086
|
-
async post(path, message, files = []) {
|
|
49486
|
+
async post(path, message, files = [], filesFieldName = 'files') {
|
|
49087
49487
|
this.onGoingRpcCounter.next(this.onGoingRpcCounter.value + 1);
|
|
49088
49488
|
try {
|
|
49089
49489
|
await this.getRateLimiterBucket(path).consume();
|
|
@@ -49095,57 +49495,64 @@ class RpcManager {
|
|
|
49095
49495
|
headers = Object.assign(Object.assign({}, headers), authHeaders);
|
|
49096
49496
|
DebugLogger.debug(`sending request: path: ${path} message: ${JSON.stringify(message)}`);
|
|
49097
49497
|
const url = getApplicationUrl(this.region, this.appId, path);
|
|
49098
|
-
let
|
|
49099
|
-
|
|
49100
|
-
|
|
49101
|
-
|
|
49102
|
-
|
|
49103
|
-
|
|
49104
|
-
|
|
49105
|
-
|
|
49106
|
-
|
|
49107
|
-
|
|
49108
|
-
|
|
49109
|
-
|
|
49110
|
-
|
|
49498
|
+
let axiosResponse;
|
|
49499
|
+
try {
|
|
49500
|
+
if (files.length) {
|
|
49501
|
+
const formData = new FormData();
|
|
49502
|
+
files.forEach(file => {
|
|
49503
|
+
const blob = file instanceof Blob ? file : file.blob;
|
|
49504
|
+
const filename = file instanceof Blob ? undefined : file.name;
|
|
49505
|
+
formData.append(filesFieldName, blob, filename);
|
|
49506
|
+
});
|
|
49507
|
+
formData.append('body', serialization_serializeObj(message));
|
|
49508
|
+
// Make the axios call
|
|
49509
|
+
axiosResponse = await external_axios_default().post(url, formData, {
|
|
49510
|
+
headers: Object.assign({}, headers),
|
|
49511
|
+
responseType: 'text',
|
|
49512
|
+
});
|
|
49513
|
+
}
|
|
49514
|
+
else {
|
|
49515
|
+
axiosResponse = await external_axios_default().post(url, serialization_serializeObj(message), {
|
|
49516
|
+
headers: Object.assign(Object.assign({}, headers), { 'Content-Type': 'application/json' }),
|
|
49517
|
+
responseType: 'text',
|
|
49518
|
+
});
|
|
49519
|
+
}
|
|
49111
49520
|
}
|
|
49112
|
-
|
|
49113
|
-
|
|
49114
|
-
|
|
49115
|
-
|
|
49116
|
-
|
|
49117
|
-
|
|
49118
|
-
|
|
49521
|
+
catch (e) {
|
|
49522
|
+
if (e instanceof external_axios_namespaceObject.AxiosError) {
|
|
49523
|
+
const response = e.response;
|
|
49524
|
+
if (!response)
|
|
49525
|
+
throw e;
|
|
49526
|
+
let message;
|
|
49527
|
+
try {
|
|
49528
|
+
const errorResponse = this.tryDeserializing(response.data);
|
|
49529
|
+
message = typeof errorResponse === 'string' ? errorResponse : errorResponse['message'];
|
|
49530
|
+
}
|
|
49531
|
+
catch (_a) { }
|
|
49532
|
+
if (!message)
|
|
49533
|
+
message = response.statusText;
|
|
49534
|
+
throw new RpcError(response.status, response.statusText, response.headers, url, message);
|
|
49535
|
+
}
|
|
49536
|
+
else {
|
|
49537
|
+
throw e;
|
|
49538
|
+
}
|
|
49119
49539
|
}
|
|
49120
|
-
const parsedResponse =
|
|
49540
|
+
const parsedResponse = this.tryDeserializing(axiosResponse.data);
|
|
49121
49541
|
DebugLogger.debug(`received response: ${JSON.stringify(parsedResponse)}`);
|
|
49122
49542
|
return parsedResponse;
|
|
49123
49543
|
}
|
|
49124
|
-
catch (e) {
|
|
49125
|
-
DebugLogger.debug(`received error: ${JSON.stringify(e)}`);
|
|
49126
|
-
throw e;
|
|
49127
|
-
}
|
|
49128
49544
|
finally {
|
|
49129
49545
|
this.onGoingRpcCounter.next(this.onGoingRpcCounter.value - 1);
|
|
49130
49546
|
}
|
|
49131
49547
|
}
|
|
49132
|
-
|
|
49133
|
-
|
|
49134
|
-
|
|
49548
|
+
tryDeserializing(text) {
|
|
49549
|
+
if (!text)
|
|
49550
|
+
return undefined;
|
|
49135
49551
|
try {
|
|
49136
|
-
|
|
49137
|
-
try {
|
|
49138
|
-
json = deserializeObj(text);
|
|
49139
|
-
}
|
|
49140
|
-
catch (_a) { }
|
|
49141
|
-
}
|
|
49142
|
-
catch (_b) {
|
|
49143
|
-
text = 'Cannot read body';
|
|
49144
|
-
}
|
|
49145
|
-
if (!response.ok) {
|
|
49146
|
-
throw new RpcError(response.status, response.statusText, response.headers, response.url, json === null || json === void 0 ? void 0 : json['message']);
|
|
49552
|
+
return deserializeObj(text);
|
|
49147
49553
|
}
|
|
49148
|
-
|
|
49554
|
+
catch (_a) { }
|
|
49555
|
+
return text;
|
|
49149
49556
|
}
|
|
49150
49557
|
getRateLimiterBucket(path) {
|
|
49151
49558
|
if (path.startsWith('ai/chatbot')) {
|
|
@@ -49350,14 +49757,14 @@ class SocketManager {
|
|
|
49350
49757
|
this.socket = createWebSocketWrapper(socketUri, {
|
|
49351
49758
|
timeout: 5000,
|
|
49352
49759
|
onmessage: (e) => this.onMessage(e.data),
|
|
49353
|
-
onopen: (
|
|
49760
|
+
onopen: () => {
|
|
49354
49761
|
DebugLogger.debug(`Connection to socket established. Endpoint: ${endpoint}`);
|
|
49355
49762
|
},
|
|
49356
|
-
onreconnect: (
|
|
49763
|
+
onreconnect: () => {
|
|
49357
49764
|
DebugLogger.debug(`WebSocket reconnect event triggered`);
|
|
49358
49765
|
this.connectionReady.next(false);
|
|
49359
49766
|
},
|
|
49360
|
-
onclose: (
|
|
49767
|
+
onclose: () => {
|
|
49361
49768
|
DebugLogger.debug(`WebSocket onclose event triggered`);
|
|
49362
49769
|
this.connectionReady.next(false);
|
|
49363
49770
|
},
|
|
@@ -49521,10 +49928,25 @@ class NativeQueryManager {
|
|
|
49521
49928
|
}
|
|
49522
49929
|
|
|
49523
49930
|
;// CONCATENATED MODULE: ./src/ai-assistant-client.ts
|
|
49931
|
+
/**
|
|
49932
|
+
* Client class for interacting with an AI Assistant server.
|
|
49933
|
+
* Provides functionalities like creating and deleting assistants and threads,
|
|
49934
|
+
* querying assistants, and managing files associated with assistants and threads.
|
|
49935
|
+
*/
|
|
49524
49936
|
class AiAssistantClient {
|
|
49525
49937
|
constructor(rpcManager) {
|
|
49526
49938
|
this.rpcManager = rpcManager;
|
|
49527
49939
|
}
|
|
49940
|
+
/**
|
|
49941
|
+
* Creates a new AI assistant with specified characteristics.
|
|
49942
|
+
* @param name - The name of the assistant.
|
|
49943
|
+
* @param instructions - Instructions for the assistant.
|
|
49944
|
+
* @param functions - Array of function names annotated with "@aiFunction" in your Squid backend that will be
|
|
49945
|
+
* available tol the assistant.
|
|
49946
|
+
* @param toolTypes - Optional array of tool types. If you want to use files for retrieval, you must add them using
|
|
49947
|
+
* the addFileToAssistant method.
|
|
49948
|
+
* @returns A promise that resolves to the created assistant's ID.
|
|
49949
|
+
*/
|
|
49528
49950
|
async createAssistant(name, instructions, functions, toolTypes) {
|
|
49529
49951
|
const request = {
|
|
49530
49952
|
name,
|
|
@@ -49535,12 +49957,23 @@ class AiAssistantClient {
|
|
|
49535
49957
|
const response = await this.rpcManager.post('ai/assistant/createAssistant', request);
|
|
49536
49958
|
return response.assistantId;
|
|
49537
49959
|
}
|
|
49960
|
+
/**
|
|
49961
|
+
* Deletes an AI assistant.
|
|
49962
|
+
* @param assistantId - The ID of the assistant to be deleted.
|
|
49963
|
+
* @returns A promise that resolves when the assistant is deleted.
|
|
49964
|
+
*/
|
|
49538
49965
|
async deleteAssistant(assistantId) {
|
|
49539
49966
|
const request = {
|
|
49540
49967
|
assistantId,
|
|
49541
49968
|
};
|
|
49542
49969
|
await this.rpcManager.post('ai/assistant/deleteAssistant', request);
|
|
49543
49970
|
}
|
|
49971
|
+
/**
|
|
49972
|
+
* Creates a new thread for an AI assistant. A thread is a long-lived conversation with the assistant that you can
|
|
49973
|
+
* always send questions to.
|
|
49974
|
+
* @param assistantId - The ID of the assistant for which the thread is created.
|
|
49975
|
+
* @returns A promise that resolves to the created thread's ID.
|
|
49976
|
+
*/
|
|
49544
49977
|
async createThread(assistantId) {
|
|
49545
49978
|
const request = {
|
|
49546
49979
|
assistantId,
|
|
@@ -49548,35 +49981,98 @@ class AiAssistantClient {
|
|
|
49548
49981
|
const response = await this.rpcManager.post('ai/assistant/createThread', request);
|
|
49549
49982
|
return response.threadId;
|
|
49550
49983
|
}
|
|
49984
|
+
/**
|
|
49985
|
+
* Deletes a thread of an AI assistant.
|
|
49986
|
+
* @param threadId - The ID of the thread to be deleted.
|
|
49987
|
+
* @returns A promise that resolves when the thread is deleted.
|
|
49988
|
+
*/
|
|
49551
49989
|
async deleteThread(threadId) {
|
|
49552
49990
|
const request = {
|
|
49553
49991
|
threadId,
|
|
49554
49992
|
};
|
|
49555
49993
|
await this.rpcManager.post('ai/assistant/deleteThread', request);
|
|
49556
49994
|
}
|
|
49557
|
-
|
|
49995
|
+
/**
|
|
49996
|
+
* Queries an AI assistant within a specific thread.
|
|
49997
|
+
* @param assistantId - The ID of the assistant.
|
|
49998
|
+
* @param threadId - The ID of the thread.
|
|
49999
|
+
* @param prompt - The query prompt.
|
|
50000
|
+
* @param fileIds - Optional array of file IDs to include in the query. These file IDs need to be added using the
|
|
50001
|
+
* addFileToThread method.
|
|
50002
|
+
* @returns A promise that resolves to the assistant's response.
|
|
50003
|
+
*/
|
|
50004
|
+
async queryAssistant(assistantId, threadId, prompt, fileIds) {
|
|
49558
50005
|
const request = {
|
|
49559
50006
|
assistantId,
|
|
49560
50007
|
threadId,
|
|
49561
50008
|
prompt,
|
|
49562
|
-
|
|
50009
|
+
fileIds,
|
|
49563
50010
|
};
|
|
49564
50011
|
const response = await this.rpcManager.post('ai/assistant/queryAssistant', request);
|
|
49565
50012
|
return response.answer;
|
|
49566
50013
|
}
|
|
50014
|
+
/**
|
|
50015
|
+
* Adds a file to an AI assistant that can be available for retrieval or code analyzer.
|
|
50016
|
+
* @param assistantId - The ID of the assistant.
|
|
50017
|
+
* @param file - The file or blob and filename to be added.
|
|
50018
|
+
* @returns A promise that resolves to the ID of the added file.
|
|
50019
|
+
*/
|
|
50020
|
+
async addFileToAssistant(assistantId, file) {
|
|
50021
|
+
const request = { assistantId };
|
|
50022
|
+
const response = await this.rpcManager.post(`ai/assistant/addFileToAssistant`, request, [file], 'file');
|
|
50023
|
+
return response.fileId;
|
|
50024
|
+
}
|
|
50025
|
+
/**
|
|
50026
|
+
* Removes a file from an AI assistant.
|
|
50027
|
+
* @param assistantId - The ID of the assistant.
|
|
50028
|
+
* @param fileId - The ID of the file to be removed.
|
|
50029
|
+
* @returns A promise that resolves when the file is removed.
|
|
50030
|
+
*/
|
|
50031
|
+
async removeFileFromAssistant(assistantId, fileId) {
|
|
50032
|
+
const request = {
|
|
50033
|
+
assistantId,
|
|
50034
|
+
fileId,
|
|
50035
|
+
};
|
|
50036
|
+
await this.rpcManager.post('ai/assistant/removeFileFromAssistant', request);
|
|
50037
|
+
}
|
|
50038
|
+
/**
|
|
50039
|
+
* Adds a file to a specific thread of an AI assistant. These files can be used when asking a question in the thread.
|
|
50040
|
+
* @param threadId - The ID of the thread.
|
|
50041
|
+
* @param file - The file or blob and filename to be added.
|
|
50042
|
+
* @returns A promise that resolves to the ID of the added file.
|
|
50043
|
+
*/
|
|
50044
|
+
async addFileToThread(threadId, file) {
|
|
50045
|
+
const request = { threadId };
|
|
50046
|
+
const response = await this.rpcManager.post(`ai/assistant/addFileToThread`, request, [file], 'file');
|
|
50047
|
+
return response.fileId;
|
|
50048
|
+
}
|
|
49567
50049
|
}
|
|
49568
50050
|
|
|
49569
50051
|
;// CONCATENATED MODULE: ./src/ai.types.ts
|
|
49570
50052
|
|
|
50053
|
+
/**
|
|
50054
|
+
* AiClient class serves as a facade for interacting with different AI services.
|
|
50055
|
+
* It provides simplified access to AI chatbot and assistant functionalities
|
|
50056
|
+
* through its methods.
|
|
50057
|
+
*/
|
|
49571
50058
|
class AiClient {
|
|
49572
50059
|
constructor(aiChatbotClientFactory, rpcManager) {
|
|
49573
50060
|
this.aiChatbotClientFactory = aiChatbotClientFactory;
|
|
49574
50061
|
this.rpcManager = rpcManager;
|
|
49575
50062
|
this.aiAssistantClient = new AiAssistantClient(this.rpcManager);
|
|
49576
50063
|
}
|
|
49577
|
-
|
|
49578
|
-
|
|
50064
|
+
/**
|
|
50065
|
+
* Retrieves an AI chatbot client for a specific AI integration.
|
|
50066
|
+
* @param aiIntegrationId - The identifier for the AI integration.
|
|
50067
|
+
* @returns An instance of AiChatbotClient associated with the given AI integration ID.
|
|
50068
|
+
*/
|
|
50069
|
+
chatbot(aiIntegrationId) {
|
|
50070
|
+
return this.aiChatbotClientFactory.getChatbot(aiIntegrationId);
|
|
49579
50071
|
}
|
|
50072
|
+
/**
|
|
50073
|
+
* Retrieves the AI assistant client.
|
|
50074
|
+
* @returns An instance of AiAssistantClient.
|
|
50075
|
+
*/
|
|
49580
50076
|
assistant() {
|
|
49581
50077
|
return this.aiAssistantClient;
|
|
49582
50078
|
}
|
|
@@ -49655,23 +50151,6 @@ class Squid {
|
|
|
49655
50151
|
constructor(options) {
|
|
49656
50152
|
this.options = options;
|
|
49657
50153
|
this.destructManager = new DestructManager();
|
|
49658
|
-
// Note: The following methods are bound using arrow functions to ensure that if a user accesses the methods via
|
|
49659
|
-
// destructuring (i.e. `{ setAuthIdToken } = squid`) then `this` will still be bound to the Squid class.
|
|
49660
|
-
/**
|
|
49661
|
-
* Sets the authorization access token (OAuth2.0) that will be sent to the server and will be used for providing the
|
|
49662
|
-
* `auth` object to the security rules.
|
|
49663
|
-
*
|
|
49664
|
-
* @deprecated: pass `AuthTokenProvider` in the constructor of the class.
|
|
49665
|
-
*
|
|
49666
|
-
* @param accessToken The OAuth2.0 access token or a promise that resolves with the access token.
|
|
49667
|
-
* When undefined, no authorization information is sent.
|
|
49668
|
-
* The Observable variant of the parameter is deprecated and will be removed soon.
|
|
49669
|
-
* @param integrationId The id of the integration.
|
|
49670
|
-
* @returns void
|
|
49671
|
-
*/
|
|
49672
|
-
this.setAuthIdToken = (accessToken, integrationId) => {
|
|
49673
|
-
this.authManager.setAuthIdToken(accessToken, integrationId);
|
|
49674
|
-
};
|
|
49675
50154
|
/**
|
|
49676
50155
|
* Returns a reference to the collection in the provided integration.
|
|
49677
50156
|
*
|
|
@@ -49909,6 +50388,8 @@ class Squid {
|
|
|
49909
50388
|
static getInstances() {
|
|
49910
50389
|
return Object.values(Squid.squidInstancesMap);
|
|
49911
50390
|
}
|
|
50391
|
+
// Note: The following methods are bound using arrow functions to ensure that if a user accesses the methods via
|
|
50392
|
+
// destructuring (i.e. `{ setAuthProvider } = squid`) then `this` will still be bound to the Squid class.
|
|
49912
50393
|
/**
|
|
49913
50394
|
* Sets the authorization access token (OAuth2.0) provider that will be sent to the server and will be used for
|
|
49914
50395
|
* providing the `auth` object to the security rules.
|