@salesforce/platform-sdk 12.12.1 → 12.14.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/analytics/index.js +1 -1
- package/dist/{analytics-wESbWdca.js → analytics-TRyVm9Ub.js} +1 -1
- package/dist/app/index.js +1 -1
- package/dist/{capabilities-B0mU0_G0.js → capabilities-B3Raifjg.js} +2 -1
- package/dist/chat/index.d.ts.map +1 -1
- package/dist/chat/index.js +11 -10
- package/dist/core/capabilities.d.ts +2 -2
- package/dist/core/capabilities.d.ts.map +1 -1
- package/dist/core/data.d.ts +5 -5
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/mcpapps-session.d.ts +19 -8
- package/dist/core/mcpapps-session.d.ts.map +1 -1
- package/dist/core/surface.d.ts +12 -10
- package/dist/core/surface.d.ts.map +1 -1
- package/dist/core/view.d.ts +118 -4
- package/dist/core/view.d.ts.map +1 -1
- package/dist/data/index.d.ts +49 -4
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +435 -366
- package/dist/data/mcpapps/index.d.ts +9 -0
- package/dist/data/mcpapps/index.d.ts.map +1 -0
- package/dist/data/mosaic/fetch.d.ts +13 -33
- package/dist/data/mosaic/fetch.d.ts.map +1 -1
- package/dist/data/mosaic/index.d.ts +0 -14
- package/dist/data/mosaic/index.d.ts.map +1 -1
- package/dist/data/shared/graphql/parse-response.d.ts +4 -36
- package/dist/data/shared/graphql/parse-response.d.ts.map +1 -1
- package/dist/data/webapp/csrf/token-manager.d.ts +14 -1
- package/dist/data/webapp/csrf/token-manager.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lightning/index.d.ts.map +1 -1
- package/dist/lightning/index.js +5 -4
- package/dist/observability/vendor/index.d.ts +17 -0
- package/dist/observability/vendor/index.d.ts.map +1 -0
- package/dist/observability/vendor/names.d.ts +11 -0
- package/dist/observability/vendor/names.d.ts.map +1 -0
- package/dist/observability/vendor/protocol.d.ts +25 -0
- package/dist/observability/vendor/protocol.d.ts.map +1 -0
- package/dist/observability/vendor/queue.d.ts +16 -0
- package/dist/observability/vendor/queue.d.ts.map +1 -0
- package/dist/observability/vendor/verbs.d.ts +19 -0
- package/dist/observability/vendor/verbs.d.ts.map +1 -0
- package/dist/{surface-DWDgqdpN.js → surface-Cg3eyRpj.js} +44 -26
- package/dist/ui-embedding/session.js +1 -1
- package/dist/view/embedding.d.ts +18 -1
- package/dist/view/embedding.d.ts.map +1 -1
- package/dist/view/index.d.ts +1 -1
- package/dist/view/index.d.ts.map +1 -1
- package/dist/view/index.js +79 -35
- package/dist/view/utils.d.ts +5 -0
- package/dist/view/utils.d.ts.map +1 -1
- package/docs/data/02-caching-and-freshness.md +3 -3
- package/docs/data/03-reactive-handle-lifecycle.md +2 -2
- package/docs/data/04-surfaces-and-guards.md +60 -6
- package/package.json +3 -3
package/dist/view/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as
|
|
1
|
+
import { g as m, S as a, a as w } from "../surface-Cg3eyRpj.js";
|
|
2
2
|
import { w as p } from "../sdk-promise-D0sy7OW1.js";
|
|
3
|
-
import { requireSharedSession as
|
|
4
|
-
function
|
|
3
|
+
import { requireSharedSession as b } from "../ui-embedding/session.js";
|
|
4
|
+
function g(i) {
|
|
5
5
|
switch (i) {
|
|
6
6
|
case "info":
|
|
7
7
|
return "ℹ️";
|
|
@@ -15,8 +15,8 @@ function f(i) {
|
|
|
15
15
|
return "ℹ️";
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return `${
|
|
18
|
+
function l(i, e) {
|
|
19
|
+
return `${g(e)} ${i}`;
|
|
20
20
|
}
|
|
21
21
|
function o(i, e) {
|
|
22
22
|
const s = i.trim();
|
|
@@ -34,14 +34,22 @@ function o(i, e) {
|
|
|
34
34
|
error: `Invalid ${e}: "${i}". Value must be a positive number.`
|
|
35
35
|
} : { success: !0, value: r };
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
function h(i, e) {
|
|
38
|
+
try {
|
|
39
|
+
structuredClone(e);
|
|
40
|
+
} catch (s) {
|
|
41
|
+
const t = s instanceof Error ? s.message : String(s);
|
|
42
|
+
throw new Error(`${i}: options must be structured-cloneable (${t})`, { cause: s });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const f = "trackdirtystate";
|
|
46
|
+
class u extends EventTarget {
|
|
39
47
|
constructor(e) {
|
|
40
48
|
super(), this.session = e;
|
|
41
49
|
}
|
|
42
50
|
session;
|
|
43
51
|
static async create() {
|
|
44
|
-
const e = await
|
|
52
|
+
const e = await b("EmbeddingViewSDK"), s = new u(e);
|
|
45
53
|
return await Promise.all([s.subscribeToHostEvent(), s.subscribeToUiState()]), s;
|
|
46
54
|
}
|
|
47
55
|
// Latest snapshot, refreshed on every host push. Session-scoped — the wire subscription
|
|
@@ -126,6 +134,41 @@ class l extends EventTarget {
|
|
|
126
134
|
...r.value !== void 0 ? { height: r.value } : {}
|
|
127
135
|
});
|
|
128
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Ask the host to navigate (`ui/navigate-to`); the host drives Lightning navigation. A URL
|
|
139
|
+
* string is sent as a `standard__webPage` page reference; a page reference is sent as is.
|
|
140
|
+
* Rejects when the page reference is not structured-cloneable.
|
|
141
|
+
*/
|
|
142
|
+
async navigateTo(e) {
|
|
143
|
+
const s = typeof e == "string" ? { type: "standard__webPage", attributes: { url: e } } : e;
|
|
144
|
+
h("navigateTo", s), await this.session.bridge.sendNavigateTo(s);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Ask the host to show a toast (`ui/display-toast`). Resolves once the host queues the
|
|
148
|
+
* toast, not when it is dismissed. `level` maps to the host's toast `variant`.
|
|
149
|
+
*/
|
|
150
|
+
async displayToast(e) {
|
|
151
|
+
await this.session.bridge.sendDisplayToast({
|
|
152
|
+
message: e.message,
|
|
153
|
+
...e.title !== void 0 ? { title: e.title } : {},
|
|
154
|
+
...e.level !== void 0 ? { variant: e.level } : {},
|
|
155
|
+
...e.mode !== void 0 ? { mode: e.mode } : {}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Ask the host to open a registered modal component (`ui/display-modal`). Resolves only
|
|
160
|
+
* when the user dismisses the modal, with its close result; rejects when the host does
|
|
161
|
+
* not register `componentReference` or when `params` is not structured-cloneable.
|
|
162
|
+
*/
|
|
163
|
+
async displayModal(e) {
|
|
164
|
+
const s = {
|
|
165
|
+
component: e.componentReference,
|
|
166
|
+
...e.params !== void 0 ? { attributes: e.params } : {},
|
|
167
|
+
...e.size !== void 0 ? { size: e.size } : {},
|
|
168
|
+
...e.label !== void 0 ? { label: e.label } : {}
|
|
169
|
+
};
|
|
170
|
+
return h("displayModal", s), this.session.bridge.sendDisplayModal(s);
|
|
171
|
+
}
|
|
129
172
|
/**
|
|
130
173
|
* Send an event to the host over the wire. Private wire-layer plumbing; the public
|
|
131
174
|
* entry point is {@link dispatchEvent}, which calls this in addition to notifying
|
|
@@ -205,14 +248,14 @@ class l extends EventTarget {
|
|
|
205
248
|
}
|
|
206
249
|
}
|
|
207
250
|
setDirty(e, s) {
|
|
208
|
-
this.session.bridge.sendEventDispatch(
|
|
251
|
+
this.session.bridge.sendEventDispatch(f, {
|
|
209
252
|
isDirty: e,
|
|
210
253
|
instanceId: this.session.hostMetaData.instanceId,
|
|
211
254
|
label: s ?? ""
|
|
212
255
|
});
|
|
213
256
|
}
|
|
214
257
|
}
|
|
215
|
-
class
|
|
258
|
+
class v {
|
|
216
259
|
constructor(e) {
|
|
217
260
|
this.session = e;
|
|
218
261
|
}
|
|
@@ -223,7 +266,7 @@ class g {
|
|
|
223
266
|
* @param level - The message severity level (defaults to "info")
|
|
224
267
|
*/
|
|
225
268
|
async sendMessage(e, s = "info") {
|
|
226
|
-
const t =
|
|
269
|
+
const t = l(e, s);
|
|
227
270
|
await this.session.request("ui/message", {
|
|
228
271
|
role: "user",
|
|
229
272
|
content: [
|
|
@@ -258,13 +301,13 @@ class g {
|
|
|
258
301
|
return t.value !== void 0 && (c.width = t.value), r.value !== void 0 && (c.height = r.value), this.session.sendNotification("ui/notifications/size-changed", c), Promise.resolve();
|
|
259
302
|
}
|
|
260
303
|
}
|
|
261
|
-
class
|
|
304
|
+
class y {
|
|
262
305
|
async displayAlert(e) {
|
|
263
|
-
const s = e.level || "info", t =
|
|
306
|
+
const s = e.level || "info", t = l(e.message, s);
|
|
264
307
|
await window.openai.sendFollowUpMessage({ prompt: t });
|
|
265
308
|
}
|
|
266
309
|
async displayToast(e) {
|
|
267
|
-
const s = e.level || "info", t =
|
|
310
|
+
const s = e.level || "info", t = l(e.message, s);
|
|
268
311
|
await window.openai.sendFollowUpMessage({ prompt: t });
|
|
269
312
|
}
|
|
270
313
|
async displayModal(e) {
|
|
@@ -278,31 +321,32 @@ class v {
|
|
|
278
321
|
return e ? { mode: e } : null;
|
|
279
322
|
}
|
|
280
323
|
}
|
|
281
|
-
let
|
|
282
|
-
function
|
|
283
|
-
return
|
|
324
|
+
let n = null, d = null;
|
|
325
|
+
function T(i) {
|
|
326
|
+
return n || (n = S(i).then((e) => (d = e, e))), n;
|
|
284
327
|
}
|
|
285
|
-
function
|
|
328
|
+
function V() {
|
|
286
329
|
return d;
|
|
287
330
|
}
|
|
288
|
-
function
|
|
289
|
-
|
|
331
|
+
function K() {
|
|
332
|
+
n = null, d = null;
|
|
290
333
|
}
|
|
291
|
-
function
|
|
334
|
+
function S(i) {
|
|
292
335
|
return p(
|
|
293
336
|
(async () => {
|
|
294
337
|
try {
|
|
295
|
-
switch (await
|
|
296
|
-
case
|
|
297
|
-
return new
|
|
298
|
-
case
|
|
299
|
-
case
|
|
338
|
+
switch (await m(i?.surface)) {
|
|
339
|
+
case a.OpenAI:
|
|
340
|
+
return new y();
|
|
341
|
+
case a.WebApp:
|
|
342
|
+
case a.Mosaic:
|
|
300
343
|
return {};
|
|
301
|
-
case
|
|
302
|
-
return await
|
|
303
|
-
case
|
|
344
|
+
case a.MicroFrontend:
|
|
345
|
+
return await u.create();
|
|
346
|
+
case a.Claude:
|
|
347
|
+
case a.MCPApps: {
|
|
304
348
|
const s = await w.getInstance();
|
|
305
|
-
return new
|
|
349
|
+
return new v(s);
|
|
306
350
|
}
|
|
307
351
|
default:
|
|
308
352
|
return {};
|
|
@@ -315,9 +359,9 @@ function y(i) {
|
|
|
315
359
|
);
|
|
316
360
|
}
|
|
317
361
|
export {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
362
|
+
v as MCPAppsViewSDK,
|
|
363
|
+
S as createViewSDK,
|
|
364
|
+
T as getViewSDK,
|
|
365
|
+
V as getViewSDKSync,
|
|
366
|
+
K as resetViewSDK
|
|
323
367
|
};
|
package/dist/view/utils.d.ts
CHANGED
|
@@ -56,4 +56,9 @@ export type ParseDimensionResult = {
|
|
|
56
56
|
* parseDimension("50%", "width") // Returns { success: false, error: "Invalid width..." }
|
|
57
57
|
*/
|
|
58
58
|
export declare function parseDimension(value: string, dimensionName: string): ParseDimensionResult;
|
|
59
|
+
/**
|
|
60
|
+
* Throw if `payload` cannot be structured-cloned. The transport drops an uncloneable message
|
|
61
|
+
* silently, so without this check the request would never settle.
|
|
62
|
+
*/
|
|
63
|
+
export declare function assertCloneable(method: string, payload: unknown): void;
|
|
59
64
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/view/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/view/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAa3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,CAGnF;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC/B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,oBAAoB,CAiCzF"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/view/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAa3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,CAGnF;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC/B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,oBAAoB,CAiCzF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAOtE"}
|
|
@@ -13,8 +13,8 @@ buildCacheServices: dist/data/shared/graphql/cache/services.d.ts
|
|
|
13
13
|
# Caching & freshness
|
|
14
14
|
|
|
15
15
|
> **Surface caveat up front:** everything about _caching_ here is the **WebApp surface**. On the
|
|
16
|
-
> uncached surfaces (Mosaic, OpenAI) there is no cache — see
|
|
17
|
-
> [Uncached surfaces](#uncached-surfaces-mosaic-openai) below and
|
|
16
|
+
> uncached surfaces (Mosaic, OpenAI, Claude, MCPApps) there is no cache — see
|
|
17
|
+
> [Uncached surfaces](#uncached-surfaces-mosaic-openai-claude-mcpapps) below and
|
|
18
18
|
> [04-surfaces-and-guards.md](./04-surfaces-and-guards.md). The `query`/`mutate` shape is identical
|
|
19
19
|
> on every surface, so call sites stay portable.
|
|
20
20
|
|
|
@@ -169,7 +169,7 @@ a held query (see [Refresh after a mutation](./03-reactive-handle-lifecycle.md#r
|
|
|
169
169
|
pushes to existing subscribers** and is a method on a live handle, while `no-cache` is a fresh
|
|
170
170
|
one-shot call with no subscribers.
|
|
171
171
|
|
|
172
|
-
## Uncached surfaces (Mosaic, OpenAI)
|
|
172
|
+
## Uncached surfaces (Mosaic, OpenAI, Claude, MCPApps)
|
|
173
173
|
|
|
174
174
|
- **No cache exists.** Every `query()` is a network request.
|
|
175
175
|
- **`cacheControl` is silently ignored** — `"no-cache"`, `"only-if-cached"`, and `max-age` have no
|
|
@@ -78,7 +78,7 @@ one-shot `cacheControl` — is a strategy call. See the two-refresh-tools table
|
|
|
78
78
|
|
|
79
79
|
## Uncached surfaces
|
|
80
80
|
|
|
81
|
-
On Mosaic / OpenAI the handle exists but `subscribe` only emits in response to `refresh()` — there
|
|
81
|
+
On Mosaic / OpenAI / Claude / MCPApps the handle exists but `subscribe` only emits in response to `refresh()` — there
|
|
82
82
|
is no background cache to push updates, and each `refresh()` costs a network request. See
|
|
83
|
-
[Uncached surfaces](./02-caching-and-freshness.md#uncached-surfaces-mosaic-openai) and
|
|
83
|
+
[Uncached surfaces](./02-caching-and-freshness.md#uncached-surfaces-mosaic-openai-claude-mcpapps) and
|
|
84
84
|
[04-surfaces-and-guards.md](./04-surfaces-and-guards.md).
|
|
@@ -5,6 +5,8 @@ DataSDKOptions: dist/data/index.d.ts
|
|
|
5
5
|
WebAppDataSDKOptions: dist/data/index.d.ts
|
|
6
6
|
StatusCallback: dist/data/index.d.ts
|
|
7
7
|
MosaicDataSDKOptions: dist/data/mosaic/index.d.ts
|
|
8
|
+
ClaudeDataSDKOptions: dist/data/index.d.ts
|
|
9
|
+
MCPAppsDataSDKOptions: dist/data/index.d.ts
|
|
8
10
|
NodeOfConnection: dist/data/index.d.ts
|
|
9
11
|
-->
|
|
10
12
|
|
|
@@ -17,10 +19,33 @@ resolves to a bare `{}` rather than throwing (see `DataSDK` in `dist/core/data.d
|
|
|
17
19
|
the residue: how to guard that optionality, what `.fetch` is and how it differs from `.graphql`, how
|
|
18
20
|
to read `errors`, the resolved `apiVersion`, and the per-surface options.
|
|
19
21
|
|
|
22
|
+
## Microfrontend Data SDK selection
|
|
23
|
+
|
|
24
|
+
For a microfrontend (MFE), `createDataSDK()` checks `globalThis.SFDC_ENV`:
|
|
25
|
+
|
|
26
|
+
| Runtime value | Base Data SDK |
|
|
27
|
+
| ------------------------------------------ | --------------- |
|
|
28
|
+
| Non-null object, including an empty object | `WebAppDataSDK` |
|
|
29
|
+
| Absent, `null`, or any other type | `{}` |
|
|
30
|
+
|
|
31
|
+
Selection does not check individual fields. The object check selects an implementation;
|
|
32
|
+
it does not grant API access or guarantee successful requests. The server authenticates
|
|
33
|
+
and authorizes each request.
|
|
34
|
+
|
|
35
|
+
An MFE with this runtime signal uses `options.webapp`, the existing `SFDC_ENV.apiPath`
|
|
36
|
+
handling, caching, and cookie-based authentication. Explicit `options.webapp.basePath`
|
|
37
|
+
takes precedence over `SFDC_ENV.apiPath`. Data calls go directly to the API and do not
|
|
38
|
+
use the embedding bridge. MFE surface detection and supported bridge capabilities do
|
|
39
|
+
not change.
|
|
40
|
+
|
|
41
|
+
Check `sdk.graphql` and `sdk.fetch` before use, as shown below. Extensions still attach
|
|
42
|
+
to the selected base SDK, including an empty base. External Client App authentication
|
|
43
|
+
support and deployed validation are separate work.
|
|
44
|
+
|
|
20
45
|
## `apiVersion` — the resolved adapter version
|
|
21
46
|
|
|
22
47
|
`sdk.apiVersion` is the optional, read-only Salesforce API version selected by the resolved surface
|
|
23
|
-
adapter. WebApp and
|
|
48
|
+
adapter. WebApp, Mosaic, Claude, and MCPApps expose it and derive their data request paths from that same value;
|
|
24
49
|
`apiVersion: "63.0"`, for example, produces paths under `/services/data/v63.0`. Tool-backed OpenAI
|
|
25
50
|
and degraded surfaces do not expose a comparable org request version, so the property is absent.
|
|
26
51
|
|
|
@@ -60,7 +85,7 @@ route for everything that has no GraphQL representation.
|
|
|
60
85
|
|
|
61
86
|
What it carries, per surface:
|
|
62
87
|
|
|
63
|
-
- **WebApp** — CSRF token handling with automatic retry on token rejection, the `Accept-Language`
|
|
88
|
+
- **WebApp / MFE with a non-null `SFDC_ENV` object** — CSRF token handling with automatic retry on token rejection, the `Accept-Language`
|
|
64
89
|
and client-context headers the platform expects, and relative URLs resolved against the app's API
|
|
65
90
|
base path. Your `onStatus` callbacks fire on `.fetch` responses too, so a `401` handler
|
|
66
91
|
re-authenticates for `.fetch` and `.graphql` alike. On this surface `.graphql` is itself built on
|
|
@@ -69,6 +94,14 @@ What it carries, per surface:
|
|
|
69
94
|
rather than assuming it.
|
|
70
95
|
- **OpenAI** — no `.fetch`. That surface exposes only `.graphql` via an MCP tool, so guard for
|
|
71
96
|
`.fetch`'s absence rather than assuming it.
|
|
97
|
+
- **Claude / MCPApps** — no `.fetch`. Only `.graphql` is exposed through H360 dispatch tools.
|
|
98
|
+
A successful SEP-1865 handshake is required; failed verification or session acquisition degrades
|
|
99
|
+
to an empty SDK. Feature-detect both members rather than assuming host support.
|
|
100
|
+
Queries go through the `dispatch_readonly` tool and mutations through `dispatch`. The host must
|
|
101
|
+
expose both (the H360 MCP server); when a tool is missing, the call fails with "Data SDK GraphQL
|
|
102
|
+
dispatch tool is unavailable." In Core, `dispatch` is gated by
|
|
103
|
+
`orgAccessCheck(isHeadless360McpDispatchToolEnabled)`, but `dispatch_readonly` has no such check.
|
|
104
|
+
An org can therefore have working queries and failing mutations.
|
|
72
105
|
|
|
73
106
|
Two things `.fetch` does **not** do, both by contrast with `.graphql`:
|
|
74
107
|
|
|
@@ -131,21 +164,42 @@ if (!result.data && result.errors?.length) {
|
|
|
131
164
|
`createDataSDK(options)` takes a `DataSDKOptions` bag; the fields you set depend on the surface. The
|
|
132
165
|
declarations own the field lists — this is just the routing:
|
|
133
166
|
|
|
134
|
-
- **WebApp** — `WebAppDataSDKOptions` (`options.webapp`): `basePath`, `apiVersion`, and `onStatus`
|
|
167
|
+
- **WebApp / MFE with a non-null `SFDC_ENV` object** — `WebAppDataSDKOptions` (`options.webapp`): `basePath`, `apiVersion`, and `onStatus`
|
|
135
168
|
per-HTTP-status callbacks (each a `StatusCallback`) for cases like re-authenticating on a `401`.
|
|
136
169
|
This is the cached surface — see [02-caching-and-freshness.md](./02-caching-and-freshness.md).
|
|
137
170
|
- **Mosaic** — `MosaicDataSDKOptions` (`options.mosaic`): server-side (Node) auth via `instanceUrl` /
|
|
138
171
|
`accessToken` / `apiVersion`. Uncached.
|
|
139
172
|
- **OpenAI** — no surface options bag; delegates to an MCP tool. Uncached, and it exposes no header
|
|
140
173
|
channel, so per-request `headers` are ignored there.
|
|
141
|
-
|
|
142
|
-
|
|
174
|
+
- **Claude** — `ClaudeDataSDKOptions` (`options.claude`) and **MCPApps** — `MCPAppsDataSDKOptions`
|
|
175
|
+
(`options.mcpApps`): separate bags, each read only on its own surface. Both currently carry
|
|
176
|
+
`apiVersion`, defaulting to the SDK's existing `API_VERSION`; an override such as `"66.0"` selects
|
|
177
|
+
`/services/data/v66.0/graphql` and is exposed as `sdk.apiVersion`. Extension `minApiVersion`
|
|
178
|
+
checks apply before setup. Session configuration (origin, identity, handshake timeout) belongs to
|
|
179
|
+
`initialize`, not these option bags.
|
|
180
|
+
|
|
181
|
+
### Claude / MCPApps H360 transport
|
|
182
|
+
|
|
183
|
+
Queries call `tools/call` with `dispatch_readonly`, `method: "GET"`, and
|
|
184
|
+
`queryParams.queryInput` containing JSON `{ query, variables?, operationName? }`. Mutations call
|
|
185
|
+
`dispatch` with `method: "POST"` and the same input object as `body`. Nullish optional fields are
|
|
186
|
+
omitted; per-request headers are not forwarded. Authentication stays with the host/session.
|
|
187
|
+
|
|
188
|
+
The adapter unwraps the dispatch envelope `{ status_code, body, url }`, preferring
|
|
189
|
+
`structuredContent` whenever present. JSON text content is a fallback only when structured content
|
|
190
|
+
is absent. The status must be numeric and the GraphQL body must be an object with its own `data`
|
|
191
|
+
or `errors`; string bodies and malformed payloads are rejected. `data: null` and errors-only bodies
|
|
192
|
+
are valid GraphQL responses. Tool errors, non-2xx statuses, and `error_code` never count as success.
|
|
193
|
+
Failures surface through `result.errors`: valid GraphQL errors are preserved, while transport and
|
|
194
|
+
malformed-envelope errors use safe generic messages without dumping URLs, queries, or bodies.
|
|
195
|
+
|
|
196
|
+
## Uncached surfaces (Mosaic, OpenAI, Claude, MCPApps)
|
|
143
197
|
|
|
144
198
|
- No cache exists — every `query()` is a network request, and `cacheControl` is silently ignored.
|
|
145
199
|
- `subscribe` is real but only emits in response to `refresh()`.
|
|
146
200
|
|
|
147
201
|
The full uncached-surface behaviour and the caching model it contrasts with are in
|
|
148
|
-
[02-caching-and-freshness.md](./02-caching-and-freshness.md#uncached-surfaces-mosaic-openai) and
|
|
202
|
+
[02-caching-and-freshness.md](./02-caching-and-freshness.md#uncached-surfaces-mosaic-openai-claude-mcpapps) and
|
|
149
203
|
[03-reactive-handle-lifecycle.md](./03-reactive-handle-lifecycle.md). The `query`/`mutate` shape is
|
|
150
204
|
identical across surfaces, so the same call site runs everywhere — only caching differs.
|
|
151
205
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/platform-sdk",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.14.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -147,8 +147,8 @@
|
|
|
147
147
|
"@conduit-client/service-pubsub": "3.19.6",
|
|
148
148
|
"@conduit-client/service-retry": "3.19.6",
|
|
149
149
|
"@conduit-client/utils": "3.19.6",
|
|
150
|
-
"@salesforce/jsonrpc": "^12.
|
|
151
|
-
"@salesforce/sf-embedding-bridge": "2.
|
|
150
|
+
"@salesforce/jsonrpc": "^12.14.0",
|
|
151
|
+
"@salesforce/sf-embedding-bridge": "2.3.0-rc.3"
|
|
152
152
|
},
|
|
153
153
|
"peerDependencies": {
|
|
154
154
|
"o11y": ">=266.13.0",
|