@salesforce/platform-sdk 12.7.0-canary.1016.23.1.g31dc6b7a → 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,aA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C,MAAM,EAAE,eAAe,CAAC,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;;;;;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MAAM,GAAG,SAAS,EAC1B,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"}
@@ -91,7 +91,7 @@ function H(t, e) {
91
91
  }
92
92
  return r;
93
93
  }
94
- function G(t) {
94
+ function U(t) {
95
95
  return H(pe, t);
96
96
  }
97
97
  function me(t) {
@@ -115,7 +115,7 @@ class _ extends Error {
115
115
  ), this.name = "GraphQLTransportError", this.status = e.status, this.url = e.url, this.cause = e.cause;
116
116
  }
117
117
  }
118
- async function U(t, e, r) {
118
+ async function G(t, e, r) {
119
119
  const n = await t.text();
120
120
  let a;
121
121
  try {
@@ -232,18 +232,18 @@ function Q(t) {
232
232
  subscribe: () => v,
233
233
  refresh: $
234
234
  };
235
- const u = /* @__PURE__ */ new Set(), d = a, f = await e(c, d, s, o);
235
+ const u = /* @__PURE__ */ new Set(), d = a, p = await e(c, d, s, o);
236
236
  return {
237
- data: f.data,
238
- errors: f.errors,
239
- subscribe(p) {
240
- return u.add(p), () => {
241
- u.delete(p);
237
+ data: p.data,
238
+ errors: p.errors,
239
+ subscribe(f) {
240
+ return u.add(f), () => {
241
+ u.delete(f);
242
242
  };
243
243
  },
244
244
  async refresh() {
245
- const p = await e(c, d, s, o);
246
- for (const E of u) E(p);
245
+ const f = await e(c, d, s, o);
246
+ for (const E of u) E(f);
247
247
  }
248
248
  };
249
249
  }
@@ -263,6 +263,7 @@ const ge = {
263
263
  class we {
264
264
  clientFetch;
265
265
  pathData;
266
+ baseUrl;
266
267
  lightningDomain;
267
268
  isInternal;
268
269
  apiVersion;
@@ -271,7 +272,7 @@ class we {
271
272
  const r = ve(), n = T(e?.instanceUrl ?? r.instanceUrl), a = e?.accessToken ?? r.accessToken, s = T(
272
273
  e?.lightningDomain ?? r.lightningDomain
273
274
  ), o = e?.isInternal ?? r.isInternal ?? !1;
274
- this.apiVersion = e?.apiVersion ?? r.apiVersion ?? q, this.pathData = j(this.apiVersion), this.lightningDomain = s || void 0, this.isInternal = o, 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({
275
276
  baseUrl: n || void 0,
276
277
  accessToken: a,
277
278
  lightningDomain: this.lightningDomain,
@@ -279,11 +280,7 @@ class we {
279
280
  }), this.graphql = Q(this.executeRawGraphQL.bind(this));
280
281
  }
281
282
  async executeRawGraphQL({ query: e, variables: r, operationName: n, headers: a }, s) {
282
- const o = `${this.pathData}/graphql`, i = H(ge, a), c = V(
283
- { headers: i },
284
- this.isInternal,
285
- this.lightningDomain
286
- );
283
+ const o = `${this.pathData}/graphql`, i = H(ge, a), c = V({ headers: i }, this.isInternal, this.lightningDomain) && !!this.baseUrl;
287
284
  if (c && s === "mutation")
288
285
  return {
289
286
  data: void 0,
@@ -305,8 +302,8 @@ class we {
305
302
  body: JSON.stringify({ query: e, variables: r, operationName: n }),
306
303
  headers: i
307
304
  }
308
- }, d = await this.clientFetch(h, u);
309
- return U(d, "Mosaic", h);
305
+ }, d = await this.clientFetch(h, u), p = c ? `${o}?queryInput=<redacted>` : h;
306
+ return G(d, "Mosaic", p);
310
307
  }
311
308
  }
312
309
  function ve() {
@@ -353,7 +350,7 @@ const C = "Accept-Language", Ce = (t) => {
353
350
  return l(t);
354
351
  const [r, n] = t;
355
352
  return (r instanceof Request && !n?.headers ? r.headers.has(C) : new Headers(n?.headers).has(C)) ? l(t) : l(y(C, e, t));
356
- }, De = "X-SFDC-Client-Name", Oe = "X-SFDC-Client-Version", xe = "@salesforce/platform-sdk", $e = "12.7.0-canary.1016.23.1.g31dc6b7a", Ne = (t) => {
353
+ }, De = "X-SFDC-Client-Name", Oe = "X-SFDC-Client-Version", xe = "@salesforce/platform-sdk", $e = "12.8.0", Ne = (t) => {
357
354
  let e = y(De, xe, t);
358
355
  return e = y(Oe, $e, e), l(e);
359
356
  }, Ae = "X-CSRF-Token";
@@ -512,7 +509,7 @@ function He(t) {
512
509
  }
513
510
  return M;
514
511
  }
515
- class Ge extends oe {
512
+ class Ue extends oe {
516
513
  constructor(e, r, n) {
517
514
  super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = Ve(
518
515
  e.variables ?? {},
@@ -532,7 +529,7 @@ class Ge extends oe {
532
529
  this.url,
533
530
  {
534
531
  method: "POST",
535
- headers: G(this.headers),
532
+ headers: U(this.headers),
536
533
  body: JSON.stringify({
537
534
  query: this.query,
538
535
  variables: this.normalizedVariables,
@@ -599,12 +596,12 @@ class Ge extends oe {
599
596
  return this.responseHasErrors(e) ? x(new X(e)) : O(e);
600
597
  }
601
598
  }
602
- const Ue = "CACHE_MISS";
599
+ const Ge = "CACHE_MISS";
603
600
  function Fe() {
604
601
  return [
605
602
  {
606
603
  message: "No cached entry found for this query (cacheControl: 'only-if-cached').",
607
- extensions: { code: Ue }
604
+ extensions: { code: Ge }
608
605
  }
609
606
  ];
610
607
  }
@@ -668,16 +665,16 @@ function Ke({
668
665
  }) {
669
666
  const u = A(s);
670
667
  if (u.isErr()) return D(u.error);
671
- const d = u.value, f = P(d, i);
672
- if (f !== "query")
668
+ const d = u.value, p = P(d, i);
669
+ if (p !== "query")
673
670
  return D([
674
671
  {
675
- message: `DataSDK.graphql.query() requires a GraphQL query, received ${f}.`
672
+ message: `DataSDK.graphql.query() requires a GraphQL query, received ${p}.`
676
673
  }
677
674
  ]);
678
- let p;
675
+ let f;
679
676
  try {
680
- p = new Ge(
677
+ f = new Ue(
681
678
  {
682
679
  query: N(d),
683
680
  variables: o,
@@ -691,7 +688,7 @@ function Ke({
691
688
  } catch (E) {
692
689
  return D(m(E));
693
690
  }
694
- return je(p, c === "only-if-cached");
691
+ return je(f, c === "only-if-cached");
695
692
  }
696
693
  return {
697
694
  query: a,
@@ -744,9 +741,9 @@ class We {
744
741
  const s = `${this.pathData}/graphql`, o = await this.fetch(s, {
745
742
  method: "POST",
746
743
  body: JSON.stringify({ query: e, variables: r, operationName: n }),
747
- headers: G(a)
744
+ headers: U(a)
748
745
  });
749
- return U(o, "WebApp", s);
746
+ return G(o, "WebApp", s);
750
747
  }
751
748
  /**
752
749
  * If the url is relative, convert to it to an absolute Salesforce URL. This is due to the way Code
@@ -831,14 +828,14 @@ async function Ze(t, e, r) {
831
828
  throw new Error(
832
829
  `Extension ${d} cannot attach: "${u}" is already defined by another extension.`
833
830
  );
834
- let f;
831
+ let p;
835
832
  try {
836
- f = await h.setup(a);
837
- } catch (p) {
838
- throw new Error(`Extension ${d} failed during setup.`, { cause: p });
833
+ p = await h.setup(a);
834
+ } catch (f) {
835
+ throw new Error(`Extension ${d} failed during setup.`, { cause: f });
839
836
  }
840
837
  Object.defineProperty(s, u, {
841
- value: f,
838
+ value: p,
842
839
  enumerable: !0,
843
840
  writable: !1,
844
841
  configurable: !1
@@ -42,6 +42,7 @@ 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;
45
46
  private readonly lightningDomain;
46
47
  private readonly isInternal;
47
48
  readonly apiVersion: string;
@@ -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;;;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Q,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "12.7.0-canary.1016.23.1.g31dc6b7a",
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-canary.1016.23.1.g31dc6b7a",
150
+ "@salesforce/jsonrpc": "^12.8.0",
151
151
  "@salesforce/sf-embedding-bridge": "2.2.5-rc.2"
152
152
  },
153
153
  "peerDependencies": {