@salesforce/platform-sdk 11.45.7 → 11.45.9

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,7 +1,7 @@
1
1
  import { g as x, S as y } from "../surface-Dd2tqrPi.js";
2
- import { w as K } from "../sdk-promise-D0sy7OW1.js";
3
- import { buildServiceDescriptor as M, setHeader as b } from "@conduit-client/service-fetch-network/v1";
4
- import { resolvedPromiseLike as u, ok as E, err as D, stableJSONStringify as G, DataNotFoundError as Q, UserVisibleError as z, deepFreeze as v, isUserVisibleError as j } from "@conduit-client/utils";
2
+ import { w as G } from "../sdk-promise-D0sy7OW1.js";
3
+ import { buildServiceDescriptor as L, setHeader as b } from "@conduit-client/service-fetch-network/v1";
4
+ import { resolvedPromiseLike as u, ok as E, err as D, stableJSONStringify as K, DataNotFoundError as Q, UserVisibleError as z, deepFreeze as v, isUserVisibleError as j } from "@conduit-client/utils";
5
5
  import { print as k, parse as W } from "@conduit-client/onestore-graphql-parser/v1";
6
6
  import { RetryPolicy as B, buildServiceDescriptor as J } from "@conduit-client/service-retry/v1";
7
7
  import { buildServiceDescriptor as X } from "@conduit-client/service-cache/v1";
@@ -24,7 +24,7 @@ function ne(r) {
24
24
  }
25
25
  function se(r, e) {
26
26
  const t = [];
27
- return r && t.push(te(r)), e && t.push(ne(e)), M({
27
+ return r && t.push(te(r)), e && t.push(ne(e)), L({
28
28
  request: t
29
29
  }).service;
30
30
  }
@@ -40,7 +40,7 @@ function oe(r) {
40
40
  }
41
41
  return Array.isArray(r) ? r.map(([e, t]) => [e, t]) : Object.entries(r);
42
42
  }
43
- function L(r, e) {
43
+ function M(r, e) {
44
44
  if (e === void 0) return { ...r };
45
45
  const t = { ...r }, n = /* @__PURE__ */ new Map();
46
46
  for (const a of Object.keys(t)) n.set(a.toLowerCase(), a);
@@ -52,7 +52,7 @@ function L(r, e) {
52
52
  return t;
53
53
  }
54
54
  function H(r) {
55
- return L(ae, r);
55
+ return M(ae, r);
56
56
  }
57
57
  function ie(r) {
58
58
  if (r === void 0) return;
@@ -71,7 +71,7 @@ function q(r) {
71
71
  return D(d(e));
72
72
  }
73
73
  }
74
- function _(r, e) {
74
+ function T(r, e) {
75
75
  const t = r.definitions.filter(
76
76
  (n) => n.kind === "OperationDefinition"
77
77
  );
@@ -88,7 +88,7 @@ function d(r) {
88
88
  async function I(r, { mutation: e, variables: t, operationName: n, headers: s }) {
89
89
  const a = q(e);
90
90
  if (a.isErr()) return { data: void 0, errors: a.error };
91
- const i = a.value, o = _(i, n);
91
+ const i = a.value, o = T(i, n);
92
92
  if (o !== "mutation")
93
93
  return {
94
94
  data: void 0,
@@ -142,7 +142,7 @@ function $(r) {
142
142
  subscribe: () => S,
143
143
  refresh: A
144
144
  };
145
- const c = o.value, f = _(c, a);
145
+ const c = o.value, f = T(c, a);
146
146
  if (f !== "query")
147
147
  return {
148
148
  data: void 0,
@@ -199,7 +199,7 @@ class he {
199
199
  return (await this.clientFetch(`${this.pathData}/graphql`, {
200
200
  method: "POST",
201
201
  body: JSON.stringify({ query: e, variables: t, operationName: n }),
202
- headers: L(ue, s)
202
+ headers: M(ue, s)
203
203
  })).json();
204
204
  }
205
205
  }
@@ -245,17 +245,17 @@ const w = "Accept-Language", me = (r) => {
245
245
  return u(r);
246
246
  const [t, n] = r;
247
247
  return (t instanceof Request && !n?.headers ? t.headers.has(w) : new Headers(n?.headers).has(w)) ? u(r) : u(b(w, e, r));
248
- }, ye = "X-SFDC-Client-Name", be = "X-SFDC-Client-Version", ve = "@salesforce/platform-sdk", Se = "11.45.7", ge = (r) => {
248
+ }, ye = "X-SFDC-Client-Name", be = "X-SFDC-Client-Version", ve = "@salesforce/platform-sdk", Se = "11.45.9", ge = (r) => {
249
249
  let e = b(ye, ve, r);
250
250
  return e = b(be, Se, e), u(e);
251
251
  }, we = "X-CSRF-Token";
252
252
  function Ce(r, e = {}) {
253
253
  const { protectedUrls: t = [], alwaysProtectedUrls: n = [] } = e;
254
254
  return async (s) => {
255
- const [a, i] = s, o = new Request(a, i);
256
- if (O(n, o.url) || Ee(o.method) && O(t, o.url)) {
257
- const f = await r.getToken();
258
- s = b(we, f, s);
255
+ const [a, i] = s, o = a instanceof Request ? a.url : a instanceof URL ? a.href : a, c = i?.method ?? (a instanceof Request ? a.method : void 0) ?? "GET";
256
+ if (_(n, o) || Ee(c) && _(t, o)) {
257
+ const h = await r.getToken();
258
+ s = b(we, h, s);
259
259
  }
260
260
  return u(s);
261
261
  };
@@ -264,8 +264,8 @@ function Ee(r) {
264
264
  const e = r.toLowerCase();
265
265
  return e === "post" || e === "put" || e === "patch" || e === "delete";
266
266
  }
267
- function O(r, e) {
268
- const t = new URL(e);
267
+ function _(r, e) {
268
+ const t = new URL(e, globalThis.location?.href ?? "http://localhost");
269
269
  return r.some((n) => t.pathname.includes(n));
270
270
  }
271
271
  function De(r, e = {}) {
@@ -351,11 +351,11 @@ class qe {
351
351
  return;
352
352
  }
353
353
  }
354
- const P = /* @__PURE__ */ new Map();
355
- function _e(r) {
354
+ const O = /* @__PURE__ */ new Map();
355
+ function Te(r) {
356
356
  const { endpoint: e, cacheName: t, ...n } = r.csrf;
357
- let s = P.get(e);
358
- return s || (s = new qe(e, t), P.set(e, s)), M(
357
+ let s = O.get(e);
358
+ return s || (s = new qe(e, t), O.set(e, s)), L(
359
359
  {
360
360
  retry: De(s, n),
361
361
  request: [ge, me]
@@ -363,17 +363,17 @@ function _e(r) {
363
363
  J(new ke(s)).service
364
364
  ).service;
365
365
  }
366
- const N = /* @__PURE__ */ new Map();
367
- function Oe(r) {
368
- let e = N.get(r);
366
+ const P = /* @__PURE__ */ new Map();
367
+ function _e(r) {
368
+ let e = P.get(r);
369
369
  if (!e) {
370
370
  const t = X().service, n = Z(t).service, s = Y(t, n).service, a = ee().service;
371
- e = { cache: t, cacheController: s, pubSub: a }, N.set(r, e);
371
+ e = { cache: t, cacheController: s, pubSub: a }, P.set(r, e);
372
372
  }
373
373
  return e;
374
374
  }
375
- function Pe(r, e) {
376
- const t = Oe(r);
375
+ function Oe(r, e) {
376
+ const t = _e(r);
377
377
  return {
378
378
  shared: t,
379
379
  services: {
@@ -383,8 +383,8 @@ function Pe(r, e) {
383
383
  }
384
384
  };
385
385
  }
386
- const T = 300;
387
- function Ne(r, e) {
386
+ const R = 300;
387
+ function Pe(r, e) {
388
388
  try {
389
389
  return JSON.parse(JSON.stringify(r));
390
390
  } catch (t) {
@@ -394,19 +394,19 @@ function Ne(r, e) {
394
394
  throw s.cause = t, s;
395
395
  }
396
396
  }
397
- function Te(r) {
397
+ function Re(r) {
398
398
  if (typeof r == "object" && r.type === "max-age") {
399
399
  const e = r.maxAge;
400
- return Number.isFinite(e) && e >= 0 ? e : T;
400
+ return Number.isFinite(e) && e >= 0 ? e : R;
401
401
  }
402
- return T;
402
+ return R;
403
403
  }
404
- class Re extends re {
404
+ class Ne extends re {
405
405
  constructor(e, t, n) {
406
- super(t), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = Ne(
406
+ super(t), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = Pe(
407
407
  e.variables ?? {},
408
408
  this.normalizedOperationName
409
- ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = Te(e.cacheControl), this.headers = e.headers, this.headersKey = ie(e.headers);
409
+ ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = Re(e.cacheControl), this.headers = e.headers, this.headersKey = ie(e.headers);
410
410
  }
411
411
  query;
412
412
  normalizedVariables;
@@ -435,7 +435,7 @@ class Re extends re {
435
435
  variables: this.normalizedVariables,
436
436
  operationName: this.normalizedOperationName
437
437
  };
438
- return this.headersKey !== void 0 && (e.headers = this.headersKey), G(e);
438
+ return this.headersKey !== void 0 && (e.headers = this.headersKey), K(e);
439
439
  }
440
440
  /**
441
441
  * Reads from the cache and returns the cache result or error
@@ -492,7 +492,7 @@ function U(r) {
492
492
  return e.data;
493
493
  }
494
494
  }
495
- function Me(r) {
495
+ function Le(r) {
496
496
  return (e) => {
497
497
  if (e.isOk()) {
498
498
  const t = e.value;
@@ -503,7 +503,7 @@ function Me(r) {
503
503
  }
504
504
  };
505
505
  }
506
- async function Le(r) {
506
+ async function Me(r) {
507
507
  let e, t, n;
508
508
  try {
509
509
  const s = await r.execute();
@@ -515,7 +515,7 @@ async function Le(r) {
515
515
  data: e,
516
516
  errors: t,
517
517
  subscribe(s) {
518
- return n ? n(Me(s)) : S;
518
+ return n ? n(Le(s)) : S;
519
519
  },
520
520
  async refresh() {
521
521
  await r.refresh();
@@ -545,7 +545,7 @@ function He({
545
545
  }) {
546
546
  const h = q(a);
547
547
  if (h.isErr()) return C(h.error);
548
- const p = h.value, m = _(p, o);
548
+ const p = h.value, m = T(p, o);
549
549
  if (m !== "query")
550
550
  return C([
551
551
  {
@@ -554,7 +554,7 @@ function He({
554
554
  ]);
555
555
  let l;
556
556
  try {
557
- l = new Re(
557
+ l = new Ne(
558
558
  {
559
559
  query: k(p),
560
560
  variables: i,
@@ -568,14 +568,14 @@ function He({
568
568
  } catch (g) {
569
569
  return C(d(g));
570
570
  }
571
- return Le(l);
571
+ return Me(l);
572
572
  }
573
573
  return {
574
574
  query: s,
575
575
  mutate: (a) => I(t, a)
576
576
  };
577
577
  }
578
- const Ie = 1, $e = `@salesforce/platform-sdk-data_v${Ie}`, V = F(), Fe = `${V}/ui-api`, R = `${V}/graphql`;
578
+ const Ie = 1, $e = `@salesforce/platform-sdk-data_v${Ie}`, V = F(), Fe = `${V}/ui-api`, N = `${V}/graphql`;
579
579
  class Ue {
580
580
  baseUrl;
581
581
  clientFetch;
@@ -583,7 +583,7 @@ class Ue {
583
583
  graphql;
584
584
  constructor(e) {
585
585
  const t = Ve();
586
- this.baseUrl = xe(e?.basePath ?? t.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = _e({
586
+ this.baseUrl = xe(e?.basePath ?? t.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = Te({
587
587
  csrf: {
588
588
  endpoint: `${this.baseUrl}${Fe}/session/csrf`,
589
589
  cacheName: $e,
@@ -591,10 +591,10 @@ class Ue {
591
591
  alwaysProtectedUrls: ["services/apexrest"]
592
592
  }
593
593
  });
594
- const n = (a, i) => this.fetch(a, i), s = Pe(this.baseUrl, n);
594
+ const n = (a, i) => this.fetch(a, i), s = Oe(this.baseUrl, n);
595
595
  this.graphql = He({
596
596
  bundle: s,
597
- url: R,
597
+ url: N,
598
598
  executeRaw: this.executeRawGraphQL.bind(this)
599
599
  });
600
600
  }
@@ -614,7 +614,7 @@ class Ue {
614
614
  operationName: n,
615
615
  headers: s
616
616
  }) {
617
- return (await this.fetch(R, {
617
+ return (await this.fetch(N, {
618
618
  method: "POST",
619
619
  body: JSON.stringify({ query: e, variables: t, operationName: n }),
620
620
  headers: H(s)
@@ -651,7 +651,7 @@ function er(r, ...e) {
651
651
  return t;
652
652
  }
653
653
  function rr(r) {
654
- return K(
654
+ return G(
655
655
  (async () => {
656
656
  try {
657
657
  switch (await x(r?.surface)) {
@@ -1 +1 @@
1
- {"version":3,"file":"header.interceptor.d.ts","sourceRoot":"","sources":["../../../../src/data/webapp/csrf/header.interceptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,MAAM,WAAW,uBAAuB;IACvC,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,GAAE,uBAA4B,GAClC,kBAAkB,CAkBpB"}
1
+ {"version":3,"file":"header.interceptor.d.ts","sourceRoot":"","sources":["../../../../src/data/webapp/csrf/header.interceptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,MAAM,WAAW,uBAAuB;IACvC,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,GAAE,uBAA4B,GAClC,kBAAkB,CAuBpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "11.45.7",
3
+ "version": "11.45.9",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -125,7 +125,7 @@
125
125
  "@conduit-client/service-pubsub": "3.19.6",
126
126
  "@conduit-client/service-retry": "3.19.6",
127
127
  "@conduit-client/utils": "3.19.6",
128
- "@salesforce/jsonrpc": "^11.45.7",
128
+ "@salesforce/jsonrpc": "^11.45.9",
129
129
  "@salesforce/sf-embedding-bridge": "2.2.5-rc.2"
130
130
  },
131
131
  "peerDependencies": {