@salesforce/platform-sdk 12.8.0 → 12.9.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/analytics/analytics.d.ts +19 -15
- package/dist/analytics/analytics.d.ts.map +1 -1
- package/dist/analytics/error-listener.d.ts +3 -3
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +1 -1
- package/dist/analytics/method-configs.d.ts +8 -4
- package/dist/analytics/method-configs.d.ts.map +1 -1
- package/dist/analytics/pft.d.ts +22 -16
- package/dist/analytics/pft.d.ts.map +1 -1
- package/dist/analytics/proxy.d.ts +10 -8
- package/dist/analytics/proxy.d.ts.map +1 -1
- package/dist/analytics/types.d.ts +57 -43
- package/dist/analytics/types.d.ts.map +1 -1
- package/dist/{analytics-Dpz22kda.js → analytics-wESbWdca.js} +1 -1
- package/dist/app/index.d.ts +18 -13
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +5 -3
- package/dist/app/webapp.d.ts +5 -2
- package/dist/app/webapp.d.ts.map +1 -1
- package/dist/{capabilities-CKe8z6kZ.js → capabilities-B0mU0_G0.js} +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/core/app.d.ts +31 -22
- package/dist/core/app.d.ts.map +1 -1
- package/dist/core/capabilities.d.ts +26 -17
- package/dist/core/capabilities.d.ts.map +1 -1
- package/dist/core/chat.d.ts +155 -125
- package/dist/core/chat.d.ts.map +1 -1
- package/dist/core/data.d.ts +146 -107
- package/dist/core/data.d.ts.map +1 -1
- package/dist/core/extension-attach.d.ts +65 -51
- package/dist/core/extension-attach.d.ts.map +1 -1
- package/dist/core/extension-types.d.ts +214 -153
- package/dist/core/extension-types.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/lightning.d.ts +11 -19
- package/dist/core/lightning.d.ts.map +1 -1
- package/dist/core/mcpapps-session.d.ts +63 -52
- package/dist/core/mcpapps-session.d.ts.map +1 -1
- package/dist/core/options.d.ts +6 -4
- package/dist/core/options.d.ts.map +1 -1
- package/dist/core/platforms.d.ts +29 -29
- package/dist/core/sdk-promise.d.ts +7 -4
- package/dist/core/sdk-promise.d.ts.map +1 -1
- package/dist/core/surface.d.ts +89 -67
- package/dist/core/surface.d.ts.map +1 -1
- package/dist/core/view.d.ts +164 -113
- package/dist/core/view.d.ts.map +1 -1
- package/dist/data/extensions/index.d.ts +5 -2
- package/dist/data/extensions/index.d.ts.map +1 -1
- package/dist/data/extensions/labels/index.d.ts +72 -49
- package/dist/data/extensions/labels/index.d.ts.map +1 -1
- package/dist/data/extensions/labels/query.d.ts +38 -29
- package/dist/data/extensions/labels/query.d.ts.map +1 -1
- package/dist/data/gql.d.ts +8 -4
- package/dist/data/gql.d.ts.map +1 -1
- package/dist/data/index.d.ts +67 -48
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +265 -242
- package/dist/data/mosaic/fetch.d.ts +24 -15
- package/dist/data/mosaic/fetch.d.ts.map +1 -1
- package/dist/data/mosaic/index.d.ts +13 -9
- package/dist/data/mosaic/index.d.ts.map +1 -1
- package/dist/data/openai/index.d.ts +11 -5
- package/dist/data/openai/index.d.ts.map +1 -1
- package/dist/data/shared/graphql/cache/command.d.ts +60 -46
- package/dist/data/shared/graphql/cache/command.d.ts.map +1 -1
- package/dist/data/shared/graphql/cache/invoker.d.ts.map +1 -1
- package/dist/data/shared/graphql/cache/services.d.ts +21 -11
- package/dist/data/shared/graphql/cache/services.d.ts.map +1 -1
- package/dist/data/shared/graphql/cached-graphql.d.ts +9 -4
- package/dist/data/shared/graphql/cached-graphql.d.ts.map +1 -1
- package/dist/data/shared/graphql/graphql-parse.d.ts +6 -3
- package/dist/data/shared/graphql/graphql-parse.d.ts.map +1 -1
- package/dist/data/shared/graphql/headers.d.ts +34 -27
- package/dist/data/shared/graphql/headers.d.ts.map +1 -1
- package/dist/data/shared/graphql/parse-response.d.ts +31 -23
- package/dist/data/shared/graphql/parse-response.d.ts.map +1 -1
- package/dist/data/shared/graphql/uncached-graphql.d.ts +10 -6
- package/dist/data/shared/graphql/uncached-graphql.d.ts.map +1 -1
- package/dist/data/shared/url-utils.d.ts +1 -1
- package/dist/data/shared/url-utils.d.ts.map +1 -1
- package/dist/data/webapp/accept-language.interceptor.d.ts +26 -9
- package/dist/data/webapp/accept-language.interceptor.d.ts.map +1 -1
- package/dist/data/webapp/client-headers.interceptor.d.ts +4 -3
- package/dist/data/webapp/client-headers.interceptor.d.ts.map +1 -1
- package/dist/data/webapp/csrf/header.interceptor.d.ts +4 -4
- package/dist/data/webapp/csrf/header.interceptor.d.ts.map +1 -1
- package/dist/data/webapp/csrf/retry.policy.d.ts +12 -11
- package/dist/data/webapp/csrf/retry.policy.d.ts.map +1 -1
- package/dist/data/webapp/csrf/token-manager.d.ts +18 -12
- package/dist/data/webapp/csrf/token-manager.d.ts.map +1 -1
- package/dist/data/webapp/fetch.d.ts +12 -8
- package/dist/data/webapp/fetch.d.ts.map +1 -1
- package/dist/data/webapp/index.d.ts +12 -7
- package/dist/data/webapp/index.d.ts.map +1 -1
- package/dist/i18n/locale-format.d.ts +23 -21
- package/dist/i18n/locale-format.d.ts.map +1 -1
- package/dist/i18n/salesforce-backend.d.ts +19 -11
- package/dist/i18n/salesforce-backend.d.ts.map +1 -1
- package/dist/i18n/salesforce-detector.d.ts +22 -14
- package/dist/i18n/salesforce-detector.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lightning/embedding.d.ts.map +1 -1
- package/dist/lightning/index.d.ts +4 -4
- package/dist/lightning/index.d.ts.map +1 -1
- package/dist/lightning/index.js +2 -2
- package/dist/{surface-Dd2tqrPi.js → surface-DWDgqdpN.js} +18 -13
- package/dist/telemetry/tool-adapter.d.ts.map +1 -1
- package/dist/telemetry/uploader/TelemetryUploader.d.ts.map +1 -1
- package/dist/ui-embedding/index.d.ts.map +1 -1
- package/dist/ui-embedding/session.d.ts +7 -2
- package/dist/ui-embedding/session.d.ts.map +1 -1
- package/dist/ui-embedding/session.js +1 -1
- package/dist/view/index.js +1 -1
- package/package.json +2 -2
package/dist/data/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { g as
|
|
2
|
-
import { w as
|
|
3
|
-
import { buildServiceDescriptor as
|
|
4
|
-
import { resolvedPromiseLike as
|
|
5
|
-
import { print as N, parse 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
|
-
const
|
|
13
|
-
function
|
|
14
|
-
const [, r, n] =
|
|
1
|
+
import { g as W, S as b } from "../surface-DWDgqdpN.js";
|
|
2
|
+
import { w as B } from "../sdk-promise-D0sy7OW1.js";
|
|
3
|
+
import { buildServiceDescriptor as V, setHeader as y } from "@conduit-client/service-fetch-network/v1";
|
|
4
|
+
import { resolvedPromiseLike as p, ok as x, err as A, stableJSONStringify as X, DataNotFoundError as Y, UserVisibleError as Z, deepFreeze as v, isUserVisibleError as ee } from "@conduit-client/utils";
|
|
5
|
+
import { print as N, parse as te } from "@conduit-client/onestore-graphql-parser/v1";
|
|
6
|
+
import { RetryPolicy as re, buildServiceDescriptor as ne } from "@conduit-client/service-retry/v1";
|
|
7
|
+
import { buildServiceDescriptor as se } from "@conduit-client/service-cache/v1";
|
|
8
|
+
import { buildServiceDescriptor as ae } from "@conduit-client/service-cache-control/v1";
|
|
9
|
+
import { buildInMemoryCacheInclusionPolicyService as oe } from "@conduit-client/service-cache-inclusion-policy/v1";
|
|
10
|
+
import { buildServiceDescriptor as ie } from "@conduit-client/service-pubsub/v1";
|
|
11
|
+
import { HttpCacheControlCommand as ce } from "@conduit-client/command-http-cache-control/v1";
|
|
12
|
+
const E = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
13
|
+
function ue(t, e) {
|
|
14
|
+
const [, r, n] = E.exec(t), [, a, s] = E.exec(e);
|
|
15
15
|
return Number(r) - Number(a) || Number(n) - Number(s);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function he(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" || !
|
|
21
|
+
if (typeof s != "string" || !E.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 (!
|
|
26
|
+
if (!E.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 (
|
|
30
|
+
if (ue(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,19 +35,19 @@ function ce(t, e) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
function
|
|
38
|
+
const le = "X-Salesforce-First-Party";
|
|
39
|
+
function de(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
|
|
45
|
-
return !e || !r ? !1 :
|
|
44
|
+
function H(t, e, r) {
|
|
45
|
+
return !e || !r ? !1 : de(t?.headers, le);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function D(t, e, r) {
|
|
48
48
|
return e ? r ? y("Cookie", `sid=${e}`, t) : y("Authorization", `Bearer ${e}`, t) : t;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function pe({
|
|
51
51
|
baseUrl: t,
|
|
52
52
|
accessToken: e,
|
|
53
53
|
lightningDomain: r,
|
|
@@ -57,74 +57,74 @@ 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
|
|
61
|
-
|
|
62
|
-
) :
|
|
60
|
+
return H(o, n, r) ? p(
|
|
61
|
+
D([`${r}${i}`, o], e, !0)
|
|
62
|
+
) : p(D([`${t}${i}`, o], e, !1));
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return p(D(a, e, !1));
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const e = t.baseUrl || t.accessToken ? [
|
|
69
|
-
return
|
|
67
|
+
function fe(t) {
|
|
68
|
+
const e = t.baseUrl || t.accessToken ? [pe(t)] : [];
|
|
69
|
+
return V({ request: e }).service;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const me = {
|
|
72
72
|
"Content-Type": "application/json",
|
|
73
73
|
Accept: "application/json",
|
|
74
74
|
"X-Chatter-Entity-Encoding": "false"
|
|
75
75
|
};
|
|
76
|
-
function
|
|
76
|
+
function ye(t) {
|
|
77
77
|
if (t instanceof Headers) {
|
|
78
78
|
const e = [];
|
|
79
79
|
return t.forEach((r, n) => e.push([n, r])), e;
|
|
80
80
|
}
|
|
81
81
|
return Array.isArray(t) ? t.map(([e, r]) => [e, r]) : Object.entries(t);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function U(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);
|
|
87
87
|
const a = /* @__PURE__ */ new Set();
|
|
88
|
-
for (const [s, o] of
|
|
88
|
+
for (const [s, o] of ye(e)) {
|
|
89
89
|
const i = s.toLowerCase(), c = n.get(i);
|
|
90
90
|
c === void 0 ? (r[s] = o, n.set(i, s), a.add(i)) : a.has(i) ? r[c] = `${r[c]}, ${o}` : (r[c] = o, a.add(i));
|
|
91
91
|
}
|
|
92
92
|
return r;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
94
|
+
function G(t) {
|
|
95
|
+
return U(me, t);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function be(t) {
|
|
98
98
|
if (t === void 0) return;
|
|
99
99
|
const e = {};
|
|
100
100
|
return new Headers(t).forEach((r, n) => {
|
|
101
101
|
e[n] = r;
|
|
102
102
|
}), Object.keys(e).length > 0 ? e : void 0;
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
function
|
|
104
|
+
const ge = 512;
|
|
105
|
+
function we(t) {
|
|
106
106
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
107
107
|
}
|
|
108
|
-
class
|
|
108
|
+
class T extends Error {
|
|
109
109
|
status;
|
|
110
110
|
url;
|
|
111
111
|
constructor(e) {
|
|
112
|
-
const r = e.body.length === 0 ? "empty response body" : "unparseable response body", n = e.body.length === 0 ? "" : ` (starts with: ${JSON.stringify(
|
|
112
|
+
const r = e.body.length === 0 ? "empty response body" : "unparseable response body", n = e.body.length === 0 ? "" : ` (starts with: ${JSON.stringify(we(e.body.slice(0, ge)))})`;
|
|
113
113
|
super(
|
|
114
114
|
`${e.surface} GraphQL request to ${e.url} returned HTTP ${e.status} with an ${r}${n}. Expected a JSON GraphQL response; the transport (proxy/gateway/auth) likely did not return one.`
|
|
115
115
|
), this.name = "GraphQLTransportError", this.status = e.status, this.url = e.url, this.cause = e.cause;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
async function
|
|
118
|
+
async function F(t, e, r) {
|
|
119
119
|
const n = await t.text();
|
|
120
120
|
let a;
|
|
121
121
|
try {
|
|
122
122
|
a = JSON.parse(n);
|
|
123
123
|
} catch (s) {
|
|
124
|
-
throw new
|
|
124
|
+
throw new T({ surface: e, url: r, status: t.status, body: n, cause: s });
|
|
125
125
|
}
|
|
126
126
|
if (a === null || typeof a != "object")
|
|
127
|
-
throw new
|
|
127
|
+
throw new T({
|
|
128
128
|
surface: e,
|
|
129
129
|
url: r,
|
|
130
130
|
status: t.status,
|
|
@@ -133,17 +133,17 @@ async function G(t, e, r) {
|
|
|
133
133
|
});
|
|
134
134
|
return a;
|
|
135
135
|
}
|
|
136
|
-
const
|
|
136
|
+
const S = () => {
|
|
137
137
|
}, $ = async () => {
|
|
138
138
|
};
|
|
139
|
-
function
|
|
139
|
+
function P(t) {
|
|
140
140
|
try {
|
|
141
|
-
return
|
|
141
|
+
return x(te(t));
|
|
142
142
|
} catch (e) {
|
|
143
|
-
return
|
|
143
|
+
return A(m(e));
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function q(t, e) {
|
|
147
147
|
const r = t.definitions.filter(
|
|
148
148
|
(n) => n.kind === "OperationDefinition"
|
|
149
149
|
);
|
|
@@ -157,10 +157,10 @@ function m(t) {
|
|
|
157
157
|
}
|
|
158
158
|
return t instanceof Error ? [{ message: t.message }] : typeof t == "string" ? [{ message: t }] : [{ message: "Unknown error" }];
|
|
159
159
|
}
|
|
160
|
-
async function
|
|
161
|
-
const s =
|
|
160
|
+
async function Q(t, { mutation: e, variables: r, operationName: n, headers: a }) {
|
|
161
|
+
const s = P(e);
|
|
162
162
|
if (s.isErr()) return { data: void 0, errors: s.error };
|
|
163
|
-
const o = s.value, i =
|
|
163
|
+
const o = s.value, i = q(o, n);
|
|
164
164
|
if (i !== "mutation")
|
|
165
165
|
return {
|
|
166
166
|
data: void 0,
|
|
@@ -188,7 +188,7 @@ async function F(t, { mutation: e, variables: r, operationName: n, headers: a })
|
|
|
188
188
|
return { data: void 0, errors: m(c) };
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function j(t) {
|
|
192
192
|
function e(n, a, s, o) {
|
|
193
193
|
return t(
|
|
194
194
|
{
|
|
@@ -212,15 +212,15 @@ function Q(t) {
|
|
|
212
212
|
operationName: s,
|
|
213
213
|
headers: o
|
|
214
214
|
}) {
|
|
215
|
-
const i =
|
|
215
|
+
const i = P(n);
|
|
216
216
|
if (i.isErr())
|
|
217
217
|
return {
|
|
218
218
|
data: void 0,
|
|
219
219
|
errors: i.error,
|
|
220
|
-
subscribe: () =>
|
|
220
|
+
subscribe: () => S,
|
|
221
221
|
refresh: $
|
|
222
222
|
};
|
|
223
|
-
const c = i.value, h =
|
|
223
|
+
const c = i.value, h = q(c, s);
|
|
224
224
|
if (h !== "query")
|
|
225
225
|
return {
|
|
226
226
|
data: void 0,
|
|
@@ -229,38 +229,38 @@ function Q(t) {
|
|
|
229
229
|
message: `DataSDK.graphql.query() requires a GraphQL query, received ${h}.`
|
|
230
230
|
}
|
|
231
231
|
],
|
|
232
|
-
subscribe: () =>
|
|
232
|
+
subscribe: () => S,
|
|
233
233
|
refresh: $
|
|
234
234
|
};
|
|
235
|
-
const u = /* @__PURE__ */ new Set(),
|
|
235
|
+
const u = /* @__PURE__ */ new Set(), l = a, d = await e(c, l, s, o);
|
|
236
236
|
return {
|
|
237
|
-
data:
|
|
238
|
-
errors:
|
|
237
|
+
data: d.data,
|
|
238
|
+
errors: d.errors,
|
|
239
239
|
subscribe(f) {
|
|
240
240
|
return u.add(f), () => {
|
|
241
241
|
u.delete(f);
|
|
242
242
|
};
|
|
243
243
|
},
|
|
244
244
|
async refresh() {
|
|
245
|
-
const f = await e(c,
|
|
246
|
-
for (const
|
|
245
|
+
const f = await e(c, l, s, o);
|
|
246
|
+
for (const w of u) w(f);
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
return {
|
|
251
251
|
query: r,
|
|
252
|
-
mutate: (n) =>
|
|
252
|
+
mutate: (n) => Q(t, n)
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
|
-
const
|
|
256
|
-
function
|
|
255
|
+
const _ = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
|
|
256
|
+
function K(t = _) {
|
|
257
257
|
return `/services/data/v${t}`;
|
|
258
258
|
}
|
|
259
|
-
const
|
|
259
|
+
const ve = {
|
|
260
260
|
"Content-Type": "application/json",
|
|
261
261
|
Accept: "application/json"
|
|
262
262
|
};
|
|
263
|
-
class
|
|
263
|
+
class Ee {
|
|
264
264
|
clientFetch;
|
|
265
265
|
pathData;
|
|
266
266
|
baseUrl;
|
|
@@ -269,18 +269,18 @@ class we {
|
|
|
269
269
|
apiVersion;
|
|
270
270
|
graphql;
|
|
271
271
|
constructor(e) {
|
|
272
|
-
const r =
|
|
272
|
+
const r = Se(), n = k(e?.instanceUrl ?? r.instanceUrl), a = e?.accessToken ?? r.accessToken, s = k(
|
|
273
273
|
e?.lightningDomain ?? r.lightningDomain
|
|
274
274
|
), o = e?.isInternal ?? r.isInternal ?? !1;
|
|
275
|
-
this.apiVersion = e?.apiVersion ?? r.apiVersion ??
|
|
275
|
+
this.apiVersion = e?.apiVersion ?? r.apiVersion ?? _, this.pathData = K(this.apiVersion), this.baseUrl = n || void 0, this.lightningDomain = s || void 0, this.isInternal = o, this.clientFetch = fe({
|
|
276
276
|
baseUrl: n || void 0,
|
|
277
277
|
accessToken: a,
|
|
278
278
|
lightningDomain: this.lightningDomain,
|
|
279
279
|
isInternal: o
|
|
280
|
-
}), this.graphql =
|
|
280
|
+
}), this.graphql = j(this.executeRawGraphQL.bind(this));
|
|
281
281
|
}
|
|
282
282
|
async executeRawGraphQL({ query: e, variables: r, operationName: n, headers: a }, s) {
|
|
283
|
-
const o = `${this.pathData}/graphql`, i =
|
|
283
|
+
const o = `${this.pathData}/graphql`, i = U(ve, a), c = H({ headers: i }, this.isInternal, this.lightningDomain) && !!this.baseUrl;
|
|
284
284
|
if (c && s === "mutation")
|
|
285
285
|
return {
|
|
286
286
|
data: void 0,
|
|
@@ -302,11 +302,11 @@ class we {
|
|
|
302
302
|
body: JSON.stringify({ query: e, variables: r, operationName: n }),
|
|
303
303
|
headers: i
|
|
304
304
|
}
|
|
305
|
-
},
|
|
306
|
-
return
|
|
305
|
+
}, l = await this.clientFetch(h, u), d = c ? `${o}?queryInput=<redacted>` : h;
|
|
306
|
+
return F(l, "Mosaic", d);
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function Se() {
|
|
310
310
|
const t = globalThis.MOSAIC_ENV;
|
|
311
311
|
return {
|
|
312
312
|
instanceUrl: t?.instanceUrl,
|
|
@@ -316,100 +316,109 @@ function ve() {
|
|
|
316
316
|
isInternal: t?.isInternal
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function k(t) {
|
|
320
320
|
if (!t || t === "/") return "";
|
|
321
321
|
let e = t;
|
|
322
322
|
return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
323
323
|
}
|
|
324
|
-
const
|
|
325
|
-
class
|
|
324
|
+
const Ce = "graphqlQuery";
|
|
325
|
+
class De {
|
|
326
326
|
graphql;
|
|
327
327
|
constructor() {
|
|
328
|
-
this.graphql =
|
|
328
|
+
this.graphql = j(this.executeRawGraphQL.bind(this));
|
|
329
329
|
}
|
|
330
330
|
/**
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
331
|
+
* This method does not forward the `headers` request option, by design.
|
|
332
|
+
*
|
|
333
|
+
* @remarks
|
|
334
|
+
* This surface delegates to the `graphqlQuery` MCP tool through the
|
|
335
|
+
* ChatGPT bridge. The bridge issues the HTTP request on the host side and
|
|
336
|
+
* exposes no header channel.
|
|
334
337
|
*/
|
|
335
338
|
async executeRawGraphQL({
|
|
336
339
|
query: e,
|
|
337
340
|
variables: r,
|
|
338
341
|
operationName: n
|
|
339
342
|
}) {
|
|
340
|
-
return (await window.openai.callTool(
|
|
343
|
+
return (await window.openai.callTool(Ce, {
|
|
341
344
|
query: e,
|
|
342
345
|
...r != null ? { variables: r } : {},
|
|
343
346
|
...n != null ? { operationName: n } : {}
|
|
344
347
|
})).structuredContent;
|
|
345
348
|
}
|
|
346
349
|
}
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
350
|
+
const g = "Accept-Language";
|
|
351
|
+
function z(t) {
|
|
352
|
+
return t ? void 0 : globalThis.SFDC_ENV?.language;
|
|
353
|
+
}
|
|
354
|
+
function Oe(t) {
|
|
355
|
+
const e = new Headers(t), r = z(e.has(g));
|
|
356
|
+
return r ? (e.set(g, r), e) : t;
|
|
357
|
+
}
|
|
358
|
+
const xe = (t) => {
|
|
359
|
+
const [e, r] = t, n = e instanceof Request && !r?.headers ? e.headers.has(g) : new Headers(r?.headers).has(g), a = z(n);
|
|
360
|
+
return a ? p(y(g, a, t)) : p(t);
|
|
361
|
+
}, Ae = "X-SFDC-Client-Name", $e = "X-SFDC-Client-Version", Ne = "@salesforce/platform-sdk", Pe = "12.9.0", qe = (t) => {
|
|
362
|
+
let e = y(Ae, Ne, t);
|
|
363
|
+
return e = y($e, Pe, e), p(e);
|
|
364
|
+
}, _e = "X-CSRF-Token";
|
|
365
|
+
function Te(t, e = {}) {
|
|
358
366
|
const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
|
|
359
367
|
return async (a) => {
|
|
360
368
|
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";
|
|
361
|
-
if (
|
|
369
|
+
if (R(n, i) || ke(c) && R(r, i)) {
|
|
362
370
|
const u = await t.getToken();
|
|
363
|
-
a = y(
|
|
371
|
+
a = y(_e, u, a);
|
|
364
372
|
}
|
|
365
|
-
return
|
|
373
|
+
return p(a);
|
|
366
374
|
};
|
|
367
375
|
}
|
|
368
|
-
function
|
|
376
|
+
function ke(t) {
|
|
369
377
|
const e = t.toLowerCase();
|
|
370
378
|
return e === "post" || e === "put" || e === "patch" || e === "delete";
|
|
371
379
|
}
|
|
372
|
-
function
|
|
380
|
+
function R(t, e) {
|
|
373
381
|
const r = new URL(e, globalThis.location?.href ?? "http://localhost");
|
|
374
382
|
return t.some((n) => r.pathname.includes(n));
|
|
375
383
|
}
|
|
376
|
-
function
|
|
377
|
-
const r =
|
|
384
|
+
function Re(t, e = {}) {
|
|
385
|
+
const r = Te(t, e);
|
|
378
386
|
async function n(a) {
|
|
379
387
|
const s = await r(a);
|
|
380
388
|
return fetch(s[0], s[1]);
|
|
381
389
|
}
|
|
382
390
|
return (a, s) => s ? s.applyRetry(async () => n(a)) : n(a);
|
|
383
391
|
}
|
|
384
|
-
const
|
|
385
|
-
class
|
|
392
|
+
const Ie = [400, 401, 403];
|
|
393
|
+
class Le extends re {
|
|
386
394
|
constructor(e) {
|
|
387
395
|
super(e), this.csrfTokenManager = e;
|
|
388
396
|
}
|
|
389
397
|
csrfTokenManager;
|
|
390
398
|
/**
|
|
391
|
-
*
|
|
399
|
+
* Returns true when a CSRF token issue caused the request to fail.
|
|
392
400
|
*/
|
|
393
401
|
async shouldRetry(e, r) {
|
|
394
|
-
return r.attempt >= 1 ? !1 :
|
|
402
|
+
return r.attempt >= 1 ? !1 : Ie.includes(e.status);
|
|
395
403
|
}
|
|
396
404
|
/**
|
|
397
|
-
* CSRF token refresh
|
|
405
|
+
* Returns zero, so the CSRF token refresh happens immediately with no added delay.
|
|
398
406
|
*/
|
|
399
407
|
async calculateDelay(e, r) {
|
|
400
408
|
return 0;
|
|
401
409
|
}
|
|
402
410
|
/**
|
|
403
|
-
*
|
|
411
|
+
* Refreshes the CSRF token before the retry service retries the request.
|
|
404
412
|
*
|
|
405
|
-
* @param _result - The failed response that triggered the retry
|
|
406
|
-
*
|
|
413
|
+
* @param _result - The failed response that triggered the retry. Unused; `shouldRetry`
|
|
414
|
+
* already validated it.
|
|
415
|
+
* @param _context - The current retry context. Unused, but required by the interface.
|
|
407
416
|
*/
|
|
408
417
|
async prepareRetry(e, r) {
|
|
409
418
|
await this.csrfTokenManager.refreshToken();
|
|
410
419
|
}
|
|
411
420
|
}
|
|
412
|
-
class
|
|
421
|
+
class Me {
|
|
413
422
|
constructor(e, r) {
|
|
414
423
|
this.endpoint = e, this.cacheName = r, this.tokenPromise = this.obtainToken();
|
|
415
424
|
}
|
|
@@ -418,16 +427,20 @@ class Re {
|
|
|
418
427
|
tokenPromise;
|
|
419
428
|
refreshPromise;
|
|
420
429
|
/**
|
|
421
|
-
* Returns the current token
|
|
422
|
-
*
|
|
430
|
+
* Returns the current CSRF token.
|
|
431
|
+
*
|
|
432
|
+
* @remarks
|
|
433
|
+
* The first call loads the token lazily, either from the cache or with a fetch request.
|
|
423
434
|
*/
|
|
424
435
|
async getToken() {
|
|
425
436
|
return this.tokenPromise;
|
|
426
437
|
}
|
|
427
438
|
/**
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
439
|
+
* Clears the cached CSRF token and fetches a fresh one.
|
|
440
|
+
*
|
|
441
|
+
* @remarks
|
|
442
|
+
* The returned promise resolves to the new token. When a refresh is already in progress,
|
|
443
|
+
* every caller shares the same in-flight promise.
|
|
431
444
|
*/
|
|
432
445
|
refreshToken() {
|
|
433
446
|
return this.refreshPromise || (this.refreshPromise = this.withCache((e) => e.delete(this.endpoint)).then(() => (this.tokenPromise = this.obtainToken(), this.tokenPromise)).finally(() => {
|
|
@@ -435,9 +448,9 @@ class Re {
|
|
|
435
448
|
})), this.refreshPromise;
|
|
436
449
|
}
|
|
437
450
|
/**
|
|
438
|
-
*
|
|
451
|
+
* Returns a CSRF token from the cache, or fetches a new one when the cache has none.
|
|
439
452
|
*
|
|
440
|
-
* @returns
|
|
453
|
+
* @returns The CSRF token.
|
|
441
454
|
*/
|
|
442
455
|
async obtainToken() {
|
|
443
456
|
let e = await this.withCache((a) => a.match(this.endpoint)), r = !1;
|
|
@@ -446,10 +459,10 @@ class Re {
|
|
|
446
459
|
return r && await this.withCache((a) => a.put(this.endpoint, e)), n;
|
|
447
460
|
}
|
|
448
461
|
/**
|
|
449
|
-
*
|
|
462
|
+
* Runs a callback against the Cache API, and returns `undefined` when the API is unavailable.
|
|
450
463
|
*
|
|
451
|
-
* @param callback -
|
|
452
|
-
* @returns The result of the callback, or undefined
|
|
464
|
+
* @param callback - The function that receives the cache instance and returns a promise.
|
|
465
|
+
* @returns The result of the callback, or `undefined` when the Cache API is not available.
|
|
453
466
|
*/
|
|
454
467
|
async withCache(e) {
|
|
455
468
|
if (this.cacheName && caches) {
|
|
@@ -459,29 +472,29 @@ class Re {
|
|
|
459
472
|
return;
|
|
460
473
|
}
|
|
461
474
|
}
|
|
462
|
-
const
|
|
463
|
-
function
|
|
475
|
+
const I = /* @__PURE__ */ new Map();
|
|
476
|
+
function Ve(t) {
|
|
464
477
|
const { endpoint: e, cacheName: r, ...n } = t.csrf;
|
|
465
|
-
let a =
|
|
466
|
-
return a || (a = new
|
|
478
|
+
let a = I.get(e);
|
|
479
|
+
return a || (a = new Me(e, r), I.set(e, a)), V(
|
|
467
480
|
{
|
|
468
|
-
retry:
|
|
469
|
-
request: [
|
|
481
|
+
retry: Re(a, n),
|
|
482
|
+
request: [qe, xe]
|
|
470
483
|
},
|
|
471
|
-
|
|
484
|
+
ne(new Le(a)).service
|
|
472
485
|
).service;
|
|
473
486
|
}
|
|
474
|
-
const
|
|
475
|
-
function
|
|
476
|
-
let e =
|
|
487
|
+
const L = /* @__PURE__ */ new Map();
|
|
488
|
+
function He(t) {
|
|
489
|
+
let e = L.get(t);
|
|
477
490
|
if (!e) {
|
|
478
|
-
const r =
|
|
479
|
-
e = { cache: r, cacheController: a, pubSub: s },
|
|
491
|
+
const r = se().service, n = oe(r).service, a = ae(r, n).service, s = ie().service;
|
|
492
|
+
e = { cache: r, cacheController: a, pubSub: s }, L.set(t, e);
|
|
480
493
|
}
|
|
481
494
|
return e;
|
|
482
495
|
}
|
|
483
|
-
function
|
|
484
|
-
const r =
|
|
496
|
+
function Ue(t, e) {
|
|
497
|
+
const r = He(t);
|
|
485
498
|
return {
|
|
486
499
|
shared: r,
|
|
487
500
|
services: {
|
|
@@ -492,7 +505,7 @@ function Le(t, e) {
|
|
|
492
505
|
};
|
|
493
506
|
}
|
|
494
507
|
const M = 300;
|
|
495
|
-
function
|
|
508
|
+
function Ge(t, e) {
|
|
496
509
|
try {
|
|
497
510
|
return JSON.parse(JSON.stringify(t));
|
|
498
511
|
} catch (r) {
|
|
@@ -502,19 +515,19 @@ function Ve(t, e) {
|
|
|
502
515
|
throw a.cause = r, a;
|
|
503
516
|
}
|
|
504
517
|
}
|
|
505
|
-
function
|
|
518
|
+
function Fe(t) {
|
|
506
519
|
if (typeof t == "object" && t.type === "max-age") {
|
|
507
520
|
const e = t.maxAge;
|
|
508
521
|
return Number.isFinite(e) && e >= 0 ? e : M;
|
|
509
522
|
}
|
|
510
523
|
return M;
|
|
511
524
|
}
|
|
512
|
-
class
|
|
525
|
+
class Qe extends ce {
|
|
513
526
|
constructor(e, r, n) {
|
|
514
|
-
super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables =
|
|
527
|
+
super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = Ge(
|
|
515
528
|
e.variables ?? {},
|
|
516
529
|
this.normalizedOperationName
|
|
517
|
-
), this.cacheControl = e.cacheControl, this.resolvedMaxAge =
|
|
530
|
+
), this.cacheControl = e.cacheControl, this.resolvedMaxAge = Fe(e.cacheControl), this.headers = e.headers, this.headersKey = be(e.headers);
|
|
518
531
|
}
|
|
519
532
|
url;
|
|
520
533
|
query;
|
|
@@ -529,7 +542,7 @@ class Ue extends oe {
|
|
|
529
542
|
this.url,
|
|
530
543
|
{
|
|
531
544
|
method: "POST",
|
|
532
|
-
headers:
|
|
545
|
+
headers: G(this.headers),
|
|
533
546
|
body: JSON.stringify({
|
|
534
547
|
query: this.query,
|
|
535
548
|
variables: this.normalizedVariables,
|
|
@@ -544,26 +557,27 @@ class Ue extends oe {
|
|
|
544
557
|
variables: this.normalizedVariables,
|
|
545
558
|
operationName: this.normalizedOperationName
|
|
546
559
|
};
|
|
547
|
-
return this.headersKey !== void 0 && (e.headers = this.headersKey),
|
|
560
|
+
return this.headersKey !== void 0 && (e.headers = this.headersKey), X(e);
|
|
548
561
|
}
|
|
549
562
|
/**
|
|
550
|
-
* Reads
|
|
563
|
+
* Reads the cached result for this command, or returns an error.
|
|
551
564
|
*
|
|
552
|
-
*
|
|
553
|
-
*
|
|
565
|
+
* @remarks
|
|
566
|
+
* When the result is missing or partial, this method returns a
|
|
567
|
+
* `DataNotFoundError` or a `DataIncompleteError` in the error response.
|
|
554
568
|
*
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
569
|
+
* A subclass must only read data from the cache here. It must not apply
|
|
570
|
+
* metadata, for example cache-control semantics, while it reads the data.
|
|
571
|
+
* The `CacheController` enforces that metadata separately.
|
|
558
572
|
*
|
|
559
|
-
* @param cache source of cached data
|
|
560
|
-
* @returns result or error from the cache
|
|
573
|
+
* @param cache - The source of the cached data.
|
|
574
|
+
* @returns The result or error from the cache.
|
|
561
575
|
*/
|
|
562
576
|
readFromCache(e) {
|
|
563
577
|
const r = this.buildKey(), n = e.get(r)?.value;
|
|
564
|
-
return n === void 0 ?
|
|
565
|
-
|
|
566
|
-
) :
|
|
578
|
+
return n === void 0 ? p(
|
|
579
|
+
A(new Y("No cached entry found for this query."))
|
|
580
|
+
) : p(x(n));
|
|
567
581
|
}
|
|
568
582
|
writeToCache(e, r) {
|
|
569
583
|
if (r.isOk() && r.value.data != null && Object.keys(r.value.data).length > 0) {
|
|
@@ -579,7 +593,7 @@ class Ue extends oe {
|
|
|
579
593
|
}
|
|
580
594
|
});
|
|
581
595
|
}
|
|
582
|
-
return
|
|
596
|
+
return p(void 0);
|
|
583
597
|
}
|
|
584
598
|
get cacheControlStrategyConfig() {
|
|
585
599
|
const e = Math.floor(Date.now() / 1e3);
|
|
@@ -593,41 +607,41 @@ class Ue extends oe {
|
|
|
593
607
|
return e.errors && e.errors.length > 0;
|
|
594
608
|
}
|
|
595
609
|
processFetchReturnValue(e) {
|
|
596
|
-
return this.responseHasErrors(e) ?
|
|
610
|
+
return this.responseHasErrors(e) ? A(new Z(e)) : x(e);
|
|
597
611
|
}
|
|
598
612
|
}
|
|
599
|
-
const
|
|
600
|
-
function
|
|
613
|
+
const je = "CACHE_MISS";
|
|
614
|
+
function Ke() {
|
|
601
615
|
return [
|
|
602
616
|
{
|
|
603
617
|
message: "No cached entry found for this query (cacheControl: 'only-if-cached').",
|
|
604
|
-
extensions: { code:
|
|
618
|
+
extensions: { code: je }
|
|
605
619
|
}
|
|
606
620
|
];
|
|
607
621
|
}
|
|
608
|
-
function
|
|
609
|
-
if (
|
|
622
|
+
function J(t) {
|
|
623
|
+
if (ee(t) && t.data && typeof t.data == "object") {
|
|
610
624
|
const e = t.data;
|
|
611
625
|
if (e.data != null)
|
|
612
626
|
return e.data;
|
|
613
627
|
}
|
|
614
628
|
}
|
|
615
|
-
function
|
|
629
|
+
function ze(t) {
|
|
616
630
|
return (e) => {
|
|
617
631
|
if (e.isOk()) {
|
|
618
632
|
const r = e.value;
|
|
619
|
-
|
|
633
|
+
v(r), t({ data: r, errors: void 0 });
|
|
620
634
|
} else {
|
|
621
|
-
const r =
|
|
622
|
-
r &&
|
|
635
|
+
const r = J(e.error);
|
|
636
|
+
r && v(r), t({ data: r, errors: m(e.error) });
|
|
623
637
|
}
|
|
624
638
|
};
|
|
625
639
|
}
|
|
626
|
-
async function
|
|
640
|
+
async function Je(t, e = !1) {
|
|
627
641
|
let r, n, a;
|
|
628
642
|
try {
|
|
629
643
|
const s = await t.execute();
|
|
630
|
-
s.isOk() ? (r = s.value.data,
|
|
644
|
+
s.isOk() ? (r = s.value.data, v(r), a = (o) => s.value.subscribe(o)) : (r = J(s.error.failure), r && v(r), n = e && r === void 0 ? Ke() : m(s.error.failure), a = (o) => s.error.subscribe(o));
|
|
631
645
|
} catch (s) {
|
|
632
646
|
n = m(s);
|
|
633
647
|
}
|
|
@@ -635,68 +649,70 @@ async function je(t, e = !1) {
|
|
|
635
649
|
data: r,
|
|
636
650
|
errors: n,
|
|
637
651
|
subscribe(s) {
|
|
638
|
-
return a ? a(
|
|
652
|
+
return a ? a(ze(s)) : S;
|
|
639
653
|
},
|
|
640
654
|
async refresh() {
|
|
641
655
|
await t.refresh();
|
|
642
656
|
}
|
|
643
657
|
};
|
|
644
658
|
}
|
|
645
|
-
function
|
|
659
|
+
function O(t) {
|
|
646
660
|
return {
|
|
647
661
|
data: void 0,
|
|
648
662
|
errors: t,
|
|
649
|
-
subscribe: () =>
|
|
663
|
+
subscribe: () => S,
|
|
650
664
|
refresh: $
|
|
651
665
|
};
|
|
652
666
|
}
|
|
653
|
-
function
|
|
667
|
+
function We({
|
|
654
668
|
bundle: t,
|
|
655
669
|
url: e,
|
|
656
|
-
executeRaw: r
|
|
670
|
+
executeRaw: r,
|
|
671
|
+
resolveEffectiveHeaders: n
|
|
657
672
|
}) {
|
|
658
|
-
const { services:
|
|
659
|
-
async function
|
|
660
|
-
query:
|
|
661
|
-
variables:
|
|
662
|
-
operationName:
|
|
663
|
-
cacheControl:
|
|
664
|
-
headers:
|
|
673
|
+
const { services: a } = t;
|
|
674
|
+
async function s({
|
|
675
|
+
query: o,
|
|
676
|
+
variables: i,
|
|
677
|
+
operationName: c,
|
|
678
|
+
cacheControl: h,
|
|
679
|
+
headers: u
|
|
665
680
|
}) {
|
|
666
|
-
const
|
|
667
|
-
if (
|
|
668
|
-
const d =
|
|
669
|
-
if (
|
|
670
|
-
return
|
|
681
|
+
const l = P(o);
|
|
682
|
+
if (l.isErr()) return O(l.error);
|
|
683
|
+
const d = l.value, f = q(d, c);
|
|
684
|
+
if (f !== "query")
|
|
685
|
+
return O([
|
|
671
686
|
{
|
|
672
|
-
message: `DataSDK.graphql.query() requires a GraphQL query, received ${
|
|
687
|
+
message: `DataSDK.graphql.query() requires a GraphQL query, received ${f}.`
|
|
673
688
|
}
|
|
674
689
|
]);
|
|
675
|
-
let
|
|
690
|
+
let w;
|
|
676
691
|
try {
|
|
677
|
-
|
|
692
|
+
const C = n ? n(u) : u;
|
|
693
|
+
w = new Qe(
|
|
678
694
|
{
|
|
679
695
|
query: N(d),
|
|
680
|
-
variables:
|
|
681
|
-
operationName:
|
|
682
|
-
cacheControl:
|
|
683
|
-
headers:
|
|
696
|
+
variables: i,
|
|
697
|
+
operationName: c,
|
|
698
|
+
cacheControl: h,
|
|
699
|
+
headers: C
|
|
684
700
|
},
|
|
685
|
-
|
|
701
|
+
a,
|
|
686
702
|
e
|
|
687
703
|
);
|
|
688
|
-
} catch (
|
|
689
|
-
return
|
|
704
|
+
} catch (C) {
|
|
705
|
+
return O(m(C));
|
|
690
706
|
}
|
|
691
|
-
return
|
|
707
|
+
return Je(w, h === "only-if-cached");
|
|
692
708
|
}
|
|
693
709
|
return {
|
|
694
|
-
query:
|
|
695
|
-
mutate: (
|
|
710
|
+
query: s,
|
|
711
|
+
mutate: (o) => Q(r, o)
|
|
696
712
|
};
|
|
697
713
|
}
|
|
698
|
-
const
|
|
699
|
-
class
|
|
714
|
+
const Be = 1, Xe = `@salesforce/platform-sdk-data_v${Be}`;
|
|
715
|
+
class Ye {
|
|
700
716
|
baseUrl;
|
|
701
717
|
pathData;
|
|
702
718
|
clientFetch;
|
|
@@ -704,22 +720,23 @@ class We {
|
|
|
704
720
|
apiVersion;
|
|
705
721
|
graphql;
|
|
706
722
|
constructor(e) {
|
|
707
|
-
const r =
|
|
708
|
-
this.baseUrl =
|
|
723
|
+
const r = Ze();
|
|
724
|
+
this.baseUrl = et(e?.basePath ?? r.apiPath), this.apiVersion = e?.apiVersion ?? _, this.pathData = K(this.apiVersion);
|
|
709
725
|
const n = `${this.pathData}/ui-api`, a = `${this.pathData}/graphql`;
|
|
710
|
-
this.onStatus = e?.onStatus ?? {}, this.clientFetch =
|
|
726
|
+
this.onStatus = e?.onStatus ?? {}, this.clientFetch = Ve({
|
|
711
727
|
csrf: {
|
|
712
728
|
endpoint: `${this.baseUrl}${n}/session/csrf`,
|
|
713
|
-
cacheName:
|
|
729
|
+
cacheName: Xe,
|
|
714
730
|
protectedUrls: ["services/data/v", "services/apexrest"],
|
|
715
731
|
alwaysProtectedUrls: ["services/apexrest"]
|
|
716
732
|
}
|
|
717
733
|
});
|
|
718
|
-
const s = (i, c) => this.fetch(i, c), o =
|
|
719
|
-
this.graphql =
|
|
734
|
+
const s = (i, c) => this.fetch(i, c), o = Ue(`${this.baseUrl}${this.pathData}`, s);
|
|
735
|
+
this.graphql = We({
|
|
720
736
|
bundle: o,
|
|
721
737
|
url: a,
|
|
722
|
-
executeRaw: this.executeRawGraphQL.bind(this)
|
|
738
|
+
executeRaw: this.executeRawGraphQL.bind(this),
|
|
739
|
+
resolveEffectiveHeaders: Oe
|
|
723
740
|
});
|
|
724
741
|
}
|
|
725
742
|
async fetch(e, r) {
|
|
@@ -727,10 +744,12 @@ class We {
|
|
|
727
744
|
return await this.onStatus[a.status]?.(), a;
|
|
728
745
|
}
|
|
729
746
|
/**
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
733
|
-
*
|
|
747
|
+
* Sends a raw GraphQL POST request.
|
|
748
|
+
*
|
|
749
|
+
* @remarks
|
|
750
|
+
* On the WebApp surface, this is the mutate-only path: `graphql.mutate` calls this method
|
|
751
|
+
* directly. The `graphql.query` (cache) path does not route through this method. The OneStore
|
|
752
|
+
* cache command in `@conduit-client` issues its own fetch and parses the response itself.
|
|
734
753
|
*/
|
|
735
754
|
async executeRawGraphQL({
|
|
736
755
|
query: e,
|
|
@@ -741,13 +760,16 @@ class We {
|
|
|
741
760
|
const s = `${this.pathData}/graphql`, o = await this.fetch(s, {
|
|
742
761
|
method: "POST",
|
|
743
762
|
body: JSON.stringify({ query: e, variables: r, operationName: n }),
|
|
744
|
-
headers:
|
|
763
|
+
headers: G(a)
|
|
745
764
|
});
|
|
746
|
-
return
|
|
765
|
+
return F(o, "WebApp", s);
|
|
747
766
|
}
|
|
748
767
|
/**
|
|
749
|
-
*
|
|
750
|
-
*
|
|
768
|
+
* Converts a relative URL to an absolute Salesforce URL.
|
|
769
|
+
*
|
|
770
|
+
* @remarks
|
|
771
|
+
* Code Builder deployments need this conversion, because they structure Salesforce URLs
|
|
772
|
+
* differently.
|
|
751
773
|
*/
|
|
752
774
|
applySalesforceBase(e) {
|
|
753
775
|
if (typeof e == "string") {
|
|
@@ -759,17 +781,17 @@ class We {
|
|
|
759
781
|
return e;
|
|
760
782
|
}
|
|
761
783
|
}
|
|
762
|
-
function
|
|
784
|
+
function Ze() {
|
|
763
785
|
return {
|
|
764
786
|
apiPath: globalThis.SFDC_ENV?.apiPath
|
|
765
787
|
};
|
|
766
788
|
}
|
|
767
|
-
function
|
|
789
|
+
function et(t) {
|
|
768
790
|
if (!t || t === "/") return "";
|
|
769
791
|
let e = t;
|
|
770
792
|
return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
771
793
|
}
|
|
772
|
-
function
|
|
794
|
+
function tt(t) {
|
|
773
795
|
const e = t, r = typeof e == "object" && e !== null ? e : void 0, n = r !== void 0 && "setup" in r, a = n ? r : r?.extension, s = n ? a?.name : r?.as;
|
|
774
796
|
if (typeof a?.setup != "function")
|
|
775
797
|
throw new Error("Extension entry cannot attach: it is missing a setup function.");
|
|
@@ -783,14 +805,14 @@ function Ye(t) {
|
|
|
783
805
|
label: s === a.name ? `"${a.name}"` : `"${a.name}" (aliased as "${s}")`
|
|
784
806
|
};
|
|
785
807
|
}
|
|
786
|
-
async function
|
|
808
|
+
async function rt(t, e, r) {
|
|
787
809
|
if (e.length === 0)
|
|
788
810
|
return t;
|
|
789
811
|
if ("ext" in t)
|
|
790
812
|
throw new Error(
|
|
791
813
|
'Cannot attach extensions: the base SDK already declares an "ext" member, which the extension container reserves.'
|
|
792
814
|
);
|
|
793
|
-
const n = e.map(
|
|
815
|
+
const n = e.map(tt);
|
|
794
816
|
r?.preflight?.(n, t);
|
|
795
817
|
const a = Object.create(t), s = /* @__PURE__ */ Object.create(null), o = (h) => {
|
|
796
818
|
throw new Error(`Cannot write "ext.${String(h)}" — ext is immutable once attached.`);
|
|
@@ -806,10 +828,11 @@ async function Ze(t, e, r) {
|
|
|
806
828
|
deleteProperty(h, u) {
|
|
807
829
|
return o(u);
|
|
808
830
|
},
|
|
809
|
-
// Without these two, `preventExtensions
|
|
810
|
-
// real `store
|
|
811
|
-
//
|
|
812
|
-
//
|
|
831
|
+
// Without these two traps, `preventExtensions` and `setPrototypeOf`
|
|
832
|
+
// fall through to the real `store`, because no per-property trap
|
|
833
|
+
// catches them. The first would silently block later extensions from
|
|
834
|
+
// mounting. The second could inject a readable property, through the
|
|
835
|
+
// prototype chain, that no extension ever returned.
|
|
813
836
|
preventExtensions() {
|
|
814
837
|
return i("prevent extensions on");
|
|
815
838
|
},
|
|
@@ -823,19 +846,19 @@ async function Ze(t, e, r) {
|
|
|
823
846
|
writable: !1,
|
|
824
847
|
configurable: !1
|
|
825
848
|
});
|
|
826
|
-
for (const { extension: h, mountName: u, label:
|
|
849
|
+
for (const { extension: h, mountName: u, label: l } of n) {
|
|
827
850
|
if (Object.hasOwn(s, u))
|
|
828
851
|
throw new Error(
|
|
829
|
-
`Extension ${
|
|
852
|
+
`Extension ${l} cannot attach: "${u}" is already defined by another extension.`
|
|
830
853
|
);
|
|
831
|
-
let
|
|
854
|
+
let d;
|
|
832
855
|
try {
|
|
833
|
-
|
|
856
|
+
d = await h.setup(a);
|
|
834
857
|
} catch (f) {
|
|
835
|
-
throw new Error(`Extension ${
|
|
858
|
+
throw new Error(`Extension ${l} failed during setup.`, { cause: f });
|
|
836
859
|
}
|
|
837
860
|
Object.defineProperty(s, u, {
|
|
838
|
-
value:
|
|
861
|
+
value: d,
|
|
839
862
|
enumerable: !0,
|
|
840
863
|
writable: !1,
|
|
841
864
|
configurable: !1
|
|
@@ -843,25 +866,25 @@ async function Ze(t, e, r) {
|
|
|
843
866
|
}
|
|
844
867
|
return Object.freeze(s), a;
|
|
845
868
|
}
|
|
846
|
-
function
|
|
869
|
+
function mt(t, ...e) {
|
|
847
870
|
let r = t[0] ?? "";
|
|
848
871
|
for (let n = 0; n < e.length; n += 1)
|
|
849
872
|
r += String(e[n]) + (t[n + 1] ?? "");
|
|
850
873
|
return r;
|
|
851
874
|
}
|
|
852
|
-
function
|
|
875
|
+
function yt(t) {
|
|
853
876
|
return t;
|
|
854
877
|
}
|
|
855
|
-
async function
|
|
878
|
+
async function nt(t) {
|
|
856
879
|
try {
|
|
857
|
-
switch (await
|
|
880
|
+
switch (await W(t?.surface)) {
|
|
858
881
|
case b.OpenAI:
|
|
859
|
-
return new
|
|
882
|
+
return new De();
|
|
860
883
|
case b.WebApp:
|
|
861
884
|
case b.MicroFrontend:
|
|
862
|
-
return new
|
|
885
|
+
return new Ye(t?.webapp);
|
|
863
886
|
case b.Mosaic:
|
|
864
|
-
return new
|
|
887
|
+
return new Ee(t?.mosaic);
|
|
865
888
|
case b.MCPApps:
|
|
866
889
|
return {};
|
|
867
890
|
default:
|
|
@@ -871,19 +894,19 @@ async function et(t) {
|
|
|
871
894
|
return {};
|
|
872
895
|
}
|
|
873
896
|
}
|
|
874
|
-
function
|
|
875
|
-
return
|
|
897
|
+
function bt(t) {
|
|
898
|
+
return B(
|
|
876
899
|
(async () => {
|
|
877
|
-
const e = await
|
|
878
|
-
return
|
|
879
|
-
preflight:
|
|
900
|
+
const e = await nt(t);
|
|
901
|
+
return rt(e, t?.extensions ?? [], {
|
|
902
|
+
preflight: he
|
|
880
903
|
});
|
|
881
904
|
})(),
|
|
882
905
|
"createDataSDK"
|
|
883
906
|
);
|
|
884
907
|
}
|
|
885
908
|
export {
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
909
|
+
bt as createDataSDK,
|
|
910
|
+
yt as defineDataExtension,
|
|
911
|
+
mt as gql
|
|
889
912
|
};
|