@salesforce/sdk-core 1.130.1 → 1.130.2

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.d.ts CHANGED
@@ -14,14 +14,18 @@ export interface GraphQLResponse<T> {
14
14
  path?: string[];
15
15
  }[];
16
16
  }
17
+ export interface GraphQLRequest<V = Record<string, unknown>> {
18
+ query: string;
19
+ variables?: V;
20
+ operationName?: string;
21
+ }
17
22
  export interface DataSDK {
18
23
  /**
19
24
  * Run a GraphQL query
20
25
  *
21
- * @param query
22
- * @param variables
26
+ * @param request - The GraphQL request options (query, variables, operationName)
23
27
  */
24
- graphql?: <T, V = Record<string, unknown>>(query: string, variables?: V) => Promise<GraphQLResponse<T>>;
28
+ graphql?: <T, V = Record<string, unknown>>(request: GraphQLRequest<V>) => Promise<GraphQLResponse<T>>;
25
29
  /**
26
30
  * Make a request using the Fetch API.
27
31
  *
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,eAAe,CAAC,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,CAAC,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC/C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KAChB,EAAE,CAAC;CACJ;AAED,MAAM,WAAW,OAAO;IACvB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,CAAC,KACT,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,eAAe,CAAC,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,CAAC,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC/C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KAChB,EAAE,CAAC;CACJ;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,MAAM,WAAW,OAAO;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,KACtB,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB"}
package/dist/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, DeviceCapabilities, DisplayMode, ResourceRequest, SafeAreaInsets, ToolCall, ToolState, } from './chat';
10
10
  export type { AlertOptions, MessageLevel, ModalOptions, ToastOptions, Theme, ThemeMode, ViewSDK, } from './view';
11
- export type { DataSDK, GraphQLResponse } from './data';
11
+ export type { DataSDK, GraphQLRequest, GraphQLResponse } 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';
@@ -18,4 +18,5 @@ export { McpAppsSession } from './mcpapps-session';
18
18
  export type { McpAppsHostContext, McpAppsSessionOptions } from './mcpapps-session';
19
19
  export { getSurfaceCapabilities } from './capabilities';
20
20
  export type { SurfaceCapabilities } from './capabilities';
21
+ export { wrapSDKPromise } from './sdk-promise';
21
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/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,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,cAAc,EACd,QAAQ,EACR,SAAS,GACT,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,SAAS,EACT,OAAO,GACP,MAAM,QAAQ,CAAC;AAGhB,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGvD,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7F,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,a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e,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7F,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/D,YAAY,EACX,WAAW,EACX,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,GACxB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACN,aAAa,EACb,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,GAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,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"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var o = /* @__PURE__ */ ((e) => (e.WebApp = "WebApp", e.MicroFrontend = "Micro-Frontend", e.OpenAI = "OpenAI", e.SalesforceACC = "Salesforce-ACC", e.MCPApps = "MCP-Apps", e.Mosaic = "Mosaic", e))(o || {});
1
+ var r = /* @__PURE__ */ ((e) => (e.WebApp = "WebApp", e.MicroFrontend = "Micro-Frontend", e.OpenAI = "OpenAI", e.SalesforceACC = "Salesforce-ACC", e.MCPApps = "MCP-Apps", e.Mosaic = "Mosaic", e))(r || {});
2
2
  const d = f();
3
3
  function f() {
4
4
  if (typeof window > "u")
@@ -14,7 +14,7 @@ function f() {
14
14
  const e = window;
15
15
  return e.$A || e.Aura ? "Salesforce-ACC" : "WebApp";
16
16
  }
17
- function w(e) {
17
+ function S(e) {
18
18
  return e ?? d;
19
19
  }
20
20
  function l(e) {
@@ -75,7 +75,7 @@ class T {
75
75
  }
76
76
  if (g(t)) {
77
77
  const n = this.notificationHandlers.get(t.method);
78
- n && n.forEach((i) => i(t.params));
78
+ n && n.forEach((o) => o(t.params));
79
79
  }
80
80
  };
81
81
  /**
@@ -92,17 +92,17 @@ class T {
92
92
  * });
93
93
  */
94
94
  request(s, t) {
95
- const n = this.nextRequestId++, i = {
95
+ const n = this.nextRequestId++, o = {
96
96
  jsonrpc: "2.0",
97
97
  id: n,
98
98
  method: s,
99
99
  params: t
100
100
  };
101
- return new Promise((c, a) => {
101
+ return new Promise((i, c) => {
102
102
  this.pending.set(n, {
103
- resolve: c,
104
- reject: a
105
- }), window.parent?.postMessage(i, "*");
103
+ resolve: i,
104
+ reject: c
105
+ }), window.parent?.postMessage(o, "*");
106
106
  });
107
107
  }
108
108
  /**
@@ -137,8 +137,8 @@ class T {
137
137
  window.parent?.postMessage(n, "*");
138
138
  }
139
139
  }
140
- const C = 500, M = "2026-01-26";
141
- class r extends T {
140
+ const M = 500, C = "2026-01-26";
141
+ class a extends T {
142
142
  static initPromise = null;
143
143
  hostCtx = {};
144
144
  _handshakeSucceeded = !1;
@@ -149,17 +149,17 @@ class r extends T {
149
149
  * calls reuse the same session and handshake result.
150
150
  */
151
151
  static async getInstance(s) {
152
- return r.initPromise || (r.initPromise = (async () => {
153
- const t = new r();
152
+ return a.initPromise || (a.initPromise = (async () => {
153
+ const t = new a();
154
154
  return await t.handshake(s), t;
155
- })()), r.initPromise;
155
+ })()), a.initPromise;
156
156
  }
157
157
  /**
158
158
  * Reset the singleton (for testing only).
159
159
  * @internal
160
160
  */
161
161
  static resetInstance() {
162
- r.initPromise = null;
162
+ a.initPromise = null;
163
163
  }
164
164
  /**
165
165
  * Perform the ui/initialize → hostContext → ui/notifications/initialized handshake.
@@ -169,20 +169,20 @@ class r extends T {
169
169
  * still render (graceful degradation for non-SEP-1865 hosts).
170
170
  */
171
171
  async handshake(s) {
172
- const t = s?.handshakeTimeoutMs ?? C, n = s?.appInfo ?? { name: "mcp-app", version: "1.0.0" };
172
+ const t = s?.handshakeTimeoutMs ?? M, n = s?.appInfo ?? { name: "mcp-app", version: "1.0.0" };
173
173
  try {
174
- const i = /* @__PURE__ */ Symbol("timeout"), c = await Promise.race([
174
+ const o = /* @__PURE__ */ Symbol("timeout"), i = await Promise.race([
175
175
  this.request("ui/initialize", {
176
- protocolVersion: M,
176
+ protocolVersion: C,
177
177
  appInfo: n,
178
178
  appCapabilities: {}
179
179
  }),
180
- new Promise((a) => setTimeout(() => a(i), t))
180
+ new Promise((c) => setTimeout(() => c(o), t))
181
181
  ]);
182
- c !== i && (this.hostCtx = c.hostContext ?? {}, this._handshakeSucceeded = !0, this.registerNotificationHandler("ui/notifications/host-context-changed", (a) => {
182
+ i !== o && (this.hostCtx = i.hostContext ?? {}, this._handshakeSucceeded = !0, this.registerNotificationHandler("ui/notifications/host-context-changed", (c) => {
183
183
  this.hostCtx = {
184
184
  ...this.hostCtx,
185
- ...a
185
+ ...c
186
186
  };
187
187
  }), this.sendNotification("ui/notifications/initialized"));
188
188
  } catch {
@@ -209,7 +209,7 @@ class r extends T {
209
209
  super.registerNotificationHandler(s, t);
210
210
  }
211
211
  }
212
- const A = {
212
+ const y = {
213
213
  callTool: !0,
214
214
  sendMessageToHost: !0,
215
215
  readResource: !0,
@@ -229,7 +229,7 @@ const A = {
229
229
  // TODO
230
230
  getTheme: !0,
231
231
  resize: !0
232
- }, m = {
232
+ }, w = {
233
233
  callTool: !0,
234
234
  sendMessageToHost: !0,
235
235
  readResource: !1,
@@ -248,7 +248,7 @@ const A = {
248
248
  displayModal: !0,
249
249
  getTheme: !0,
250
250
  resize: !1
251
- }, y = {
251
+ }, m = {
252
252
  callTool: !1,
253
253
  sendMessageToHost: !0,
254
254
  readResource: !1,
@@ -267,7 +267,7 @@ const A = {
267
267
  displayModal: !1,
268
268
  getTheme: !0,
269
269
  resize: !1
270
- }, I = {
270
+ }, A = {
271
271
  callTool: !1,
272
272
  sendMessageToHost: !1,
273
273
  readResource: !1,
@@ -287,31 +287,47 @@ const A = {
287
287
  getTheme: !1,
288
288
  resize: !1
289
289
  };
290
- function S(e) {
290
+ function b(e) {
291
291
  switch (e) {
292
- case o.MCPApps:
293
- return { ...A };
294
- case o.OpenAI:
295
- return { ...m };
296
- case o.SalesforceACC:
292
+ case r.MCPApps:
297
293
  return { ...y };
298
- case o.Mosaic:
299
- case o.WebApp:
300
- case o.MicroFrontend:
294
+ case r.OpenAI:
295
+ return { ...w };
296
+ case r.SalesforceACC:
297
+ return { ...m };
298
+ case r.Mosaic:
299
+ case r.WebApp:
300
+ case r.MicroFrontend:
301
301
  default:
302
- return { ...I };
302
+ return { ...A };
303
303
  }
304
304
  }
305
+ const I = /* @__PURE__ */ new Set(["then", "catch", "finally"]);
306
+ function R(e, s) {
307
+ return new Proxy(e, {
308
+ get(t, n, o) {
309
+ if (typeof n == "symbol" || I.has(n)) {
310
+ const i = Reflect.get(t, n, o);
311
+ return typeof i == "function" ? i.bind(t) : i;
312
+ }
313
+ throw new TypeError(
314
+ `\`${s}()\` returns a Promise — did you forget to await it?
315
+ Use \`const sdk = await ${s}();\` before accessing SDK methods.`
316
+ );
317
+ }
318
+ });
319
+ }
305
320
  export {
306
321
  T as JsonRpcClient,
307
- r as McpAppsSession,
308
- o as Surface,
309
- w as getSurface,
310
- S as getSurfaceCapabilities,
322
+ a as McpAppsSession,
323
+ r as Surface,
324
+ S as getSurface,
325
+ b as getSurfaceCapabilities,
311
326
  l as isJsonRpcBase,
312
327
  u as isJsonRpcErrorResponse,
313
328
  g as isJsonRpcNotification,
314
329
  P as isJsonRpcRequest,
315
330
  h as isJsonRpcResponse,
316
- p as isJsonRpcSuccessResponse
331
+ p as isJsonRpcSuccessResponse,
332
+ R as wrapSDKPromise
317
333
  };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ /**
7
+ * Wraps an SDK factory Promise in a Proxy that throws a clear error if a
8
+ * non-Promise method is accessed, guiding callers who forgot to `await`.
9
+ *
10
+ * Symbol-keyed properties (e.g. Symbol.toStringTag, Symbol.iterator) are
11
+ * always forwarded so the value continues to behave as a proper thenable.
12
+ */
13
+ export declare function wrapSDKPromise<T>(promise: Promise<T>, factoryName: string): Promise<T>;
14
+ //# sourceMappingURL=sdk-promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-promise.d.ts","sourceRoot":"","sources":["../src/sdk-promise.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAetF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sdk-core",
3
- "version": "1.130.1",
3
+ "version": "1.130.2",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",