@salesforce/platform-sdk 11.41.0 → 11.42.1

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.
@@ -245,7 +245,7 @@ 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.41.0", ge = (r) => {
248
+ }, ye = "X-SFDC-Client-Name", be = "X-SFDC-Client-Version", ve = "@salesforce/platform-sdk", Se = "11.42.1", 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";
@@ -1,6 +1,6 @@
1
- let o = null;
2
- async function c(a) {
3
- if (o) return o;
1
+ let s = null;
2
+ async function f(a) {
3
+ if (s) return s;
4
4
  if (!a.graphql)
5
5
  throw new Error("Data SDK GraphQL surface unavailable");
6
6
  const t = await a.graphql.query({
@@ -26,20 +26,20 @@ async function c(a) {
26
26
  `I18nDetect query failed: ${JSON.stringify(t.errors ?? "no data, no errors")}`
27
27
  );
28
28
  const e = t.data.uiapi.platform.i18n;
29
- return o = e, e;
29
+ return s = e, e;
30
30
  }
31
- async function f(a) {
32
- return o = null, c(a);
31
+ async function h(a) {
32
+ return s = null, f(a);
33
33
  }
34
- function d(a) {
34
+ function b(a) {
35
35
  return {
36
36
  type: "languageDetector",
37
37
  detect() {
38
- return o?.lang;
38
+ return s?.lang;
39
39
  }
40
40
  };
41
41
  }
42
- const i = `
42
+ const d = `
43
43
  query Labels($ns: String!, $names: [String!]!, $locale: String) {
44
44
  uiapi {
45
45
  platform {
@@ -52,24 +52,30 @@ const i = `
52
52
  }
53
53
  }
54
54
  }
55
- `;
56
- function u(a) {
55
+ `, m = 100;
56
+ function p(a, t) {
57
+ const e = [...new Set(a)], r = [];
58
+ for (let n = 0; n < e.length; n += t)
59
+ r.push(e.slice(n, n + t));
60
+ return r;
61
+ }
62
+ function y(a) {
57
63
  const t = {};
58
64
  for (const e of a) {
59
65
  const r = e.indexOf(":");
60
66
  if (r === -1) continue;
61
- const n = e.slice(0, r), l = e.slice(r + 1);
62
- (t[n] ??= []).push(l);
67
+ const n = e.slice(0, r), o = e.slice(r + 1);
68
+ (t[n] ??= []).push(o);
63
69
  }
64
70
  return t;
65
71
  }
66
- class p {
72
+ class g {
67
73
  type = "backend";
68
74
  static type = "backend";
69
75
  options = { dataSDK: {} };
70
76
  grouped = {};
71
77
  init(t, e) {
72
- this.options = e, this.grouped = u(e.labelManifest ?? []);
78
+ this.options = e, this.grouped = y(e.labelManifest ?? []);
73
79
  }
74
80
  read(t, e, r) {
75
81
  this.loadLabels(t, e).then((n) => r(null, n)).catch((n) => r(n, !1));
@@ -77,24 +83,31 @@ class p {
77
83
  async loadLabels(t, e) {
78
84
  const r = this.grouped[e];
79
85
  if (!r?.length) return {};
80
- if (!this.options.dataSDK.graphql)
86
+ const { graphql: n } = this.options.dataSDK;
87
+ if (!n)
81
88
  throw new Error("Data SDK GraphQL surface unavailable");
82
- const n = await this.options.dataSDK.graphql.query({
89
+ const o = p(r, m), u = await Promise.all(
90
+ o.map((c) => this.queryBatch(n, e, c, t))
91
+ ), i = {};
92
+ for (const c of u)
93
+ for (const l of c)
94
+ l.value != null && (i[l.name] = l.value);
95
+ return i;
96
+ }
97
+ async queryBatch(t, e, r, n) {
98
+ const o = await t.query({
83
99
  operationName: "Labels",
84
- query: i,
85
- variables: { ns: e, names: r, locale: t }
100
+ query: d,
101
+ variables: { ns: e, names: r, locale: n }
86
102
  });
87
- if (!n.data)
103
+ if (!o.data)
88
104
  throw new Error(
89
- `Labels query failed: ${JSON.stringify(n.errors ?? "no data, no errors")}`
105
+ `Labels query failed: ${JSON.stringify(o.errors ?? "no data, no errors")}`
90
106
  );
91
- const l = {};
92
- for (const s of n.data.uiapi.platform.labels)
93
- s.value != null && (l[s.name] = s.value);
94
- return l;
107
+ return o.data.uiapi.platform.labels;
95
108
  }
96
109
  }
97
- function m(a) {
110
+ function w(a) {
98
111
  const t = a.locale.replace(/_/g, "-") || void 0;
99
112
  return {
100
113
  formatDate(e, r) {
@@ -121,9 +134,9 @@ function m(a) {
121
134
  };
122
135
  }
123
136
  export {
124
- p as SalesforceBackend,
125
- m as createI18nFormatters,
126
- d as createSalesforceDetector,
127
- c as fetchI18nContext,
128
- f as reloadI18nContext
137
+ g as SalesforceBackend,
138
+ w as createI18nFormatters,
139
+ b as createSalesforceDetector,
140
+ f as fetchI18nContext,
141
+ h as reloadI18nContext
129
142
  };
@@ -12,6 +12,7 @@ export declare class SalesforceBackend {
12
12
  init(_services: unknown, options: SalesforceBackendOptions): void;
13
13
  read(language: string, namespace: string, callback: ReadCallback): void;
14
14
  private loadLabels;
15
+ private queryBatch;
15
16
  }
16
17
  export {};
17
18
  //# sourceMappingURL=salesforce-backend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"salesforce-backend.d.ts","sourceRoot":"","sources":["../../src/i18n/salesforce-backend.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,WAAW,wBAAwB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAeD,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,KAAK,IAAI,CAAC;AA6BjF,qBAAa,iBAAiB;IAC7B,IAAI,EAAG,SAAS,CAAU;IAC1B,MAAM,CAAC,IAAI,EAAG,SAAS,CAAU;IAEjC,OAAO,CAAC,OAAO,CAA6C;IAC5D,OAAO,CAAC,OAAO,CAAgC;IAE/C,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,wBAAwB,GAAG,IAAI;IAKjE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI;YAMzD,UAAU;CA8BxB"}
1
+ {"version":3,"file":"salesforce-backend.d.ts","sourceRoot":"","sources":["../../src/i18n/salesforce-backend.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,WAAW,wBAAwB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAeD,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,KAAK,IAAI,CAAC;AA0CjF,qBAAa,iBAAiB;IAC7B,IAAI,EAAG,SAAS,CAAU;IAC1B,MAAM,CAAC,IAAI,EAAG,SAAS,CAAU;IAEjC,OAAO,CAAC,OAAO,CAA6C;IAC5D,OAAO,CAAC,OAAO,CAAgC;IAE/C,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,wBAAwB,GAAG,IAAI;IAKjE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI;YAMzD,UAAU;YA2BV,UAAU;CAuBxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "11.41.0",
3
+ "version": "11.42.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -123,7 +123,7 @@
123
123
  "@conduit-client/service-pubsub": "3.19.6",
124
124
  "@conduit-client/service-retry": "3.19.6",
125
125
  "@conduit-client/utils": "3.19.6",
126
- "@salesforce/jsonrpc": "^11.41.0",
126
+ "@salesforce/jsonrpc": "^11.42.1",
127
127
  "@salesforce/sf-embedding-bridge": "2.2.5-rc.2"
128
128
  },
129
129
  "peerDependencies": {