@salesforce/platform-sdk 12.7.0 → 12.8.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.
@@ -15,5 +15,5 @@
15
15
  * ```
16
16
  */
17
17
  export { labels } from './labels';
18
- export type { LabelsApi, LabelsOptions, LabelFallback } from './labels';
18
+ export type { LabelsApi, LabelsOptions, LabelFallback, LabelResolution } from './labels';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/extensions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/extensions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
@@ -1,5 +1,5 @@
1
- import { defineDataExtension as b } from "../index.js";
2
- const m = "BASE_VALUE", p = `
1
+ import { defineDataExtension as v } from "../index.js";
2
+ const E = "BASE_VALUE", d = `
3
3
  query Labels($namespace: String, $names: [String!]!, $locale: String, $fallback: LabelFallback) {
4
4
  uiapi {
5
5
  platform {
@@ -10,76 +10,142 @@ const m = "BASE_VALUE", p = `
10
10
  }
11
11
  }
12
12
  }
13
- `, E = /* @__PURE__ */ new Set(["TRANSLATION_NOT_FOUND", "LABEL_NOT_FOUND"]), f = ["uiapi", "platform", "labels"];
14
- function L(n) {
13
+ `, y = `
14
+ query LabelResolutions($namespace: String, $names: [String!]!, $locale: String, $fallback: LabelFallback) {
15
+ uiapi {
16
+ platform {
17
+ labels(namespace: $namespace, names: $names, locale: $locale, fallback: $fallback) {
18
+ name
19
+ value
20
+ resolvedLocale
21
+ wasFallback
22
+ }
23
+ }
24
+ }
25
+ }
26
+ `, S = /* @__PURE__ */ new Set(["TRANSLATION_NOT_FOUND", "LABEL_NOT_FOUND"]), b = ["uiapi", "platform", "labels"];
27
+ function g(n) {
15
28
  const e = n.path;
16
- return e?.length !== f.length + 1 ? !1 : f.every((s, l) => e[l] === s) && typeof e[f.length] == "number";
29
+ return e?.length !== b.length + 1 ? !1 : b.every((o, r) => e[r] === o) && typeof e[b.length] == "number";
17
30
  }
18
- function d(n) {
31
+ function k(n) {
19
32
  const e = n.extensions?.code;
20
- return typeof e == "string" && E.has(e) && L(n);
33
+ return typeof e == "string" && S.has(e) && g(n);
21
34
  }
22
- const h = 100;
23
- function y(n, e) {
24
- const s = [...new Set(n)], l = [];
25
- for (let r = 0; r < s.length; r += e)
26
- l.push(s.slice(r, r + e));
27
- return l;
35
+ const $ = 100;
36
+ function h(n, e) {
37
+ const o = [...new Set(n)], r = [];
38
+ for (let t = 0; t < o.length; t += e)
39
+ r.push(o.slice(t, t + e));
40
+ return r;
28
41
  }
29
- async function A(n, e, s, l, r) {
30
- const t = { names: s, fallback: r };
31
- e != null && (t.namespace = e), l != null && (t.locale = l);
32
- const a = await n.query({
33
- operationName: "Labels",
34
- query: p,
35
- variables: t
36
- }), o = a.errors?.filter((i) => !d(i));
37
- if (o?.length)
38
- throw new Error(`Labels query failed: ${JSON.stringify(o)}`);
39
- const c = a.data?.uiapi?.platform?.labels;
40
- if (c == null)
42
+ async function A(n, e, o, r, t, c, a) {
43
+ const s = { names: o, fallback: t };
44
+ e != null && (s.namespace = e), r != null && (s.locale = r);
45
+ const l = await n.query({
46
+ operationName: a,
47
+ query: c,
48
+ variables: s
49
+ }), i = l.errors?.filter((p) => !k(p));
50
+ if (i?.length)
51
+ throw new Error(`Labels query failed: ${JSON.stringify(i)}`);
52
+ const u = l.data?.uiapi?.platform?.labels;
53
+ if (u == null)
41
54
  throw new Error(
42
- `Labels query failed: ${JSON.stringify(a.errors ?? "no labels in response")}`
55
+ `Labels query failed: ${JSON.stringify(l.errors ?? "no labels in response")}`
43
56
  );
44
- return c;
57
+ return u;
58
+ }
59
+ async function L(n, e, o, r, t, c, a) {
60
+ const s = h(o, $);
61
+ return Promise.all(
62
+ s.map(
63
+ (l) => A(n, e, l, r, t, c, a)
64
+ )
65
+ );
66
+ }
67
+ async function w(n, e, o, r, t) {
68
+ const c = await L(
69
+ n,
70
+ e,
71
+ o,
72
+ r,
73
+ t,
74
+ d,
75
+ "Labels"
76
+ ), a = /* @__PURE__ */ Object.create(null);
77
+ for (const s of c)
78
+ for (const l of s)
79
+ l?.value != null && (a[l.name] = l.value);
80
+ return a;
45
81
  }
46
- async function g(n, e, s, l, r) {
47
- const t = y(s, h), a = await Promise.all(
48
- t.map((c) => A(n, e, c, l, r))
49
- ), o = {};
50
- for (const c of a)
51
- for (const i of c)
52
- i?.value != null && (o[i.name] = i.value);
53
- return o;
82
+ async function _(n, e, o, r, t) {
83
+ const c = await L(
84
+ n,
85
+ e,
86
+ o,
87
+ r,
88
+ t,
89
+ y,
90
+ "LabelResolutions"
91
+ ), a = /* @__PURE__ */ Object.create(null);
92
+ for (const s of c)
93
+ for (const l of s)
94
+ if (l?.value != null) {
95
+ if (l.wasFallback == null)
96
+ throw new Error(`Labels query failed: missing fallback result for ${l.name}`);
97
+ a[l.name] = {
98
+ value: l.value,
99
+ resolvedLocale: l.resolvedLocale,
100
+ wasFallback: l.wasFallback
101
+ };
102
+ }
103
+ return a;
54
104
  }
55
- function u(n) {
105
+ function f(n) {
56
106
  const e = n?.trim();
57
107
  return e || void 0;
58
108
  }
59
- function _(n = {}) {
109
+ function m(n, e) {
110
+ return {
111
+ namespace: f(n?.namespace) ?? f(e.namespace),
112
+ locale: f(n?.locale) ?? f(e.locale),
113
+ fallback: n?.fallback ?? e.fallback ?? E
114
+ };
115
+ }
116
+ function O(n = {}) {
60
117
  const e = { ...n };
61
- return b({
118
+ return v({
62
119
  name: "labels",
63
120
  minApiVersion: "64.0",
64
- setup: (s) => {
65
- const l = s.graphql;
66
- if (!l)
121
+ setup: (o) => {
122
+ const r = o.graphql;
123
+ if (!r)
67
124
  return {};
68
- const r = async (t, a) => {
69
- const o = u(a?.namespace) ?? u(e.namespace), c = u(a?.locale) ?? u(e.locale), i = a?.fallback ?? e.fallback ?? m;
70
- return g(l, o, t, c, i);
125
+ const t = async (a, s) => {
126
+ const { namespace: l, locale: i, fallback: u } = m(s, e);
127
+ return w(r, l, a, i, u);
128
+ }, c = async (a, s) => {
129
+ const { namespace: l, locale: i, fallback: u } = m(s, e);
130
+ return _(r, l, a, i, u);
71
131
  };
72
132
  return {
73
- async get(t, a) {
74
- return (await r([t], a))[t];
133
+ async get(a, s) {
134
+ return (await t([a], s))[a];
135
+ },
136
+ async getAll(a, s) {
137
+ return t(a, s);
138
+ },
139
+ async resolve(a, s) {
140
+ return (await c([a], s))[a];
75
141
  },
76
- async getAll(t, a) {
77
- return r(t, a);
142
+ async resolveAll(a, s) {
143
+ return c(a, s);
78
144
  }
79
145
  };
80
146
  }
81
147
  });
82
148
  }
83
149
  export {
84
- _ as labels
150
+ O as labels
85
151
  };
@@ -1,5 +1,5 @@
1
- import { LabelFallback } from './query';
2
- export type { LabelFallback };
1
+ import { LabelFallback, LabelResolution } from './query';
2
+ export type { LabelFallback, LabelResolution } from './query';
3
3
  /**
4
4
  * Where labels are read from and how they resolve. Supplied once when the
5
5
  * extension is configured (`labels({ namespace: "MyApp" })`) to set defaults,
@@ -31,15 +31,14 @@ export interface LabelsOptions {
31
31
  }
32
32
  /**
33
33
  * The `labels` namespace mounted in the DataSDK's `ext` container — `sdk.ext.labels`.
34
- * Both methods resolve labels in a namespace (configured or per-call) and report
35
- * an unresolved label as a miss — `undefined` from {@link get}, an absent key
36
- * from {@link getAll}. The caller decides what a miss means; fall back to the
37
- * name with `await sdk.ext.labels.get?.(name) ?? name`.
34
+ * Its methods read labels with configured or per-call options. A missing label
35
+ * returns `undefined` from {@link get}/{@link resolve}. It has no key in the
36
+ * maps from {@link getAll}/{@link resolveAll}.
38
37
  *
39
38
  * The methods are optional, mirroring the {@link DataSDK.graphql} namespace they
40
39
  * depend on: a surface whose DataSDK has no `graphql` cannot fetch labels, so
41
- * `get`/`getAll` are absent there. Feature-detect (`sdk.ext.labels.get?.(name)`) or
42
- * narrow once, exactly as you would `sdk.graphql`.
40
+ * `get`, `getAll`, `resolve`, and `resolveAll` are absent there. Use optional
41
+ * chaining or check that the method exists first.
43
42
  */
44
43
  export interface LabelsApi {
45
44
  /**
@@ -68,12 +67,26 @@ export interface LabelsApi {
68
67
  * @param options - Per-call overrides of the configured {@link LabelsOptions}.
69
68
  */
70
69
  getAll?(names: readonly string[], options?: LabelsOptions): Promise<Record<string, string>>;
70
+ /**
71
+ * Read one label with its server locale and fallback result. Returns `undefined`
72
+ * for a missing label. `resolvedLocale` is `null` when the server has no locale
73
+ * for the base label. Absent when the DataSDK has no GraphQL.
74
+ */
75
+ resolve?(name: string, options?: LabelsOptions): Promise<LabelResolution | undefined>;
76
+ /**
77
+ * Read many labels with their server locale and fallback results. The map has
78
+ * only resolved names. Names are deduped and batches of 100 run in parallel, so
79
+ * large inputs can start many requests at once. `resolvedLocale` can be `null`.
80
+ * Absent when the DataSDK has no GraphQL.
81
+ */
82
+ resolveAll?(names: readonly string[], options?: LabelsOptions): Promise<Record<string, LabelResolution>>;
71
83
  }
72
84
  /**
73
85
  * A first-party DataSDK extension that mounts a `labels` namespace for reading
74
86
  * custom labels. Attach it via `createDataSDK({ extensions: [labels()] })`,
75
- * then call `sdk.ext.labels.get?.(name)` / `sdk.ext.labels.getAll?.(names)` — the
76
- * methods are optional, absent on a surface whose DataSDK has no `graphql`.
87
+ * then call `sdk.ext.labels.get?.(name)` / `sdk.ext.labels.getAll?.(names)` for
88
+ * values, or `resolve` / `resolveAll` for resolution data. The methods are
89
+ * optional and are absent when the DataSDK has no `graphql`.
77
90
  *
78
91
  * Requires Salesforce API v64.0 or later (release 264 introduced the
79
92
  * `uiapi.platform.labels` GraphQL shape this extension queries).
@@ -91,6 +104,8 @@ export interface LabelsApi {
91
104
  * const greeting = (await sdk.ext.labels.get?.("greeting")) ?? "greeting"; // uses "MyApp"; ?? name if you want the key
92
105
  * const french = await sdk.ext.labels.get?.("greeting", { locale: "fr" }); // string | undefined
93
106
  * const many = await sdk.ext.labels.getAll?.(["greeting", "farewell"]); // only resolved names
107
+ * const resolved = await sdk.ext.labels.resolve?.("greeting", { locale: "fr" });
108
+ * // { value: "Bonjour", resolvedLocale: "fr", wasFallback: false } | undefined
94
109
  * ```
95
110
  */
96
111
  export declare function labels(config?: LabelsOptions): import('../../index').DataSDKExtension<"labels", LabelsApi>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/data/extensions/labels/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAA0B,KAAK,aAAa,EAAiB,MAAM,SAAS,CAAC;AAGpF,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC7B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACzB;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACzE;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,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AAC,CAAC,CAAC;CAC5C;AAyBD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,MAAM,CAAC,MAAM,GAAE,aAAkB,+DAkEhD"}
@@ -15,6 +15,19 @@ export type LabelFallback = "BASE_VALUE" | "USER_DEFAULT" | "NONE";
15
15
  * opts into `BASE_VALUE`.
16
16
  */
17
17
  export declare const DEFAULT_LABEL_FALLBACK: LabelFallback;
18
+ /**
19
+ * A resolved label value and its server resolution data. Unknown labels and
20
+ * labels without a translation under `fallback: "NONE"` are not returned.
21
+ */
22
+ export interface LabelResolution {
23
+ value: string;
24
+ /**
25
+ * The locale that supplied `value`, or `null` when the server has no locale
26
+ * for the base label.
27
+ */
28
+ resolvedLocale: string | null;
29
+ wasFallback: boolean;
30
+ }
18
31
  /** The DataSDK `graphql` namespace with its optionality removed. */
19
32
  type GraphQL = NonNullable<DataSDK["graphql"]>;
20
33
  /**
@@ -38,5 +51,12 @@ type GraphQL = NonNullable<DataSDK["graphql"]>;
38
51
  * logged-in user's locale (the GraphQL `locale` arg is nullable).
39
52
  */
40
53
  export declare function resolveLabels(graphql: GraphQL, namespace: string | undefined, names: readonly string[], locale: string | undefined, fallback: LabelFallback): Promise<Record<string, string>>;
54
+ /**
55
+ * Resolve names to values, locales, and fallback results.
56
+ *
57
+ * Dedupes names and runs batches of at most 100 queries in parallel. One failed
58
+ * batch rejects the whole load; a missing name is absent from the returned map.
59
+ */
60
+ export declare function resolveLabelResolutions(graphql: GraphQL, namespace: string | undefined, names: readonly string[], locale: string | undefined, fallback: LabelFallback): Promise<Record<string, LabelResolution>>;
41
61
  export {};
42
62
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../src/data/extensions/labels/query.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,eAAe,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,MA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1B,QAAQ,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA4BjC;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,QAAQ,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CA2B1C"}
@@ -1,33 +1,33 @@
1
- import { g as K, S as b } from "../surface-Dd2tqrPi.js";
2
- import { w as z } from "../sdk-promise-D0sy7OW1.js";
3
- import { buildServiceDescriptor as V, setHeader as y } from "@conduit-client/service-fetch-network/v1";
4
- import { resolvedPromiseLike as l, ok as x, err as O, stableJSONStringify as J, DataNotFoundError as W, UserVisibleError as B, deepFreeze as w, isUserVisibleError as X } from "@conduit-client/utils";
5
- import { print as $, parse as Y } from "@conduit-client/onestore-graphql-parser/v1";
6
- import { RetryPolicy as Z, buildServiceDescriptor as ee } from "@conduit-client/service-retry/v1";
7
- import { buildServiceDescriptor as te } from "@conduit-client/service-cache/v1";
8
- import { buildServiceDescriptor as re } from "@conduit-client/service-cache-control/v1";
9
- import { buildInMemoryCacheInclusionPolicyService as ne } from "@conduit-client/service-cache-inclusion-policy/v1";
10
- import { buildServiceDescriptor as se } from "@conduit-client/service-pubsub/v1";
11
- import { HttpCacheControlCommand as ae } from "@conduit-client/command-http-cache-control/v1";
12
- const g = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
13
- function oe(t, e) {
14
- const [, r, n] = g.exec(t), [, a, s] = g.exec(e);
1
+ import { g as z, S as b } from "../surface-Dd2tqrPi.js";
2
+ import { w as J } from "../sdk-promise-D0sy7OW1.js";
3
+ import { buildServiceDescriptor as L, setHeader as y } from "@conduit-client/service-fetch-network/v1";
4
+ import { resolvedPromiseLike as l, ok as O, err as x, stableJSONStringify as W, DataNotFoundError as B, UserVisibleError as X, deepFreeze as g, isUserVisibleError as Y } from "@conduit-client/utils";
5
+ import { print as N, parse as Z } from "@conduit-client/onestore-graphql-parser/v1";
6
+ import { RetryPolicy as ee, buildServiceDescriptor as te } from "@conduit-client/service-retry/v1";
7
+ import { buildServiceDescriptor as re } from "@conduit-client/service-cache/v1";
8
+ import { buildServiceDescriptor as ne } from "@conduit-client/service-cache-control/v1";
9
+ import { buildInMemoryCacheInclusionPolicyService as se } from "@conduit-client/service-cache-inclusion-policy/v1";
10
+ import { buildServiceDescriptor as ae } from "@conduit-client/service-pubsub/v1";
11
+ import { HttpCacheControlCommand as oe } from "@conduit-client/command-http-cache-control/v1";
12
+ const w = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
13
+ function ie(t, e) {
14
+ const [, r, n] = w.exec(t), [, a, s] = w.exec(e);
15
15
  return Number(r) - Number(a) || Number(n) - Number(s);
16
16
  }
17
- function ie(t, e) {
17
+ function ce(t, e) {
18
18
  for (const r of t) {
19
19
  const n = r.extension, { label: a } = r, s = n.minApiVersion;
20
20
  if (s !== void 0) {
21
- if (typeof s != "string" || !g.test(s))
21
+ if (typeof s != "string" || !w.test(s))
22
22
  throw new TypeError(
23
23
  `Extension ${a} declares invalid minApiVersion ${JSON.stringify(s)}; expected a Salesforce API version such as "64.0".`
24
24
  );
25
25
  if (e.apiVersion !== void 0) {
26
- if (!g.test(e.apiVersion))
26
+ if (!w.test(e.apiVersion))
27
27
  throw new Error(
28
28
  `Extension ${a} requires Salesforce API version ${s} or later, but the Data SDK exposes invalid apiVersion ${JSON.stringify(e.apiVersion)}.`
29
29
  );
30
- if (oe(e.apiVersion, s) < 0)
30
+ if (ie(e.apiVersion, s) < 0)
31
31
  throw new Error(
32
32
  `Extension ${a} requires Salesforce API version ${s} or later, but the Data SDK uses version ${e.apiVersion}.`
33
33
  );
@@ -35,14 +35,14 @@ function ie(t, e) {
35
35
  }
36
36
  }
37
37
  }
38
- const ce = "X-Salesforce-First-Party";
39
- function ue(t, e) {
38
+ const ue = "X-Salesforce-First-Party";
39
+ function he(t, e) {
40
40
  if (!t) return !1;
41
41
  const r = e.toLowerCase();
42
42
  return t instanceof Headers ? t.has(e) : Array.isArray(t) ? t.some(([n]) => n.toLowerCase() === r) : Object.keys(t).some((n) => n.toLowerCase() === r);
43
43
  }
44
- function he(t, e, r) {
45
- return !e || !r ? !1 : ue(t?.headers, ce);
44
+ function V(t, e, r) {
45
+ return !e || !r ? !1 : he(t?.headers, ue);
46
46
  }
47
47
  function S(t, e, r) {
48
48
  return e ? r ? y("Cookie", `sid=${e}`, t) : y("Authorization", `Bearer ${e}`, t) : t;
@@ -57,7 +57,7 @@ function le({
57
57
  const [s, o] = a;
58
58
  if (typeof s == "string" && !s.startsWith("http") && t) {
59
59
  const i = s.startsWith("/") ? s : `/${s}`;
60
- return he(o, n, r) ? l(
60
+ return V(o, n, r) ? l(
61
61
  S([`${r}${i}`, o], e, !0)
62
62
  ) : l(S([`${t}${i}`, o], e, !1));
63
63
  }
@@ -66,7 +66,7 @@ function le({
66
66
  }
67
67
  function de(t) {
68
68
  const e = t.baseUrl || t.accessToken ? [le(t)] : [];
69
- return V({ request: e }).service;
69
+ return L({ request: e }).service;
70
70
  }
71
71
  const pe = {
72
72
  "Content-Type": "application/json",
@@ -80,7 +80,7 @@ function fe(t) {
80
80
  }
81
81
  return Array.isArray(t) ? t.map(([e, r]) => [e, r]) : Object.entries(t);
82
82
  }
83
- function I(t, e) {
83
+ function H(t, e) {
84
84
  if (e === void 0) return { ...t };
85
85
  const r = { ...t }, n = /* @__PURE__ */ new Map();
86
86
  for (const s of Object.keys(r)) n.set(s.toLowerCase(), s);
@@ -91,8 +91,8 @@ function I(t, e) {
91
91
  }
92
92
  return r;
93
93
  }
94
- function H(t) {
95
- return I(pe, t);
94
+ function U(t) {
95
+ return H(pe, t);
96
96
  }
97
97
  function me(t) {
98
98
  if (t === void 0) return;
@@ -134,13 +134,13 @@ async function G(t, e, r) {
134
134
  return a;
135
135
  }
136
136
  const v = () => {
137
- }, N = async () => {
137
+ }, $ = async () => {
138
138
  };
139
139
  function A(t) {
140
140
  try {
141
- return x(Y(t));
141
+ return O(Z(t));
142
142
  } catch (e) {
143
- return O(m(e));
143
+ return x(m(e));
144
144
  }
145
145
  }
146
146
  function P(t, e) {
@@ -171,12 +171,15 @@ async function F(t, { mutation: e, variables: r, operationName: n, headers: a })
171
171
  ]
172
172
  };
173
173
  try {
174
- const c = await t({
175
- query: $(o),
176
- variables: r,
177
- operationName: n,
178
- headers: a
179
- });
174
+ const c = await t(
175
+ {
176
+ query: N(o),
177
+ variables: r,
178
+ operationName: n,
179
+ headers: a
180
+ },
181
+ "mutation"
182
+ );
180
183
  return {
181
184
  data: c.data ?? void 0,
182
185
  errors: c.errors
@@ -185,14 +188,17 @@ async function F(t, { mutation: e, variables: r, operationName: n, headers: a })
185
188
  return { data: void 0, errors: m(c) };
186
189
  }
187
190
  }
188
- function U(t) {
191
+ function Q(t) {
189
192
  function e(n, a, s, o) {
190
- return t({
191
- query: $(n),
192
- variables: a,
193
- operationName: s,
194
- headers: o
195
- }).then(
193
+ return t(
194
+ {
195
+ query: N(n),
196
+ variables: a,
197
+ operationName: s,
198
+ headers: o
199
+ },
200
+ "query"
201
+ ).then(
196
202
  (i) => ({
197
203
  data: i.data ?? void 0,
198
204
  errors: i.errors
@@ -212,7 +218,7 @@ function U(t) {
212
218
  data: void 0,
213
219
  errors: i.error,
214
220
  subscribe: () => v,
215
- refresh: N
221
+ refresh: $
216
222
  };
217
223
  const c = i.value, h = P(c, s);
218
224
  if (h !== "query")
@@ -224,20 +230,20 @@ function U(t) {
224
230
  }
225
231
  ],
226
232
  subscribe: () => v,
227
- refresh: N
233
+ refresh: $
228
234
  };
229
- const u = /* @__PURE__ */ new Set(), p = a, f = await e(c, p, s, o);
235
+ const u = /* @__PURE__ */ new Set(), d = a, p = await e(c, d, s, o);
230
236
  return {
231
- data: f.data,
232
- errors: f.errors,
233
- subscribe(d) {
234
- return u.add(d), () => {
235
- u.delete(d);
237
+ data: p.data,
238
+ errors: p.errors,
239
+ subscribe(f) {
240
+ return u.add(f), () => {
241
+ u.delete(f);
236
242
  };
237
243
  },
238
244
  async refresh() {
239
- const d = await e(c, p, s, o);
240
- for (const E of u) E(d);
245
+ const f = await e(c, d, s, o);
246
+ for (const E of u) E(f);
241
247
  }
242
248
  };
243
249
  }
@@ -250,38 +256,54 @@ const q = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
250
256
  function j(t = q) {
251
257
  return `/services/data/v${t}`;
252
258
  }
253
- const we = {
259
+ const ge = {
254
260
  "Content-Type": "application/json",
255
261
  Accept: "application/json"
256
262
  };
257
- class ge {
263
+ class we {
258
264
  clientFetch;
259
265
  pathData;
266
+ baseUrl;
267
+ lightningDomain;
268
+ isInternal;
260
269
  apiVersion;
261
270
  graphql;
262
271
  constructor(e) {
263
- const r = ve(), n = k(e?.instanceUrl ?? r.instanceUrl), a = e?.accessToken ?? r.accessToken, s = k(
272
+ const r = ve(), n = T(e?.instanceUrl ?? r.instanceUrl), a = e?.accessToken ?? r.accessToken, s = T(
264
273
  e?.lightningDomain ?? r.lightningDomain
265
274
  ), o = e?.isInternal ?? r.isInternal ?? !1;
266
- this.apiVersion = e?.apiVersion ?? r.apiVersion ?? q, this.pathData = j(this.apiVersion), this.clientFetch = de({
275
+ this.apiVersion = e?.apiVersion ?? r.apiVersion ?? q, this.pathData = j(this.apiVersion), this.baseUrl = n || void 0, this.lightningDomain = s || void 0, this.isInternal = o, this.clientFetch = de({
267
276
  baseUrl: n || void 0,
268
277
  accessToken: a,
269
- lightningDomain: s || void 0,
278
+ lightningDomain: this.lightningDomain,
270
279
  isInternal: o
271
- }), this.graphql = U(this.executeRawGraphQL.bind(this));
280
+ }), this.graphql = Q(this.executeRawGraphQL.bind(this));
272
281
  }
273
- async executeRawGraphQL({
274
- query: e,
275
- variables: r,
276
- operationName: n,
277
- headers: a
278
- }) {
279
- const s = `${this.pathData}/graphql`, o = await this.clientFetch(s, {
280
- method: "POST",
281
- body: JSON.stringify({ query: e, variables: r, operationName: n }),
282
- headers: I(we, a)
283
- });
284
- return G(o, "Mosaic", s);
282
+ async executeRawGraphQL({ query: e, variables: r, operationName: n, headers: a }, s) {
283
+ const o = `${this.pathData}/graphql`, i = H(ge, a), c = V({ headers: i }, this.isInternal, this.lightningDomain) && !!this.baseUrl;
284
+ if (c && s === "mutation")
285
+ return {
286
+ data: void 0,
287
+ errors: [
288
+ {
289
+ message: "GraphQL mutations are not supported on the lightning domain for the Mosaic surface."
290
+ }
291
+ ]
292
+ };
293
+ const { resource: h, init: u } = c ? {
294
+ resource: `${o}?queryInput=${encodeURIComponent(
295
+ JSON.stringify({ query: e, variables: r, operationName: n })
296
+ )}`,
297
+ init: { method: "GET", headers: i }
298
+ } : {
299
+ resource: o,
300
+ init: {
301
+ method: "POST",
302
+ body: JSON.stringify({ query: e, variables: r, operationName: n }),
303
+ headers: i
304
+ }
305
+ }, d = await this.clientFetch(h, u), p = c ? `${o}?queryInput=<redacted>` : h;
306
+ return G(d, "Mosaic", p);
285
307
  }
286
308
  }
287
309
  function ve() {
@@ -294,7 +316,7 @@ function ve() {
294
316
  isInternal: t?.isInternal
295
317
  };
296
318
  }
297
- function k(t) {
319
+ function T(t) {
298
320
  if (!t || t === "/") return "";
299
321
  let e = t;
300
322
  return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
@@ -303,7 +325,7 @@ const Ee = "graphqlQuery";
303
325
  class Se {
304
326
  graphql;
305
327
  constructor() {
306
- this.graphql = U(this.executeRawGraphQL.bind(this));
328
+ this.graphql = Q(this.executeRawGraphQL.bind(this));
307
329
  }
308
330
  /**
309
331
  * The `headers` request option is intentionally not forwarded: this surface
@@ -328,15 +350,15 @@ const C = "Accept-Language", Ce = (t) => {
328
350
  return l(t);
329
351
  const [r, n] = t;
330
352
  return (r instanceof Request && !n?.headers ? r.headers.has(C) : new Headers(n?.headers).has(C)) ? l(t) : l(y(C, e, t));
331
- }, De = "X-SFDC-Client-Name", xe = "X-SFDC-Client-Version", Oe = "@salesforce/platform-sdk", Ne = "12.7.0", $e = (t) => {
332
- let e = y(De, Oe, t);
333
- return e = y(xe, Ne, e), l(e);
353
+ }, De = "X-SFDC-Client-Name", Oe = "X-SFDC-Client-Version", xe = "@salesforce/platform-sdk", $e = "12.8.0", Ne = (t) => {
354
+ let e = y(De, xe, t);
355
+ return e = y(Oe, $e, e), l(e);
334
356
  }, Ae = "X-CSRF-Token";
335
357
  function Pe(t, e = {}) {
336
358
  const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
337
359
  return async (a) => {
338
360
  const [s, o] = a, i = s instanceof Request ? s.url : s instanceof URL ? s.href : s, c = o?.method ?? (s instanceof Request ? s.method : void 0) ?? "GET";
339
- if (T(n, i) || qe(c) && T(r, i)) {
361
+ if (k(n, i) || qe(c) && k(r, i)) {
340
362
  const u = await t.getToken();
341
363
  a = y(Ae, u, a);
342
364
  }
@@ -347,7 +369,7 @@ function qe(t) {
347
369
  const e = t.toLowerCase();
348
370
  return e === "post" || e === "put" || e === "patch" || e === "delete";
349
371
  }
350
- function T(t, e) {
372
+ function k(t, e) {
351
373
  const r = new URL(e, globalThis.location?.href ?? "http://localhost");
352
374
  return t.some((n) => r.pathname.includes(n));
353
375
  }
@@ -359,8 +381,8 @@ function _e(t, e = {}) {
359
381
  }
360
382
  return (a, s) => s ? s.applyRetry(async () => n(a)) : n(a);
361
383
  }
362
- const ke = [400, 401, 403];
363
- class Te extends Z {
384
+ const Te = [400, 401, 403];
385
+ class ke extends ee {
364
386
  constructor(e) {
365
387
  super(e), this.csrfTokenManager = e;
366
388
  }
@@ -369,7 +391,7 @@ class Te extends Z {
369
391
  * Determines if a failed request should be retried due to CSRF token issues.
370
392
  */
371
393
  async shouldRetry(e, r) {
372
- return r.attempt >= 1 ? !1 : ke.includes(e.status);
394
+ return r.attempt >= 1 ? !1 : Te.includes(e.status);
373
395
  }
374
396
  /**
375
397
  * CSRF token refresh should happen immediately with no delay.
@@ -438,28 +460,28 @@ class Re {
438
460
  }
439
461
  }
440
462
  const R = /* @__PURE__ */ new Map();
441
- function Me(t) {
463
+ function Ie(t) {
442
464
  const { endpoint: e, cacheName: r, ...n } = t.csrf;
443
465
  let a = R.get(e);
444
- return a || (a = new Re(e, r), R.set(e, a)), V(
466
+ return a || (a = new Re(e, r), R.set(e, a)), L(
445
467
  {
446
468
  retry: _e(a, n),
447
- request: [$e, Ce]
469
+ request: [Ne, Ce]
448
470
  },
449
- ee(new Te(a)).service
471
+ te(new ke(a)).service
450
472
  ).service;
451
473
  }
452
- const M = /* @__PURE__ */ new Map();
453
- function Le(t) {
454
- let e = M.get(t);
474
+ const I = /* @__PURE__ */ new Map();
475
+ function Me(t) {
476
+ let e = I.get(t);
455
477
  if (!e) {
456
- const r = te().service, n = ne(r).service, a = re(r, n).service, s = se().service;
457
- e = { cache: r, cacheController: a, pubSub: s }, M.set(t, e);
478
+ const r = re().service, n = se(r).service, a = ne(r, n).service, s = ae().service;
479
+ e = { cache: r, cacheController: a, pubSub: s }, I.set(t, e);
458
480
  }
459
481
  return e;
460
482
  }
461
- function Ve(t, e) {
462
- const r = Le(t);
483
+ function Le(t, e) {
484
+ const r = Me(t);
463
485
  return {
464
486
  shared: r,
465
487
  services: {
@@ -469,8 +491,8 @@ function Ve(t, e) {
469
491
  }
470
492
  };
471
493
  }
472
- const L = 300;
473
- function Ie(t, e) {
494
+ const M = 300;
495
+ function Ve(t, e) {
474
496
  try {
475
497
  return JSON.parse(JSON.stringify(t));
476
498
  } catch (r) {
@@ -483,13 +505,13 @@ function Ie(t, e) {
483
505
  function He(t) {
484
506
  if (typeof t == "object" && t.type === "max-age") {
485
507
  const e = t.maxAge;
486
- return Number.isFinite(e) && e >= 0 ? e : L;
508
+ return Number.isFinite(e) && e >= 0 ? e : M;
487
509
  }
488
- return L;
510
+ return M;
489
511
  }
490
- class Ge extends ae {
512
+ class Ue extends oe {
491
513
  constructor(e, r, n) {
492
- super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = Ie(
514
+ super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = Ve(
493
515
  e.variables ?? {},
494
516
  this.normalizedOperationName
495
517
  ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = He(e.cacheControl), this.headers = e.headers, this.headersKey = me(e.headers);
@@ -507,7 +529,7 @@ class Ge extends ae {
507
529
  this.url,
508
530
  {
509
531
  method: "POST",
510
- headers: H(this.headers),
532
+ headers: U(this.headers),
511
533
  body: JSON.stringify({
512
534
  query: this.query,
513
535
  variables: this.normalizedVariables,
@@ -522,7 +544,7 @@ class Ge extends ae {
522
544
  variables: this.normalizedVariables,
523
545
  operationName: this.normalizedOperationName
524
546
  };
525
- return this.headersKey !== void 0 && (e.headers = this.headersKey), J(e);
547
+ return this.headersKey !== void 0 && (e.headers = this.headersKey), W(e);
526
548
  }
527
549
  /**
528
550
  * Reads from the cache and returns the cache result or error
@@ -540,8 +562,8 @@ class Ge extends ae {
540
562
  readFromCache(e) {
541
563
  const r = this.buildKey(), n = e.get(r)?.value;
542
564
  return n === void 0 ? l(
543
- O(new W("No cached entry found for this query."))
544
- ) : l(x(n));
565
+ x(new B("No cached entry found for this query."))
566
+ ) : l(O(n));
545
567
  }
546
568
  writeToCache(e, r) {
547
569
  if (r.isOk() && r.value.data != null && Object.keys(r.value.data).length > 0) {
@@ -571,41 +593,41 @@ class Ge extends ae {
571
593
  return e.errors && e.errors.length > 0;
572
594
  }
573
595
  processFetchReturnValue(e) {
574
- return this.responseHasErrors(e) ? O(new B(e)) : x(e);
596
+ return this.responseHasErrors(e) ? x(new X(e)) : O(e);
575
597
  }
576
598
  }
577
- const Fe = "CACHE_MISS";
578
- function Ue() {
599
+ const Ge = "CACHE_MISS";
600
+ function Fe() {
579
601
  return [
580
602
  {
581
603
  message: "No cached entry found for this query (cacheControl: 'only-if-cached').",
582
- extensions: { code: Fe }
604
+ extensions: { code: Ge }
583
605
  }
584
606
  ];
585
607
  }
586
- function Q(t) {
587
- if (X(t) && t.data && typeof t.data == "object") {
608
+ function K(t) {
609
+ if (Y(t) && t.data && typeof t.data == "object") {
588
610
  const e = t.data;
589
611
  if (e.data != null)
590
612
  return e.data;
591
613
  }
592
614
  }
593
- function je(t) {
615
+ function Qe(t) {
594
616
  return (e) => {
595
617
  if (e.isOk()) {
596
618
  const r = e.value;
597
- w(r), t({ data: r, errors: void 0 });
619
+ g(r), t({ data: r, errors: void 0 });
598
620
  } else {
599
- const r = Q(e.error);
600
- r && w(r), t({ data: r, errors: m(e.error) });
621
+ const r = K(e.error);
622
+ r && g(r), t({ data: r, errors: m(e.error) });
601
623
  }
602
624
  };
603
625
  }
604
- async function Qe(t, e = !1) {
626
+ async function je(t, e = !1) {
605
627
  let r, n, a;
606
628
  try {
607
629
  const s = await t.execute();
608
- s.isOk() ? (r = s.value.data, w(r), a = (o) => s.value.subscribe(o)) : (r = Q(s.error.failure), r && w(r), n = e && r === void 0 ? Ue() : m(s.error.failure), a = (o) => s.error.subscribe(o));
630
+ s.isOk() ? (r = s.value.data, g(r), a = (o) => s.value.subscribe(o)) : (r = K(s.error.failure), r && g(r), n = e && r === void 0 ? Fe() : m(s.error.failure), a = (o) => s.error.subscribe(o));
609
631
  } catch (s) {
610
632
  n = m(s);
611
633
  }
@@ -613,7 +635,7 @@ async function Qe(t, e = !1) {
613
635
  data: r,
614
636
  errors: n,
615
637
  subscribe(s) {
616
- return a ? a(je(s)) : v;
638
+ return a ? a(Qe(s)) : v;
617
639
  },
618
640
  async refresh() {
619
641
  await t.refresh();
@@ -625,7 +647,7 @@ function D(t) {
625
647
  data: void 0,
626
648
  errors: t,
627
649
  subscribe: () => v,
628
- refresh: N
650
+ refresh: $
629
651
  };
630
652
  }
631
653
  function Ke({
@@ -643,18 +665,18 @@ function Ke({
643
665
  }) {
644
666
  const u = A(s);
645
667
  if (u.isErr()) return D(u.error);
646
- const p = u.value, f = P(p, i);
647
- if (f !== "query")
668
+ const d = u.value, p = P(d, i);
669
+ if (p !== "query")
648
670
  return D([
649
671
  {
650
- message: `DataSDK.graphql.query() requires a GraphQL query, received ${f}.`
672
+ message: `DataSDK.graphql.query() requires a GraphQL query, received ${p}.`
651
673
  }
652
674
  ]);
653
- let d;
675
+ let f;
654
676
  try {
655
- d = new Ge(
677
+ f = new Ue(
656
678
  {
657
- query: $(p),
679
+ query: N(d),
658
680
  variables: o,
659
681
  operationName: i,
660
682
  cacheControl: c,
@@ -666,7 +688,7 @@ function Ke({
666
688
  } catch (E) {
667
689
  return D(m(E));
668
690
  }
669
- return Qe(d, c === "only-if-cached");
691
+ return je(f, c === "only-if-cached");
670
692
  }
671
693
  return {
672
694
  query: a,
@@ -685,7 +707,7 @@ class We {
685
707
  const r = Be();
686
708
  this.baseUrl = Xe(e?.basePath ?? r.apiPath), this.apiVersion = e?.apiVersion ?? q, this.pathData = j(this.apiVersion);
687
709
  const n = `${this.pathData}/ui-api`, a = `${this.pathData}/graphql`;
688
- this.onStatus = e?.onStatus ?? {}, this.clientFetch = Me({
710
+ this.onStatus = e?.onStatus ?? {}, this.clientFetch = Ie({
689
711
  csrf: {
690
712
  endpoint: `${this.baseUrl}${n}/session/csrf`,
691
713
  cacheName: Je,
@@ -693,7 +715,7 @@ class We {
693
715
  alwaysProtectedUrls: ["services/apexrest"]
694
716
  }
695
717
  });
696
- const s = (i, c) => this.fetch(i, c), o = Ve(`${this.baseUrl}${this.pathData}`, s);
718
+ const s = (i, c) => this.fetch(i, c), o = Le(`${this.baseUrl}${this.pathData}`, s);
697
719
  this.graphql = Ke({
698
720
  bundle: o,
699
721
  url: a,
@@ -719,7 +741,7 @@ class We {
719
741
  const s = `${this.pathData}/graphql`, o = await this.fetch(s, {
720
742
  method: "POST",
721
743
  body: JSON.stringify({ query: e, variables: r, operationName: n }),
722
- headers: H(a)
744
+ headers: U(a)
723
745
  });
724
746
  return G(o, "WebApp", s);
725
747
  }
@@ -801,19 +823,19 @@ async function Ze(t, e, r) {
801
823
  writable: !1,
802
824
  configurable: !1
803
825
  });
804
- for (const { extension: h, mountName: u, label: p } of n) {
826
+ for (const { extension: h, mountName: u, label: d } of n) {
805
827
  if (Object.hasOwn(s, u))
806
828
  throw new Error(
807
- `Extension ${p} cannot attach: "${u}" is already defined by another extension.`
829
+ `Extension ${d} cannot attach: "${u}" is already defined by another extension.`
808
830
  );
809
- let f;
831
+ let p;
810
832
  try {
811
- f = await h.setup(a);
812
- } catch (d) {
813
- throw new Error(`Extension ${p} failed during setup.`, { cause: d });
833
+ p = await h.setup(a);
834
+ } catch (f) {
835
+ throw new Error(`Extension ${d} failed during setup.`, { cause: f });
814
836
  }
815
837
  Object.defineProperty(s, u, {
816
- value: f,
838
+ value: p,
817
839
  enumerable: !0,
818
840
  writable: !1,
819
841
  configurable: !1
@@ -832,14 +854,14 @@ function pt(t) {
832
854
  }
833
855
  async function et(t) {
834
856
  try {
835
- switch (await K(t?.surface)) {
857
+ switch (await z(t?.surface)) {
836
858
  case b.OpenAI:
837
859
  return new Se();
838
860
  case b.WebApp:
839
861
  case b.MicroFrontend:
840
862
  return new We(t?.webapp);
841
863
  case b.Mosaic:
842
- return new ge(t?.mosaic);
864
+ return new we(t?.mosaic);
843
865
  case b.MCPApps:
844
866
  return {};
845
867
  default:
@@ -850,11 +872,11 @@ async function et(t) {
850
872
  }
851
873
  }
852
874
  function ft(t) {
853
- return z(
875
+ return J(
854
876
  (async () => {
855
877
  const e = await et(t);
856
878
  return Ze(e, t?.extensions ?? [], {
857
- preflight: ie
879
+ preflight: ce
858
880
  });
859
881
  })(),
860
882
  "createDataSDK"
@@ -1,4 +1,11 @@
1
1
  import { FetchService, RequestInterceptor } from '@conduit-client/service-fetch-network/v1';
2
+ /**
3
+ * Decides whether a request should pivot to the lightning domain: only when the
4
+ * widget is trusted (`isInternal`), a `lightningDomain` is configured, and
5
+ * the request carries the first-party header. When true, `lightningDomain` is
6
+ * narrowed to `string` at the call site.
7
+ */
8
+ export declare function shouldPivotToLightning(init: RequestInit | undefined, isInternal: boolean, lightningDomain: string | undefined): lightningDomain is string;
2
9
  /** Configuration for the Mosaic fetch transport. */
3
10
  interface MosaicFetchConfig {
4
11
  /** My-domain base URL for resolving relative paths (e.g., "https://myorg.salesforce.com"). */
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/data/mosaic/fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIN,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AA0ClD,oDAAoD;AACpD,UAAU,iBAAiB;IAC1B,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4FAA4F;IAC5F,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,EACvC,OAAO,EACP,WAAW,EACX,eAAe,EACf,UAAkB,GAClB,EAAE,iBAAiB,GAAG,kBAAkB,CAkBxC;AAED,8EAA8E;AAC9E,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,GAAG,YAAY,CAKhF"}
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/data/mosaic/fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIN,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAelD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,UAAU,EAAE,OAAO,EACnB,eAAe,EAAE,MAAM,GAAG,SAAS,GACjC,eAAe,IAAI,MAAM,CAG3B;AAcD,oDAAoD;AACpD,UAAU,iBAAiB;IAC1B,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4FAA4F;IAC5F,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,EACvC,OAAO,EACP,WAAW,EACX,eAAe,EACf,UAAkB,GAClB,EAAE,iBAAiB,GAAG,kBAAkB,CAkBxC;AAED,8EAA8E;AAC9E,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,GAAG,YAAY,CAKhF"}
@@ -42,6 +42,9 @@ export interface MosaicDataSDKOptions {
42
42
  export declare class MosaicDataSDK implements DataSDK {
43
43
  private readonly clientFetch;
44
44
  private readonly pathData;
45
+ private readonly baseUrl;
46
+ private readonly lightningDomain;
47
+ private readonly isInternal;
45
48
  readonly apiVersion: string;
46
49
  readonly graphql: DataSDKGraphQL;
47
50
  constructor(options?: MosaicDataSDKOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/mosaic/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAmC,MAAM,YAAY,CAAC;AAe3F;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;gBAErB,OAAO,CAAC,EAAE,oBAAoB;YAuB5B,iBAAiB;CAe/B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/mosaic/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAmC,MAAM,YAAY,CAAC;AAe3F;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IACrD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;gBAErB,OAAO,CAAC,EAAE,oBAAoB;YA0B5B,iBAAiB;CA4D/B"}
@@ -11,6 +11,13 @@ export declare const NOOP_REFRESH: () => Promise<void>;
11
11
  export declare function parseToDocument(op: GraphQLRawDocument): Result<DocumentNode, GraphQLError[]>;
12
12
  export declare function getOperationKind(document: DocumentNode, operationName?: string): "query" | "mutation" | "subscription" | "unknown";
13
13
  export declare function toErrors(reason: unknown): GraphQLError[];
14
- export type RawGraphQLExecutor = <T, V = Record<string, unknown>>(request: GraphQLRequest<V>) => Promise<GraphQLResponse<T>>;
14
+ /**
15
+ * Executes a fully-resolved GraphQL request against a surface's transport. The
16
+ * caller-resolved `operation` kind is passed alongside the request (rather than
17
+ * on the public {@link GraphQLRequest}) as an internal routing hint: a surface
18
+ * may use it to pick a transport verb or reject unsupported operations, or
19
+ * ignore it entirely when every operation is sent the same way.
20
+ */
21
+ export type RawGraphQLExecutor = <T, V = Record<string, unknown>>(request: GraphQLRequest<V>, operation: "query" | "mutation") => Promise<GraphQLResponse<T>>;
15
22
  export declare function executeMutate<T, V = Record<string, unknown>>(executeRaw: RawGraphQLExecutor, { mutation: op, variables, operationName: explicitName, headers }: MutateOptions<V>): Promise<MutationResult<T>>;
16
23
  //# sourceMappingURL=graphql-parse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-parse.d.ts","sourceRoot":"","sources":["../../../../src/data/shared/graphql/graphql-parse.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAGN,KAAK,YAAY,EAEjB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EACX,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,WAAW,EACX,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,UAAU,EAAE,WAExB,CAAC;AAEF,eAAO,MAAM,YAAY,QAAa,OAAO,CAAC,IAAI,CAEjD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,CAM5F;AAED,wBAAgB,gB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M5F;AAED,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,YAAY,EACtB,aAAa,CAAC,EAAE,MAAM,GACpB,OAAO,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,CAanD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,EAAE,CAiBxD;AAED;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAC1B,SAAS,EAAE,OAAO,GAAG,UAAU,KAC3B,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjC,wBAAsB,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,UAAU,EAAE,kBAAkB,EAC9B,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,GACjF,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAiC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"uncached-graphql.d.ts","sourceRoot":"","sources":["../../../../src/data/shared/graphql/uncached-graphql.ts"],"names":[],"mappings":"AAMA,OAAO,EAON,KAAK,kBAAkB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACX,cAAc,EAMd,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,kBAAkB,GAAG,cAAc,CA4EnF"}
1
+ {"version":3,"file":"uncached-graphql.d.ts","sourceRoot":"","sources":["../../../../src/data/shared/graphql/uncached-graphql.ts"],"names":[],"mappings":"AAMA,OAAO,EAON,KAAK,kBAAkB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACX,cAAc,EAMd,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,kBAAkB,GAAG,cAAc,CA+EnF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "12.7.0",
3
+ "version": "12.8.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -147,7 +147,7 @@
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.7.0",
150
+ "@salesforce/jsonrpc": "^12.8.0",
151
151
  "@salesforce/sf-embedding-bridge": "2.2.5-rc.2"
152
152
  },
153
153
  "peerDependencies": {