@salesforce/platform-sdk 11.62.1 → 11.63.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.
@@ -19,6 +19,11 @@ export interface WebAppDataSDKOptions {
19
19
  * @example { 401: () => reauthenticate() }
20
20
  */
21
21
  onStatus?: Partial<Record<number, StatusCallback>>;
22
+ /**
23
+ * The Salesforce API version.
24
+ * @example "64.0"
25
+ */
26
+ apiVersion?: string;
22
27
  }
23
28
  export type { MosaicDataSDKOptions };
24
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,OAAO,EACP,WAAW,EACX,MAAM,EACN,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAMpE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;CACnD;AAED,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,GAAG,GAAG,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAEpG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,sIAAiC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,UAAU,CAAC,OAAO,CAAC,IAA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iBH,wBAAgB,aAAa,CAAC,KAAK,CAAC,OAAO,SAAS,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,EAC3E,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAC7F,eAAe,CAAC,OAAO,CAAC,GACvB,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAexC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EACX,YAAY,EACZ,OAAO,EACP,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,UAAU,EACV,WAAW,GACX,MAAM,SAAS,CAAC;AAEjB;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS;IAC3C,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;CAC3B,GAAG,IAAI,GACL,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,GAClC,CAAC,GACD,KAAK,GACN,KAAK,CAAC"}
@@ -1,16 +1,16 @@
1
- import { g as U, S as y } from "../surface-Dd2tqrPi.js";
2
- import { w as V } from "../sdk-promise-D0sy7OW1.js";
3
- import { c as j } from "../plugin-factory-BC3b3BOy.js";
4
- import { buildServiceDescriptor as L, setHeader as b } from "@conduit-client/service-fetch-network/v1";
5
- import { resolvedPromiseLike as u, ok as D, err as P, stableJSONStringify as z, DataNotFoundError as W, UserVisibleError as J, deepFreeze as g, isUserVisibleError as B } from "@conduit-client/utils";
6
- import { print as O, parse as X } from "@conduit-client/onestore-graphql-parser/v1";
7
- import { RetryPolicy as Y, buildServiceDescriptor as Z } from "@conduit-client/service-retry/v1";
8
- import { buildServiceDescriptor as ee } from "@conduit-client/service-cache/v1";
9
- import { buildServiceDescriptor as te } from "@conduit-client/service-cache-control/v1";
10
- import { buildInMemoryCacheInclusionPolicyService as re } from "@conduit-client/service-cache-inclusion-policy/v1";
11
- import { buildServiceDescriptor as ne } from "@conduit-client/service-pubsub/v1";
12
- import { HttpCacheControlCommand as se } from "@conduit-client/command-http-cache-control/v1";
13
- function ae(t) {
1
+ import { g as K, S as y } from "../surface-Dd2tqrPi.js";
2
+ import { w as Q } from "../sdk-promise-D0sy7OW1.js";
3
+ import { c as U } from "../plugin-factory-BC3b3BOy.js";
4
+ import { buildServiceDescriptor as $, setHeader as b } from "@conduit-client/service-fetch-network/v1";
5
+ import { resolvedPromiseLike as u, ok as D, err as C, stableJSONStringify as V, DataNotFoundError as j, UserVisibleError as z, deepFreeze as g, isUserVisibleError as W } from "@conduit-client/utils";
6
+ import { print as q, parse as J } from "@conduit-client/onestore-graphql-parser/v1";
7
+ import { RetryPolicy as B, buildServiceDescriptor as X } from "@conduit-client/service-retry/v1";
8
+ import { buildServiceDescriptor as Y } from "@conduit-client/service-cache/v1";
9
+ import { buildServiceDescriptor as Z } from "@conduit-client/service-cache-control/v1";
10
+ import { buildInMemoryCacheInclusionPolicyService as ee } from "@conduit-client/service-cache-inclusion-policy/v1";
11
+ import { buildServiceDescriptor as te } from "@conduit-client/service-pubsub/v1";
12
+ import { HttpCacheControlCommand as re } from "@conduit-client/command-http-cache-control/v1";
13
+ function ne(t) {
14
14
  return (e) => {
15
15
  const [r, n] = e;
16
16
  if (typeof r == "string" && !r.startsWith("http")) {
@@ -20,72 +20,72 @@ function ae(t) {
20
20
  return u(e);
21
21
  };
22
22
  }
23
- function oe(t) {
23
+ function se(t) {
24
24
  return (e) => u(b("Authorization", `Bearer ${t}`, e));
25
25
  }
26
- function ie(t, e) {
26
+ function ae(t, e) {
27
27
  const r = [];
28
- return t && r.push(ae(t)), e && r.push(oe(e)), L({
28
+ return t && r.push(ne(t)), e && r.push(se(e)), $({
29
29
  request: r
30
30
  }).service;
31
31
  }
32
- const ce = {
32
+ const oe = {
33
33
  "Content-Type": "application/json",
34
34
  Accept: "application/json",
35
35
  "X-Chatter-Entity-Encoding": "false"
36
36
  };
37
- function ue(t) {
37
+ function ie(t) {
38
38
  if (t instanceof Headers) {
39
39
  const e = [];
40
40
  return t.forEach((r, n) => e.push([n, r])), e;
41
41
  }
42
42
  return Array.isArray(t) ? t.map(([e, r]) => [e, r]) : Object.entries(t);
43
43
  }
44
- function M(t, e) {
44
+ function L(t, e) {
45
45
  if (e === void 0) return { ...t };
46
46
  const r = { ...t }, n = /* @__PURE__ */ new Map();
47
47
  for (const a of Object.keys(r)) n.set(a.toLowerCase(), a);
48
48
  const s = /* @__PURE__ */ new Set();
49
- for (const [a, o] of ue(e)) {
49
+ for (const [a, o] of ie(e)) {
50
50
  const i = a.toLowerCase(), c = n.get(i);
51
51
  c === void 0 ? (r[a] = o, n.set(i, a), s.add(i)) : s.has(i) ? r[c] = `${r[c]}, ${o}` : (r[c] = o, s.add(i));
52
52
  }
53
53
  return r;
54
54
  }
55
- function H(t) {
56
- return M(ce, t);
55
+ function M(t) {
56
+ return L(oe, t);
57
57
  }
58
- function he(t) {
58
+ function ce(t) {
59
59
  if (t === void 0) return;
60
60
  const e = {};
61
61
  return new Headers(t).forEach((r, n) => {
62
62
  e[n] = r;
63
63
  }), Object.keys(e).length > 0 ? e : void 0;
64
64
  }
65
- const le = 512;
66
- function de(t) {
65
+ const ue = 512;
66
+ function he(t) {
67
67
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
68
68
  }
69
- class N extends Error {
69
+ class A extends Error {
70
70
  status;
71
71
  url;
72
72
  constructor(e) {
73
- const r = e.body.length === 0 ? "empty response body" : "unparseable response body", n = e.body.length === 0 ? "" : ` (starts with: ${JSON.stringify(de(e.body.slice(0, le)))})`;
73
+ const r = e.body.length === 0 ? "empty response body" : "unparseable response body", n = e.body.length === 0 ? "" : ` (starts with: ${JSON.stringify(he(e.body.slice(0, ue)))})`;
74
74
  super(
75
75
  `${e.surface} GraphQL request to ${e.url} returned HTTP ${e.status} with an ${r}${n}. Expected a JSON GraphQL response; the transport (proxy/gateway/auth) likely did not return one.`
76
76
  ), this.name = "GraphQLTransportError", this.status = e.status, this.url = e.url, this.cause = e.cause;
77
77
  }
78
78
  }
79
- async function I(t, e, r) {
79
+ async function G(t, e, r) {
80
80
  const n = await t.text();
81
81
  let s;
82
82
  try {
83
83
  s = JSON.parse(n);
84
84
  } catch (a) {
85
- throw new N({ surface: e, url: r, status: t.status, body: n, cause: a });
85
+ throw new A({ surface: e, url: r, status: t.status, body: n, cause: a });
86
86
  }
87
87
  if (s === null || typeof s != "object")
88
- throw new N({
88
+ throw new A({
89
89
  surface: e,
90
90
  url: r,
91
91
  status: t.status,
@@ -95,16 +95,16 @@ async function I(t, e, r) {
95
95
  return s;
96
96
  }
97
97
  const w = () => {
98
- }, A = async () => {
98
+ }, P = async () => {
99
99
  };
100
- function T(t) {
100
+ function O(t) {
101
101
  try {
102
- return D(X(t));
102
+ return D(J(t));
103
103
  } catch (e) {
104
- return P(p(e));
104
+ return C(p(e));
105
105
  }
106
106
  }
107
- function _(t, e) {
107
+ function N(t, e) {
108
108
  const r = t.definitions.filter(
109
109
  (n) => n.kind === "OperationDefinition"
110
110
  );
@@ -118,10 +118,10 @@ function p(t) {
118
118
  }
119
119
  return t instanceof Error ? [{ message: t.message }] : typeof t == "string" ? [{ message: t }] : [{ message: "Unknown error" }];
120
120
  }
121
- async function G(t, { mutation: e, variables: r, operationName: n, headers: s }) {
122
- const a = T(e);
121
+ async function I(t, { mutation: e, variables: r, operationName: n, headers: s }) {
122
+ const a = O(e);
123
123
  if (a.isErr()) return { data: void 0, errors: a.error };
124
- const o = a.value, i = _(o, n);
124
+ const o = a.value, i = N(o, n);
125
125
  if (i !== "mutation")
126
126
  return {
127
127
  data: void 0,
@@ -133,7 +133,7 @@ async function G(t, { mutation: e, variables: r, operationName: n, headers: s })
133
133
  };
134
134
  try {
135
135
  const c = await t({
136
- query: O(o),
136
+ query: q(o),
137
137
  variables: r,
138
138
  operationName: n,
139
139
  headers: s
@@ -149,7 +149,7 @@ async function G(t, { mutation: e, variables: r, operationName: n, headers: s })
149
149
  function F(t) {
150
150
  function e(n, s, a, o) {
151
151
  return t({
152
- query: O(n),
152
+ query: q(n),
153
153
  variables: s,
154
154
  operationName: a,
155
155
  headers: o
@@ -167,15 +167,15 @@ function F(t) {
167
167
  operationName: a,
168
168
  headers: o
169
169
  }) {
170
- const i = T(n);
170
+ const i = O(n);
171
171
  if (i.isErr())
172
172
  return {
173
173
  data: void 0,
174
174
  errors: i.error,
175
175
  subscribe: () => w,
176
- refresh: A
176
+ refresh: P
177
177
  };
178
- const c = i.value, l = _(c, a);
178
+ const c = i.value, l = N(c, a);
179
179
  if (l !== "query")
180
180
  return {
181
181
  data: void 0,
@@ -185,7 +185,7 @@ function F(t) {
185
185
  }
186
186
  ],
187
187
  subscribe: () => w,
188
- refresh: A
188
+ refresh: P
189
189
  };
190
190
  const h = /* @__PURE__ */ new Set(), f = s, m = await e(c, f, a, o);
191
191
  return {
@@ -204,24 +204,24 @@ function F(t) {
204
204
  }
205
205
  return {
206
206
  query: r,
207
- mutate: (n) => G(t, n)
207
+ mutate: (n) => I(t, n)
208
208
  };
209
209
  }
210
- const pe = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
211
- function Q(t = pe) {
210
+ const le = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
211
+ function H(t = le) {
212
212
  return `/services/data/v${t}`;
213
213
  }
214
- const fe = {
214
+ const de = {
215
215
  "Content-Type": "application/json",
216
216
  Accept: "application/json"
217
217
  };
218
- class me {
218
+ class pe {
219
219
  clientFetch;
220
220
  pathData;
221
221
  graphql;
222
222
  constructor(e) {
223
- const r = ye(), n = be(e?.instanceUrl ?? r.instanceUrl), s = e?.accessToken ?? r.accessToken;
224
- this.pathData = Q(e?.apiVersion ?? r.apiVersion), this.clientFetch = ie(n || void 0, s), this.graphql = F(this.executeRawGraphQL.bind(this));
223
+ const r = fe(), n = me(e?.instanceUrl ?? r.instanceUrl), s = e?.accessToken ?? r.accessToken;
224
+ this.pathData = H(e?.apiVersion ?? r.apiVersion), this.clientFetch = ae(n || void 0, s), this.graphql = F(this.executeRawGraphQL.bind(this));
225
225
  }
226
226
  async executeRawGraphQL({
227
227
  query: e,
@@ -232,12 +232,12 @@ class me {
232
232
  const a = `${this.pathData}/graphql`, o = await this.clientFetch(a, {
233
233
  method: "POST",
234
234
  body: JSON.stringify({ query: e, variables: r, operationName: n }),
235
- headers: M(fe, s)
235
+ headers: L(de, s)
236
236
  });
237
- return I(o, "Mosaic", a);
237
+ return G(o, "Mosaic", a);
238
238
  }
239
239
  }
240
- function ye() {
240
+ function fe() {
241
241
  const t = globalThis.MOSAIC_ENV;
242
242
  return {
243
243
  instanceUrl: t?.instanceUrl,
@@ -245,13 +245,13 @@ function ye() {
245
245
  apiVersion: t?.apiVersion
246
246
  };
247
247
  }
248
- function be(t) {
248
+ function me(t) {
249
249
  if (!t || t === "/") return "";
250
250
  let e = t;
251
251
  return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
252
252
  }
253
- const ge = "graphqlQuery";
254
- class we {
253
+ const ye = "graphqlQuery";
254
+ class be {
255
255
  graphql;
256
256
  constructor() {
257
257
  this.graphql = F(this.executeRawGraphQL.bind(this));
@@ -266,33 +266,33 @@ class we {
266
266
  variables: r,
267
267
  operationName: n
268
268
  }) {
269
- return (await window.openai.callTool(ge, {
269
+ return (await window.openai.callTool(ye, {
270
270
  query: e,
271
271
  ...r != null ? { variables: r } : {},
272
272
  ...n != null ? { operationName: n } : {}
273
273
  })).structuredContent;
274
274
  }
275
275
  }
276
- const Se = {
276
+ const ge = {
277
277
  graphql: !0,
278
278
  fetch: !0
279
- }, ve = new Set(Object.keys(Se)), v = "Accept-Language", Ee = (t) => {
279
+ }, we = new Set(Object.keys(ge)), v = "Accept-Language", Se = (t) => {
280
280
  const e = globalThis.SFDC_ENV?.language;
281
281
  if (!e)
282
282
  return u(t);
283
283
  const [r, n] = t;
284
284
  return (r instanceof Request && !n?.headers ? r.headers.has(v) : new Headers(n?.headers).has(v)) ? u(t) : u(b(v, e, t));
285
- }, Ce = "X-SFDC-Client-Name", De = "X-SFDC-Client-Version", Pe = "@salesforce/platform-sdk", Ae = "11.62.1", Oe = (t) => {
286
- let e = b(Ce, Pe, t);
287
- return e = b(De, Ae, e), u(e);
288
- }, Te = "X-CSRF-Token";
289
- function _e(t, e = {}) {
285
+ }, ve = "X-SFDC-Client-Name", Ee = "X-SFDC-Client-Version", De = "@salesforce/platform-sdk", Ce = "11.63.0", Pe = (t) => {
286
+ let e = b(ve, De, t);
287
+ return e = b(Ee, Ce, e), u(e);
288
+ }, qe = "X-CSRF-Token";
289
+ function Oe(t, e = {}) {
290
290
  const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
291
291
  return async (s) => {
292
292
  const [a, o] = s, i = a instanceof Request ? a.url : a instanceof URL ? a.href : a, c = o?.method ?? (a instanceof Request ? a.method : void 0) ?? "GET";
293
293
  if (k(n, i) || Ne(c) && k(r, i)) {
294
294
  const h = await t.getToken();
295
- s = b(Te, h, s);
295
+ s = b(qe, h, s);
296
296
  }
297
297
  return u(s);
298
298
  };
@@ -305,16 +305,16 @@ function k(t, e) {
305
305
  const r = new URL(e, globalThis.location?.href ?? "http://localhost");
306
306
  return t.some((n) => r.pathname.includes(n));
307
307
  }
308
- function ke(t, e = {}) {
309
- const r = _e(t, e);
308
+ function Ae(t, e = {}) {
309
+ const r = Oe(t, e);
310
310
  async function n(s) {
311
311
  const a = await r(s);
312
312
  return fetch(a[0], a[1]);
313
313
  }
314
314
  return (s, a) => a ? a.applyRetry(async () => n(s)) : n(s);
315
315
  }
316
- const qe = [400, 401, 403];
317
- class Re extends Y {
316
+ const ke = [400, 401, 403];
317
+ class _e extends B {
318
318
  constructor(e) {
319
319
  super(e), this.csrfTokenManager = e;
320
320
  }
@@ -322,7 +322,7 @@ class Re extends Y {
322
322
  * Determines if a failed request should be retried due to CSRF token issues.
323
323
  */
324
324
  async shouldRetry(e, r) {
325
- return r.attempt >= 1 ? !1 : qe.includes(e.status);
325
+ return r.attempt >= 1 ? !1 : ke.includes(e.status);
326
326
  }
327
327
  /**
328
328
  * CSRF token refresh should happen immediately with no delay.
@@ -340,7 +340,7 @@ class Re extends Y {
340
340
  await this.csrfTokenManager.refreshToken();
341
341
  }
342
342
  }
343
- class $e {
343
+ class Re {
344
344
  constructor(e, r) {
345
345
  this.endpoint = e, this.cacheName = r, this.tokenPromise = this.obtainToken();
346
346
  }
@@ -388,29 +388,29 @@ class $e {
388
388
  return;
389
389
  }
390
390
  }
391
- const q = /* @__PURE__ */ new Map();
392
- function Le(t) {
391
+ const _ = /* @__PURE__ */ new Map();
392
+ function Te(t) {
393
393
  const { endpoint: e, cacheName: r, ...n } = t.csrf;
394
- let s = q.get(e);
395
- return s || (s = new $e(e, r), q.set(e, s)), L(
394
+ let s = _.get(e);
395
+ return s || (s = new Re(e, r), _.set(e, s)), $(
396
396
  {
397
- retry: ke(s, n),
398
- request: [Oe, Ee]
397
+ retry: Ae(s, n),
398
+ request: [Pe, Se]
399
399
  },
400
- Z(new Re(s)).service
400
+ X(new _e(s)).service
401
401
  ).service;
402
402
  }
403
403
  const R = /* @__PURE__ */ new Map();
404
- function Me(t) {
404
+ function $e(t) {
405
405
  let e = R.get(t);
406
406
  if (!e) {
407
- const r = ee().service, n = re(r).service, s = te(r, n).service, a = ne().service;
407
+ const r = Y().service, n = ee(r).service, s = Z(r, n).service, a = te().service;
408
408
  e = { cache: r, cacheController: s, pubSub: a }, R.set(t, e);
409
409
  }
410
410
  return e;
411
411
  }
412
- function He(t, e) {
413
- const r = Me(t);
412
+ function Le(t, e) {
413
+ const r = $e(t);
414
414
  return {
415
415
  shared: r,
416
416
  services: {
@@ -420,8 +420,8 @@ function He(t, e) {
420
420
  }
421
421
  };
422
422
  }
423
- const $ = 300;
424
- function Ie(t, e) {
423
+ const T = 300;
424
+ function Me(t, e) {
425
425
  try {
426
426
  return JSON.parse(JSON.stringify(t));
427
427
  } catch (r) {
@@ -434,16 +434,16 @@ function Ie(t, e) {
434
434
  function Ge(t) {
435
435
  if (typeof t == "object" && t.type === "max-age") {
436
436
  const e = t.maxAge;
437
- return Number.isFinite(e) && e >= 0 ? e : $;
437
+ return Number.isFinite(e) && e >= 0 ? e : T;
438
438
  }
439
- return $;
439
+ return T;
440
440
  }
441
- class Fe extends se {
441
+ class Ie extends re {
442
442
  constructor(e, r, n) {
443
- super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = Ie(
443
+ super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = Me(
444
444
  e.variables ?? {},
445
445
  this.normalizedOperationName
446
- ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = Ge(e.cacheControl), this.headers = e.headers, this.headersKey = he(e.headers);
446
+ ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = Ge(e.cacheControl), this.headers = e.headers, this.headersKey = ce(e.headers);
447
447
  }
448
448
  query;
449
449
  normalizedVariables;
@@ -457,7 +457,7 @@ class Fe extends se {
457
457
  this.url,
458
458
  {
459
459
  method: "POST",
460
- headers: H(this.headers),
460
+ headers: M(this.headers),
461
461
  body: JSON.stringify({
462
462
  query: this.query,
463
463
  variables: this.normalizedVariables,
@@ -472,7 +472,7 @@ class Fe extends se {
472
472
  variables: this.normalizedVariables,
473
473
  operationName: this.normalizedOperationName
474
474
  };
475
- return this.headersKey !== void 0 && (e.headers = this.headersKey), z(e);
475
+ return this.headersKey !== void 0 && (e.headers = this.headersKey), V(e);
476
476
  }
477
477
  /**
478
478
  * Reads from the cache and returns the cache result or error
@@ -489,7 +489,7 @@ class Fe extends se {
489
489
  */
490
490
  readFromCache(e) {
491
491
  const r = this.buildKey(), n = e.get(r)?.value;
492
- return n === void 0 ? u(P(new W())) : u(D(n));
492
+ return n === void 0 ? u(C(new j())) : u(D(n));
493
493
  }
494
494
  writeToCache(e, r) {
495
495
  if (r.isOk() && r.value.data != null && Object.keys(r.value.data).length > 0) {
@@ -519,17 +519,17 @@ class Fe extends se {
519
519
  return e.errors && e.errors.length > 0;
520
520
  }
521
521
  processFetchReturnValue(e) {
522
- return this.responseHasErrors(e) ? P(new J(e)) : D(e);
522
+ return this.responseHasErrors(e) ? C(new z(e)) : D(e);
523
523
  }
524
524
  }
525
525
  function x(t) {
526
- if (B(t) && t.data && typeof t.data == "object") {
526
+ if (W(t) && t.data && typeof t.data == "object") {
527
527
  const e = t.data;
528
528
  if (e.data != null)
529
529
  return e.data;
530
530
  }
531
531
  }
532
- function Qe(t) {
532
+ function Fe(t) {
533
533
  return (e) => {
534
534
  if (e.isOk()) {
535
535
  const r = e.value;
@@ -540,7 +540,7 @@ function Qe(t) {
540
540
  }
541
541
  };
542
542
  }
543
- async function xe(t) {
543
+ async function He(t) {
544
544
  let e, r, n;
545
545
  try {
546
546
  const s = await t.execute();
@@ -552,7 +552,7 @@ async function xe(t) {
552
552
  data: e,
553
553
  errors: r,
554
554
  subscribe(s) {
555
- return n ? n(Qe(s)) : w;
555
+ return n ? n(Fe(s)) : w;
556
556
  },
557
557
  async refresh() {
558
558
  await t.refresh();
@@ -564,10 +564,10 @@ function E(t) {
564
564
  data: void 0,
565
565
  errors: t,
566
566
  subscribe: () => w,
567
- refresh: A
567
+ refresh: P
568
568
  };
569
569
  }
570
- function Ke({
570
+ function xe({
571
571
  bundle: t,
572
572
  url: e,
573
573
  executeRaw: r
@@ -580,9 +580,9 @@ function Ke({
580
580
  cacheControl: c,
581
581
  headers: l
582
582
  }) {
583
- const h = T(a);
583
+ const h = O(a);
584
584
  if (h.isErr()) return E(h.error);
585
- const f = h.value, m = _(f, i);
585
+ const f = h.value, m = N(f, i);
586
586
  if (m !== "query")
587
587
  return E([
588
588
  {
@@ -591,9 +591,9 @@ function Ke({
591
591
  ]);
592
592
  let d;
593
593
  try {
594
- d = new Fe(
594
+ d = new Ie(
595
595
  {
596
- query: O(f),
596
+ query: q(f),
597
597
  variables: o,
598
598
  operationName: i,
599
599
  cacheControl: c,
@@ -605,33 +605,36 @@ function Ke({
605
605
  } catch (S) {
606
606
  return E(p(S));
607
607
  }
608
- return xe(d);
608
+ return He(d);
609
609
  }
610
610
  return {
611
611
  query: s,
612
- mutate: (a) => G(r, a)
612
+ mutate: (a) => I(r, a)
613
613
  };
614
614
  }
615
- const Ue = 1, Ve = `@salesforce/platform-sdk-data_v${Ue}`, K = Q(), je = `${K}/ui-api`, C = `${K}/graphql`;
616
- class ze {
615
+ const Ke = 1, Qe = `@salesforce/platform-sdk-data_v${Ke}`;
616
+ class Ue {
617
617
  baseUrl;
618
+ pathData;
618
619
  clientFetch;
619
620
  onStatus;
620
621
  graphql;
621
622
  constructor(e) {
622
- const r = We();
623
- this.baseUrl = Je(e?.basePath ?? r.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = Le({
623
+ const r = Ve();
624
+ this.baseUrl = je(e?.basePath ?? r.apiPath), this.pathData = H(e?.apiVersion);
625
+ const n = `${this.pathData}/ui-api`, s = `${this.pathData}/graphql`;
626
+ this.onStatus = e?.onStatus ?? {}, this.clientFetch = Te({
624
627
  csrf: {
625
- endpoint: `${this.baseUrl}${je}/session/csrf`,
626
- cacheName: Ve,
628
+ endpoint: `${this.baseUrl}${n}/session/csrf`,
629
+ cacheName: Qe,
627
630
  protectedUrls: ["services/data/v", "services/apexrest"],
628
631
  alwaysProtectedUrls: ["services/apexrest"]
629
632
  }
630
633
  });
631
- const n = (a, o) => this.fetch(a, o), s = He(this.baseUrl, n);
632
- this.graphql = Ke({
633
- bundle: s,
634
- url: C,
634
+ const a = (i, c) => this.fetch(i, c), o = Le(this.baseUrl, a);
635
+ this.graphql = xe({
636
+ bundle: o,
637
+ url: s,
635
638
  executeRaw: this.executeRawGraphQL.bind(this)
636
639
  });
637
640
  }
@@ -651,12 +654,12 @@ class ze {
651
654
  operationName: n,
652
655
  headers: s
653
656
  }) {
654
- const a = await this.fetch(C, {
657
+ const a = `${this.pathData}/graphql`, o = await this.fetch(a, {
655
658
  method: "POST",
656
659
  body: JSON.stringify({ query: e, variables: r, operationName: n }),
657
- headers: H(s)
660
+ headers: M(s)
658
661
  });
659
- return I(a, "WebApp", C);
662
+ return G(o, "WebApp", a);
660
663
  }
661
664
  /**
662
665
  * If the url is relative, convert to it to an absolute Salesforce URL. This is due to the way Code
@@ -672,17 +675,17 @@ class ze {
672
675
  return e;
673
676
  }
674
677
  }
675
- function We() {
678
+ function Ve() {
676
679
  return {
677
680
  apiPath: globalThis.SFDC_ENV?.apiPath
678
681
  };
679
682
  }
680
- function Je(t) {
683
+ function je(t) {
681
684
  if (!t || t === "/") return "";
682
685
  let e = t;
683
686
  return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
684
687
  }
685
- function Be(t) {
688
+ function ze(t) {
686
689
  const e = typeof t == "object" && t !== null && "setup" in t, r = e ? t : t.plugin, n = e ? r?.name : t.as;
687
690
  if (typeof r?.setup != "function")
688
691
  throw new Error("Plugin entry cannot attach: it is missing a setup function.");
@@ -692,12 +695,12 @@ function Be(t) {
692
695
  );
693
696
  return { plugin: r, mountName: n };
694
697
  }
695
- async function Xe(t, e, r = /* @__PURE__ */ new Set()) {
698
+ async function We(t, e, r = /* @__PURE__ */ new Set()) {
696
699
  if (e.length === 0)
697
700
  return t;
698
701
  const n = Object.create(t);
699
702
  for (const s of e) {
700
- const { plugin: a, mountName: o } = Be(s), i = o === a.name ? `"${a.name}"` : `"${a.name}" (aliased as "${o}")`;
703
+ const { plugin: a, mountName: o } = ze(s), i = o === a.name ? `"${a.name}"` : `"${a.name}" (aliased as "${o}")`;
701
704
  if (r.has(o))
702
705
  throw new Error(`Plugin ${i} cannot attach: "${o}" is a reserved SDK name.`);
703
706
  if (o in n)
@@ -719,23 +722,23 @@ async function Xe(t, e, r = /* @__PURE__ */ new Set()) {
719
722
  }
720
723
  return n;
721
724
  }
722
- function lt(t, ...e) {
725
+ function ct(t, ...e) {
723
726
  let r = t[0] ?? "";
724
727
  for (let n = 0; n < e.length; n += 1)
725
728
  r += String(e[n]) + (t[n + 1] ?? "");
726
729
  return r;
727
730
  }
728
- const dt = j();
729
- async function Ye(t) {
731
+ const ut = U();
732
+ async function Je(t) {
730
733
  try {
731
- switch (await U(t?.surface)) {
734
+ switch (await K(t?.surface)) {
732
735
  case y.OpenAI:
733
- return new we();
736
+ return new be();
734
737
  case y.WebApp:
735
738
  case y.MicroFrontend:
736
- return new ze(t?.webapp);
739
+ return new Ue(t?.webapp);
737
740
  case y.Mosaic:
738
- return new me(t?.mosaic);
741
+ return new pe(t?.mosaic);
739
742
  case y.MCPApps:
740
743
  return {};
741
744
  default:
@@ -745,17 +748,17 @@ async function Ye(t) {
745
748
  return {};
746
749
  }
747
750
  }
748
- function pt(t) {
749
- return V(
751
+ function ht(t) {
752
+ return Q(
750
753
  (async () => {
751
- const e = await Ye(t);
752
- return Xe(e, t?.plugins ?? [], ve);
754
+ const e = await Je(t);
755
+ return We(e, t?.plugins ?? [], we);
753
756
  })(),
754
757
  "createDataSDK"
755
758
  );
756
759
  }
757
760
  export {
758
- pt as createDataSDK,
759
- dt as defineDataPlugin,
760
- lt as gql
761
+ ht as createDataSDK,
762
+ ut as defineDataPlugin,
763
+ ct as gql
761
764
  };
@@ -5,6 +5,7 @@ import { WebAppDataSDKOptions } from '../index';
5
5
  */
6
6
  export declare class WebAppDataSDK implements DataSDK {
7
7
  private readonly baseUrl;
8
+ private readonly pathData;
8
9
  private readonly clientFetch;
9
10
  private readonly onStatus;
10
11
  readonly graphql: DataSDKGraphQL;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../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AAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAUjF;;;;;OAKG;YACW,iBAAiB;IAgB/B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;CAa3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "11.62.1",
3
+ "version": "11.63.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -134,7 +134,7 @@
134
134
  "@conduit-client/service-pubsub": "3.19.6",
135
135
  "@conduit-client/service-retry": "3.19.6",
136
136
  "@conduit-client/utils": "3.19.6",
137
- "@salesforce/jsonrpc": "^11.62.1",
137
+ "@salesforce/jsonrpc": "^11.63.0",
138
138
  "@salesforce/sf-embedding-bridge": "2.2.5-rc.2"
139
139
  },
140
140
  "peerDependencies": {