@salesforce/platform-sdk 11.39.0 → 11.40.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.
package/dist/data/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { g as x, S as y } from "../surface-Dd2tqrPi.js";
|
|
2
2
|
import { w as K } from "../sdk-promise-D0sy7OW1.js";
|
|
3
|
-
import { buildServiceDescriptor as
|
|
4
|
-
import { resolvedPromiseLike as u, ok as
|
|
5
|
-
import { print as
|
|
6
|
-
import { RetryPolicy as
|
|
7
|
-
import { buildServiceDescriptor as
|
|
8
|
-
import { buildServiceDescriptor as
|
|
9
|
-
import { buildInMemoryCacheInclusionPolicyService as
|
|
10
|
-
import { buildServiceDescriptor as
|
|
11
|
-
import { HttpCacheControlCommand as
|
|
12
|
-
function
|
|
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";
|
|
5
|
+
import { print as k, parse as W } from "@conduit-client/onestore-graphql-parser/v1";
|
|
6
|
+
import { RetryPolicy as B, buildServiceDescriptor as J } from "@conduit-client/service-retry/v1";
|
|
7
|
+
import { buildServiceDescriptor as X } from "@conduit-client/service-cache/v1";
|
|
8
|
+
import { buildServiceDescriptor as Y } from "@conduit-client/service-cache-control/v1";
|
|
9
|
+
import { buildInMemoryCacheInclusionPolicyService as Z } from "@conduit-client/service-cache-inclusion-policy/v1";
|
|
10
|
+
import { buildServiceDescriptor as ee } from "@conduit-client/service-pubsub/v1";
|
|
11
|
+
import { HttpCacheControlCommand as re } from "@conduit-client/command-http-cache-control/v1";
|
|
12
|
+
function te(r) {
|
|
13
13
|
return (e) => {
|
|
14
14
|
const [t, n] = e;
|
|
15
15
|
if (typeof t == "string" && !t.startsWith("http")) {
|
|
@@ -19,42 +19,42 @@ function re(r) {
|
|
|
19
19
|
return u(e);
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ne(r) {
|
|
23
23
|
return (e) => u(b("Authorization", `Bearer ${r}`, e));
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function se(r, e) {
|
|
26
26
|
const t = [];
|
|
27
|
-
return r && t.push(
|
|
27
|
+
return r && t.push(te(r)), e && t.push(ne(e)), M({
|
|
28
28
|
request: t
|
|
29
29
|
}).service;
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const ae = {
|
|
32
32
|
"Content-Type": "application/json",
|
|
33
33
|
Accept: "application/json",
|
|
34
34
|
"X-Chatter-Entity-Encoding": "false"
|
|
35
35
|
};
|
|
36
|
-
function
|
|
36
|
+
function oe(r) {
|
|
37
37
|
if (r instanceof Headers) {
|
|
38
38
|
const e = [];
|
|
39
39
|
return r.forEach((t, n) => e.push([n, t])), e;
|
|
40
40
|
}
|
|
41
41
|
return Array.isArray(r) ? r.map(([e, t]) => [e, t]) : Object.entries(r);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function L(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);
|
|
47
47
|
const s = /* @__PURE__ */ new Set();
|
|
48
|
-
for (const [a, i] of
|
|
48
|
+
for (const [a, i] of oe(e)) {
|
|
49
49
|
const o = a.toLowerCase(), c = n.get(o);
|
|
50
50
|
c === void 0 ? (t[a] = i, n.set(o, a), s.add(o)) : s.has(o) ? t[c] = `${t[c]}, ${i}` : (t[c] = i, s.add(o));
|
|
51
51
|
}
|
|
52
52
|
return t;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
54
|
+
function H(r) {
|
|
55
|
+
return L(ae, r);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function ie(r) {
|
|
58
58
|
if (r === void 0) return;
|
|
59
59
|
const e = {};
|
|
60
60
|
return new Headers(r).forEach((t, n) => {
|
|
@@ -62,16 +62,16 @@ function oe(r) {
|
|
|
62
62
|
}), Object.keys(e).length > 0 ? e : void 0;
|
|
63
63
|
}
|
|
64
64
|
const S = () => {
|
|
65
|
-
},
|
|
65
|
+
}, A = async () => {
|
|
66
66
|
};
|
|
67
|
-
function
|
|
67
|
+
function q(r) {
|
|
68
68
|
try {
|
|
69
|
-
return
|
|
69
|
+
return E(W(r));
|
|
70
70
|
} catch (e) {
|
|
71
|
-
return
|
|
71
|
+
return D(d(e));
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function _(r, e) {
|
|
75
75
|
const t = r.definitions.filter(
|
|
76
76
|
(n) => n.kind === "OperationDefinition"
|
|
77
77
|
);
|
|
@@ -85,10 +85,10 @@ function d(r) {
|
|
|
85
85
|
}
|
|
86
86
|
return r instanceof Error ? [{ message: r.message }] : typeof r == "string" ? [{ message: r }] : [{ message: "Unknown error" }];
|
|
87
87
|
}
|
|
88
|
-
async function
|
|
89
|
-
const a =
|
|
88
|
+
async function I(r, { mutation: e, variables: t, operationName: n, headers: s }) {
|
|
89
|
+
const a = q(e);
|
|
90
90
|
if (a.isErr()) return { data: void 0, errors: a.error };
|
|
91
|
-
const i = a.value, o =
|
|
91
|
+
const i = a.value, o = _(i, n);
|
|
92
92
|
if (o !== "mutation")
|
|
93
93
|
return {
|
|
94
94
|
data: void 0,
|
|
@@ -100,7 +100,7 @@ async function L(r, { mutation: e, variables: t, operationName: n, headers: s })
|
|
|
100
100
|
};
|
|
101
101
|
try {
|
|
102
102
|
const c = await r({
|
|
103
|
-
query:
|
|
103
|
+
query: k(i),
|
|
104
104
|
variables: t,
|
|
105
105
|
operationName: n,
|
|
106
106
|
headers: s
|
|
@@ -116,7 +116,7 @@ async function L(r, { mutation: e, variables: t, operationName: n, headers: s })
|
|
|
116
116
|
function $(r) {
|
|
117
117
|
function e(n, s, a, i) {
|
|
118
118
|
return r({
|
|
119
|
-
query:
|
|
119
|
+
query: k(n),
|
|
120
120
|
variables: s,
|
|
121
121
|
operationName: a,
|
|
122
122
|
headers: i
|
|
@@ -134,15 +134,15 @@ function $(r) {
|
|
|
134
134
|
operationName: a,
|
|
135
135
|
headers: i
|
|
136
136
|
}) {
|
|
137
|
-
const o =
|
|
137
|
+
const o = q(n);
|
|
138
138
|
if (o.isErr())
|
|
139
139
|
return {
|
|
140
140
|
data: void 0,
|
|
141
141
|
errors: o.error,
|
|
142
142
|
subscribe: () => S,
|
|
143
|
-
refresh:
|
|
143
|
+
refresh: A
|
|
144
144
|
};
|
|
145
|
-
const c = o.value, f =
|
|
145
|
+
const c = o.value, f = _(c, a);
|
|
146
146
|
if (f !== "query")
|
|
147
147
|
return {
|
|
148
148
|
data: void 0,
|
|
@@ -152,7 +152,7 @@ function $(r) {
|
|
|
152
152
|
}
|
|
153
153
|
],
|
|
154
154
|
subscribe: () => S,
|
|
155
|
-
refresh:
|
|
155
|
+
refresh: A
|
|
156
156
|
};
|
|
157
157
|
const h = /* @__PURE__ */ new Set(), p = s, m = await e(c, p, a, i);
|
|
158
158
|
return {
|
|
@@ -165,30 +165,30 @@ function $(r) {
|
|
|
165
165
|
},
|
|
166
166
|
async refresh() {
|
|
167
167
|
const l = await e(c, p, a, i);
|
|
168
|
-
for (const
|
|
168
|
+
for (const g of h) g(l);
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
return {
|
|
173
173
|
query: t,
|
|
174
|
-
mutate: (n) =>
|
|
174
|
+
mutate: (n) => I(r, n)
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
const
|
|
178
|
-
function
|
|
177
|
+
const ce = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
|
|
178
|
+
function F(r = ce) {
|
|
179
179
|
return `/services/data/v${r}`;
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const ue = {
|
|
182
182
|
"Content-Type": "application/json",
|
|
183
183
|
Accept: "application/json"
|
|
184
184
|
};
|
|
185
|
-
class
|
|
185
|
+
class he {
|
|
186
186
|
clientFetch;
|
|
187
187
|
pathData;
|
|
188
188
|
graphql;
|
|
189
189
|
constructor(e) {
|
|
190
|
-
const t =
|
|
191
|
-
this.pathData =
|
|
190
|
+
const t = le(), n = de(e?.instanceUrl ?? t.instanceUrl), s = e?.accessToken ?? t.accessToken;
|
|
191
|
+
this.pathData = F(e?.apiVersion ?? t.apiVersion), this.clientFetch = se(n || void 0, s), this.graphql = $(this.executeRawGraphQL.bind(this));
|
|
192
192
|
}
|
|
193
193
|
async executeRawGraphQL({
|
|
194
194
|
query: e,
|
|
@@ -199,11 +199,11 @@ class ue {
|
|
|
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:
|
|
202
|
+
headers: L(ue, s)
|
|
203
203
|
})).json();
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function le() {
|
|
207
207
|
const r = globalThis.MOSAIC_ENV;
|
|
208
208
|
return {
|
|
209
209
|
instanceUrl: r?.instanceUrl,
|
|
@@ -211,13 +211,13 @@ function he() {
|
|
|
211
211
|
apiVersion: r?.apiVersion
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function de(r) {
|
|
215
215
|
if (!r || r === "/") return "";
|
|
216
216
|
let e = r;
|
|
217
217
|
return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
218
218
|
}
|
|
219
|
-
const
|
|
220
|
-
class
|
|
219
|
+
const fe = "graphqlQuery";
|
|
220
|
+
class pe {
|
|
221
221
|
graphql;
|
|
222
222
|
constructor() {
|
|
223
223
|
this.graphql = $(this.executeRawGraphQL.bind(this));
|
|
@@ -232,29 +232,35 @@ class fe {
|
|
|
232
232
|
variables: t,
|
|
233
233
|
operationName: n
|
|
234
234
|
}) {
|
|
235
|
-
return (await window.openai.callTool(
|
|
235
|
+
return (await window.openai.callTool(fe, {
|
|
236
236
|
query: e,
|
|
237
237
|
...t != null ? { variables: t } : {},
|
|
238
238
|
...n != null ? { operationName: n } : {}
|
|
239
239
|
})).structuredContent;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
const w = "Accept-Language", me = (r) => {
|
|
243
|
+
const e = globalThis.SFDC_ENV?.language;
|
|
244
|
+
if (!e)
|
|
245
|
+
return u(r);
|
|
246
|
+
const [t, n] = r;
|
|
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.40.0", ge = (r) => {
|
|
249
|
+
let e = b(ye, ve, r);
|
|
250
|
+
return e = b(be, Se, e), u(e);
|
|
251
|
+
}, we = "X-CSRF-Token";
|
|
252
|
+
function Ce(r, e = {}) {
|
|
247
253
|
const { protectedUrls: t = [], alwaysProtectedUrls: n = [] } = e;
|
|
248
254
|
return async (s) => {
|
|
249
255
|
const [a, i] = s, o = new Request(a, i);
|
|
250
|
-
if (O(n, o.url) ||
|
|
256
|
+
if (O(n, o.url) || Ee(o.method) && O(t, o.url)) {
|
|
251
257
|
const f = await r.getToken();
|
|
252
|
-
s = b(
|
|
258
|
+
s = b(we, f, s);
|
|
253
259
|
}
|
|
254
260
|
return u(s);
|
|
255
261
|
};
|
|
256
262
|
}
|
|
257
|
-
function
|
|
263
|
+
function Ee(r) {
|
|
258
264
|
const e = r.toLowerCase();
|
|
259
265
|
return e === "post" || e === "put" || e === "patch" || e === "delete";
|
|
260
266
|
}
|
|
@@ -262,16 +268,16 @@ function O(r, e) {
|
|
|
262
268
|
const t = new URL(e);
|
|
263
269
|
return r.some((n) => t.pathname.includes(n));
|
|
264
270
|
}
|
|
265
|
-
function
|
|
266
|
-
const t =
|
|
271
|
+
function De(r, e = {}) {
|
|
272
|
+
const t = Ce(r, e);
|
|
267
273
|
async function n(s) {
|
|
268
274
|
const a = await t(s);
|
|
269
275
|
return fetch(a[0], a[1]);
|
|
270
276
|
}
|
|
271
277
|
return (s, a) => a ? a.applyRetry(async () => n(s)) : n(s);
|
|
272
278
|
}
|
|
273
|
-
const
|
|
274
|
-
class
|
|
279
|
+
const Ae = [400, 401, 403];
|
|
280
|
+
class ke extends B {
|
|
275
281
|
constructor(e) {
|
|
276
282
|
super(e), this.csrfTokenManager = e;
|
|
277
283
|
}
|
|
@@ -279,7 +285,7 @@ class De extends W {
|
|
|
279
285
|
* Determines if a failed request should be retried due to CSRF token issues.
|
|
280
286
|
*/
|
|
281
287
|
async shouldRetry(e, t) {
|
|
282
|
-
return t.attempt >= 1 ? !1 :
|
|
288
|
+
return t.attempt >= 1 ? !1 : Ae.includes(e.status);
|
|
283
289
|
}
|
|
284
290
|
/**
|
|
285
291
|
* CSRF token refresh should happen immediately with no delay.
|
|
@@ -297,7 +303,7 @@ class De extends W {
|
|
|
297
303
|
await this.csrfTokenManager.refreshToken();
|
|
298
304
|
}
|
|
299
305
|
}
|
|
300
|
-
class
|
|
306
|
+
class qe {
|
|
301
307
|
constructor(e, t) {
|
|
302
308
|
this.endpoint = e, this.cacheName = t, this.tokenPromise = this.obtainToken();
|
|
303
309
|
}
|
|
@@ -346,28 +352,28 @@ class Ae {
|
|
|
346
352
|
}
|
|
347
353
|
}
|
|
348
354
|
const P = /* @__PURE__ */ new Map();
|
|
349
|
-
function
|
|
355
|
+
function _e(r) {
|
|
350
356
|
const { endpoint: e, cacheName: t, ...n } = r.csrf;
|
|
351
357
|
let s = P.get(e);
|
|
352
|
-
return s || (s = new
|
|
358
|
+
return s || (s = new qe(e, t), P.set(e, s)), M(
|
|
353
359
|
{
|
|
354
|
-
retry:
|
|
355
|
-
request: [
|
|
360
|
+
retry: De(s, n),
|
|
361
|
+
request: [ge, me]
|
|
356
362
|
},
|
|
357
|
-
|
|
363
|
+
J(new ke(s)).service
|
|
358
364
|
).service;
|
|
359
365
|
}
|
|
360
|
-
const
|
|
361
|
-
function
|
|
362
|
-
let e =
|
|
366
|
+
const N = /* @__PURE__ */ new Map();
|
|
367
|
+
function Oe(r) {
|
|
368
|
+
let e = N.get(r);
|
|
363
369
|
if (!e) {
|
|
364
|
-
const t =
|
|
365
|
-
e = { cache: t, cacheController: s, pubSub: a },
|
|
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);
|
|
366
372
|
}
|
|
367
373
|
return e;
|
|
368
374
|
}
|
|
369
|
-
function
|
|
370
|
-
const t =
|
|
375
|
+
function Pe(r, e) {
|
|
376
|
+
const t = Oe(r);
|
|
371
377
|
return {
|
|
372
378
|
shared: t,
|
|
373
379
|
services: {
|
|
@@ -377,8 +383,8 @@ function Oe(r, e) {
|
|
|
377
383
|
}
|
|
378
384
|
};
|
|
379
385
|
}
|
|
380
|
-
const
|
|
381
|
-
function
|
|
386
|
+
const T = 300;
|
|
387
|
+
function Ne(r, e) {
|
|
382
388
|
try {
|
|
383
389
|
return JSON.parse(JSON.stringify(r));
|
|
384
390
|
} catch (t) {
|
|
@@ -388,19 +394,19 @@ function Pe(r, e) {
|
|
|
388
394
|
throw s.cause = t, s;
|
|
389
395
|
}
|
|
390
396
|
}
|
|
391
|
-
function
|
|
397
|
+
function Te(r) {
|
|
392
398
|
if (typeof r == "object" && r.type === "max-age") {
|
|
393
399
|
const e = r.maxAge;
|
|
394
|
-
return Number.isFinite(e) && e >= 0 ? e :
|
|
400
|
+
return Number.isFinite(e) && e >= 0 ? e : T;
|
|
395
401
|
}
|
|
396
|
-
return
|
|
402
|
+
return T;
|
|
397
403
|
}
|
|
398
|
-
class
|
|
404
|
+
class Re extends re {
|
|
399
405
|
constructor(e, t, n) {
|
|
400
|
-
super(t), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables =
|
|
406
|
+
super(t), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = Ne(
|
|
401
407
|
e.variables ?? {},
|
|
402
408
|
this.normalizedOperationName
|
|
403
|
-
), this.cacheControl = e.cacheControl, this.resolvedMaxAge =
|
|
409
|
+
), this.cacheControl = e.cacheControl, this.resolvedMaxAge = Te(e.cacheControl), this.headers = e.headers, this.headersKey = ie(e.headers);
|
|
404
410
|
}
|
|
405
411
|
query;
|
|
406
412
|
normalizedVariables;
|
|
@@ -414,7 +420,7 @@ class Ne extends ee {
|
|
|
414
420
|
this.url,
|
|
415
421
|
{
|
|
416
422
|
method: "POST",
|
|
417
|
-
headers:
|
|
423
|
+
headers: H(this.headers),
|
|
418
424
|
body: JSON.stringify({
|
|
419
425
|
query: this.query,
|
|
420
426
|
variables: this.normalizedVariables,
|
|
@@ -429,7 +435,7 @@ class Ne extends ee {
|
|
|
429
435
|
variables: this.normalizedVariables,
|
|
430
436
|
operationName: this.normalizedOperationName
|
|
431
437
|
};
|
|
432
|
-
return this.headersKey !== void 0 && (e.headers = this.headersKey),
|
|
438
|
+
return this.headersKey !== void 0 && (e.headers = this.headersKey), G(e);
|
|
433
439
|
}
|
|
434
440
|
/**
|
|
435
441
|
* Reads from the cache and returns the cache result or error
|
|
@@ -446,7 +452,7 @@ class Ne extends ee {
|
|
|
446
452
|
*/
|
|
447
453
|
readFromCache(e) {
|
|
448
454
|
const t = this.buildKey(), n = e.get(t)?.value;
|
|
449
|
-
return n === void 0 ? u(
|
|
455
|
+
return n === void 0 ? u(D(new Q())) : u(E(n));
|
|
450
456
|
}
|
|
451
457
|
writeToCache(e, t) {
|
|
452
458
|
if (t.isOk() && t.value.data != null && Object.keys(t.value.data).length > 0) {
|
|
@@ -476,32 +482,32 @@ class Ne extends ee {
|
|
|
476
482
|
return e.errors && e.errors.length > 0;
|
|
477
483
|
}
|
|
478
484
|
processFetchReturnValue(e) {
|
|
479
|
-
return this.responseHasErrors(e) ?
|
|
485
|
+
return this.responseHasErrors(e) ? D(new z(e)) : E(e);
|
|
480
486
|
}
|
|
481
487
|
}
|
|
482
|
-
function
|
|
483
|
-
if (
|
|
488
|
+
function U(r) {
|
|
489
|
+
if (j(r) && r.data && typeof r.data == "object") {
|
|
484
490
|
const e = r.data;
|
|
485
491
|
if (e.data != null)
|
|
486
492
|
return e.data;
|
|
487
493
|
}
|
|
488
494
|
}
|
|
489
|
-
function
|
|
495
|
+
function Me(r) {
|
|
490
496
|
return (e) => {
|
|
491
497
|
if (e.isOk()) {
|
|
492
498
|
const t = e.value;
|
|
493
499
|
v(t), r({ data: t, errors: void 0 });
|
|
494
500
|
} else {
|
|
495
|
-
const t =
|
|
501
|
+
const t = U(e.error);
|
|
496
502
|
t && v(t), r({ data: t, errors: d(e.error) });
|
|
497
503
|
}
|
|
498
504
|
};
|
|
499
505
|
}
|
|
500
|
-
async function
|
|
506
|
+
async function Le(r) {
|
|
501
507
|
let e, t, n;
|
|
502
508
|
try {
|
|
503
509
|
const s = await r.execute();
|
|
504
|
-
s.isOk() ? (e = s.value.data, v(e), n = (a) => s.value.subscribe(a)) : (e =
|
|
510
|
+
s.isOk() ? (e = s.value.data, v(e), n = (a) => s.value.subscribe(a)) : (e = U(s.error.failure), e && v(e), t = d(s.error.failure), n = (a) => s.error.subscribe(a));
|
|
505
511
|
} catch (s) {
|
|
506
512
|
t = d(s);
|
|
507
513
|
}
|
|
@@ -509,22 +515,22 @@ async function Re(r) {
|
|
|
509
515
|
data: e,
|
|
510
516
|
errors: t,
|
|
511
517
|
subscribe(s) {
|
|
512
|
-
return n ? n(
|
|
518
|
+
return n ? n(Me(s)) : S;
|
|
513
519
|
},
|
|
514
520
|
async refresh() {
|
|
515
521
|
await r.refresh();
|
|
516
522
|
}
|
|
517
523
|
};
|
|
518
524
|
}
|
|
519
|
-
function
|
|
525
|
+
function C(r) {
|
|
520
526
|
return {
|
|
521
527
|
data: void 0,
|
|
522
528
|
errors: r,
|
|
523
529
|
subscribe: () => S,
|
|
524
|
-
refresh:
|
|
530
|
+
refresh: A
|
|
525
531
|
};
|
|
526
532
|
}
|
|
527
|
-
function
|
|
533
|
+
function He({
|
|
528
534
|
bundle: r,
|
|
529
535
|
url: e,
|
|
530
536
|
executeRaw: t
|
|
@@ -537,20 +543,20 @@ function Me({
|
|
|
537
543
|
cacheControl: c,
|
|
538
544
|
headers: f
|
|
539
545
|
}) {
|
|
540
|
-
const h =
|
|
541
|
-
if (h.isErr()) return
|
|
542
|
-
const p = h.value, m =
|
|
546
|
+
const h = q(a);
|
|
547
|
+
if (h.isErr()) return C(h.error);
|
|
548
|
+
const p = h.value, m = _(p, o);
|
|
543
549
|
if (m !== "query")
|
|
544
|
-
return
|
|
550
|
+
return C([
|
|
545
551
|
{
|
|
546
552
|
message: `DataSDK.graphql.query() requires a GraphQL query, received ${m}.`
|
|
547
553
|
}
|
|
548
554
|
]);
|
|
549
555
|
let l;
|
|
550
556
|
try {
|
|
551
|
-
l = new
|
|
557
|
+
l = new Re(
|
|
552
558
|
{
|
|
553
|
-
query:
|
|
559
|
+
query: k(p),
|
|
554
560
|
variables: i,
|
|
555
561
|
operationName: o,
|
|
556
562
|
cacheControl: c,
|
|
@@ -559,36 +565,36 @@ function Me({
|
|
|
559
565
|
n,
|
|
560
566
|
e
|
|
561
567
|
);
|
|
562
|
-
} catch (
|
|
563
|
-
return
|
|
568
|
+
} catch (g) {
|
|
569
|
+
return C(d(g));
|
|
564
570
|
}
|
|
565
|
-
return
|
|
571
|
+
return Le(l);
|
|
566
572
|
}
|
|
567
573
|
return {
|
|
568
574
|
query: s,
|
|
569
|
-
mutate: (a) =>
|
|
575
|
+
mutate: (a) => I(t, a)
|
|
570
576
|
};
|
|
571
577
|
}
|
|
572
|
-
const Ie = 1,
|
|
573
|
-
class
|
|
578
|
+
const Ie = 1, $e = `@salesforce/platform-sdk-data_v${Ie}`, V = F(), Fe = `${V}/ui-api`, R = `${V}/graphql`;
|
|
579
|
+
class Ue {
|
|
574
580
|
baseUrl;
|
|
575
581
|
clientFetch;
|
|
576
582
|
onStatus;
|
|
577
583
|
graphql;
|
|
578
584
|
constructor(e) {
|
|
579
|
-
const t =
|
|
580
|
-
this.baseUrl =
|
|
585
|
+
const t = Ve();
|
|
586
|
+
this.baseUrl = xe(e?.basePath ?? t.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = _e({
|
|
581
587
|
csrf: {
|
|
582
|
-
endpoint: `${this.baseUrl}${
|
|
583
|
-
cacheName:
|
|
588
|
+
endpoint: `${this.baseUrl}${Fe}/session/csrf`,
|
|
589
|
+
cacheName: $e,
|
|
584
590
|
protectedUrls: ["services/data/v", "services/apexrest"],
|
|
585
591
|
alwaysProtectedUrls: ["services/apexrest"]
|
|
586
592
|
}
|
|
587
593
|
});
|
|
588
|
-
const n = (a, i) => this.fetch(a, i), s =
|
|
589
|
-
this.graphql =
|
|
594
|
+
const n = (a, i) => this.fetch(a, i), s = Pe(this.baseUrl, n);
|
|
595
|
+
this.graphql = He({
|
|
590
596
|
bundle: s,
|
|
591
|
-
url:
|
|
597
|
+
url: R,
|
|
592
598
|
executeRaw: this.executeRawGraphQL.bind(this)
|
|
593
599
|
});
|
|
594
600
|
}
|
|
@@ -608,10 +614,10 @@ class He {
|
|
|
608
614
|
operationName: n,
|
|
609
615
|
headers: s
|
|
610
616
|
}) {
|
|
611
|
-
return (await this.fetch(
|
|
617
|
+
return (await this.fetch(R, {
|
|
612
618
|
method: "POST",
|
|
613
619
|
body: JSON.stringify({ query: e, variables: t, operationName: n }),
|
|
614
|
-
headers:
|
|
620
|
+
headers: H(s)
|
|
615
621
|
})).json();
|
|
616
622
|
}
|
|
617
623
|
/**
|
|
@@ -628,34 +634,34 @@ class He {
|
|
|
628
634
|
return e;
|
|
629
635
|
}
|
|
630
636
|
}
|
|
631
|
-
function
|
|
637
|
+
function Ve() {
|
|
632
638
|
return {
|
|
633
639
|
apiPath: globalThis.SFDC_ENV?.apiPath
|
|
634
640
|
};
|
|
635
641
|
}
|
|
636
|
-
function
|
|
642
|
+
function xe(r) {
|
|
637
643
|
if (!r || r === "/") return "";
|
|
638
644
|
let e = r;
|
|
639
645
|
return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
640
646
|
}
|
|
641
|
-
function
|
|
647
|
+
function er(r, ...e) {
|
|
642
648
|
let t = r[0] ?? "";
|
|
643
649
|
for (let n = 0; n < e.length; n += 1)
|
|
644
650
|
t += String(e[n]) + (r[n + 1] ?? "");
|
|
645
651
|
return t;
|
|
646
652
|
}
|
|
647
|
-
function
|
|
653
|
+
function rr(r) {
|
|
648
654
|
return K(
|
|
649
655
|
(async () => {
|
|
650
656
|
try {
|
|
651
657
|
switch (await x(r?.surface)) {
|
|
652
658
|
case y.OpenAI:
|
|
653
|
-
return new
|
|
659
|
+
return new pe();
|
|
654
660
|
case y.WebApp:
|
|
655
661
|
case y.MicroFrontend:
|
|
656
|
-
return new
|
|
662
|
+
return new Ue(r?.webapp);
|
|
657
663
|
case y.Mosaic:
|
|
658
|
-
return new
|
|
664
|
+
return new he(r?.mosaic);
|
|
659
665
|
case y.MCPApps:
|
|
660
666
|
return {};
|
|
661
667
|
default:
|
|
@@ -669,6 +675,6 @@ function Ze(r) {
|
|
|
669
675
|
);
|
|
670
676
|
}
|
|
671
677
|
export {
|
|
672
|
-
|
|
673
|
-
|
|
678
|
+
rr as createDataSDK,
|
|
679
|
+
er as gql
|
|
674
680
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RequestInterceptor } from '@conduit-client/service-fetch-network/v1';
|
|
2
|
+
export declare const ACCEPT_LANGUAGE_HEADER = "Accept-Language";
|
|
3
|
+
/**
|
|
4
|
+
* A request interceptor that propagates the site's active language to every
|
|
5
|
+
* outgoing SDK request as an `Accept-Language` header.
|
|
6
|
+
*
|
|
7
|
+
* The language is read from the SFDC runtime environment
|
|
8
|
+
* ({@link globalThis.SFDC_ENV}`.language`), the same channel that carries the
|
|
9
|
+
* API path — never from the URL. Behavior:
|
|
10
|
+
*
|
|
11
|
+
* - No env language present -> no-op (falls back to platform/org default).
|
|
12
|
+
* - Caller already set `Accept-Language` (on `init` or on a `Request` input)
|
|
13
|
+
* -> preserved, never overwritten.
|
|
14
|
+
*
|
|
15
|
+
* Since both REST (`fetch`) and GraphQL requests flow through the same fetch
|
|
16
|
+
* service, wiring this once into the request chain covers both paths.
|
|
17
|
+
*/
|
|
18
|
+
export declare const acceptLanguageInterceptor: RequestInterceptor;
|
|
19
|
+
//# sourceMappingURL=accept-language.interceptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accept-language.interceptor.d.ts","sourceRoot":"","sources":["../../../src/data/webapp/accept-language.interceptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAGlD,eAAO,MAAM,sBAAsB,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,EAAE,kBAwBvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/data/webapp/fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEN,KAAK,YAAY,EACjB,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/data/webapp/fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEN,KAAK,YAAY,EACjB,MAAM,0CAA0C,CAAC;AAIlD,OAAO,EAEN,KAAK,sBAAsB,EAC3B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,UAAU,UAAW,SAAQ,sBAAsB;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,UAAU,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,+BAAsC,CAAC;AAExE;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,YAAY,CAgBpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/platform-sdk",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.40.0",
|
|
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.
|
|
126
|
+
"@salesforce/jsonrpc": "^11.40.0",
|
|
127
127
|
"@salesforce/sf-embedding-bridge": "2.2.5-rc.2"
|
|
128
128
|
},
|
|
129
129
|
"peerDependencies": {
|