@salesforce/platform-sdk 9.6.0 → 9.7.0
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/data/shared/graphql/cache/invoker.d.ts.map +1 -1
- package/dist/index.js +269 -260
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoker.d.ts","sourceRoot":"","sources":["../../../../../src/data/shared/graphql/cache/invoker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invoker.d.ts","sourceRoot":"","sources":["../../../../../src/data/shared/graphql/cache/invoker.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,uBAAuB,CAAC;AA6B1E,wBAAsB,qBAAqB,CAAC,CAAC,EAC5C,OAAO,EAAE,sCAAsC,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACtE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAkCzB"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { buildServiceDescriptor as
|
|
2
|
-
import { resolvedPromiseLike as w, ok as
|
|
3
|
-
import { print as
|
|
4
|
-
import { RetryPolicy as
|
|
5
|
-
import { buildServiceDescriptor as
|
|
6
|
-
import { buildServiceDescriptor as
|
|
7
|
-
import { buildInMemoryCacheInclusionPolicyService as
|
|
8
|
-
import { buildServiceDescriptor as
|
|
9
|
-
import { HttpCacheControlCommand as
|
|
10
|
-
import { encodeCoreEnvelopeContentsRaw as
|
|
11
|
-
import { SimpleCollector as
|
|
12
|
-
import { registerInstrumentedApp as
|
|
13
|
-
import { analyticsContextSchema as
|
|
1
|
+
import { buildServiceDescriptor as z, setHeader as _ } from "@conduit-client/service-fetch-network/v1";
|
|
2
|
+
import { resolvedPromiseLike as w, ok as D, err as P, stableJSONStringify as ee, DataNotFoundError as te, UserVisibleError as se, deepFreeze as E, isUserVisibleError as re } from "@conduit-client/utils";
|
|
3
|
+
import { print as R, parse as ne } from "@conduit-client/onestore-graphql-parser/v1";
|
|
4
|
+
import { RetryPolicy as ie, buildServiceDescriptor as oe } from "@conduit-client/service-retry/v1";
|
|
5
|
+
import { buildServiceDescriptor as ae } from "@conduit-client/service-cache/v1";
|
|
6
|
+
import { buildServiceDescriptor as ce } from "@conduit-client/service-cache-control/v1";
|
|
7
|
+
import { buildInMemoryCacheInclusionPolicyService as le } from "@conduit-client/service-cache-inclusion-policy/v1";
|
|
8
|
+
import { buildServiceDescriptor as ue } from "@conduit-client/service-pubsub/v1";
|
|
9
|
+
import { HttpCacheControlCommand as de } from "@conduit-client/command-http-cache-control/v1";
|
|
10
|
+
import { encodeCoreEnvelopeContentsRaw as he } from "o11y/collectors";
|
|
11
|
+
import { SimpleCollector as fe } from "o11y/simple_collector";
|
|
12
|
+
import { registerInstrumentedApp as pe } from "o11y/client";
|
|
13
|
+
import { analyticsContextSchema as ge, sessionSchema as me, pageViewSchema as ye, errorContextSchema as we, interactionSchema as be, customEventSchema as ve } from "o11y_schema/sf_mcpanalytics";
|
|
14
14
|
var c = /* @__PURE__ */ ((s) => (s.WebApp = "WebApp", s.MicroFrontend = "Micro-Frontend", s.OpenAI = "OpenAI", s.SalesforceACC = "Salesforce-ACC", s.MCPApps = "MCP-Apps", s.Mosaic = "Mosaic", s))(c || {});
|
|
15
|
-
const
|
|
16
|
-
function
|
|
15
|
+
const Ce = Se();
|
|
16
|
+
function Se() {
|
|
17
17
|
if (typeof window > "u")
|
|
18
18
|
return "Mosaic";
|
|
19
19
|
if (window.openai)
|
|
@@ -28,27 +28,27 @@ function ve() {
|
|
|
28
28
|
return s.$A || s.Aura ? "Salesforce-ACC" : "WebApp";
|
|
29
29
|
}
|
|
30
30
|
function C(s) {
|
|
31
|
-
return s ??
|
|
31
|
+
return s ?? Ce;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function A(s) {
|
|
34
34
|
return typeof s == "object" && s !== null && "jsonrpc" in s && s.jsonrpc === "2.0";
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
36
|
+
function Te(s) {
|
|
37
|
+
return A(s) && "id" in s && typeof s.id == "number" && "result" in s;
|
|
38
38
|
}
|
|
39
39
|
function j(s) {
|
|
40
|
-
return
|
|
40
|
+
return A(s) && "id" in s && typeof s.id == "number" && "error" in s;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return
|
|
42
|
+
function _e(s) {
|
|
43
|
+
return Te(s) || j(s);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
45
|
+
function Ee(s) {
|
|
46
|
+
return A(s) && "method" in s && typeof s.method == "string" && !("id" in s);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
48
|
+
function ns(s) {
|
|
49
|
+
return A(s) && "id" in s && typeof s.id == "number" && "method" in s && typeof s.method == "string";
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class Me {
|
|
52
52
|
targetOrigin;
|
|
53
53
|
/**
|
|
54
54
|
* @param targetOrigin - origin passed as the second argument to
|
|
@@ -69,7 +69,7 @@ class _e {
|
|
|
69
69
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
class
|
|
72
|
+
class Ae {
|
|
73
73
|
nextRequestId = 1;
|
|
74
74
|
pending = /* @__PURE__ */ new Map();
|
|
75
75
|
notificationHandlers = /* @__PURE__ */ new Map();
|
|
@@ -81,7 +81,7 @@ class Ee {
|
|
|
81
81
|
* `WindowPostMessageTransport`, which preserves the original
|
|
82
82
|
* `window.parent.postMessage` behaviour.
|
|
83
83
|
*/
|
|
84
|
-
constructor(e = new
|
|
84
|
+
constructor(e = new Me()) {
|
|
85
85
|
this.transport = e, this.transport.onMessage(this.onMessage);
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
@@ -110,14 +110,14 @@ class Ee {
|
|
|
110
110
|
* multiple protocols without cross-talk.
|
|
111
111
|
*/
|
|
112
112
|
onMessage = (e) => {
|
|
113
|
-
if (
|
|
113
|
+
if (_e(e)) {
|
|
114
114
|
const t = this.pending.get(e.id);
|
|
115
115
|
if (!t)
|
|
116
116
|
return;
|
|
117
117
|
this.pending.delete(e.id), j(e) ? t.reject(new Error(e.error.message || "Request failed")) : t.resolve(e.result);
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
if (
|
|
120
|
+
if (Ee(e)) {
|
|
121
121
|
const t = this.notificationHandlers.get(e.method);
|
|
122
122
|
t && t.forEach((r) => r(e.params));
|
|
123
123
|
}
|
|
@@ -181,9 +181,9 @@ class Ee {
|
|
|
181
181
|
this.transport.post(r);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function Ie() {
|
|
185
185
|
}
|
|
186
|
-
class
|
|
186
|
+
class is {
|
|
187
187
|
#e;
|
|
188
188
|
#s = /* @__PURE__ */ new Set();
|
|
189
189
|
#n = !1;
|
|
@@ -225,7 +225,7 @@ class rs {
|
|
|
225
225
|
*/
|
|
226
226
|
onMessage(e) {
|
|
227
227
|
if (this.#r)
|
|
228
|
-
return
|
|
228
|
+
return Ie;
|
|
229
229
|
this.#s.add(e), this.#n || this.#o();
|
|
230
230
|
let t = !1;
|
|
231
231
|
return () => {
|
|
@@ -279,8 +279,8 @@ class rs {
|
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
|
-
const
|
|
283
|
-
class y extends
|
|
282
|
+
const ke = 500, De = "2026-01-26";
|
|
283
|
+
class y extends Ae {
|
|
284
284
|
static initPromise = null;
|
|
285
285
|
hostCtx = {};
|
|
286
286
|
_handshakeSucceeded = !1;
|
|
@@ -311,11 +311,11 @@ class y extends Ee {
|
|
|
311
311
|
* still render (graceful degradation for non-SEP-1865 hosts).
|
|
312
312
|
*/
|
|
313
313
|
async handshake(e) {
|
|
314
|
-
const t = e?.handshakeTimeoutMs ??
|
|
314
|
+
const t = e?.handshakeTimeoutMs ?? ke, r = e?.appInfo ?? { name: "mcp-app", version: "1.0.0" };
|
|
315
315
|
try {
|
|
316
316
|
const n = /* @__PURE__ */ Symbol("timeout"), i = await Promise.race([
|
|
317
317
|
this.request("ui/initialize", {
|
|
318
|
-
protocolVersion:
|
|
318
|
+
protocolVersion: De,
|
|
319
319
|
appInfo: r,
|
|
320
320
|
appCapabilities: {}
|
|
321
321
|
}),
|
|
@@ -351,7 +351,7 @@ class y extends Ee {
|
|
|
351
351
|
super.registerNotificationHandler(e, t);
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
const
|
|
354
|
+
const Pe = {
|
|
355
355
|
callTool: !0,
|
|
356
356
|
sendMessageToHost: !0,
|
|
357
357
|
readResource: !0,
|
|
@@ -372,7 +372,7 @@ const ke = {
|
|
|
372
372
|
// TODO
|
|
373
373
|
getTheme: !0,
|
|
374
374
|
resize: !0
|
|
375
|
-
},
|
|
375
|
+
}, Le = {
|
|
376
376
|
callTool: !0,
|
|
377
377
|
sendMessageToHost: !0,
|
|
378
378
|
readResource: !1,
|
|
@@ -392,7 +392,7 @@ const ke = {
|
|
|
392
392
|
displayModal: !0,
|
|
393
393
|
getTheme: !0,
|
|
394
394
|
resize: !1
|
|
395
|
-
},
|
|
395
|
+
}, xe = {
|
|
396
396
|
callTool: !1,
|
|
397
397
|
sendMessageToHost: !0,
|
|
398
398
|
readResource: !1,
|
|
@@ -412,7 +412,7 @@ const ke = {
|
|
|
412
412
|
displayModal: !1,
|
|
413
413
|
getTheme: !0,
|
|
414
414
|
resize: !1
|
|
415
|
-
},
|
|
415
|
+
}, Re = {
|
|
416
416
|
callTool: !1,
|
|
417
417
|
sendMessageToHost: !1,
|
|
418
418
|
readResource: !1,
|
|
@@ -433,26 +433,26 @@ const ke = {
|
|
|
433
433
|
getTheme: !1,
|
|
434
434
|
resize: !1
|
|
435
435
|
};
|
|
436
|
-
function
|
|
436
|
+
function os(s) {
|
|
437
437
|
switch (s) {
|
|
438
438
|
case c.MCPApps:
|
|
439
|
-
return { ...
|
|
439
|
+
return { ...Pe };
|
|
440
440
|
case c.OpenAI:
|
|
441
|
-
return { ...
|
|
441
|
+
return { ...Le };
|
|
442
442
|
case c.SalesforceACC:
|
|
443
|
-
return { ...
|
|
443
|
+
return { ...xe };
|
|
444
444
|
case c.Mosaic:
|
|
445
445
|
case c.WebApp:
|
|
446
446
|
case c.MicroFrontend:
|
|
447
447
|
default:
|
|
448
|
-
return { ...
|
|
448
|
+
return { ...Re };
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
const
|
|
452
|
-
function
|
|
451
|
+
const Oe = /* @__PURE__ */ new Set(["then", "catch", "finally"]);
|
|
452
|
+
function I(s, e) {
|
|
453
453
|
return new Proxy(s, {
|
|
454
454
|
get(t, r, n) {
|
|
455
|
-
if (typeof r == "symbol" ||
|
|
455
|
+
if (typeof r == "symbol" || Oe.has(r)) {
|
|
456
456
|
const i = Reflect.get(t, r, n);
|
|
457
457
|
return typeof i == "function" ? i.bind(t) : i;
|
|
458
458
|
}
|
|
@@ -463,7 +463,7 @@ Use \`const sdk = await ${e}();\` before accessing SDK methods.`
|
|
|
463
463
|
}
|
|
464
464
|
});
|
|
465
465
|
}
|
|
466
|
-
class
|
|
466
|
+
class He {
|
|
467
467
|
constructor(e) {
|
|
468
468
|
this.session = e;
|
|
469
469
|
const t = e.getHostContext();
|
|
@@ -599,8 +599,8 @@ class Re {
|
|
|
599
599
|
this.subscriptions.forEach((e) => e());
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
const
|
|
603
|
-
class
|
|
602
|
+
const F = "openai:set_globals";
|
|
603
|
+
class qe {
|
|
604
604
|
sendMessageToHost(e) {
|
|
605
605
|
return window.openai.sendFollowUpMessage({ prompt: e.content });
|
|
606
606
|
}
|
|
@@ -635,12 +635,12 @@ class Oe {
|
|
|
635
635
|
}
|
|
636
636
|
subscribe(e) {
|
|
637
637
|
const t = () => e();
|
|
638
|
-
return window.addEventListener(
|
|
639
|
-
window.removeEventListener(
|
|
638
|
+
return window.addEventListener(F, t), () => {
|
|
639
|
+
window.removeEventListener(F, t);
|
|
640
640
|
};
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
class
|
|
643
|
+
class Ne {
|
|
644
644
|
async sendMessageToHost(e) {
|
|
645
645
|
throw console.warn("SalesforceACCChatSDK.sendMessageToHost: stub implementation", e), new Error("SalesforceACCChatSDK.sendMessageToHost not yet implemented");
|
|
646
646
|
}
|
|
@@ -648,31 +648,31 @@ class He {
|
|
|
648
648
|
return console.warn("SalesforceACCChatSDK.followUpActions: stub implementation"), [];
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
|
-
let S = null,
|
|
652
|
-
function
|
|
653
|
-
return S || (S =
|
|
651
|
+
let S = null, O = null;
|
|
652
|
+
function Fe(s) {
|
|
653
|
+
return S || (S = Ue(s).then((e) => (O = e, e))), S;
|
|
654
654
|
}
|
|
655
|
-
function
|
|
656
|
-
return
|
|
655
|
+
function as() {
|
|
656
|
+
return O;
|
|
657
657
|
}
|
|
658
|
-
function
|
|
659
|
-
S = null,
|
|
658
|
+
function cs() {
|
|
659
|
+
S = null, O = null;
|
|
660
660
|
}
|
|
661
|
-
function
|
|
662
|
-
return
|
|
661
|
+
function Ue(s) {
|
|
662
|
+
return I(
|
|
663
663
|
(async () => {
|
|
664
664
|
switch (C(s?.surface)) {
|
|
665
665
|
case c.OpenAI:
|
|
666
|
-
return new
|
|
666
|
+
return new qe();
|
|
667
667
|
case c.WebApp:
|
|
668
668
|
case c.Mosaic:
|
|
669
669
|
return {};
|
|
670
670
|
case c.SalesforceACC:
|
|
671
|
-
return new
|
|
671
|
+
return new Ne();
|
|
672
672
|
case c.MicroFrontend:
|
|
673
673
|
case c.MCPApps: {
|
|
674
674
|
const t = await y.getInstance(s?.mcpApps);
|
|
675
|
-
return t.handshakeSucceeded ? new
|
|
675
|
+
return t.handshakeSucceeded ? new He(t) : {};
|
|
676
676
|
}
|
|
677
677
|
default:
|
|
678
678
|
return {};
|
|
@@ -681,7 +681,7 @@ function Ne(s) {
|
|
|
681
681
|
"createChatSDK"
|
|
682
682
|
);
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function Ve(s) {
|
|
685
685
|
switch (s) {
|
|
686
686
|
case "info":
|
|
687
687
|
return "ℹ️";
|
|
@@ -695,10 +695,10 @@ function Fe(s) {
|
|
|
695
695
|
return "ℹ️";
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
function
|
|
699
|
-
return `${
|
|
698
|
+
function L(s, e) {
|
|
699
|
+
return `${Ve(e)} ${s}`;
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function U(s, e) {
|
|
702
702
|
const t = s.trim();
|
|
703
703
|
if (t === "")
|
|
704
704
|
return { success: !0, value: void 0 };
|
|
@@ -714,7 +714,7 @@ function F(s, e) {
|
|
|
714
714
|
error: `Invalid ${e}: "${s}". Value must be a positive number.`
|
|
715
715
|
} : { success: !0, value: n };
|
|
716
716
|
}
|
|
717
|
-
class
|
|
717
|
+
class We {
|
|
718
718
|
constructor(e) {
|
|
719
719
|
this.session = e;
|
|
720
720
|
}
|
|
@@ -724,7 +724,7 @@ class Ue {
|
|
|
724
724
|
* @param level - The message severity level (defaults to "info")
|
|
725
725
|
*/
|
|
726
726
|
async sendMessage(e, t = "info") {
|
|
727
|
-
const r =
|
|
727
|
+
const r = L(e, t);
|
|
728
728
|
await this.session.request("ui/message", {
|
|
729
729
|
role: "user",
|
|
730
730
|
content: [
|
|
@@ -749,23 +749,23 @@ class Ue {
|
|
|
749
749
|
return e ? { mode: e } : null;
|
|
750
750
|
}
|
|
751
751
|
async resize(e, t) {
|
|
752
|
-
const r =
|
|
752
|
+
const r = U(e, "width");
|
|
753
753
|
if (!r.success)
|
|
754
754
|
return Promise.reject(new Error(r.error));
|
|
755
|
-
const n =
|
|
755
|
+
const n = U(t, "height");
|
|
756
756
|
if (!n.success)
|
|
757
757
|
return Promise.reject(new Error(n.error));
|
|
758
758
|
const i = {};
|
|
759
759
|
return r.value !== void 0 && (i.width = r.value), n.value !== void 0 && (i.height = n.value), this.session.sendNotification("ui/notifications/size-changed", i), Promise.resolve();
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
class
|
|
762
|
+
class $e {
|
|
763
763
|
async displayAlert(e) {
|
|
764
|
-
const t = e.level || "info", r =
|
|
764
|
+
const t = e.level || "info", r = L(e.message, t);
|
|
765
765
|
await window.openai.sendFollowUpMessage({ prompt: r });
|
|
766
766
|
}
|
|
767
767
|
async displayToast(e) {
|
|
768
|
-
const t = e.level || "info", r =
|
|
768
|
+
const t = e.level || "info", r = L(e.message, t);
|
|
769
769
|
await window.openai.sendFollowUpMessage({ prompt: r });
|
|
770
770
|
}
|
|
771
771
|
async displayModal(e) {
|
|
@@ -779,22 +779,22 @@ class Ve {
|
|
|
779
779
|
return e ? { mode: e } : null;
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
|
-
let T = null,
|
|
783
|
-
function
|
|
784
|
-
return T || (T =
|
|
782
|
+
let T = null, H = null;
|
|
783
|
+
function ls(s) {
|
|
784
|
+
return T || (T = Ke(s).then((e) => (H = e, e))), T;
|
|
785
785
|
}
|
|
786
|
-
function
|
|
787
|
-
return
|
|
786
|
+
function us() {
|
|
787
|
+
return H;
|
|
788
788
|
}
|
|
789
|
-
function
|
|
790
|
-
T = null,
|
|
789
|
+
function ds() {
|
|
790
|
+
T = null, H = null;
|
|
791
791
|
}
|
|
792
|
-
function
|
|
793
|
-
return
|
|
792
|
+
function Ke(s) {
|
|
793
|
+
return I(
|
|
794
794
|
(async () => {
|
|
795
795
|
switch (C(s?.surface)) {
|
|
796
796
|
case c.OpenAI:
|
|
797
|
-
return new
|
|
797
|
+
return new $e();
|
|
798
798
|
case c.WebApp:
|
|
799
799
|
case c.Mosaic:
|
|
800
800
|
return {};
|
|
@@ -803,7 +803,7 @@ function We(s) {
|
|
|
803
803
|
case c.MicroFrontend:
|
|
804
804
|
case c.MCPApps: {
|
|
805
805
|
const t = await y.getInstance(s?.mcpApps);
|
|
806
|
-
return t.handshakeSucceeded ? new
|
|
806
|
+
return t.handshakeSucceeded ? new We(t) : {};
|
|
807
807
|
}
|
|
808
808
|
default:
|
|
809
809
|
return {};
|
|
@@ -812,7 +812,7 @@ function We(s) {
|
|
|
812
812
|
"createViewSDK"
|
|
813
813
|
);
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function Be(s) {
|
|
816
816
|
return (e) => {
|
|
817
817
|
const [t, r] = e;
|
|
818
818
|
if (typeof t == "string" && !t.startsWith("http")) {
|
|
@@ -822,26 +822,26 @@ function $e(s) {
|
|
|
822
822
|
return w(e);
|
|
823
823
|
};
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function ze(s) {
|
|
826
826
|
return (e) => w(_("Authorization", `Bearer ${s}`, e));
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function je(s, e) {
|
|
829
829
|
const t = [];
|
|
830
|
-
return s && t.push(
|
|
830
|
+
return s && t.push(Be(s)), e && t.push(ze(e)), z({
|
|
831
831
|
request: t
|
|
832
832
|
}).service;
|
|
833
833
|
}
|
|
834
|
-
const
|
|
835
|
-
},
|
|
834
|
+
const M = () => {
|
|
835
|
+
}, x = async () => {
|
|
836
836
|
};
|
|
837
|
-
function
|
|
837
|
+
function q(s) {
|
|
838
838
|
try {
|
|
839
|
-
return
|
|
839
|
+
return D(ne(s));
|
|
840
840
|
} catch (e) {
|
|
841
|
-
return
|
|
841
|
+
return P(b(e));
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function N(s, e) {
|
|
845
845
|
const t = s.definitions.filter(
|
|
846
846
|
(r) => r.kind === "OperationDefinition"
|
|
847
847
|
);
|
|
@@ -856,9 +856,9 @@ function b(s) {
|
|
|
856
856
|
return s instanceof Error ? [{ message: s.message }] : typeof s == "string" ? [{ message: s }] : [{ message: "Unknown error" }];
|
|
857
857
|
}
|
|
858
858
|
async function Q(s, { mutation: e, variables: t, operationName: r }) {
|
|
859
|
-
const n =
|
|
859
|
+
const n = q(e);
|
|
860
860
|
if (n.isErr()) return { data: void 0, errors: n.error };
|
|
861
|
-
const i = n.value, o =
|
|
861
|
+
const i = n.value, o = N(i, r);
|
|
862
862
|
if (o !== "mutation")
|
|
863
863
|
return {
|
|
864
864
|
data: void 0,
|
|
@@ -870,7 +870,7 @@ async function Q(s, { mutation: e, variables: t, operationName: r }) {
|
|
|
870
870
|
};
|
|
871
871
|
try {
|
|
872
872
|
const a = await s({
|
|
873
|
-
query:
|
|
873
|
+
query: R(i),
|
|
874
874
|
variables: t,
|
|
875
875
|
operationName: r
|
|
876
876
|
});
|
|
@@ -885,7 +885,7 @@ async function Q(s, { mutation: e, variables: t, operationName: r }) {
|
|
|
885
885
|
function G(s) {
|
|
886
886
|
function e(r, n, i) {
|
|
887
887
|
return s({
|
|
888
|
-
query:
|
|
888
|
+
query: R(r),
|
|
889
889
|
variables: n,
|
|
890
890
|
operationName: i
|
|
891
891
|
}).then(
|
|
@@ -901,15 +901,15 @@ function G(s) {
|
|
|
901
901
|
variables: n,
|
|
902
902
|
operationName: i
|
|
903
903
|
}) {
|
|
904
|
-
const o =
|
|
904
|
+
const o = q(r);
|
|
905
905
|
if (o.isErr())
|
|
906
906
|
return {
|
|
907
907
|
data: void 0,
|
|
908
908
|
errors: o.error,
|
|
909
|
-
subscribe: () =>
|
|
910
|
-
refresh:
|
|
909
|
+
subscribe: () => M,
|
|
910
|
+
refresh: x
|
|
911
911
|
};
|
|
912
|
-
const a = o.value, h =
|
|
912
|
+
const a = o.value, h = N(a, i);
|
|
913
913
|
if (h !== "query")
|
|
914
914
|
return {
|
|
915
915
|
data: void 0,
|
|
@@ -918,8 +918,8 @@ function G(s) {
|
|
|
918
918
|
message: `DataSDK.graphql.query() requires a GraphQL query, received ${h}.`
|
|
919
919
|
}
|
|
920
920
|
],
|
|
921
|
-
subscribe: () =>
|
|
922
|
-
refresh:
|
|
921
|
+
subscribe: () => M,
|
|
922
|
+
refresh: x
|
|
923
923
|
};
|
|
924
924
|
const d = /* @__PURE__ */ new Set(), p = n, f = await e(a, p, i);
|
|
925
925
|
return {
|
|
@@ -941,17 +941,17 @@ function G(s) {
|
|
|
941
941
|
mutate: (r) => Q(s, r)
|
|
942
942
|
};
|
|
943
943
|
}
|
|
944
|
-
const
|
|
945
|
-
function J(s =
|
|
944
|
+
const Qe = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
|
|
945
|
+
function J(s = Qe) {
|
|
946
946
|
return `/services/data/v${s}`;
|
|
947
947
|
}
|
|
948
|
-
class
|
|
948
|
+
class Ge {
|
|
949
949
|
clientFetch;
|
|
950
950
|
pathData;
|
|
951
951
|
graphql;
|
|
952
952
|
constructor(e) {
|
|
953
|
-
const t =
|
|
954
|
-
this.pathData = J(e?.apiVersion ?? t.apiVersion), this.clientFetch =
|
|
953
|
+
const t = Je(), r = Xe(e?.instanceUrl ?? t.instanceUrl), n = e?.accessToken ?? t.accessToken;
|
|
954
|
+
this.pathData = J(e?.apiVersion ?? t.apiVersion), this.clientFetch = je(r || void 0, n), this.graphql = G(this.executeRawGraphQL.bind(this));
|
|
955
955
|
}
|
|
956
956
|
async executeRawGraphQL({
|
|
957
957
|
query: e,
|
|
@@ -968,7 +968,7 @@ class je {
|
|
|
968
968
|
})).json();
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function Je() {
|
|
972
972
|
const s = globalThis.MOSAIC_ENV;
|
|
973
973
|
return {
|
|
974
974
|
instanceUrl: s?.instanceUrl,
|
|
@@ -976,13 +976,13 @@ function Qe() {
|
|
|
976
976
|
apiVersion: s?.apiVersion
|
|
977
977
|
};
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function Xe(s) {
|
|
980
980
|
if (!s || s === "/") return "";
|
|
981
981
|
let e = s;
|
|
982
982
|
return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
983
983
|
}
|
|
984
|
-
const
|
|
985
|
-
class
|
|
984
|
+
const Ye = "graphqlQuery";
|
|
985
|
+
class Ze {
|
|
986
986
|
graphql;
|
|
987
987
|
constructor() {
|
|
988
988
|
this.graphql = G(this.executeRawGraphQL.bind(this));
|
|
@@ -992,46 +992,46 @@ class Xe {
|
|
|
992
992
|
variables: t,
|
|
993
993
|
operationName: r
|
|
994
994
|
}) {
|
|
995
|
-
return (await window.openai.callTool(
|
|
995
|
+
return (await window.openai.callTool(Ye, {
|
|
996
996
|
query: e,
|
|
997
997
|
...t != null ? { variables: t } : {},
|
|
998
998
|
...r != null ? { operationName: r } : {}
|
|
999
999
|
})).structuredContent;
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
const
|
|
1003
|
-
let e = _(
|
|
1004
|
-
return e = _(
|
|
1005
|
-
},
|
|
1006
|
-
function
|
|
1002
|
+
const et = "X-SFDC-Client-Name", tt = "X-SFDC-Client-Version", st = "@salesforce/platform-sdk", rt = "9.7.0", nt = (s) => {
|
|
1003
|
+
let e = _(et, st, s);
|
|
1004
|
+
return e = _(tt, rt, e), w(e);
|
|
1005
|
+
}, it = "X-CSRF-Token";
|
|
1006
|
+
function ot(s, e = {}) {
|
|
1007
1007
|
const { protectedUrls: t = [], alwaysProtectedUrls: r = [] } = e;
|
|
1008
1008
|
return async (n) => {
|
|
1009
1009
|
const [i, o] = n, a = new Request(i, o);
|
|
1010
|
-
if (
|
|
1010
|
+
if (V(r, a.url) || at(a.method) && V(t, a.url)) {
|
|
1011
1011
|
const d = await s.getToken();
|
|
1012
|
-
n = _(
|
|
1012
|
+
n = _(it, d, n);
|
|
1013
1013
|
}
|
|
1014
1014
|
return w(n);
|
|
1015
1015
|
};
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1017
|
+
function at(s) {
|
|
1018
1018
|
const e = s.toLowerCase();
|
|
1019
1019
|
return e === "post" || e === "put" || e === "patch" || e === "delete";
|
|
1020
1020
|
}
|
|
1021
|
-
function
|
|
1021
|
+
function V(s, e) {
|
|
1022
1022
|
const t = new URL(e);
|
|
1023
1023
|
return s.some((r) => t.pathname.includes(r));
|
|
1024
1024
|
}
|
|
1025
|
-
function
|
|
1026
|
-
const t =
|
|
1025
|
+
function ct(s, e = {}) {
|
|
1026
|
+
const t = ot(s, e);
|
|
1027
1027
|
async function r(n) {
|
|
1028
1028
|
const i = await t(n);
|
|
1029
1029
|
return fetch(i[0], i[1]);
|
|
1030
1030
|
}
|
|
1031
1031
|
return (n, i) => i ? i.applyRetry(async () => r(n)) : r(n);
|
|
1032
1032
|
}
|
|
1033
|
-
const
|
|
1034
|
-
class
|
|
1033
|
+
const lt = [400, 401, 403];
|
|
1034
|
+
class ut extends ie {
|
|
1035
1035
|
constructor(e) {
|
|
1036
1036
|
super(e), this.csrfTokenManager = e;
|
|
1037
1037
|
}
|
|
@@ -1039,7 +1039,7 @@ class ct extends re {
|
|
|
1039
1039
|
* Determines if a failed request should be retried due to CSRF token issues.
|
|
1040
1040
|
*/
|
|
1041
1041
|
async shouldRetry(e, t) {
|
|
1042
|
-
return t.attempt >= 1 ? !1 :
|
|
1042
|
+
return t.attempt >= 1 ? !1 : lt.includes(e.status);
|
|
1043
1043
|
}
|
|
1044
1044
|
/**
|
|
1045
1045
|
* CSRF token refresh should happen immediately with no delay.
|
|
@@ -1057,7 +1057,7 @@ class ct extends re {
|
|
|
1057
1057
|
await this.csrfTokenManager.refreshToken();
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
|
-
class
|
|
1060
|
+
class dt {
|
|
1061
1061
|
constructor(e, t) {
|
|
1062
1062
|
this.endpoint = e, this.cacheName = t, this.tokenPromise = this.obtainToken();
|
|
1063
1063
|
}
|
|
@@ -1105,29 +1105,29 @@ class lt {
|
|
|
1105
1105
|
return;
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
-
const
|
|
1109
|
-
function
|
|
1108
|
+
const W = /* @__PURE__ */ new Map();
|
|
1109
|
+
function ht(s) {
|
|
1110
1110
|
const { endpoint: e, cacheName: t, ...r } = s.csrf;
|
|
1111
|
-
let n =
|
|
1112
|
-
return n || (n = new
|
|
1111
|
+
let n = W.get(e);
|
|
1112
|
+
return n || (n = new dt(e, t), W.set(e, n)), z(
|
|
1113
1113
|
{
|
|
1114
|
-
retry:
|
|
1115
|
-
request: [
|
|
1114
|
+
retry: ct(n, r),
|
|
1115
|
+
request: [nt]
|
|
1116
1116
|
},
|
|
1117
|
-
|
|
1117
|
+
oe(new ut(n)).service
|
|
1118
1118
|
).service;
|
|
1119
1119
|
}
|
|
1120
|
-
const
|
|
1121
|
-
function
|
|
1122
|
-
let e =
|
|
1120
|
+
const $ = /* @__PURE__ */ new Map();
|
|
1121
|
+
function ft(s) {
|
|
1122
|
+
let e = $.get(s);
|
|
1123
1123
|
if (!e) {
|
|
1124
|
-
const t =
|
|
1125
|
-
e = { cache: t, cacheController: n, pubSub: i },
|
|
1124
|
+
const t = ae().service, r = le(t).service, n = ce(t, r).service, i = ue().service;
|
|
1125
|
+
e = { cache: t, cacheController: n, pubSub: i }, $.set(s, e);
|
|
1126
1126
|
}
|
|
1127
1127
|
return e;
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
const t =
|
|
1129
|
+
function pt(s, e) {
|
|
1130
|
+
const t = ft(s);
|
|
1131
1131
|
return {
|
|
1132
1132
|
shared: t,
|
|
1133
1133
|
services: {
|
|
@@ -1144,8 +1144,8 @@ function X() {
|
|
|
1144
1144
|
"X-Chatter-Entity-Encoding": "false"
|
|
1145
1145
|
};
|
|
1146
1146
|
}
|
|
1147
|
-
const
|
|
1148
|
-
function
|
|
1147
|
+
const K = 300;
|
|
1148
|
+
function gt(s, e) {
|
|
1149
1149
|
try {
|
|
1150
1150
|
return JSON.parse(JSON.stringify(s));
|
|
1151
1151
|
} catch (t) {
|
|
@@ -1155,19 +1155,19 @@ function ft(s, e) {
|
|
|
1155
1155
|
throw n.cause = t, n;
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1158
|
+
function mt(s) {
|
|
1159
1159
|
if (typeof s == "object" && s.type === "max-age") {
|
|
1160
1160
|
const e = s.maxAge;
|
|
1161
|
-
return Number.isFinite(e) && e >= 0 ? e :
|
|
1161
|
+
return Number.isFinite(e) && e >= 0 ? e : K;
|
|
1162
1162
|
}
|
|
1163
|
-
return
|
|
1163
|
+
return K;
|
|
1164
1164
|
}
|
|
1165
|
-
class
|
|
1165
|
+
class yt extends de {
|
|
1166
1166
|
constructor(e, t, r) {
|
|
1167
|
-
super(t), this.url = r, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables =
|
|
1167
|
+
super(t), this.url = r, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = gt(
|
|
1168
1168
|
e.variables ?? {},
|
|
1169
1169
|
this.normalizedOperationName
|
|
1170
|
-
), this.cacheControl = e.cacheControl, this.resolvedMaxAge =
|
|
1170
|
+
), this.cacheControl = e.cacheControl, this.resolvedMaxAge = mt(e.cacheControl);
|
|
1171
1171
|
}
|
|
1172
1172
|
query;
|
|
1173
1173
|
normalizedVariables;
|
|
@@ -1189,7 +1189,7 @@ class gt extends le {
|
|
|
1189
1189
|
];
|
|
1190
1190
|
}
|
|
1191
1191
|
buildKey() {
|
|
1192
|
-
return
|
|
1192
|
+
return ee({
|
|
1193
1193
|
query: this.query,
|
|
1194
1194
|
variables: this.normalizedVariables,
|
|
1195
1195
|
operationName: this.normalizedOperationName
|
|
@@ -1210,7 +1210,7 @@ class gt extends le {
|
|
|
1210
1210
|
*/
|
|
1211
1211
|
readFromCache(e) {
|
|
1212
1212
|
const t = this.buildKey(), r = e.get(t)?.value;
|
|
1213
|
-
return r === void 0 ? w(
|
|
1213
|
+
return r === void 0 ? w(P(new te())) : w(D(r));
|
|
1214
1214
|
}
|
|
1215
1215
|
writeToCache(e, t) {
|
|
1216
1216
|
if (t.isOk() && t.value.data != null && Object.keys(t.value.data).length > 0) {
|
|
@@ -1240,23 +1240,32 @@ class gt extends le {
|
|
|
1240
1240
|
return e.errors && e.errors.length > 0;
|
|
1241
1241
|
}
|
|
1242
1242
|
processFetchReturnValue(e) {
|
|
1243
|
-
return this.responseHasErrors(e) ?
|
|
1243
|
+
return this.responseHasErrors(e) ? P(new se(e)) : D(e);
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Y(s) {
|
|
1247
|
+
if (re(s) && s.data && typeof s.data == "object") {
|
|
1248
|
+
const e = s.data;
|
|
1249
|
+
if (e.data != null)
|
|
1250
|
+
return e.data;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
function wt(s) {
|
|
1247
1254
|
return (e) => {
|
|
1248
1255
|
if (e.isOk()) {
|
|
1249
1256
|
const t = e.value;
|
|
1250
|
-
|
|
1251
|
-
} else
|
|
1252
|
-
|
|
1257
|
+
E(t), s({ data: t, errors: void 0 });
|
|
1258
|
+
} else {
|
|
1259
|
+
const t = Y(e.error);
|
|
1260
|
+
t && E(t), s({ data: t, errors: b(e.error) });
|
|
1261
|
+
}
|
|
1253
1262
|
};
|
|
1254
1263
|
}
|
|
1255
|
-
async function
|
|
1264
|
+
async function bt(s) {
|
|
1256
1265
|
let e, t, r;
|
|
1257
1266
|
try {
|
|
1258
1267
|
const n = await s.execute();
|
|
1259
|
-
n.isOk() ? (e = n.value.data,
|
|
1268
|
+
n.isOk() ? (e = n.value.data, E(e), r = (i) => n.value.subscribe(i)) : (e = Y(n.error.failure), e && E(e), t = b(n.error.failure), r = (i) => n.error.subscribe(i));
|
|
1260
1269
|
} catch (n) {
|
|
1261
1270
|
t = b(n);
|
|
1262
1271
|
}
|
|
@@ -1264,22 +1273,22 @@ async function yt(s) {
|
|
|
1264
1273
|
data: e,
|
|
1265
1274
|
errors: t,
|
|
1266
1275
|
subscribe(n) {
|
|
1267
|
-
return r ? r(
|
|
1276
|
+
return r ? r(wt(n)) : M;
|
|
1268
1277
|
},
|
|
1269
1278
|
async refresh() {
|
|
1270
1279
|
await s.refresh();
|
|
1271
1280
|
}
|
|
1272
1281
|
};
|
|
1273
1282
|
}
|
|
1274
|
-
function
|
|
1283
|
+
function k(s) {
|
|
1275
1284
|
return {
|
|
1276
1285
|
data: void 0,
|
|
1277
1286
|
errors: s,
|
|
1278
|
-
subscribe: () =>
|
|
1279
|
-
refresh:
|
|
1287
|
+
subscribe: () => M,
|
|
1288
|
+
refresh: x
|
|
1280
1289
|
};
|
|
1281
1290
|
}
|
|
1282
|
-
function
|
|
1291
|
+
function vt({
|
|
1283
1292
|
bundle: s,
|
|
1284
1293
|
url: e,
|
|
1285
1294
|
executeRaw: t
|
|
@@ -1291,20 +1300,20 @@ function wt({
|
|
|
1291
1300
|
operationName: a,
|
|
1292
1301
|
cacheControl: h
|
|
1293
1302
|
}) {
|
|
1294
|
-
const d =
|
|
1295
|
-
if (d.isErr()) return
|
|
1296
|
-
const p = d.value, f =
|
|
1303
|
+
const d = q(i);
|
|
1304
|
+
if (d.isErr()) return k(d.error);
|
|
1305
|
+
const p = d.value, f = N(p, a);
|
|
1297
1306
|
if (f !== "query")
|
|
1298
|
-
return
|
|
1307
|
+
return k([
|
|
1299
1308
|
{
|
|
1300
1309
|
message: `DataSDK.graphql.query() requires a GraphQL query, received ${f}.`
|
|
1301
1310
|
}
|
|
1302
1311
|
]);
|
|
1303
1312
|
let l;
|
|
1304
1313
|
try {
|
|
1305
|
-
l = new
|
|
1314
|
+
l = new yt(
|
|
1306
1315
|
{
|
|
1307
|
-
query:
|
|
1316
|
+
query: R(p),
|
|
1308
1317
|
variables: o,
|
|
1309
1318
|
operationName: a,
|
|
1310
1319
|
cacheControl: h
|
|
@@ -1313,35 +1322,35 @@ function wt({
|
|
|
1313
1322
|
e
|
|
1314
1323
|
);
|
|
1315
1324
|
} catch (u) {
|
|
1316
|
-
return
|
|
1325
|
+
return k(b(u));
|
|
1317
1326
|
}
|
|
1318
|
-
return
|
|
1327
|
+
return bt(l);
|
|
1319
1328
|
}
|
|
1320
1329
|
return {
|
|
1321
1330
|
query: n,
|
|
1322
1331
|
mutate: (i) => Q(t, i)
|
|
1323
1332
|
};
|
|
1324
1333
|
}
|
|
1325
|
-
const
|
|
1326
|
-
class
|
|
1334
|
+
const Ct = 1, St = `@salesforce/platform-sdk-data_v${Ct}`, Z = J(), Tt = `${Z}/ui-api`, B = `${Z}/graphql`;
|
|
1335
|
+
class _t {
|
|
1327
1336
|
baseUrl;
|
|
1328
1337
|
clientFetch;
|
|
1329
1338
|
onStatus;
|
|
1330
1339
|
graphql;
|
|
1331
1340
|
constructor(e) {
|
|
1332
|
-
const t =
|
|
1333
|
-
this.baseUrl =
|
|
1341
|
+
const t = Et();
|
|
1342
|
+
this.baseUrl = Mt(e?.basePath ?? t.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = ht({
|
|
1334
1343
|
csrf: {
|
|
1335
|
-
endpoint: `${this.baseUrl}${
|
|
1336
|
-
cacheName:
|
|
1344
|
+
endpoint: `${this.baseUrl}${Tt}/session/csrf`,
|
|
1345
|
+
cacheName: St,
|
|
1337
1346
|
protectedUrls: ["services/data/v", "services/apexrest"],
|
|
1338
1347
|
alwaysProtectedUrls: ["services/apexrest"]
|
|
1339
1348
|
}
|
|
1340
1349
|
});
|
|
1341
|
-
const r = (i, o) => this.fetch(i, o), n =
|
|
1342
|
-
this.graphql =
|
|
1350
|
+
const r = (i, o) => this.fetch(i, o), n = pt(this.baseUrl, r);
|
|
1351
|
+
this.graphql = vt({
|
|
1343
1352
|
bundle: n,
|
|
1344
|
-
url:
|
|
1353
|
+
url: B,
|
|
1345
1354
|
executeRaw: this.executeRawGraphQL.bind(this)
|
|
1346
1355
|
});
|
|
1347
1356
|
}
|
|
@@ -1360,7 +1369,7 @@ class St {
|
|
|
1360
1369
|
variables: t,
|
|
1361
1370
|
operationName: r
|
|
1362
1371
|
}) {
|
|
1363
|
-
return (await this.fetch(
|
|
1372
|
+
return (await this.fetch(B, {
|
|
1364
1373
|
method: "POST",
|
|
1365
1374
|
body: JSON.stringify({ query: e, variables: t, operationName: r }),
|
|
1366
1375
|
headers: X()
|
|
@@ -1380,33 +1389,33 @@ class St {
|
|
|
1380
1389
|
return e;
|
|
1381
1390
|
}
|
|
1382
1391
|
}
|
|
1383
|
-
function
|
|
1392
|
+
function Et() {
|
|
1384
1393
|
return {
|
|
1385
1394
|
apiPath: globalThis.SFDC_ENV?.apiPath
|
|
1386
1395
|
};
|
|
1387
1396
|
}
|
|
1388
|
-
function
|
|
1397
|
+
function Mt(s) {
|
|
1389
1398
|
if (!s || s === "/") return "";
|
|
1390
1399
|
let e = s;
|
|
1391
1400
|
return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
1392
1401
|
}
|
|
1393
|
-
function
|
|
1402
|
+
function hs(s, ...e) {
|
|
1394
1403
|
let t = s[0] ?? "";
|
|
1395
1404
|
for (let r = 0; r < e.length; r += 1)
|
|
1396
1405
|
t += String(e[r]) + (s[r + 1] ?? "");
|
|
1397
1406
|
return t;
|
|
1398
1407
|
}
|
|
1399
|
-
function
|
|
1400
|
-
return
|
|
1408
|
+
function fs(s) {
|
|
1409
|
+
return I(
|
|
1401
1410
|
(async () => {
|
|
1402
1411
|
switch (C(s?.surface)) {
|
|
1403
1412
|
case c.OpenAI:
|
|
1404
|
-
return new
|
|
1413
|
+
return new Ze();
|
|
1405
1414
|
case c.WebApp:
|
|
1406
1415
|
case c.MicroFrontend:
|
|
1407
|
-
return new
|
|
1416
|
+
return new _t(s?.webapp);
|
|
1408
1417
|
case c.Mosaic:
|
|
1409
|
-
return new
|
|
1418
|
+
return new Ge(s?.mosaic);
|
|
1410
1419
|
case c.SalesforceACC:
|
|
1411
1420
|
case c.MCPApps:
|
|
1412
1421
|
return {};
|
|
@@ -1417,8 +1426,8 @@ function ds(s) {
|
|
|
1417
1426
|
"createDataSDK"
|
|
1418
1427
|
);
|
|
1419
1428
|
}
|
|
1420
|
-
function
|
|
1421
|
-
return
|
|
1429
|
+
function ps(s) {
|
|
1430
|
+
return I(
|
|
1422
1431
|
(async () => {
|
|
1423
1432
|
switch (C(s?.surface)) {
|
|
1424
1433
|
case c.OpenAI:
|
|
@@ -1440,13 +1449,13 @@ function hs(s) {
|
|
|
1440
1449
|
"createLightningSDK"
|
|
1441
1450
|
);
|
|
1442
1451
|
}
|
|
1443
|
-
function
|
|
1452
|
+
function At(s) {
|
|
1444
1453
|
let e = "";
|
|
1445
1454
|
for (let r = 0; r < s.length; r += 8192)
|
|
1446
1455
|
e += String.fromCharCode.apply(null, Array.from(s.subarray(r, r + 8192)));
|
|
1447
1456
|
return btoa(e);
|
|
1448
1457
|
}
|
|
1449
|
-
class
|
|
1458
|
+
class It {
|
|
1450
1459
|
entries = [];
|
|
1451
1460
|
totalBytes = 0;
|
|
1452
1461
|
maxBufferSize;
|
|
@@ -1461,7 +1470,7 @@ class Mt {
|
|
|
1461
1470
|
return this.entries.length === 0;
|
|
1462
1471
|
}
|
|
1463
1472
|
enqueue(e, t) {
|
|
1464
|
-
const r =
|
|
1473
|
+
const r = At(e), n = {
|
|
1465
1474
|
data: r,
|
|
1466
1475
|
traceId: t?.traceId,
|
|
1467
1476
|
instanceId: t?.instanceId,
|
|
@@ -1483,8 +1492,8 @@ class Mt {
|
|
|
1483
1492
|
e > 0 && this.onError?.({ reason: "buffer_overflow", droppedCount: e });
|
|
1484
1493
|
}
|
|
1485
1494
|
}
|
|
1486
|
-
const
|
|
1487
|
-
class
|
|
1495
|
+
const kt = "telemetry/upload";
|
|
1496
|
+
class Dt {
|
|
1488
1497
|
buffer;
|
|
1489
1498
|
sdk;
|
|
1490
1499
|
onError;
|
|
@@ -1502,8 +1511,8 @@ class It {
|
|
|
1502
1511
|
flush() {
|
|
1503
1512
|
if (this.buffer.isEmpty || !this.sdk.callTool)
|
|
1504
1513
|
return;
|
|
1505
|
-
const t = this.buffer.drain().map(
|
|
1506
|
-
this.sdk.callTool({ toolName:
|
|
1514
|
+
const t = this.buffer.drain().map(Pt);
|
|
1515
|
+
this.sdk.callTool({ toolName: kt, params: { inputs: [{ envelopes: t }] } }).catch((r) => {
|
|
1507
1516
|
this.onError?.({ reason: "tool_call_failed", error: r });
|
|
1508
1517
|
});
|
|
1509
1518
|
}
|
|
@@ -1511,18 +1520,18 @@ class It {
|
|
|
1511
1520
|
this.disposed || (this.disposed = !0, this.timerId !== null && (clearInterval(this.timerId), this.timerId = null), document.removeEventListener("visibilitychange", this.handleVisibilityChange), window.removeEventListener("pagehide", this.handlePageHide), this.flush());
|
|
1512
1521
|
}
|
|
1513
1522
|
}
|
|
1514
|
-
function
|
|
1523
|
+
function Pt(s) {
|
|
1515
1524
|
const e = { base64Env: s.data };
|
|
1516
1525
|
return s.traceId !== void 0 && (e.traceId = s.traceId), e;
|
|
1517
1526
|
}
|
|
1518
|
-
const
|
|
1519
|
-
function
|
|
1527
|
+
const Lt = 65536, xt = 3e4;
|
|
1528
|
+
function gs(s) {
|
|
1520
1529
|
const {
|
|
1521
1530
|
sdk: e,
|
|
1522
|
-
maxBufferSize: t =
|
|
1523
|
-
flushInterval: r =
|
|
1531
|
+
maxBufferSize: t = Lt,
|
|
1532
|
+
flushInterval: r = xt,
|
|
1524
1533
|
onError: n
|
|
1525
|
-
} = s, i = new
|
|
1534
|
+
} = s, i = new It({ maxBufferSize: t, onError: n }), o = new Dt(i, e, { flushInterval: r, onError: n });
|
|
1526
1535
|
return {
|
|
1527
1536
|
enqueue(a, h) {
|
|
1528
1537
|
i.enqueue(a, h);
|
|
@@ -1532,16 +1541,16 @@ function fs(s) {
|
|
|
1532
1541
|
}
|
|
1533
1542
|
};
|
|
1534
1543
|
}
|
|
1535
|
-
const
|
|
1544
|
+
const Rt = 1e4, Ot = 10, Ht = 10, qt = 250, Nt = 1e3;
|
|
1536
1545
|
function v(s, e) {
|
|
1537
1546
|
if (s !== void 0 && (typeof s != "number" || !Number.isFinite(s) || s <= 0))
|
|
1538
1547
|
throw new Error(`${e}, if defined, must be a finite number greater than 0`);
|
|
1539
1548
|
}
|
|
1540
|
-
function
|
|
1549
|
+
function Ft(s, e) {
|
|
1541
1550
|
if (typeof s != "function")
|
|
1542
1551
|
throw new Error(`${e} must be a function`);
|
|
1543
1552
|
}
|
|
1544
|
-
class
|
|
1553
|
+
class Ut {
|
|
1545
1554
|
_collector;
|
|
1546
1555
|
_onEnvelope;
|
|
1547
1556
|
_onError;
|
|
@@ -1562,7 +1571,7 @@ class Nt {
|
|
|
1562
1571
|
_lastClickTriggeredAt = 0;
|
|
1563
1572
|
_isDisposed = !1;
|
|
1564
1573
|
constructor(e) {
|
|
1565
|
-
|
|
1574
|
+
Ft(e?.onEnvelope, "options.onEnvelope"), v(e.uploadInterval, "options.uploadInterval"), v(e.messagesLimit, "options.messagesLimit"), v(e.metricsLimit, "options.metricsLimit"), v(e.maxUniqueSchemas, "options.maxUniqueSchemas"), v(e.clickUploadDelay, "options.clickUploadDelay"), v(e.clickTriggerCooldown, "options.clickTriggerCooldown"), this._onEnvelope = e.onEnvelope, this._onError = e.onError, this._messagesLimit = e.messagesLimit ?? Ot, this._metricsLimit = e.metricsLimit ?? Ht, this._uploadInterval = e.uploadInterval ?? Rt, this._clickUploadDelay = e.clickUploadDelay ?? qt, this._clickTriggerCooldown = e.clickTriggerCooldown ?? Nt, this._enableClickTrigger = e.enableClickTrigger !== !1, this._enableVisibilityTrigger = e.enableVisibilityTrigger !== !1, this._collector = new fe({
|
|
1566
1575
|
environment: e.environment,
|
|
1567
1576
|
maxUniqueSchemas: e.maxUniqueSchemas
|
|
1568
1577
|
}), this._restartInterval(), this._attachWindowListeners();
|
|
@@ -1642,7 +1651,7 @@ class Nt {
|
|
|
1642
1651
|
metricsCount: this.metricsCount,
|
|
1643
1652
|
estimatedByteSize: this.estimatedByteSize,
|
|
1644
1653
|
triggeredAt: Date.now()
|
|
1645
|
-
}, r = this._collector.getRawContentsOfCoreEnvelope(), n =
|
|
1654
|
+
}, r = this._collector.getRawContentsOfCoreEnvelope(), n = he(r);
|
|
1646
1655
|
this._restartInterval();
|
|
1647
1656
|
try {
|
|
1648
1657
|
await this._onEnvelope(n, t);
|
|
@@ -1655,13 +1664,13 @@ class Nt {
|
|
|
1655
1664
|
}
|
|
1656
1665
|
}
|
|
1657
1666
|
}
|
|
1658
|
-
function
|
|
1667
|
+
function Vt(s, e) {
|
|
1659
1668
|
if (!s)
|
|
1660
1669
|
throw new Error("instrumentedApp is required");
|
|
1661
|
-
const t = new
|
|
1670
|
+
const t = new Ut(e);
|
|
1662
1671
|
return s.registerLogCollector(t), s.registerMetricsCollector(t), e.enableClickTrigger !== !1 && s.activateClickTracker?.(), t;
|
|
1663
1672
|
}
|
|
1664
|
-
function
|
|
1673
|
+
function Wt(s) {
|
|
1665
1674
|
const e = (r, n, i, o, a) => {
|
|
1666
1675
|
s.error(a ?? r);
|
|
1667
1676
|
}, t = (r) => {
|
|
@@ -1674,7 +1683,7 @@ function Ut(s) {
|
|
|
1674
1683
|
function m(s, e) {
|
|
1675
1684
|
return { surface: e };
|
|
1676
1685
|
}
|
|
1677
|
-
const
|
|
1686
|
+
const $t = {
|
|
1678
1687
|
callTool: {
|
|
1679
1688
|
isAsync: !0,
|
|
1680
1689
|
extractTags: (s, e) => ({ toolName: s[0]?.toolName ?? "unknown", surface: e })
|
|
@@ -1728,10 +1737,10 @@ const Vt = {
|
|
|
1728
1737
|
extractTags: m
|
|
1729
1738
|
}
|
|
1730
1739
|
};
|
|
1731
|
-
function
|
|
1740
|
+
function Kt(s, e, t) {
|
|
1732
1741
|
return new Proxy(s, {
|
|
1733
1742
|
get(r, n, i) {
|
|
1734
|
-
const o = Reflect.get(r, n, i), a =
|
|
1743
|
+
const o = Reflect.get(r, n, i), a = $t[n];
|
|
1735
1744
|
return !a || typeof o != "function" ? o : (...h) => {
|
|
1736
1745
|
const d = a.extractTags(h, t), p = a.wrapArgs ? a.wrapArgs(h, e) : h, f = `sdk.${String(n)}`;
|
|
1737
1746
|
return a.isAsync ? e.activityAsync(f, async () => {
|
|
@@ -1749,18 +1758,18 @@ function Wt(s, e, t) {
|
|
|
1749
1758
|
}
|
|
1750
1759
|
});
|
|
1751
1760
|
}
|
|
1752
|
-
async function
|
|
1753
|
-
const { appId: e, clientSessionId: t } = s, r = C(), n = Date.now(), i = s.sdk ?? await
|
|
1761
|
+
async function ms(s) {
|
|
1762
|
+
const { appId: e, clientSessionId: t } = s, r = C(), n = Date.now(), i = s.sdk ?? await Fe(), o = pe("mcp-widget", {
|
|
1754
1763
|
appPayloadProvider: {
|
|
1755
1764
|
getPayload: () => ({
|
|
1756
|
-
schema:
|
|
1765
|
+
schema: ge,
|
|
1757
1766
|
payload: { appId: e, surface: r }
|
|
1758
1767
|
})
|
|
1759
1768
|
},
|
|
1760
1769
|
clientSessionId: t
|
|
1761
|
-
}), a = o, h =
|
|
1770
|
+
}), a = o, h = Kt(i, a, r), d = Wt(a);
|
|
1762
1771
|
let p;
|
|
1763
|
-
s.transport && (p =
|
|
1772
|
+
s.transport && (p = Vt(o, {
|
|
1764
1773
|
onEnvelope: (u) => {
|
|
1765
1774
|
s.transport.enqueue(u);
|
|
1766
1775
|
}
|
|
@@ -1770,63 +1779,63 @@ async function ps(s) {
|
|
|
1770
1779
|
instrumentedSDK: h,
|
|
1771
1780
|
app: o,
|
|
1772
1781
|
trackEvent(u, g) {
|
|
1773
|
-
l || a.log(
|
|
1782
|
+
l || a.log(ve, {
|
|
1774
1783
|
eventName: u,
|
|
1775
1784
|
properties: g ? JSON.stringify(g) : ""
|
|
1776
1785
|
});
|
|
1777
1786
|
},
|
|
1778
1787
|
trackInteraction(u, g) {
|
|
1779
|
-
l || a.log(
|
|
1788
|
+
l || a.log(be, {
|
|
1780
1789
|
elementId: u,
|
|
1781
1790
|
properties: g ? JSON.stringify(g) : ""
|
|
1782
1791
|
});
|
|
1783
1792
|
},
|
|
1784
1793
|
trackError(u, g) {
|
|
1785
|
-
l || a.error(u,
|
|
1794
|
+
l || a.error(u, we, {
|
|
1786
1795
|
properties: g ? JSON.stringify(g) : ""
|
|
1787
1796
|
});
|
|
1788
1797
|
},
|
|
1789
1798
|
trackPageView(u) {
|
|
1790
|
-
l || u !== f && (f = u, a.log(
|
|
1799
|
+
l || u !== f && (f = u, a.log(ye, { componentRef: u }));
|
|
1791
1800
|
},
|
|
1792
1801
|
dispose() {
|
|
1793
1802
|
if (l) return;
|
|
1794
1803
|
l = !0, d();
|
|
1795
1804
|
const u = Date.now() - n;
|
|
1796
|
-
a.log(
|
|
1805
|
+
a.log(me, { durationMs: u }), p?.dispose();
|
|
1797
1806
|
}
|
|
1798
1807
|
};
|
|
1799
1808
|
}
|
|
1800
1809
|
export {
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1810
|
+
Ae as JsonRpcClient,
|
|
1811
|
+
He as MCPAppsChatSDK,
|
|
1812
|
+
We as MCPAppsViewSDK,
|
|
1804
1813
|
y as McpAppsSession,
|
|
1805
|
-
|
|
1814
|
+
is as MessageChannelTransport,
|
|
1806
1815
|
c as Surface,
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1816
|
+
Ut as TelemetryUploader,
|
|
1817
|
+
Me as WindowPostMessageTransport,
|
|
1818
|
+
ms as createAnalytics,
|
|
1819
|
+
Ue as createChatSDK,
|
|
1820
|
+
fs as createDataSDK,
|
|
1821
|
+
ps as createLightningSDK,
|
|
1822
|
+
gs as createTelemetryTransport,
|
|
1823
|
+
Ke as createViewSDK,
|
|
1824
|
+
Fe as getChatSDK,
|
|
1825
|
+
as as getChatSDKSync,
|
|
1817
1826
|
C as getSurface,
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1827
|
+
os as getSurfaceCapabilities,
|
|
1828
|
+
ls as getViewSDK,
|
|
1829
|
+
us as getViewSDKSync,
|
|
1830
|
+
hs as gql,
|
|
1831
|
+
A as isJsonRpcBase,
|
|
1823
1832
|
j as isJsonRpcErrorResponse,
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1833
|
+
Ee as isJsonRpcNotification,
|
|
1834
|
+
ns as isJsonRpcRequest,
|
|
1835
|
+
_e as isJsonRpcResponse,
|
|
1836
|
+
Te as isJsonRpcSuccessResponse,
|
|
1837
|
+
Vt as registerTelemetryUploader,
|
|
1838
|
+
cs as resetChatSDK,
|
|
1839
|
+
ds as resetViewSDK,
|
|
1840
|
+
I as wrapSDKPromise
|
|
1832
1841
|
};
|