@salesforce/platform-sdk 13.0.0 → 13.1.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.
@@ -1,35 +1,36 @@
1
1
  import { c as te, S as y, g as re, a as ne } from "../surface-DyglgPiz.js";
2
2
  import { w as se } from "../sdk-promise-D0sy7OW1.js";
3
- import { print as N, parse as oe } from "@conduit-client/onestore-graphql-parser/v1";
4
- import { ok as O, err as k, resolvedPromiseLike as l, stableJSONStringify as ae, DataNotFoundError as ie, UserVisibleError as ce, deepFreeze as S, isUserVisibleError as ue } from "@conduit-client/utils";
5
- import { buildServiceDescriptor as J, setHeader as w } from "@conduit-client/service-fetch-network/v1";
6
- import { RetryPolicy as he, buildServiceDescriptor as de } from "@conduit-client/service-retry/v1";
3
+ import { print as N, parse as ae } from "@conduit-client/onestore-graphql-parser/v1";
4
+ import { ok as O, err as k, resolvedPromiseLike as p, stableJSONStringify as oe, DataNotFoundError as ie, UserVisibleError as ce, deepFreeze as S, isUserVisibleError as ue } from "@conduit-client/utils";
5
+ import { buildServiceDescriptor as J, setHeader as g } from "@conduit-client/service-fetch-network/v1";
6
+ import { p as he } from "../pdp_event-DNU_h--P.js";
7
+ import { RetryPolicy as le, buildServiceDescriptor as de } from "@conduit-client/service-retry/v1";
7
8
  import { buildServiceDescriptor as pe } from "@conduit-client/service-cache/v1";
8
- import { buildServiceDescriptor as le } from "@conduit-client/service-cache-control/v1";
9
- import { buildInMemoryCacheInclusionPolicyService as fe } from "@conduit-client/service-cache-inclusion-policy/v1";
10
- import { buildServiceDescriptor as ye } from "@conduit-client/service-pubsub/v1";
11
- import { HttpCacheControlCommand as me } from "@conduit-client/command-http-cache-control/v1";
9
+ import { buildServiceDescriptor as fe } from "@conduit-client/service-cache-control/v1";
10
+ import { buildInMemoryCacheInclusionPolicyService as ye } from "@conduit-client/service-cache-inclusion-policy/v1";
11
+ import { buildServiceDescriptor as me } from "@conduit-client/service-pubsub/v1";
12
+ import { HttpCacheControlCommand as be } from "@conduit-client/command-http-cache-control/v1";
12
13
  const v = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
13
- function be(t, e) {
14
- const [, r, n] = v.exec(t), [, s, o] = v.exec(e);
15
- return Number(r) - Number(s) || Number(n) - Number(o);
14
+ function we(t, e) {
15
+ const [, r, n] = v.exec(t), [, s, a] = v.exec(e);
16
+ return Number(r) - Number(s) || Number(n) - Number(a);
16
17
  }
17
18
  function ge(t, e) {
18
19
  for (const r of t) {
19
- const n = r.extension, { label: s } = r, o = n.minApiVersion;
20
- if (o !== void 0) {
21
- if (typeof o != "string" || !v.test(o))
20
+ const n = r.extension, { label: s } = r, a = n.minApiVersion;
21
+ if (a !== void 0) {
22
+ if (typeof a != "string" || !v.test(a))
22
23
  throw new TypeError(
23
- `Extension ${s} declares invalid minApiVersion ${JSON.stringify(o)}; expected a Salesforce API version such as "64.0".`
24
+ `Extension ${s} declares invalid minApiVersion ${JSON.stringify(a)}; expected a Salesforce API version such as "64.0".`
24
25
  );
25
26
  if (e.apiVersion !== void 0) {
26
27
  if (!v.test(e.apiVersion))
27
28
  throw new Error(
28
- `Extension ${s} requires Salesforce API version ${o} or later, but the Data SDK exposes invalid apiVersion ${JSON.stringify(e.apiVersion)}.`
29
+ `Extension ${s} requires Salesforce API version ${a} or later, but the Data SDK exposes invalid apiVersion ${JSON.stringify(e.apiVersion)}.`
29
30
  );
30
- if (be(e.apiVersion, o) < 0)
31
+ if (we(e.apiVersion, a) < 0)
31
32
  throw new Error(
32
- `Extension ${s} requires Salesforce API version ${o} or later, but the Data SDK uses version ${e.apiVersion}.`
33
+ `Extension ${s} requires Salesforce API version ${a} or later, but the Data SDK uses version ${e.apiVersion}.`
33
34
  );
34
35
  }
35
36
  }
@@ -40,7 +41,7 @@ const D = () => {
40
41
  };
41
42
  function P(t) {
42
43
  try {
43
- return O(oe(t));
44
+ return O(ae(t));
44
45
  } catch (e) {
45
46
  return k(m(e));
46
47
  }
@@ -60,9 +61,9 @@ function m(t) {
60
61
  return t instanceof Error ? [{ message: t.message }] : typeof t == "string" ? [{ message: t }] : [{ message: "Unknown error" }];
61
62
  }
62
63
  async function W(t, { mutation: e, variables: r, operationName: n, headers: s }) {
63
- const o = P(e);
64
- if (o.isErr()) return { data: void 0, errors: o.error };
65
- const a = o.value, i = $(a, n);
64
+ const a = P(e);
65
+ if (a.isErr()) return { data: void 0, errors: a.error };
66
+ const o = a.value, i = $(o, n);
66
67
  if (i !== "mutation")
67
68
  return {
68
69
  data: void 0,
@@ -75,7 +76,7 @@ async function W(t, { mutation: e, variables: r, operationName: n, headers: s })
75
76
  try {
76
77
  const c = await t(
77
78
  {
78
- query: N(a),
79
+ query: N(o),
79
80
  variables: r,
80
81
  operationName: n,
81
82
  headers: s
@@ -91,13 +92,13 @@ async function W(t, { mutation: e, variables: r, operationName: n, headers: s })
91
92
  }
92
93
  }
93
94
  function q(t) {
94
- function e(n, s, o, a) {
95
+ function e(n, s, a, o) {
95
96
  return t(
96
97
  {
97
98
  query: N(n),
98
99
  variables: s,
99
- operationName: o,
100
- headers: a
100
+ operationName: a,
101
+ headers: o
101
102
  },
102
103
  "query"
103
104
  ).then(
@@ -111,8 +112,8 @@ function q(t) {
111
112
  async function r({
112
113
  query: n,
113
114
  variables: s,
114
- operationName: o,
115
- headers: a
115
+ operationName: a,
116
+ headers: o
116
117
  }) {
117
118
  const i = P(n);
118
119
  if (i.isErr())
@@ -122,7 +123,7 @@ function q(t) {
122
123
  subscribe: () => D,
123
124
  refresh: T
124
125
  };
125
- const c = i.value, h = $(c, o);
126
+ const c = i.value, h = $(c, a);
126
127
  if (h !== "query")
127
128
  return {
128
129
  data: void 0,
@@ -134,17 +135,17 @@ function q(t) {
134
135
  subscribe: () => D,
135
136
  refresh: T
136
137
  };
137
- const u = /* @__PURE__ */ new Set(), d = s, p = await e(c, d, o, a);
138
+ const u = /* @__PURE__ */ new Set(), l = s, d = await e(c, l, a, o);
138
139
  return {
139
- data: p.data,
140
- errors: p.errors,
140
+ data: d.data,
141
+ errors: d.errors,
141
142
  subscribe(f) {
142
143
  return u.add(f), () => {
143
144
  u.delete(f);
144
145
  };
145
146
  },
146
147
  async refresh() {
147
- const f = await e(c, d, o, a);
148
+ const f = await e(c, l, a, o);
148
149
  for (const E of u) E(f);
149
150
  }
150
151
  };
@@ -158,7 +159,7 @@ const A = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
158
159
  function x(t = A) {
159
160
  return `/services/data/v${t}`;
160
161
  }
161
- function we(t) {
162
+ function Ee(t) {
162
163
  if (Array.isArray(t)) {
163
164
  for (const e of t)
164
165
  if (!(e?.type !== "text" || !e.text))
@@ -170,11 +171,11 @@ function we(t) {
170
171
  }
171
172
  }
172
173
  }
173
- function Ee(t) {
174
+ function Se(t) {
174
175
  const e = t;
175
176
  return e?.code === -32601 || e?.code === -32602 && typeof e.message == "string" && /^Unknown tool\b/i.test(e.message);
176
177
  }
177
- function V(t) {
178
+ function R(t) {
178
179
  if (typeof t != "object" || Array.isArray(t)) return !1;
179
180
  if (!Object.hasOwn(t, "errors")) return Object.hasOwn(t, "data");
180
181
  const { errors: e } = t;
@@ -182,7 +183,7 @@ function V(t) {
182
183
  (r) => r !== null && typeof r == "object" && !Array.isArray(r) && typeof r.message == "string"
183
184
  );
184
185
  }
185
- class Se {
186
+ class ve {
186
187
  graphql;
187
188
  apiVersion;
188
189
  #e;
@@ -192,61 +193,61 @@ class Se {
192
193
  this.graphql = q(this.#t.bind(this));
193
194
  }
194
195
  async #t({ query: e, variables: r, operationName: n }, s) {
195
- const o = {
196
+ const a = {
196
197
  query: e,
197
198
  ...r != null ? { variables: r } : {},
198
199
  ...n != null ? { operationName: n } : {}
199
- }, a = s === "query" ? { method: "GET", queryParams: { queryInput: JSON.stringify(o) } } : { method: "POST", body: o }, i = await this.#e.request("tools/call", {
200
+ }, o = s === "query" ? { method: "GET", queryParams: { queryInput: JSON.stringify(a) } } : { method: "POST", body: a }, i = await this.#e.request("tools/call", {
200
201
  name: s === "query" ? "dispatch_readonly" : "dispatch",
201
202
  arguments: {
202
203
  url: `${x(this.apiVersion)}/graphql`,
203
- ...a
204
+ ...o
204
205
  }
205
- }).catch((p) => {
206
+ }).catch((d) => {
206
207
  throw new Error(
207
- Ee(p) ? "Data SDK GraphQL dispatch tool is unavailable." : "Data SDK GraphQL request failed.",
208
- { cause: p }
208
+ Se(d) ? "Data SDK GraphQL dispatch tool is unavailable." : "Data SDK GraphQL request failed.",
209
+ { cause: d }
209
210
  );
210
- }), c = i?.structuredContent ?? we(i?.content), h = c?.status_code, u = c?.body, d = i?.isError || c?.error_code !== void 0;
211
+ }), c = i?.structuredContent ?? Ee(i?.content), h = c?.status_code, u = c?.body, l = i?.isError || c?.error_code !== void 0;
211
212
  if (typeof h != "number" || !Number.isInteger(h))
212
213
  throw new Error(
213
- d ? "Data SDK GraphQL request failed." : "Data SDK GraphQL response is malformed."
214
+ l ? "Data SDK GraphQL request failed." : "Data SDK GraphQL response is malformed."
214
215
  );
215
- if (d || h < 200 || h >= 300)
216
- throw u != null && V(u) && u.errors?.length ? (
216
+ if (l || h < 200 || h >= 300)
217
+ throw u != null && R(u) && u.errors?.length ? (
217
218
  // This method is wrapped by `buildUncachedGraphQL`, which handles thrown {data} errors
218
219
  { data: { errors: u.errors } }
219
220
  ) : new Error("Data SDK GraphQL request failed.");
220
- if (u == null || !V(u))
221
+ if (u == null || !R(u))
221
222
  throw new Error("Data SDK GraphQL response is malformed.");
222
223
  return u;
223
224
  }
224
225
  }
225
- function ve(t) {
226
+ function De(t) {
226
227
  return (e) => {
227
228
  const [r, n] = e;
228
229
  if (typeof r == "string" && !r.startsWith("http")) {
229
230
  const s = r.startsWith("/") ? r : `/${r}`;
230
- return l([`${t}${s}`, n]);
231
+ return p([`${t}${s}`, n]);
231
232
  }
232
- return l(e);
233
+ return p(e);
233
234
  };
234
235
  }
235
- function De(t) {
236
- return (e) => l(w("Authorization", `Bearer ${t}`, e));
236
+ function Ae(t) {
237
+ return (e) => p(g("Authorization", `Bearer ${t}`, e));
237
238
  }
238
- function Ae(t, e) {
239
+ function Ce(t, e) {
239
240
  const r = [];
240
- return t && r.push(ve(t)), e && r.push(De(e)), J({
241
+ return t && r.push(De(t)), e && r.push(Ae(e)), J({
241
242
  request: r
242
243
  }).service;
243
244
  }
244
- const Ce = {
245
+ const _e = {
245
246
  "Content-Type": "application/json",
246
247
  Accept: "application/json",
247
248
  "X-Chatter-Entity-Encoding": "false"
248
249
  };
249
- function _e(t) {
250
+ function Oe(t) {
250
251
  if (t instanceof Headers) {
251
252
  const e = [];
252
253
  return t.forEach((r, n) => e.push([n, r])), e;
@@ -256,33 +257,33 @@ function _e(t) {
256
257
  function B(t, e) {
257
258
  if (e === void 0) return { ...t };
258
259
  const r = { ...t }, n = /* @__PURE__ */ new Map();
259
- for (const o of Object.keys(r)) n.set(o.toLowerCase(), o);
260
+ for (const a of Object.keys(r)) n.set(a.toLowerCase(), a);
260
261
  const s = /* @__PURE__ */ new Set();
261
- for (const [o, a] of _e(e)) {
262
- const i = o.toLowerCase(), c = n.get(i);
263
- c === void 0 ? (r[o] = a, n.set(i, o), s.add(i)) : s.has(i) ? r[c] = `${r[c]}, ${a}` : (r[c] = a, s.add(i));
262
+ for (const [a, o] of Oe(e)) {
263
+ const i = a.toLowerCase(), c = n.get(i);
264
+ 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));
264
265
  }
265
266
  return r;
266
267
  }
267
268
  function X(t) {
268
- return B(Ce, t);
269
+ return B(_e, t);
269
270
  }
270
- function Oe(t) {
271
+ function ke(t) {
271
272
  if (t === void 0) return;
272
273
  const e = {};
273
274
  return new Headers(t).forEach((r, n) => {
274
275
  e[n] = r;
275
276
  }), Object.keys(e).length > 0 ? e : void 0;
276
277
  }
277
- const ke = 512;
278
- function Te(t) {
278
+ const Te = 512;
279
+ function Ne(t) {
279
280
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
280
281
  }
281
- class R extends Error {
282
+ class V extends Error {
282
283
  status;
283
284
  url;
284
285
  constructor(e) {
285
- const r = e.body.length === 0 ? "empty response body" : "unparseable response body", n = e.body.length === 0 ? "" : ` (starts with: ${JSON.stringify(Te(e.body.slice(0, ke)))})`;
286
+ const r = e.body.length === 0 ? "empty response body" : "unparseable response body", n = e.body.length === 0 ? "" : ` (starts with: ${JSON.stringify(Ne(e.body.slice(0, Te)))})`;
286
287
  super(
287
288
  `${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.`
288
289
  ), this.name = "GraphQLTransportError", this.status = e.status, this.url = e.url, this.cause = e.cause;
@@ -293,11 +294,11 @@ async function Y(t, e, r) {
293
294
  let s;
294
295
  try {
295
296
  s = JSON.parse(n);
296
- } catch (o) {
297
- throw new R({ surface: e, url: r, status: t.status, body: n, cause: o });
297
+ } catch (a) {
298
+ throw new V({ surface: e, url: r, status: t.status, body: n, cause: a });
298
299
  }
299
- if (!Ne(s))
300
- throw new R({
300
+ if (!Pe(s))
301
+ throw new V({
301
302
  surface: e,
302
303
  url: r,
303
304
  status: t.status,
@@ -306,21 +307,21 @@ async function Y(t, e, r) {
306
307
  });
307
308
  return s;
308
309
  }
309
- function Ne(t) {
310
+ function Pe(t) {
310
311
  return t === null || typeof t != "object" || Array.isArray(t) ? !1 : "data" in t || Array.isArray(t.errors);
311
312
  }
312
- const Pe = {
313
+ const $e = {
313
314
  "Content-Type": "application/json",
314
315
  Accept: "application/json"
315
316
  };
316
- class $e {
317
+ class qe {
317
318
  clientFetch;
318
319
  pathData;
319
320
  apiVersion;
320
321
  graphql;
321
322
  constructor(e) {
322
- const r = qe(), n = xe(e?.instanceUrl ?? r.instanceUrl), s = e?.accessToken ?? r.accessToken;
323
- this.apiVersion = e?.apiVersion ?? r.apiVersion ?? A, this.pathData = x(this.apiVersion), this.clientFetch = Ae(n || void 0, s), this.graphql = q(this.executeRawGraphQL.bind(this));
323
+ const r = xe(), n = Re(e?.instanceUrl ?? r.instanceUrl), s = e?.accessToken ?? r.accessToken;
324
+ this.apiVersion = e?.apiVersion ?? r.apiVersion ?? A, this.pathData = x(this.apiVersion), this.clientFetch = Ce(n || void 0, s), this.graphql = q(this.executeRawGraphQL.bind(this));
324
325
  }
325
326
  async executeRawGraphQL({
326
327
  query: e,
@@ -328,15 +329,15 @@ class $e {
328
329
  operationName: n,
329
330
  headers: s
330
331
  }) {
331
- const o = `${this.pathData}/graphql`, a = await this.clientFetch(o, {
332
+ const a = `${this.pathData}/graphql`, o = await this.clientFetch(a, {
332
333
  method: "POST",
333
334
  body: JSON.stringify({ query: e, variables: r, operationName: n }),
334
- headers: B(Pe, s)
335
+ headers: B($e, s)
335
336
  });
336
- return Y(a, "Mosaic", o);
337
+ return Y(o, "Mosaic", a);
337
338
  }
338
339
  }
339
- function qe() {
340
+ function xe() {
340
341
  const t = globalThis.MOSAIC_ENV;
341
342
  return {
342
343
  instanceUrl: t?.instanceUrl,
@@ -344,13 +345,13 @@ function qe() {
344
345
  apiVersion: t?.apiVersion
345
346
  };
346
347
  }
347
- function xe(t) {
348
+ function Re(t) {
348
349
  if (!t || t === "/") return "";
349
350
  let e = t;
350
351
  return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
351
352
  }
352
353
  const Ve = "graphqlQuery";
353
- class Re {
354
+ class Le {
354
355
  graphql;
355
356
  constructor() {
356
357
  this.graphql = q(this.executeRawGraphQL.bind(this));
@@ -375,16 +376,12 @@ class Re {
375
376
  })).structuredContent;
376
377
  }
377
378
  }
378
- const Le = { namespace: "sf.pdp", name: "PdpEvent", pbjsSchema: { nested: { sf: { nested: { pdp: { nested: { PdpEvent: { oneofs: { _eventVolume: { oneof: ["eventVolume"] } }, fields: { contextName: { id: 5, type: "string" }, componentId: { id: 2, type: "string" }, productFeatureId: { id: 3, type: "string" }, channel: { id: 7, type: "string" }, eventName: { id: 1, type: "string" }, contextValue: { id: 6, type: "string" }, subType: { id: 8, type: "string" }, eventVolume: {
379
- options: { proto3_optional: !0 },
380
- id: 4,
381
- type: "int32"
382
- }, userId: { id: 9, type: "string" } } } } } } } } } }, Ie = 1, L = 256, I = "__SF_O11Y_QUEUE_1P__", Me = 1e3;
379
+ const Me = 1, L = 256, M = "__SF_O11Y_QUEUE_1P__", Ie = 1e3;
383
380
  function Ge() {
384
381
  const t = [], e = {
385
382
  droppedCount: 0,
386
383
  push(r) {
387
- t.length >= Me && (t.shift(), e.droppedCount++), t.push(r);
384
+ t.length >= Ie && (t.shift(), e.droppedCount++), t.push(r);
388
385
  },
389
386
  drain() {
390
387
  return t.splice(0, t.length);
@@ -395,8 +392,8 @@ function Ge() {
395
392
  function b(t, e, r) {
396
393
  if (!(typeof window > "u"))
397
394
  try {
398
- const n = window, s = n[I] ?? (n[I] = Ge()), o = { version: Ie, name: t, verb: e, args: r };
399
- s.push(o);
395
+ const n = window, s = n[M] ?? (n[M] = Ge()), a = { version: Me, name: t, verb: e, args: r };
396
+ s.push(a);
400
397
  } catch {
401
398
  }
402
399
  }
@@ -414,8 +411,8 @@ function Ue(t) {
414
411
  trackValue(e, r, n, s) {
415
412
  b(t, "trackValue", [e, r, n, s]);
416
413
  },
417
- bucketValue(e, r, n, s, o) {
418
- b(t, "bucketValue", [e, r, n, s, o]);
414
+ bucketValue(e, r, n, s, a) {
415
+ b(t, "bucketValue", [e, r, n, s, a]);
419
416
  }
420
417
  };
421
418
  }
@@ -430,10 +427,10 @@ function Qe(t) {
430
427
  function Fe(t) {
431
428
  return Object.freeze({ kind: "log", ...t });
432
429
  }
433
- const Ke = /* @__PURE__ */ new Set([y.WebApp, y.MicroFrontend]), M = /* @__PURE__ */ new Set();
430
+ const Ke = /* @__PURE__ */ new Set([y.WebApp, y.MicroFrontend]), I = /* @__PURE__ */ new Set();
434
431
  function G(t, e) {
435
432
  const { namespace: r, name: n } = t.schema, s = `${t.area}/${r}.${n}/${e}`;
436
- M.has(s) || (M.add(s), console.debug(
433
+ I.has(s) || (I.add(s), console.debug(
437
434
  `[platform-sdk:telemetry] Dropped ${r}.${n} for area "${t.area}". ${e}`
438
435
  ));
439
436
  }
@@ -470,39 +467,39 @@ const je = {
470
467
  }), We = /* @__PURE__ */ Fe({
471
468
  area: "data",
472
469
  description: "Data SDK adoption. Answers: how many distinct orgs use the Data SDK (PF MAT, trailing 28 days)?",
473
- schema: Le
470
+ schema: he
474
471
  });
475
472
  let U = !1;
476
473
  function Be() {
477
474
  U || (U = !0, je.log(We, Je));
478
475
  }
479
- const g = "Accept-Language";
476
+ const w = "Accept-Language";
480
477
  function Z(t) {
481
478
  return t ? void 0 : globalThis.SFDC_ENV?.language;
482
479
  }
483
480
  function Xe(t) {
484
- const e = new Headers(t), r = Z(e.has(g));
485
- return r ? (e.set(g, r), e) : t;
481
+ const e = new Headers(t), r = Z(e.has(w));
482
+ return r ? (e.set(w, r), e) : t;
486
483
  }
487
484
  const Ye = (t) => {
488
- const [e, r] = t, n = e instanceof Request && !r?.headers ? e.headers.has(g) : new Headers(r?.headers).has(g), s = Z(n);
489
- return s ? l(w(g, s, t)) : l(t);
490
- }, Ze = "X-SFDC-Client-Name", et = "X-SFDC-Client-Version", tt = "@salesforce/platform-sdk", rt = "13.0.0", nt = (t) => {
491
- let e = w(Ze, tt, t);
492
- return e = w(et, rt, e), l(e);
485
+ const [e, r] = t, n = e instanceof Request && !r?.headers ? e.headers.has(w) : new Headers(r?.headers).has(w), s = Z(n);
486
+ return s ? p(g(w, s, t)) : p(t);
487
+ }, Ze = "X-SFDC-Client-Name", et = "X-SFDC-Client-Version", tt = "@salesforce/platform-sdk", rt = "13.1.0", nt = (t) => {
488
+ let e = g(Ze, tt, t);
489
+ return e = g(et, rt, e), p(e);
493
490
  }, st = "X-CSRF-Token";
494
- function ot(t, e = {}) {
491
+ function at(t, e = {}) {
495
492
  const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
496
493
  return async (s) => {
497
- const [o, a] = s, i = o instanceof Request ? o.url : o instanceof URL ? o.href : o, c = a?.method ?? (o instanceof Request ? o.method : void 0) ?? "GET";
498
- if (Q(n, i) || at(c) && Q(r, i)) {
494
+ 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";
495
+ if (Q(n, i) || ot(c) && Q(r, i)) {
499
496
  const u = await t.getToken();
500
- s = w(st, u, s);
497
+ s = g(st, u, s);
501
498
  }
502
- return l(s);
499
+ return p(s);
503
500
  };
504
501
  }
505
- function at(t) {
502
+ function ot(t) {
506
503
  const e = t.toLowerCase();
507
504
  return e === "post" || e === "put" || e === "patch" || e === "delete";
508
505
  }
@@ -511,15 +508,15 @@ function Q(t, e) {
511
508
  return t.some((n) => r.pathname.includes(n));
512
509
  }
513
510
  function it(t, e = {}) {
514
- const r = ot(t, e);
511
+ const r = at(t, e);
515
512
  async function n(s) {
516
- const o = await r(s);
517
- return fetch(o[0], o[1]);
513
+ const a = await r(s);
514
+ return fetch(a[0], a[1]);
518
515
  }
519
- return (s, o) => o ? o.applyRetry(async () => n(s)) : n(s);
516
+ return (s, a) => a ? a.applyRetry(async () => n(s)) : n(s);
520
517
  }
521
518
  const ct = [400, 401, 403];
522
- class ut extends he {
519
+ class ut extends le {
523
520
  constructor(e) {
524
521
  super(e), this.csrfTokenManager = e;
525
522
  }
@@ -606,7 +603,7 @@ class ht {
606
603
  });
607
604
  if (s)
608
605
  return s;
609
- await this.withCache((o) => o.delete(this.endpoint));
606
+ await this.withCache((a) => a.delete(this.endpoint));
610
607
  }
611
608
  const r = await fetch(this.endpoint, { method: "get" });
612
609
  if (!r.ok)
@@ -638,7 +635,7 @@ async function F(t) {
638
635
  return typeof r == "string" && r !== "" ? r : void 0;
639
636
  }
640
637
  const K = /* @__PURE__ */ new Map();
641
- function dt(t) {
638
+ function lt(t) {
642
639
  const { endpoint: e, cacheName: r, ...n } = t.csrf;
643
640
  let s = K.get(e);
644
641
  return s || (s = new ht(e, r), K.set(e, s)), J(
@@ -650,16 +647,16 @@ function dt(t) {
650
647
  ).service;
651
648
  }
652
649
  const j = /* @__PURE__ */ new Map();
653
- function pt(t) {
650
+ function dt(t) {
654
651
  let e = j.get(t);
655
652
  if (!e) {
656
- const r = pe().service, n = fe(r).service, s = le(r, n).service, o = ye().service;
657
- e = { cache: r, cacheController: s, pubSub: o }, j.set(t, e);
653
+ const r = pe().service, n = ye(r).service, s = fe(r, n).service, a = me().service;
654
+ e = { cache: r, cacheController: s, pubSub: a }, j.set(t, e);
658
655
  }
659
656
  return e;
660
657
  }
661
- function lt(t, e) {
662
- const r = pt(t);
658
+ function pt(t, e) {
659
+ const r = dt(t);
663
660
  return {
664
661
  shared: r,
665
662
  services: {
@@ -687,12 +684,12 @@ function yt(t) {
687
684
  }
688
685
  return H;
689
686
  }
690
- class mt extends me {
687
+ class mt extends be {
691
688
  constructor(e, r, n) {
692
689
  super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = ft(
693
690
  e.variables ?? {},
694
691
  this.normalizedOperationName
695
- ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = yt(e.cacheControl), this.headers = e.headers, this.headersKey = Oe(e.headers);
692
+ ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = yt(e.cacheControl), this.headers = e.headers, this.headersKey = ke(e.headers);
696
693
  }
697
694
  url;
698
695
  query;
@@ -722,7 +719,7 @@ class mt extends me {
722
719
  variables: this.normalizedVariables,
723
720
  operationName: this.normalizedOperationName
724
721
  };
725
- return this.headersKey !== void 0 && (e.headers = this.headersKey), ae(e);
722
+ return this.headersKey !== void 0 && (e.headers = this.headersKey), oe(e);
726
723
  }
727
724
  /**
728
725
  * Reads the cached result for this command, or returns an error.
@@ -740,9 +737,9 @@ class mt extends me {
740
737
  */
741
738
  readFromCache(e) {
742
739
  const r = this.buildKey(), n = e.get(r)?.value;
743
- return n === void 0 ? l(
740
+ return n === void 0 ? p(
744
741
  k(new ie("No cached entry found for this query."))
745
- ) : l(O(n));
742
+ ) : p(O(n));
746
743
  }
747
744
  writeToCache(e, r) {
748
745
  if (r.isOk() && r.value.data != null && Object.keys(r.value.data).length > 0) {
@@ -758,7 +755,7 @@ class mt extends me {
758
755
  }
759
756
  });
760
757
  }
761
- return l(void 0);
758
+ return p(void 0);
762
759
  }
763
760
  get cacheControlStrategyConfig() {
764
761
  const e = Math.floor(Date.now() / 1e3);
@@ -776,7 +773,7 @@ class mt extends me {
776
773
  }
777
774
  }
778
775
  const bt = "CACHE_MISS";
779
- function gt() {
776
+ function wt() {
780
777
  return [
781
778
  {
782
779
  message: "No cached entry found for this query (cacheControl: 'only-if-cached').",
@@ -791,7 +788,7 @@ function ee(t) {
791
788
  return e.data;
792
789
  }
793
790
  }
794
- function wt(t) {
791
+ function gt(t) {
795
792
  return (e) => {
796
793
  if (e.isOk()) {
797
794
  const r = e.value;
@@ -805,16 +802,16 @@ function wt(t) {
805
802
  async function Et(t, e = !1) {
806
803
  let r, n, s;
807
804
  try {
808
- const o = await t.execute();
809
- o.isOk() ? (r = o.value.data, S(r), s = (a) => o.value.subscribe(a)) : (r = ee(o.error.failure), r && S(r), n = e && r === void 0 ? gt() : m(o.error.failure), s = (a) => o.error.subscribe(a));
810
- } catch (o) {
811
- n = m(o);
805
+ const a = await t.execute();
806
+ a.isOk() ? (r = a.value.data, S(r), s = (o) => a.value.subscribe(o)) : (r = ee(a.error.failure), r && S(r), n = e && r === void 0 ? wt() : m(a.error.failure), s = (o) => a.error.subscribe(o));
807
+ } catch (a) {
808
+ n = m(a);
812
809
  }
813
810
  return {
814
811
  data: r,
815
812
  errors: n,
816
- subscribe(o) {
817
- return s ? s(wt(o)) : D;
813
+ subscribe(a) {
814
+ return s ? s(gt(a)) : D;
818
815
  },
819
816
  async refresh() {
820
817
  await t.refresh();
@@ -836,16 +833,16 @@ function St({
836
833
  resolveEffectiveHeaders: n
837
834
  }) {
838
835
  const { services: s } = t;
839
- async function o({
840
- query: a,
836
+ async function a({
837
+ query: o,
841
838
  variables: i,
842
839
  operationName: c,
843
840
  cacheControl: h,
844
841
  headers: u
845
842
  }) {
846
- const d = P(a);
847
- if (d.isErr()) return _(d.error);
848
- const p = d.value, f = $(p, c);
843
+ const l = P(o);
844
+ if (l.isErr()) return _(l.error);
845
+ const d = l.value, f = $(d, c);
849
846
  if (f !== "query")
850
847
  return _([
851
848
  {
@@ -857,7 +854,7 @@ function St({
857
854
  const C = n ? n(u) : u;
858
855
  E = new mt(
859
856
  {
860
- query: N(p),
857
+ query: N(d),
861
858
  variables: i,
862
859
  operationName: c,
863
860
  cacheControl: h,
@@ -872,8 +869,8 @@ function St({
872
869
  return Et(E, h === "only-if-cached");
873
870
  }
874
871
  return {
875
- query: o,
876
- mutate: (a) => W(r, a)
872
+ query: a,
873
+ mutate: (o) => W(r, o)
877
874
  };
878
875
  }
879
876
  const vt = 1, Dt = `@salesforce/platform-sdk-data_v${vt}`;
@@ -888,7 +885,7 @@ class z {
888
885
  const r = At();
889
886
  this.baseUrl = Ct(e?.basePath ?? r.apiPath), this.apiVersion = e?.apiVersion ?? A, this.pathData = x(this.apiVersion);
890
887
  const n = `${this.pathData}/ui-api`, s = `${this.pathData}/graphql`;
891
- this.onStatus = e?.onStatus ?? {}, this.clientFetch = dt({
888
+ this.onStatus = e?.onStatus ?? {}, this.clientFetch = lt({
892
889
  csrf: {
893
890
  endpoint: `${this.baseUrl}${n}/session/csrf`,
894
891
  cacheName: Dt,
@@ -896,9 +893,9 @@ class z {
896
893
  alwaysProtectedUrls: ["services/apexrest"]
897
894
  }
898
895
  });
899
- const o = (i, c) => this.fetch(i, c), a = lt(`${this.baseUrl}${this.pathData}`, o);
896
+ const a = (i, c) => this.fetch(i, c), o = pt(`${this.baseUrl}${this.pathData}`, a);
900
897
  this.graphql = St({
901
- bundle: a,
898
+ bundle: o,
902
899
  url: s,
903
900
  executeRaw: this.executeRawGraphQL.bind(this),
904
901
  resolveEffectiveHeaders: Xe
@@ -922,12 +919,12 @@ class z {
922
919
  operationName: n,
923
920
  headers: s
924
921
  }) {
925
- const o = `${this.pathData}/graphql`, a = await this.fetch(o, {
922
+ const a = `${this.pathData}/graphql`, o = await this.fetch(a, {
926
923
  method: "POST",
927
924
  body: JSON.stringify({ query: e, variables: r, operationName: n }),
928
925
  headers: X(s)
929
926
  });
930
- return Y(a, "WebApp", o);
927
+ return Y(o, "WebApp", a);
931
928
  }
932
929
  /**
933
930
  * Converts a relative URL to an absolute Salesforce URL.
@@ -957,17 +954,17 @@ function Ct(t) {
957
954
  return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
958
955
  }
959
956
  function _t(t) {
960
- const e = t, r = typeof e == "object" && e !== null ? e : void 0, n = r !== void 0 && "setup" in r, s = n ? r : r?.extension, o = n ? s?.name : r?.as;
957
+ const e = t, r = typeof e == "object" && e !== null ? e : void 0, n = r !== void 0 && "setup" in r, s = n ? r : r?.extension, a = n ? s?.name : r?.as;
961
958
  if (typeof s?.setup != "function")
962
959
  throw new Error("Extension entry cannot attach: it is missing a setup function.");
963
- if (typeof o != "string" || o.length === 0)
960
+ if (typeof a != "string" || a.length === 0)
964
961
  throw new Error(
965
962
  n ? 'Extension entry cannot attach: "name" must be a non-empty string.' : 'Extension entry cannot attach: alias "as" must be a non-empty string.'
966
963
  );
967
964
  return {
968
965
  extension: s,
969
- mountName: o,
970
- label: o === s.name ? `"${s.name}"` : `"${s.name}" (aliased as "${o}")`
966
+ mountName: a,
967
+ label: a === s.name ? `"${s.name}"` : `"${s.name}" (aliased as "${a}")`
971
968
  };
972
969
  }
973
970
  async function Ot(t, e, r) {
@@ -979,19 +976,19 @@ async function Ot(t, e, r) {
979
976
  );
980
977
  const n = e.map(_t);
981
978
  r?.preflight?.(n, t);
982
- const s = Object.create(t), o = /* @__PURE__ */ Object.create(null), a = (h) => {
979
+ const s = Object.create(t), a = /* @__PURE__ */ Object.create(null), o = (h) => {
983
980
  throw new Error(`Cannot write "ext.${String(h)}" — ext is immutable once attached.`);
984
981
  }, i = (h) => {
985
982
  throw new Error(`Cannot ${h} "ext" — ext is immutable once attached.`);
986
- }, c = new Proxy(o, {
983
+ }, c = new Proxy(a, {
987
984
  set(h, u) {
988
- return a(u);
985
+ return o(u);
989
986
  },
990
987
  defineProperty(h, u) {
991
- return a(u);
988
+ return o(u);
992
989
  },
993
990
  deleteProperty(h, u) {
994
- return a(u);
991
+ return o(u);
995
992
  },
996
993
  // Without these two traps, `preventExtensions` and `setPrototypeOf`
997
994
  // fall through to the real `store`, because no per-property trap
@@ -1011,40 +1008,40 @@ async function Ot(t, e, r) {
1011
1008
  writable: !1,
1012
1009
  configurable: !1
1013
1010
  });
1014
- for (const { extension: h, mountName: u, label: d } of n) {
1015
- if (Object.hasOwn(o, u))
1011
+ for (const { extension: h, mountName: u, label: l } of n) {
1012
+ if (Object.hasOwn(a, u))
1016
1013
  throw new Error(
1017
- `Extension ${d} cannot attach: "${u}" is already defined by another extension.`
1014
+ `Extension ${l} cannot attach: "${u}" is already defined by another extension.`
1018
1015
  );
1019
- let p;
1016
+ let d;
1020
1017
  try {
1021
- p = await h.setup(s);
1018
+ d = await h.setup(s);
1022
1019
  } catch (f) {
1023
- throw new Error(`Extension ${d} failed during setup.`, { cause: f });
1020
+ throw new Error(`Extension ${l} failed during setup.`, { cause: f });
1024
1021
  }
1025
- Object.defineProperty(o, u, {
1026
- value: p,
1022
+ Object.defineProperty(a, u, {
1023
+ value: d,
1027
1024
  enumerable: !0,
1028
1025
  writable: !1,
1029
1026
  configurable: !1
1030
1027
  });
1031
1028
  }
1032
- return Object.freeze(o), s;
1029
+ return Object.freeze(a), s;
1033
1030
  }
1034
- function Gt(t, ...e) {
1031
+ function Ut(t, ...e) {
1035
1032
  let r = t[0] ?? "";
1036
1033
  for (let n = 0; n < e.length; n += 1)
1037
1034
  r += String(e[n]) + (t[n + 1] ?? "");
1038
1035
  return r;
1039
1036
  }
1040
- function Ut(t) {
1037
+ function Qt(t) {
1041
1038
  return t;
1042
1039
  }
1043
1040
  async function kt(t) {
1044
1041
  try {
1045
1042
  switch (await re(t?.surface)) {
1046
1043
  case y.OpenAI:
1047
- return new Re();
1044
+ return new Le();
1048
1045
  case y.WebApp:
1049
1046
  return new z(t?.webapp);
1050
1047
  case y.MicroFrontend: {
@@ -1052,9 +1049,9 @@ async function kt(t) {
1052
1049
  return typeof r == "object" && r !== null ? new z(t?.webapp) : {};
1053
1050
  }
1054
1051
  case y.Mosaic:
1055
- return new $e(t?.mosaic);
1052
+ return new qe(t?.mosaic);
1056
1053
  case y.MCPApps:
1057
- return new Se(await ne.getInstance(), t?.mcpApps);
1054
+ return new ve(await ne.getInstance(), t?.mcpApps);
1058
1055
  default:
1059
1056
  return {};
1060
1057
  }
@@ -1062,7 +1059,7 @@ async function kt(t) {
1062
1059
  return {};
1063
1060
  }
1064
1061
  }
1065
- function Qt(t) {
1062
+ function Ft(t) {
1066
1063
  return se(
1067
1064
  (async () => {
1068
1065
  const e = await kt(t), r = await Ot(e, t?.extensions ?? [], {
@@ -1074,7 +1071,7 @@ function Qt(t) {
1074
1071
  );
1075
1072
  }
1076
1073
  export {
1077
- Qt as createDataSDK,
1078
- Ut as defineDataExtension,
1079
- Gt as gql
1074
+ Ft as createDataSDK,
1075
+ Qt as defineDataExtension,
1076
+ Ut as gql
1080
1077
  };