@salesforce/platform-sdk 9.2.0 → 9.4.1
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/core/data.d.ts +30 -0
- package/dist/core/data.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data/shared/graphql/cache/command.d.ts +9 -11
- package/dist/data/shared/graphql/cache/command.d.ts.map +1 -1
- package/dist/data/shared/graphql/cached-graphql.d.ts.map +1 -1
- package/dist/index.js +152 -140
- package/dist/telemetry/tool-adapter.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/core/data.d.ts
CHANGED
|
@@ -70,6 +70,34 @@ export interface MutationResult<T> {
|
|
|
70
70
|
data: T | undefined;
|
|
71
71
|
errors?: GraphQLError[];
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Shorthand cache policies passed as a plain string.
|
|
75
|
+
*
|
|
76
|
+
* - `"no-cache"` — skip the cache read and fetch from the network. The
|
|
77
|
+
* response is still written back to cache for subsequent callers.
|
|
78
|
+
* Follows HTTP RFC 7234 `no-cache` semantics.
|
|
79
|
+
* - `"only-if-cached"` — return the cached entry without a network call.
|
|
80
|
+
* Returns an error if no entry exists for this query + variables.
|
|
81
|
+
*/
|
|
82
|
+
export type CacheControlShorthand = "no-cache" | "only-if-cached";
|
|
83
|
+
/**
|
|
84
|
+
* Override the default TTL (300 seconds) with a custom max-age in seconds.
|
|
85
|
+
*
|
|
86
|
+
* - `maxAge: 0` — entry is written but immediately considered stale
|
|
87
|
+
* (always re-fetches, similar to `"no-cache"` but writes a 0s TTL).
|
|
88
|
+
* - Invalid values (NaN, Infinity, negative) fall back to the 300s default.
|
|
89
|
+
*/
|
|
90
|
+
export interface CacheControlMaxAge {
|
|
91
|
+
type: "max-age";
|
|
92
|
+
maxAge: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Per-call cache policy for {@link DataSDKGraphQL.query}.
|
|
96
|
+
*
|
|
97
|
+
* When omitted, the default `max-age` strategy with a 300-second TTL applies.
|
|
98
|
+
* After the TTL expires, the next call fetches fresh data from the network.
|
|
99
|
+
*/
|
|
100
|
+
export type CacheControl = CacheControlShorthand | CacheControlMaxAge;
|
|
73
101
|
/**
|
|
74
102
|
* Options bag for {@link DataSDKGraphQL.query}.
|
|
75
103
|
*/
|
|
@@ -77,6 +105,8 @@ export interface QueryOptions<V = Record<string, unknown>> {
|
|
|
77
105
|
query: GraphQLRawDocument;
|
|
78
106
|
variables?: V;
|
|
79
107
|
operationName?: string;
|
|
108
|
+
/** Override the default cache behavior for this query. @see {@link CacheControl} */
|
|
109
|
+
cacheControl?: CacheControl;
|
|
80
110
|
}
|
|
81
111
|
/**
|
|
82
112
|
* Options bag for {@link DataSDKGraphQL.mutate}.
|
package/dist/core/data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/core/data.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC;;GA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AM,WAAW,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxD,KAAK,EAAE,kBAAkB,CAAC;IAC1B,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oFAAoF;IACpF,YAAY,CAAC,EAAE,YAAY,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzF;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9F;AAED,MAAM,WAAW,OAAO;IACvB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type { ACCConnection, ACCPanelCallbacks, ACCPreReceiveArgs } from './acc-
|
|
|
8
8
|
export type { SDKOptions } from './options';
|
|
9
9
|
export type { HostContext, HostStyles, ChatMessage, ChatSDK, ContentBlock, DeviceCapabilities, DisplayMode, ResourceRequest, SafeAreaInsets, SetWidgetStateOptions, ToolCall, ToolState, } from './chat';
|
|
10
10
|
export type { AlertOptions, MessageLevel, ModalOptions, ToastOptions, Theme, ThemeMode, ViewSDK, } from './view';
|
|
11
|
-
export type { DataSDK, DataSDKGraphQL, GraphQLError, GraphQLRawDocument, GraphQLRequest, GraphQLResponse, MutateOptions, MutationResult, QueryOptions, QueryResult, QuerySubscriber, Unsubscribe, } from './data';
|
|
11
|
+
export type { CacheControl, DataSDK, DataSDKGraphQL, GraphQLError, GraphQLRawDocument, GraphQLRequest, GraphQLResponse, MutateOptions, MutationResult, QueryOptions, QueryResult, QuerySubscriber, Unsubscribe, } from './data';
|
|
12
12
|
export type { LightningSDK, LMSMessage, LMSSubscription, MessageChannel } from './lightning';
|
|
13
13
|
export type { OpenAISDK, SalesforceACCSDK } from './platforms';
|
|
14
14
|
export type { JsonRpcBase, JsonRpcRequest, JsonRpcError, JsonRpcSuccessResponse, JsonRpcErrorResponse, JsonRpcResponse, JsonRpcNotification, JsonRpcMessage, JsonRpcPendingRequest, JsonRpcPendingRequestMap, } from './jsonrpc';
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGhD,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGvF,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,YAAY,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,QAAQ,EACR,SAAS,GACT,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,YAA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AAO,EACN,uBAAuB,EACvB,KAAK,+BAA+B,GACpC,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -5,10 +5,12 @@ import { CacheControlStrategyConfig, NamedCacheControllerService } from '@condui
|
|
|
5
5
|
import { FetchService, NamedFetchService } from '@conduit-client/service-fetch-network/v1';
|
|
6
6
|
import { NamedPubSubService } from '@conduit-client/service-pubsub/v1';
|
|
7
7
|
import { Result, SyncOrAsync } from '@conduit-client/utils';
|
|
8
|
+
import { CacheControl } from '../../../../core/data';
|
|
8
9
|
export interface GraphQLResourceRequestParams {
|
|
9
10
|
query: string;
|
|
10
11
|
variables?: Record<string, unknown>;
|
|
11
12
|
operationName?: string;
|
|
13
|
+
cacheControl?: CacheControl;
|
|
12
14
|
}
|
|
13
15
|
type Services = NamedCacheControllerService & Partial<NamedPubSubService> & NamedFetchService;
|
|
14
16
|
/**
|
|
@@ -38,18 +40,12 @@ type Services = NamedCacheControllerService & Partial<NamedPubSubService> & Name
|
|
|
38
40
|
* bypass it for non-query operations to avoid silent re-issue of cached mutation
|
|
39
41
|
* responses.
|
|
40
42
|
*
|
|
41
|
-
* ##
|
|
43
|
+
* ## TTL expiry
|
|
42
44
|
*
|
|
43
|
-
* After the `max-age` window elapses,
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* 3. Publish the fresh value to PubSub subscribers via `cacheUpdate`.
|
|
48
|
-
*
|
|
49
|
-
* Non-subscribed callers therefore observe one cycle of stale data after expiry and
|
|
50
|
-
* will only receive the refreshed value on a subsequent `execute()` or `refresh()` call.
|
|
51
|
-
* Callers that need synchronous freshness should subscribe via the returned
|
|
52
|
-
* `SubscribableResult` or call `refresh()` explicitly.
|
|
45
|
+
* After the `max-age` window elapses, stale entries are filtered out and
|
|
46
|
+
* the next call to `execute()` fetches fresh data from the network.
|
|
47
|
+
* Subscribers receive updates via PubSub `cacheUpdate` events when fresh
|
|
48
|
+
* data is written back to the cache.
|
|
53
49
|
*
|
|
54
50
|
* ## Variable handling
|
|
55
51
|
*
|
|
@@ -66,6 +62,8 @@ export declare class HttpGraphQLResourceCacheControlCommand<TData extends Record
|
|
|
66
62
|
private readonly query;
|
|
67
63
|
private readonly normalizedVariables;
|
|
68
64
|
private readonly normalizedOperationName;
|
|
65
|
+
private readonly cacheControl;
|
|
66
|
+
private readonly resolvedMaxAge;
|
|
69
67
|
constructor(config: GraphQLResourceRequestParams, services: Services, url: string);
|
|
70
68
|
protected get fetchParams(): Parameters<FetchService>;
|
|
71
69
|
buildKey(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/data/shared/graphql/cache/command.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,KAAK,EACX,0BAA0B,EAC1B,2BAA2B,EAC3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAON,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":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,CAAC;CAC/B;AAWD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAClC,MAAM,EACN,GAAG,EACH,UAAU,GACV,EAAE,yBAAyB,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"cached-graphql.d.ts","sourceRoot":"","sources":["../../../../src/data/shared/graphql/cached-graphql.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAON,KAAK,kBAAkB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAA2C,MAAM,eAAe,CAAC;AAE7F,UAAU,yBAAyB;IAClC,MAAM,EAAE,WAAW,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,kBAAkB,CAAC;CAC/B;AAWD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAClC,MAAM,EACN,GAAG,EACH,UAAU,GACV,EAAE,yBAAyB,GAAG,cAAc,CA4C5C"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildServiceDescriptor as K, setHeader as _ } from "@conduit-client/service-fetch-network/v1";
|
|
2
2
|
import { resolvedPromiseLike as w, ok as k, err as D, stableJSONStringify as Y, DataNotFoundError as Z, UserVisibleError as ee, deepFreeze as z } from "@conduit-client/utils";
|
|
3
|
-
import { print as
|
|
3
|
+
import { print as x, parse as te } from "@conduit-client/onestore-graphql-parser/v1";
|
|
4
4
|
import { RetryPolicy as se, buildServiceDescriptor as re } from "@conduit-client/service-retry/v1";
|
|
5
5
|
import { buildServiceDescriptor as ne } from "@conduit-client/service-cache/v1";
|
|
6
6
|
import { buildServiceDescriptor as ie } from "@conduit-client/service-cache-control/v1";
|
|
@@ -10,7 +10,7 @@ import { HttpCacheControlCommand as ce } from "@conduit-client/command-http-cach
|
|
|
10
10
|
import { encodeCoreEnvelopeContentsRaw as le } from "o11y/collectors";
|
|
11
11
|
import { SimpleCollector as ue } from "o11y/simple_collector";
|
|
12
12
|
import { registerInstrumentedApp as de } from "o11y/client";
|
|
13
|
-
import { analyticsContextSchema as he, sessionSchema as fe, pageViewSchema as pe, errorContextSchema as
|
|
13
|
+
import { analyticsContextSchema as he, sessionSchema as fe, pageViewSchema as pe, errorContextSchema as ge, interactionSchema as me, customEventSchema as ye } 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
15
|
const we = ve();
|
|
16
16
|
function ve() {
|
|
@@ -45,7 +45,7 @@ function Ce(s) {
|
|
|
45
45
|
function Se(s) {
|
|
46
46
|
return M(s) && "method" in s && typeof s.method == "string" && !("id" in s);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function es(s) {
|
|
49
49
|
return M(s) && "id" in s && typeof s.id == "number" && "method" in s && typeof s.method == "string";
|
|
50
50
|
}
|
|
51
51
|
class Te {
|
|
@@ -183,7 +183,7 @@ class _e {
|
|
|
183
183
|
}
|
|
184
184
|
function Ee() {
|
|
185
185
|
}
|
|
186
|
-
class
|
|
186
|
+
class ts {
|
|
187
187
|
#e;
|
|
188
188
|
#s = /* @__PURE__ */ new Set();
|
|
189
189
|
#n = !1;
|
|
@@ -433,7 +433,7 @@ const Ie = {
|
|
|
433
433
|
getTheme: !1,
|
|
434
434
|
resize: !1
|
|
435
435
|
};
|
|
436
|
-
function
|
|
436
|
+
function ss(s) {
|
|
437
437
|
switch (s) {
|
|
438
438
|
case c.MCPApps:
|
|
439
439
|
return { ...Ie };
|
|
@@ -463,7 +463,7 @@ Use \`const sdk = await ${e}();\` before accessing SDK methods.`
|
|
|
463
463
|
}
|
|
464
464
|
});
|
|
465
465
|
}
|
|
466
|
-
class
|
|
466
|
+
class xe {
|
|
467
467
|
constructor(e) {
|
|
468
468
|
this.session = e;
|
|
469
469
|
const t = e.getHostContext();
|
|
@@ -600,7 +600,7 @@ class Re {
|
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
const N = "openai:set_globals";
|
|
603
|
-
class
|
|
603
|
+
class Re {
|
|
604
604
|
sendMessageToHost(e) {
|
|
605
605
|
return window.openai.sendFollowUpMessage({ prompt: e.content });
|
|
606
606
|
}
|
|
@@ -648,22 +648,22 @@ class Oe {
|
|
|
648
648
|
return console.warn("SalesforceACCChatSDK.followUpActions: stub implementation"), [];
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
|
-
let S = null,
|
|
651
|
+
let S = null, R = null;
|
|
652
652
|
function He(s) {
|
|
653
|
-
return S || (S = qe(s).then((e) => (
|
|
654
|
-
}
|
|
655
|
-
function ss() {
|
|
656
|
-
return x;
|
|
653
|
+
return S || (S = qe(s).then((e) => (R = e, e))), S;
|
|
657
654
|
}
|
|
658
655
|
function rs() {
|
|
659
|
-
|
|
656
|
+
return R;
|
|
657
|
+
}
|
|
658
|
+
function ns() {
|
|
659
|
+
S = null, R = null;
|
|
660
660
|
}
|
|
661
661
|
function qe(s) {
|
|
662
662
|
return A(
|
|
663
663
|
(async () => {
|
|
664
664
|
switch (C(s?.surface)) {
|
|
665
665
|
case c.OpenAI:
|
|
666
|
-
return new
|
|
666
|
+
return new Re();
|
|
667
667
|
case c.WebApp:
|
|
668
668
|
case c.Mosaic:
|
|
669
669
|
return {};
|
|
@@ -672,7 +672,7 @@ function qe(s) {
|
|
|
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 xe(t) : {};
|
|
676
676
|
}
|
|
677
677
|
default:
|
|
678
678
|
return {};
|
|
@@ -780,13 +780,13 @@ class Ue {
|
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
782
|
let T = null, O = null;
|
|
783
|
-
function
|
|
783
|
+
function is(s) {
|
|
784
784
|
return T || (T = Ve(s).then((e) => (O = e, e))), T;
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function os() {
|
|
787
787
|
return O;
|
|
788
788
|
}
|
|
789
|
-
function
|
|
789
|
+
function as() {
|
|
790
790
|
T = null, O = null;
|
|
791
791
|
}
|
|
792
792
|
function Ve(s) {
|
|
@@ -870,7 +870,7 @@ async function j(s, { mutation: e, variables: t, operationName: r }) {
|
|
|
870
870
|
};
|
|
871
871
|
try {
|
|
872
872
|
const a = await s({
|
|
873
|
-
query:
|
|
873
|
+
query: x(i),
|
|
874
874
|
variables: t,
|
|
875
875
|
operationName: r
|
|
876
876
|
});
|
|
@@ -885,7 +885,7 @@ async function j(s, { mutation: e, variables: t, operationName: r }) {
|
|
|
885
885
|
function Q(s) {
|
|
886
886
|
function e(r, n, i) {
|
|
887
887
|
return s({
|
|
888
|
-
query:
|
|
888
|
+
query: x(r),
|
|
889
889
|
variables: n,
|
|
890
890
|
operationName: i
|
|
891
891
|
}).then(
|
|
@@ -909,30 +909,30 @@ function Q(s) {
|
|
|
909
909
|
subscribe: () => E,
|
|
910
910
|
refresh: L
|
|
911
911
|
};
|
|
912
|
-
const a = o.value,
|
|
913
|
-
if (
|
|
912
|
+
const a = o.value, h = q(a, i);
|
|
913
|
+
if (h !== "query")
|
|
914
914
|
return {
|
|
915
915
|
data: void 0,
|
|
916
916
|
errors: [
|
|
917
917
|
{
|
|
918
|
-
message: `DataSDK.graphql.query() requires a GraphQL query, received ${
|
|
918
|
+
message: `DataSDK.graphql.query() requires a GraphQL query, received ${h}.`
|
|
919
919
|
}
|
|
920
920
|
],
|
|
921
921
|
subscribe: () => E,
|
|
922
922
|
refresh: L
|
|
923
923
|
};
|
|
924
|
-
const
|
|
924
|
+
const d = /* @__PURE__ */ new Set(), p = n, f = await e(a, p, i);
|
|
925
925
|
return {
|
|
926
926
|
data: f.data,
|
|
927
927
|
errors: f.errors,
|
|
928
928
|
subscribe(l) {
|
|
929
|
-
return
|
|
930
|
-
|
|
929
|
+
return d.add(l), () => {
|
|
930
|
+
d.delete(l);
|
|
931
931
|
};
|
|
932
932
|
},
|
|
933
933
|
async refresh() {
|
|
934
934
|
const l = await e(a, p, i);
|
|
935
|
-
for (const
|
|
935
|
+
for (const u of d) u(l);
|
|
936
936
|
}
|
|
937
937
|
};
|
|
938
938
|
}
|
|
@@ -999,7 +999,7 @@ class Je {
|
|
|
999
999
|
})).structuredContent;
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
const Xe = "X-SFDC-Client-Name", Ye = "X-SFDC-Client-Version", Ze = "@salesforce/platform-sdk", et = "9.
|
|
1002
|
+
const Xe = "X-SFDC-Client-Name", Ye = "X-SFDC-Client-Version", Ze = "@salesforce/platform-sdk", et = "9.4.1", tt = (s) => {
|
|
1003
1003
|
let e = _(Xe, Ze, s);
|
|
1004
1004
|
return e = _(Ye, et, e), w(e);
|
|
1005
1005
|
}, st = "X-CSRF-Token";
|
|
@@ -1008,8 +1008,8 @@ function rt(s, e = {}) {
|
|
|
1008
1008
|
return async (n) => {
|
|
1009
1009
|
const [i, o] = n, a = new Request(i, o);
|
|
1010
1010
|
if (U(r, a.url) || nt(a.method) && U(t, a.url)) {
|
|
1011
|
-
const
|
|
1012
|
-
n = _(st,
|
|
1011
|
+
const d = await s.getToken();
|
|
1012
|
+
n = _(st, d, n);
|
|
1013
1013
|
}
|
|
1014
1014
|
return w(n);
|
|
1015
1015
|
};
|
|
@@ -1142,16 +1142,25 @@ function dt(s, e) {
|
|
|
1142
1142
|
throw n.cause = t, n;
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
|
-
|
|
1145
|
+
function ht(s) {
|
|
1146
|
+
if (typeof s == "object" && s.type === "max-age") {
|
|
1147
|
+
const e = s.maxAge;
|
|
1148
|
+
return Number.isFinite(e) && e >= 0 ? e : W;
|
|
1149
|
+
}
|
|
1150
|
+
return W;
|
|
1151
|
+
}
|
|
1152
|
+
class ft extends ce {
|
|
1146
1153
|
constructor(e, t, r) {
|
|
1147
1154
|
super(t), this.url = r, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = dt(
|
|
1148
1155
|
e.variables ?? {},
|
|
1149
1156
|
this.normalizedOperationName
|
|
1150
|
-
);
|
|
1157
|
+
), this.cacheControl = e.cacheControl, this.resolvedMaxAge = ht(e.cacheControl);
|
|
1151
1158
|
}
|
|
1152
1159
|
query;
|
|
1153
1160
|
normalizedVariables;
|
|
1154
1161
|
normalizedOperationName;
|
|
1162
|
+
cacheControl;
|
|
1163
|
+
resolvedMaxAge;
|
|
1155
1164
|
get fetchParams() {
|
|
1156
1165
|
return [
|
|
1157
1166
|
this.url,
|
|
@@ -1198,7 +1207,7 @@ class ht extends ce {
|
|
|
1198
1207
|
metadata: {
|
|
1199
1208
|
cacheControl: {
|
|
1200
1209
|
type: "max-age",
|
|
1201
|
-
maxAge:
|
|
1210
|
+
maxAge: this.resolvedMaxAge,
|
|
1202
1211
|
generatedTime: r
|
|
1203
1212
|
}
|
|
1204
1213
|
}
|
|
@@ -1207,10 +1216,11 @@ class ht extends ce {
|
|
|
1207
1216
|
return w(void 0);
|
|
1208
1217
|
}
|
|
1209
1218
|
get cacheControlStrategyConfig() {
|
|
1210
|
-
|
|
1219
|
+
const e = Math.floor(Date.now() / 1e3);
|
|
1220
|
+
return this.cacheControl === "no-cache" ? { type: "no-cache", now: e } : this.cacheControl === "only-if-cached" ? { type: "only-if-cached", now: e } : {
|
|
1211
1221
|
type: "max-age",
|
|
1212
|
-
requestMaxAge:
|
|
1213
|
-
now:
|
|
1222
|
+
requestMaxAge: this.resolvedMaxAge,
|
|
1223
|
+
now: e
|
|
1214
1224
|
};
|
|
1215
1225
|
}
|
|
1216
1226
|
responseHasErrors(e) {
|
|
@@ -1220,7 +1230,7 @@ class ht extends ce {
|
|
|
1220
1230
|
return this.responseHasErrors(e) ? D(new ee(e)) : k(e);
|
|
1221
1231
|
}
|
|
1222
1232
|
}
|
|
1223
|
-
function
|
|
1233
|
+
function pt(s) {
|
|
1224
1234
|
return (e) => {
|
|
1225
1235
|
if (e.isOk()) {
|
|
1226
1236
|
const t = e.value;
|
|
@@ -1229,7 +1239,7 @@ function ft(s) {
|
|
|
1229
1239
|
s({ data: void 0, errors: v(e.error) });
|
|
1230
1240
|
};
|
|
1231
1241
|
}
|
|
1232
|
-
async function
|
|
1242
|
+
async function gt(s) {
|
|
1233
1243
|
let e, t, r;
|
|
1234
1244
|
try {
|
|
1235
1245
|
const n = await s.execute();
|
|
@@ -1241,7 +1251,7 @@ async function pt(s) {
|
|
|
1241
1251
|
data: e,
|
|
1242
1252
|
errors: t,
|
|
1243
1253
|
subscribe(n) {
|
|
1244
|
-
return r ? r(
|
|
1254
|
+
return r ? r(pt(n)) : E;
|
|
1245
1255
|
},
|
|
1246
1256
|
async refresh() {
|
|
1247
1257
|
await s.refresh();
|
|
@@ -1265,50 +1275,52 @@ function mt({
|
|
|
1265
1275
|
async function n({
|
|
1266
1276
|
query: i,
|
|
1267
1277
|
variables: o,
|
|
1268
|
-
operationName: a
|
|
1278
|
+
operationName: a,
|
|
1279
|
+
cacheControl: h
|
|
1269
1280
|
}) {
|
|
1270
|
-
const
|
|
1271
|
-
if (
|
|
1272
|
-
const
|
|
1273
|
-
if (
|
|
1281
|
+
const d = H(i);
|
|
1282
|
+
if (d.isErr()) return I(d.error);
|
|
1283
|
+
const p = d.value, f = q(p, a);
|
|
1284
|
+
if (f !== "query")
|
|
1274
1285
|
return I([
|
|
1275
1286
|
{
|
|
1276
|
-
message: `DataSDK.graphql.query() requires a GraphQL query, received ${
|
|
1287
|
+
message: `DataSDK.graphql.query() requires a GraphQL query, received ${f}.`
|
|
1277
1288
|
}
|
|
1278
1289
|
]);
|
|
1279
|
-
let
|
|
1290
|
+
let l;
|
|
1280
1291
|
try {
|
|
1281
|
-
|
|
1292
|
+
l = new ft(
|
|
1282
1293
|
{
|
|
1283
|
-
query:
|
|
1294
|
+
query: x(p),
|
|
1284
1295
|
variables: o,
|
|
1285
|
-
operationName: a
|
|
1296
|
+
operationName: a,
|
|
1297
|
+
cacheControl: h
|
|
1286
1298
|
},
|
|
1287
1299
|
r,
|
|
1288
1300
|
e
|
|
1289
1301
|
);
|
|
1290
|
-
} catch (
|
|
1291
|
-
return I(v(
|
|
1302
|
+
} catch (u) {
|
|
1303
|
+
return I(v(u));
|
|
1292
1304
|
}
|
|
1293
|
-
return
|
|
1305
|
+
return gt(l);
|
|
1294
1306
|
}
|
|
1295
1307
|
return {
|
|
1296
1308
|
query: n,
|
|
1297
1309
|
mutate: (i) => j(t, i)
|
|
1298
1310
|
};
|
|
1299
1311
|
}
|
|
1300
|
-
const
|
|
1301
|
-
class
|
|
1312
|
+
const yt = 1, wt = `@salesforce/platform-sdk-data_v${yt}`, X = G(), vt = `${X}/ui-api`, $ = `${X}/graphql`;
|
|
1313
|
+
class bt {
|
|
1302
1314
|
baseUrl;
|
|
1303
1315
|
clientFetch;
|
|
1304
1316
|
onStatus;
|
|
1305
1317
|
graphql;
|
|
1306
1318
|
constructor(e) {
|
|
1307
|
-
const t =
|
|
1308
|
-
this.baseUrl =
|
|
1319
|
+
const t = Ct();
|
|
1320
|
+
this.baseUrl = St(e?.basePath ?? t.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = lt({
|
|
1309
1321
|
csrf: {
|
|
1310
|
-
endpoint: `${this.baseUrl}${
|
|
1311
|
-
cacheName:
|
|
1322
|
+
endpoint: `${this.baseUrl}${vt}/session/csrf`,
|
|
1323
|
+
cacheName: wt,
|
|
1312
1324
|
protectedUrls: ["services/data/v", "services/apexrest"],
|
|
1313
1325
|
alwaysProtectedUrls: ["services/apexrest"]
|
|
1314
1326
|
}
|
|
@@ -1355,23 +1367,23 @@ class vt {
|
|
|
1355
1367
|
return e;
|
|
1356
1368
|
}
|
|
1357
1369
|
}
|
|
1358
|
-
function
|
|
1370
|
+
function Ct() {
|
|
1359
1371
|
return {
|
|
1360
1372
|
apiPath: globalThis.SFDC_ENV?.apiPath
|
|
1361
1373
|
};
|
|
1362
1374
|
}
|
|
1363
|
-
function
|
|
1375
|
+
function St(s) {
|
|
1364
1376
|
if (!s || s === "/") return "";
|
|
1365
1377
|
let e = s;
|
|
1366
1378
|
return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
1367
1379
|
}
|
|
1368
|
-
function
|
|
1380
|
+
function cs(s, ...e) {
|
|
1369
1381
|
let t = s[0] ?? "";
|
|
1370
1382
|
for (let r = 0; r < e.length; r += 1)
|
|
1371
1383
|
t += String(e[r]) + (s[r + 1] ?? "");
|
|
1372
1384
|
return t;
|
|
1373
1385
|
}
|
|
1374
|
-
function
|
|
1386
|
+
function ls(s) {
|
|
1375
1387
|
return A(
|
|
1376
1388
|
(async () => {
|
|
1377
1389
|
switch (C(s?.surface)) {
|
|
@@ -1379,7 +1391,7 @@ function cs(s) {
|
|
|
1379
1391
|
return new Je();
|
|
1380
1392
|
case c.WebApp:
|
|
1381
1393
|
case c.MicroFrontend:
|
|
1382
|
-
return new
|
|
1394
|
+
return new bt(s?.webapp);
|
|
1383
1395
|
case c.Mosaic:
|
|
1384
1396
|
return new Be(s?.mosaic);
|
|
1385
1397
|
case c.SalesforceACC:
|
|
@@ -1392,7 +1404,7 @@ function cs(s) {
|
|
|
1392
1404
|
"createDataSDK"
|
|
1393
1405
|
);
|
|
1394
1406
|
}
|
|
1395
|
-
function
|
|
1407
|
+
function us(s) {
|
|
1396
1408
|
return A(
|
|
1397
1409
|
(async () => {
|
|
1398
1410
|
switch (C(s?.surface)) {
|
|
@@ -1415,13 +1427,13 @@ function ls(s) {
|
|
|
1415
1427
|
"createLightningSDK"
|
|
1416
1428
|
);
|
|
1417
1429
|
}
|
|
1418
|
-
function
|
|
1430
|
+
function Tt(s) {
|
|
1419
1431
|
let e = "";
|
|
1420
1432
|
for (let r = 0; r < s.length; r += 8192)
|
|
1421
1433
|
e += String.fromCharCode.apply(null, Array.from(s.subarray(r, r + 8192)));
|
|
1422
1434
|
return btoa(e);
|
|
1423
1435
|
}
|
|
1424
|
-
class
|
|
1436
|
+
class _t {
|
|
1425
1437
|
entries = [];
|
|
1426
1438
|
totalBytes = 0;
|
|
1427
1439
|
maxBufferSize;
|
|
@@ -1436,7 +1448,7 @@ class Tt {
|
|
|
1436
1448
|
return this.entries.length === 0;
|
|
1437
1449
|
}
|
|
1438
1450
|
enqueue(e, t) {
|
|
1439
|
-
const r =
|
|
1451
|
+
const r = Tt(e), n = {
|
|
1440
1452
|
data: r,
|
|
1441
1453
|
traceId: t?.traceId,
|
|
1442
1454
|
instanceId: t?.instanceId,
|
|
@@ -1458,8 +1470,8 @@ class Tt {
|
|
|
1458
1470
|
e > 0 && this.onError?.({ reason: "buffer_overflow", droppedCount: e });
|
|
1459
1471
|
}
|
|
1460
1472
|
}
|
|
1461
|
-
const
|
|
1462
|
-
class
|
|
1473
|
+
const Et = "telemetry/upload";
|
|
1474
|
+
class Mt {
|
|
1463
1475
|
buffer;
|
|
1464
1476
|
sdk;
|
|
1465
1477
|
onError;
|
|
@@ -1477,8 +1489,8 @@ class Et {
|
|
|
1477
1489
|
flush() {
|
|
1478
1490
|
if (this.buffer.isEmpty || !this.sdk.callTool)
|
|
1479
1491
|
return;
|
|
1480
|
-
const t = this.buffer.drain().map(
|
|
1481
|
-
this.sdk.callTool({ toolName:
|
|
1492
|
+
const t = this.buffer.drain().map(At);
|
|
1493
|
+
this.sdk.callTool({ toolName: Et, params: { inputs: [{ envelopes: t }] } }).catch((r) => {
|
|
1482
1494
|
this.onError?.({ reason: "tool_call_failed", error: r });
|
|
1483
1495
|
});
|
|
1484
1496
|
}
|
|
@@ -1486,37 +1498,37 @@ class Et {
|
|
|
1486
1498
|
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());
|
|
1487
1499
|
}
|
|
1488
1500
|
}
|
|
1489
|
-
function
|
|
1501
|
+
function At(s) {
|
|
1490
1502
|
const e = { base64Env: s.data };
|
|
1491
1503
|
return s.traceId !== void 0 && (e.traceId = s.traceId), e;
|
|
1492
1504
|
}
|
|
1493
|
-
const
|
|
1494
|
-
function
|
|
1505
|
+
const It = 65536, kt = 3e4;
|
|
1506
|
+
function ds(s) {
|
|
1495
1507
|
const {
|
|
1496
1508
|
sdk: e,
|
|
1497
|
-
maxBufferSize: t =
|
|
1498
|
-
flushInterval: r =
|
|
1509
|
+
maxBufferSize: t = It,
|
|
1510
|
+
flushInterval: r = kt,
|
|
1499
1511
|
onError: n
|
|
1500
|
-
} = s, i = new
|
|
1512
|
+
} = s, i = new _t({ maxBufferSize: t, onError: n }), o = new Mt(i, e, { flushInterval: r, onError: n });
|
|
1501
1513
|
return {
|
|
1502
|
-
enqueue(a,
|
|
1503
|
-
i.enqueue(a,
|
|
1514
|
+
enqueue(a, h) {
|
|
1515
|
+
i.enqueue(a, h);
|
|
1504
1516
|
},
|
|
1505
1517
|
dispose() {
|
|
1506
1518
|
o.dispose();
|
|
1507
1519
|
}
|
|
1508
1520
|
};
|
|
1509
1521
|
}
|
|
1510
|
-
const
|
|
1522
|
+
const Dt = 1e4, Pt = 10, Lt = 10, xt = 250, Rt = 1e3;
|
|
1511
1523
|
function b(s, e) {
|
|
1512
1524
|
if (s !== void 0 && (typeof s != "number" || !Number.isFinite(s) || s <= 0))
|
|
1513
1525
|
throw new Error(`${e}, if defined, must be a finite number greater than 0`);
|
|
1514
1526
|
}
|
|
1515
|
-
function
|
|
1527
|
+
function Ot(s, e) {
|
|
1516
1528
|
if (typeof s != "function")
|
|
1517
1529
|
throw new Error(`${e} must be a function`);
|
|
1518
1530
|
}
|
|
1519
|
-
class
|
|
1531
|
+
class Ht {
|
|
1520
1532
|
_collector;
|
|
1521
1533
|
_onEnvelope;
|
|
1522
1534
|
_onError;
|
|
@@ -1537,7 +1549,7 @@ class Ot {
|
|
|
1537
1549
|
_lastClickTriggeredAt = 0;
|
|
1538
1550
|
_isDisposed = !1;
|
|
1539
1551
|
constructor(e) {
|
|
1540
|
-
|
|
1552
|
+
Ot(e?.onEnvelope, "options.onEnvelope"), b(e.uploadInterval, "options.uploadInterval"), b(e.messagesLimit, "options.messagesLimit"), b(e.metricsLimit, "options.metricsLimit"), b(e.maxUniqueSchemas, "options.maxUniqueSchemas"), b(e.clickUploadDelay, "options.clickUploadDelay"), b(e.clickTriggerCooldown, "options.clickTriggerCooldown"), this._onEnvelope = e.onEnvelope, this._onError = e.onError, this._messagesLimit = e.messagesLimit ?? Pt, this._metricsLimit = e.metricsLimit ?? Lt, this._uploadInterval = e.uploadInterval ?? Dt, this._clickUploadDelay = e.clickUploadDelay ?? xt, this._clickTriggerCooldown = e.clickTriggerCooldown ?? Rt, this._enableClickTrigger = e.enableClickTrigger !== !1, this._enableVisibilityTrigger = e.enableVisibilityTrigger !== !1, this._collector = new ue({
|
|
1541
1553
|
environment: e.environment,
|
|
1542
1554
|
maxUniqueSchemas: e.maxUniqueSchemas
|
|
1543
1555
|
}), this._restartInterval(), this._attachWindowListeners();
|
|
@@ -1630,13 +1642,13 @@ class Ot {
|
|
|
1630
1642
|
}
|
|
1631
1643
|
}
|
|
1632
1644
|
}
|
|
1633
|
-
function
|
|
1645
|
+
function qt(s, e) {
|
|
1634
1646
|
if (!s)
|
|
1635
1647
|
throw new Error("instrumentedApp is required");
|
|
1636
|
-
const t = new
|
|
1648
|
+
const t = new Ht(e);
|
|
1637
1649
|
return s.registerLogCollector(t), s.registerMetricsCollector(t), e.enableClickTrigger !== !1 && s.activateClickTracker?.(), t;
|
|
1638
1650
|
}
|
|
1639
|
-
function
|
|
1651
|
+
function Nt(s) {
|
|
1640
1652
|
const e = (r, n, i, o, a) => {
|
|
1641
1653
|
s.error(a ?? r);
|
|
1642
1654
|
}, t = (r) => {
|
|
@@ -1646,33 +1658,33 @@ function qt(s) {
|
|
|
1646
1658
|
window.removeEventListener("error", e), window.removeEventListener("unhandledrejection", t);
|
|
1647
1659
|
};
|
|
1648
1660
|
}
|
|
1649
|
-
function
|
|
1661
|
+
function m(s, e) {
|
|
1650
1662
|
return { surface: e };
|
|
1651
1663
|
}
|
|
1652
|
-
const
|
|
1664
|
+
const Ft = {
|
|
1653
1665
|
callTool: {
|
|
1654
1666
|
isAsync: !0,
|
|
1655
1667
|
extractTags: (s, e) => ({ toolName: s[0]?.toolName ?? "unknown", surface: e })
|
|
1656
1668
|
},
|
|
1657
1669
|
setWidgetState: {
|
|
1658
1670
|
isAsync: !1,
|
|
1659
|
-
extractTags:
|
|
1671
|
+
extractTags: m
|
|
1660
1672
|
},
|
|
1661
1673
|
getWidgetState: {
|
|
1662
1674
|
isAsync: !1,
|
|
1663
|
-
extractTags:
|
|
1675
|
+
extractTags: m
|
|
1664
1676
|
},
|
|
1665
1677
|
sendMessageToHost: {
|
|
1666
1678
|
isAsync: !0,
|
|
1667
|
-
extractTags:
|
|
1679
|
+
extractTags: m
|
|
1668
1680
|
},
|
|
1669
1681
|
openLink: {
|
|
1670
1682
|
isAsync: !0,
|
|
1671
|
-
extractTags:
|
|
1683
|
+
extractTags: m
|
|
1672
1684
|
},
|
|
1673
1685
|
subscribe: {
|
|
1674
1686
|
isAsync: !1,
|
|
1675
|
-
extractTags:
|
|
1687
|
+
extractTags: m,
|
|
1676
1688
|
wrapArgs: (s, e) => {
|
|
1677
1689
|
const t = s[0];
|
|
1678
1690
|
return [
|
|
@@ -1692,39 +1704,39 @@ const Nt = {
|
|
|
1692
1704
|
},
|
|
1693
1705
|
accessToolOutput: {
|
|
1694
1706
|
isAsync: !1,
|
|
1695
|
-
extractTags:
|
|
1707
|
+
extractTags: m
|
|
1696
1708
|
},
|
|
1697
1709
|
accessToolInput: {
|
|
1698
1710
|
isAsync: !1,
|
|
1699
|
-
extractTags:
|
|
1711
|
+
extractTags: m
|
|
1700
1712
|
},
|
|
1701
1713
|
accessToolMetadata: {
|
|
1702
1714
|
isAsync: !1,
|
|
1703
|
-
extractTags:
|
|
1715
|
+
extractTags: m
|
|
1704
1716
|
}
|
|
1705
1717
|
};
|
|
1706
|
-
function
|
|
1718
|
+
function Ut(s, e, t) {
|
|
1707
1719
|
return new Proxy(s, {
|
|
1708
1720
|
get(r, n, i) {
|
|
1709
|
-
const o = Reflect.get(r, n, i), a =
|
|
1710
|
-
return !a || typeof o != "function" ? o : (...
|
|
1711
|
-
const
|
|
1721
|
+
const o = Reflect.get(r, n, i), a = Ft[n];
|
|
1722
|
+
return !a || typeof o != "function" ? o : (...h) => {
|
|
1723
|
+
const d = a.extractTags(h, t), p = a.wrapArgs ? a.wrapArgs(h, e) : h, f = `sdk.${String(n)}`;
|
|
1712
1724
|
return a.isAsync ? e.activityAsync(f, async () => {
|
|
1713
1725
|
try {
|
|
1714
1726
|
const l = await o.apply(
|
|
1715
1727
|
r,
|
|
1716
1728
|
p
|
|
1717
1729
|
);
|
|
1718
|
-
return e.incrementCounter(f, 1, !1,
|
|
1730
|
+
return e.incrementCounter(f, 1, !1, d), l;
|
|
1719
1731
|
} catch (l) {
|
|
1720
|
-
throw e.incrementCounter(f, 1, !0,
|
|
1732
|
+
throw e.incrementCounter(f, 1, !0, d), l;
|
|
1721
1733
|
}
|
|
1722
|
-
}) : (e.incrementCounter(f, 1, !1,
|
|
1734
|
+
}) : (e.incrementCounter(f, 1, !1, d), o.apply(r, p));
|
|
1723
1735
|
};
|
|
1724
1736
|
}
|
|
1725
1737
|
});
|
|
1726
1738
|
}
|
|
1727
|
-
async function
|
|
1739
|
+
async function hs(s) {
|
|
1728
1740
|
const { appId: e, clientSessionId: t } = s, r = C(), n = Date.now(), i = s.sdk ?? await He(), o = de("mcp-widget", {
|
|
1729
1741
|
appPayloadProvider: {
|
|
1730
1742
|
getPayload: () => ({
|
|
@@ -1733,75 +1745,75 @@ async function ds(s) {
|
|
|
1733
1745
|
})
|
|
1734
1746
|
},
|
|
1735
1747
|
clientSessionId: t
|
|
1736
|
-
}), a = o,
|
|
1748
|
+
}), a = o, h = Ut(i, a, r), d = Nt(a);
|
|
1737
1749
|
let p;
|
|
1738
|
-
s.transport && (p =
|
|
1739
|
-
onEnvelope: (
|
|
1740
|
-
s.transport.enqueue(
|
|
1750
|
+
s.transport && (p = qt(o, {
|
|
1751
|
+
onEnvelope: (u) => {
|
|
1752
|
+
s.transport.enqueue(u);
|
|
1741
1753
|
}
|
|
1742
1754
|
}));
|
|
1743
1755
|
let f, l = !1;
|
|
1744
1756
|
return {
|
|
1745
|
-
instrumentedSDK:
|
|
1757
|
+
instrumentedSDK: h,
|
|
1746
1758
|
app: o,
|
|
1747
|
-
trackEvent(
|
|
1759
|
+
trackEvent(u, g) {
|
|
1748
1760
|
l || a.log(ye, {
|
|
1749
|
-
eventName:
|
|
1750
|
-
properties:
|
|
1761
|
+
eventName: u,
|
|
1762
|
+
properties: g ? JSON.stringify(g) : ""
|
|
1751
1763
|
});
|
|
1752
1764
|
},
|
|
1753
|
-
trackInteraction(
|
|
1754
|
-
l || a.log(
|
|
1755
|
-
elementId:
|
|
1756
|
-
properties:
|
|
1765
|
+
trackInteraction(u, g) {
|
|
1766
|
+
l || a.log(me, {
|
|
1767
|
+
elementId: u,
|
|
1768
|
+
properties: g ? JSON.stringify(g) : ""
|
|
1757
1769
|
});
|
|
1758
1770
|
},
|
|
1759
|
-
trackError(
|
|
1760
|
-
l || a.error(
|
|
1761
|
-
properties:
|
|
1771
|
+
trackError(u, g) {
|
|
1772
|
+
l || a.error(u, ge, {
|
|
1773
|
+
properties: g ? JSON.stringify(g) : ""
|
|
1762
1774
|
});
|
|
1763
1775
|
},
|
|
1764
|
-
trackPageView(
|
|
1765
|
-
l ||
|
|
1776
|
+
trackPageView(u) {
|
|
1777
|
+
l || u !== f && (f = u, a.log(pe, { componentRef: u }));
|
|
1766
1778
|
},
|
|
1767
1779
|
dispose() {
|
|
1768
1780
|
if (l) return;
|
|
1769
|
-
l = !0,
|
|
1770
|
-
const
|
|
1771
|
-
a.log(fe, { durationMs:
|
|
1781
|
+
l = !0, d();
|
|
1782
|
+
const u = Date.now() - n;
|
|
1783
|
+
a.log(fe, { durationMs: u }), p?.dispose();
|
|
1772
1784
|
}
|
|
1773
1785
|
};
|
|
1774
1786
|
}
|
|
1775
1787
|
export {
|
|
1776
1788
|
_e as JsonRpcClient,
|
|
1777
|
-
|
|
1789
|
+
xe as MCPAppsChatSDK,
|
|
1778
1790
|
Fe as MCPAppsViewSDK,
|
|
1779
1791
|
y as McpAppsSession,
|
|
1780
|
-
|
|
1792
|
+
ts as MessageChannelTransport,
|
|
1781
1793
|
c as Surface,
|
|
1782
|
-
|
|
1794
|
+
Ht as TelemetryUploader,
|
|
1783
1795
|
Te as WindowPostMessageTransport,
|
|
1784
|
-
|
|
1796
|
+
hs as createAnalytics,
|
|
1785
1797
|
qe as createChatSDK,
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1798
|
+
ls as createDataSDK,
|
|
1799
|
+
us as createLightningSDK,
|
|
1800
|
+
ds as createTelemetryTransport,
|
|
1789
1801
|
Ve as createViewSDK,
|
|
1790
1802
|
He as getChatSDK,
|
|
1791
|
-
|
|
1803
|
+
rs as getChatSDKSync,
|
|
1792
1804
|
C as getSurface,
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1805
|
+
ss as getSurfaceCapabilities,
|
|
1806
|
+
is as getViewSDK,
|
|
1807
|
+
os as getViewSDKSync,
|
|
1808
|
+
cs as gql,
|
|
1797
1809
|
M as isJsonRpcBase,
|
|
1798
1810
|
B as isJsonRpcErrorResponse,
|
|
1799
1811
|
Se as isJsonRpcNotification,
|
|
1800
|
-
|
|
1812
|
+
es as isJsonRpcRequest,
|
|
1801
1813
|
Ce as isJsonRpcResponse,
|
|
1802
1814
|
be as isJsonRpcSuccessResponse,
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1815
|
+
qt as registerTelemetryUploader,
|
|
1816
|
+
ns as resetChatSDK,
|
|
1817
|
+
as as resetViewSDK,
|
|
1806
1818
|
A as wrapSDKPromise
|
|
1807
1819
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-adapter.d.ts","sourceRoot":"","sources":["../../src/telemetry/tool-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAKhD,UAAU,uBAAuB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,2BAA2B;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAC;CACrD;AAED,qBAAa,oBAAoB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAA6C;IACtE,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAIrC;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE7B;gBAEU,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,2BAA2B;IAUvF,KAAK,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"tool-adapter.d.ts","sourceRoot":"","sources":["../../src/telemetry/tool-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAKhD,UAAU,uBAAuB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,2BAA2B;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAC;CACrD;AAED,qBAAa,oBAAoB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAA6C;IACtE,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAIrC;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE7B;gBAEU,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,2BAA2B;IAUvF,KAAK,IAAI,IAAI;IAab,OAAO,IAAI,IAAI;CAcf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/platform-sdk",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@conduit-client/service-cache-inclusion-policy": "3.19.6",
|
|
35
35
|
"@conduit-client/service-fetch-network": "3.19.6",
|
|
36
36
|
"@conduit-client/service-pubsub": "3.19.6",
|
|
37
|
+
"@conduit-client/service-retry": "3.19.6",
|
|
37
38
|
"@conduit-client/utils": "3.19.6"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|