@salesforce/platform-sdk 12.12.1 → 12.13.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/index.js +1 -1
- package/dist/{analytics-wESbWdca.js → analytics-TRyVm9Ub.js} +1 -1
- package/dist/app/index.js +1 -1
- package/dist/{capabilities-B0mU0_G0.js → capabilities-B3Raifjg.js} +2 -1
- package/dist/chat/index.d.ts.map +1 -1
- package/dist/chat/index.js +11 -10
- package/dist/core/capabilities.d.ts +2 -2
- package/dist/core/capabilities.d.ts.map +1 -1
- package/dist/core/data.d.ts +5 -5
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/mcpapps-session.d.ts +19 -8
- package/dist/core/mcpapps-session.d.ts.map +1 -1
- package/dist/core/surface.d.ts +12 -10
- package/dist/core/surface.d.ts.map +1 -1
- package/dist/core/view.d.ts +118 -4
- package/dist/core/view.d.ts.map +1 -1
- package/dist/data/index.d.ts +44 -2
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +314 -248
- package/dist/data/mcpapps/index.d.ts +9 -0
- package/dist/data/mcpapps/index.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lightning/index.d.ts.map +1 -1
- package/dist/lightning/index.js +5 -4
- package/dist/{surface-DWDgqdpN.js → surface-Cg3eyRpj.js} +44 -26
- package/dist/ui-embedding/session.js +1 -1
- package/dist/view/embedding.d.ts +18 -1
- package/dist/view/embedding.d.ts.map +1 -1
- package/dist/view/index.d.ts +1 -1
- package/dist/view/index.d.ts.map +1 -1
- package/dist/view/index.js +79 -35
- package/dist/view/utils.d.ts +5 -0
- package/dist/view/utils.d.ts.map +1 -1
- package/docs/data/02-caching-and-freshness.md +3 -3
- package/docs/data/03-reactive-handle-lifecycle.md +2 -2
- package/docs/data/04-surfaces-and-guards.md +35 -4
- package/package.json +3 -3
package/dist/data/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { g as
|
|
2
|
-
import { w as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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 Y, S as m, a as I } from "../surface-Cg3eyRpj.js";
|
|
2
|
+
import { w as Z } from "../sdk-promise-D0sy7OW1.js";
|
|
3
|
+
import { print as N, parse as ee } from "@conduit-client/onestore-graphql-parser/v1";
|
|
4
|
+
import { ok as q, err as x, resolvedPromiseLike as p, stableJSONStringify as te, DataNotFoundError as re, UserVisibleError as ne, deepFreeze as v, isUserVisibleError as se } from "@conduit-client/utils";
|
|
5
|
+
import { buildServiceDescriptor as j, setHeader as b } from "@conduit-client/service-fetch-network/v1";
|
|
6
|
+
import { RetryPolicy as ae, buildServiceDescriptor as oe } from "@conduit-client/service-retry/v1";
|
|
7
|
+
import { buildServiceDescriptor as ie } from "@conduit-client/service-cache/v1";
|
|
8
|
+
import { buildServiceDescriptor as ce } from "@conduit-client/service-cache-control/v1";
|
|
9
|
+
import { buildInMemoryCacheInclusionPolicyService as ue } from "@conduit-client/service-cache-inclusion-policy/v1";
|
|
10
|
+
import { buildServiceDescriptor as he } from "@conduit-client/service-pubsub/v1";
|
|
11
|
+
import { HttpCacheControlCommand as le } from "@conduit-client/command-http-cache-control/v1";
|
|
12
|
+
const S = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
13
|
+
function de(t, e) {
|
|
14
|
+
const [, r, n] = S.exec(t), [, a, s] = S.exec(e);
|
|
15
15
|
return Number(r) - Number(a) || Number(n) - Number(s);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function pe(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" || !S.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 (!S.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 (de(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,121 +35,23 @@ function he(t, e) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
function de(t, e) {
|
|
40
|
-
if (!t) return !1;
|
|
41
|
-
const r = e.toLowerCase();
|
|
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
|
-
}
|
|
44
|
-
function H(t, e, r) {
|
|
45
|
-
return !e || !r ? !1 : de(t?.headers, le);
|
|
46
|
-
}
|
|
47
|
-
function D(t, e, r) {
|
|
48
|
-
return e ? r ? y("Cookie", `sid=${e}`, t) : y("Authorization", `Bearer ${e}`, t) : t;
|
|
49
|
-
}
|
|
50
|
-
function pe({
|
|
51
|
-
baseUrl: t,
|
|
52
|
-
accessToken: e,
|
|
53
|
-
lightningDomain: r,
|
|
54
|
-
isInternal: n = !1
|
|
55
|
-
}) {
|
|
56
|
-
return (a) => {
|
|
57
|
-
const [s, o] = a;
|
|
58
|
-
if (typeof s == "string" && !s.startsWith("http") && t) {
|
|
59
|
-
const i = s.startsWith("/") ? s : `/${s}`;
|
|
60
|
-
return H(o, n, r) ? p(
|
|
61
|
-
D([`${r}${i}`, o], e, !0)
|
|
62
|
-
) : p(D([`${t}${i}`, o], e, !1));
|
|
63
|
-
}
|
|
64
|
-
return p(D(a, e, !1));
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function fe(t) {
|
|
68
|
-
const e = t.baseUrl || t.accessToken ? [pe(t)] : [];
|
|
69
|
-
return V({ request: e }).service;
|
|
70
|
-
}
|
|
71
|
-
const me = {
|
|
72
|
-
"Content-Type": "application/json",
|
|
73
|
-
Accept: "application/json",
|
|
74
|
-
"X-Chatter-Entity-Encoding": "false"
|
|
75
|
-
};
|
|
76
|
-
function ye(t) {
|
|
77
|
-
if (t instanceof Headers) {
|
|
78
|
-
const e = [];
|
|
79
|
-
return t.forEach((r, n) => e.push([n, r])), e;
|
|
80
|
-
}
|
|
81
|
-
return Array.isArray(t) ? t.map(([e, r]) => [e, r]) : Object.entries(t);
|
|
82
|
-
}
|
|
83
|
-
function U(t, e) {
|
|
84
|
-
if (e === void 0) return { ...t };
|
|
85
|
-
const r = { ...t }, n = /* @__PURE__ */ new Map();
|
|
86
|
-
for (const s of Object.keys(r)) n.set(s.toLowerCase(), s);
|
|
87
|
-
const a = /* @__PURE__ */ new Set();
|
|
88
|
-
for (const [s, o] of ye(e)) {
|
|
89
|
-
const i = s.toLowerCase(), c = n.get(i);
|
|
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
|
-
}
|
|
92
|
-
return r;
|
|
93
|
-
}
|
|
94
|
-
function G(t) {
|
|
95
|
-
return U(me, t);
|
|
96
|
-
}
|
|
97
|
-
function be(t) {
|
|
98
|
-
if (t === void 0) return;
|
|
99
|
-
const e = {};
|
|
100
|
-
return new Headers(t).forEach((r, n) => {
|
|
101
|
-
e[n] = r;
|
|
102
|
-
}), Object.keys(e).length > 0 ? e : void 0;
|
|
103
|
-
}
|
|
104
|
-
const ge = 512;
|
|
105
|
-
function we(t) {
|
|
106
|
-
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
107
|
-
}
|
|
108
|
-
class T extends Error {
|
|
109
|
-
status;
|
|
110
|
-
url;
|
|
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(we(e.body.slice(0, ge)))})`;
|
|
113
|
-
super(
|
|
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
|
-
), this.name = "GraphQLTransportError", this.status = e.status, this.url = e.url, this.cause = e.cause;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
async function F(t, e, r) {
|
|
119
|
-
const n = await t.text();
|
|
120
|
-
let a;
|
|
121
|
-
try {
|
|
122
|
-
a = JSON.parse(n);
|
|
123
|
-
} catch (s) {
|
|
124
|
-
throw new T({ surface: e, url: r, status: t.status, body: n, cause: s });
|
|
125
|
-
}
|
|
126
|
-
if (a === null || typeof a != "object")
|
|
127
|
-
throw new T({
|
|
128
|
-
surface: e,
|
|
129
|
-
url: r,
|
|
130
|
-
status: t.status,
|
|
131
|
-
body: n,
|
|
132
|
-
cause: new Error("Parsed GraphQL response body was not a JSON object")
|
|
133
|
-
});
|
|
134
|
-
return a;
|
|
135
|
-
}
|
|
136
|
-
const S = () => {
|
|
38
|
+
const E = () => {
|
|
137
39
|
}, $ = async () => {
|
|
138
40
|
};
|
|
139
41
|
function P(t) {
|
|
140
42
|
try {
|
|
141
|
-
return
|
|
43
|
+
return q(ee(t));
|
|
142
44
|
} catch (e) {
|
|
143
|
-
return
|
|
45
|
+
return x(y(e));
|
|
144
46
|
}
|
|
145
47
|
}
|
|
146
|
-
function
|
|
48
|
+
function _(t, e) {
|
|
147
49
|
const r = t.definitions.filter(
|
|
148
50
|
(n) => n.kind === "OperationDefinition"
|
|
149
51
|
);
|
|
150
52
|
return r.length === 0 ? "unknown" : r.length === 1 ? e === void 0 || r[0].name?.value === e ? r[0].operation : "unknown" : e === void 0 ? "unknown" : r.find((n) => n.name?.value === e)?.operation ?? "unknown";
|
|
151
53
|
}
|
|
152
|
-
function
|
|
54
|
+
function y(t) {
|
|
153
55
|
if (t && typeof t == "object" && "data" in t) {
|
|
154
56
|
const e = t.data;
|
|
155
57
|
if (e && typeof e == "object" && "errors" in e && Array.isArray(e.errors))
|
|
@@ -157,10 +59,10 @@ function m(t) {
|
|
|
157
59
|
}
|
|
158
60
|
return t instanceof Error ? [{ message: t.message }] : typeof t == "string" ? [{ message: t }] : [{ message: "Unknown error" }];
|
|
159
61
|
}
|
|
160
|
-
async function
|
|
62
|
+
async function F(t, { mutation: e, variables: r, operationName: n, headers: a }) {
|
|
161
63
|
const s = P(e);
|
|
162
64
|
if (s.isErr()) return { data: void 0, errors: s.error };
|
|
163
|
-
const o = s.value, i =
|
|
65
|
+
const o = s.value, i = _(o, n);
|
|
164
66
|
if (i !== "mutation")
|
|
165
67
|
return {
|
|
166
68
|
data: void 0,
|
|
@@ -185,10 +87,10 @@ async function Q(t, { mutation: e, variables: r, operationName: n, headers: a })
|
|
|
185
87
|
errors: c.errors
|
|
186
88
|
};
|
|
187
89
|
} catch (c) {
|
|
188
|
-
return { data: void 0, errors:
|
|
90
|
+
return { data: void 0, errors: y(c) };
|
|
189
91
|
}
|
|
190
92
|
}
|
|
191
|
-
function
|
|
93
|
+
function T(t) {
|
|
192
94
|
function e(n, a, s, o) {
|
|
193
95
|
return t(
|
|
194
96
|
{
|
|
@@ -203,7 +105,7 @@ function j(t) {
|
|
|
203
105
|
data: i.data ?? void 0,
|
|
204
106
|
errors: i.errors
|
|
205
107
|
}),
|
|
206
|
-
(i) => ({ data: void 0, errors:
|
|
108
|
+
(i) => ({ data: void 0, errors: y(i) })
|
|
207
109
|
);
|
|
208
110
|
}
|
|
209
111
|
async function r({
|
|
@@ -217,10 +119,10 @@ function j(t) {
|
|
|
217
119
|
return {
|
|
218
120
|
data: void 0,
|
|
219
121
|
errors: i.error,
|
|
220
|
-
subscribe: () =>
|
|
122
|
+
subscribe: () => E,
|
|
221
123
|
refresh: $
|
|
222
124
|
};
|
|
223
|
-
const c = i.value, h =
|
|
125
|
+
const c = i.value, h = _(c, s);
|
|
224
126
|
if (h !== "query")
|
|
225
127
|
return {
|
|
226
128
|
data: void 0,
|
|
@@ -229,7 +131,7 @@ function j(t) {
|
|
|
229
131
|
message: `DataSDK.graphql.query() requires a GraphQL query, received ${h}.`
|
|
230
132
|
}
|
|
231
133
|
],
|
|
232
|
-
subscribe: () =>
|
|
134
|
+
subscribe: () => E,
|
|
233
135
|
refresh: $
|
|
234
136
|
};
|
|
235
137
|
const u = /* @__PURE__ */ new Set(), l = a, d = await e(c, l, s, o);
|
|
@@ -249,18 +151,180 @@ function j(t) {
|
|
|
249
151
|
}
|
|
250
152
|
return {
|
|
251
153
|
query: r,
|
|
252
|
-
mutate: (n) =>
|
|
154
|
+
mutate: (n) => F(t, n)
|
|
253
155
|
};
|
|
254
156
|
}
|
|
255
|
-
const
|
|
256
|
-
function
|
|
157
|
+
const D = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
|
|
158
|
+
function L(t = D) {
|
|
257
159
|
return `/services/data/v${t}`;
|
|
258
160
|
}
|
|
161
|
+
function fe(t) {
|
|
162
|
+
if (Array.isArray(t)) {
|
|
163
|
+
for (const e of t)
|
|
164
|
+
if (!(e?.type !== "text" || !e.text))
|
|
165
|
+
try {
|
|
166
|
+
const r = JSON.parse(e.text);
|
|
167
|
+
if (r?.status_code !== void 0 || r?.error_code !== void 0)
|
|
168
|
+
return r;
|
|
169
|
+
} catch {
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function ye(t) {
|
|
174
|
+
const e = t;
|
|
175
|
+
return e?.code === -32601 || e?.code === -32602 && typeof e.message == "string" && /^Unknown tool\b/i.test(e.message);
|
|
176
|
+
}
|
|
177
|
+
function k(t) {
|
|
178
|
+
if (typeof t != "object" || Array.isArray(t)) return !1;
|
|
179
|
+
if (!Object.hasOwn(t, "errors")) return Object.hasOwn(t, "data");
|
|
180
|
+
const { errors: e } = t;
|
|
181
|
+
return Array.isArray(e) && e.every(
|
|
182
|
+
(r) => r !== null && typeof r == "object" && !Array.isArray(r) && typeof r.message == "string"
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
class R {
|
|
186
|
+
graphql;
|
|
187
|
+
apiVersion;
|
|
188
|
+
#e;
|
|
189
|
+
constructor(e, r) {
|
|
190
|
+
if (this.#e = e, this.apiVersion = r?.apiVersion ?? D, typeof this.apiVersion != "string" || !/^(0|[1-9]\d*)\.(0|[1-9]\d*)(?![\s\S])/.test(this.apiVersion))
|
|
191
|
+
throw new TypeError("Invalid Data SDK API version.");
|
|
192
|
+
this.graphql = T(this.#t.bind(this));
|
|
193
|
+
}
|
|
194
|
+
async #t({ query: e, variables: r, operationName: n }, a) {
|
|
195
|
+
const s = {
|
|
196
|
+
query: e,
|
|
197
|
+
...r != null ? { variables: r } : {},
|
|
198
|
+
...n != null ? { operationName: n } : {}
|
|
199
|
+
}, o = a === "query" ? { method: "GET", queryParams: { queryInput: JSON.stringify(s) } } : { method: "POST", body: s }, i = await this.#e.request("tools/call", {
|
|
200
|
+
name: a === "query" ? "dispatch_readonly" : "dispatch",
|
|
201
|
+
arguments: {
|
|
202
|
+
url: `${L(this.apiVersion)}/graphql`,
|
|
203
|
+
...o
|
|
204
|
+
}
|
|
205
|
+
}).catch((d) => {
|
|
206
|
+
throw new Error(
|
|
207
|
+
ye(d) ? "Data SDK GraphQL dispatch tool is unavailable." : "Data SDK GraphQL request failed.",
|
|
208
|
+
{ cause: d }
|
|
209
|
+
);
|
|
210
|
+
}), c = i?.structuredContent ?? fe(i?.content), h = c?.status_code, u = c?.body, l = i?.isError || c?.error_code !== void 0;
|
|
211
|
+
if (typeof h != "number" || !Number.isInteger(h))
|
|
212
|
+
throw new Error(
|
|
213
|
+
l ? "Data SDK GraphQL request failed." : "Data SDK GraphQL response is malformed."
|
|
214
|
+
);
|
|
215
|
+
if (l || h < 200 || h >= 300)
|
|
216
|
+
throw u != null && k(u) && u.errors?.length ? (
|
|
217
|
+
// This method is wrapped by `buildUncachedGraphQL`, which handles thrown {data} errors
|
|
218
|
+
{ data: { errors: u.errors } }
|
|
219
|
+
) : new Error("Data SDK GraphQL request failed.");
|
|
220
|
+
if (u == null || !k(u))
|
|
221
|
+
throw new Error("Data SDK GraphQL response is malformed.");
|
|
222
|
+
return u;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const me = "X-Salesforce-First-Party";
|
|
226
|
+
function be(t, e) {
|
|
227
|
+
if (!t) return !1;
|
|
228
|
+
const r = e.toLowerCase();
|
|
229
|
+
return t instanceof Headers ? t.has(e) : Array.isArray(t) ? t.some(([n]) => n.toLowerCase() === r) : Object.keys(t).some((n) => n.toLowerCase() === r);
|
|
230
|
+
}
|
|
231
|
+
function K(t, e, r) {
|
|
232
|
+
return !e || !r ? !1 : be(t?.headers, me);
|
|
233
|
+
}
|
|
234
|
+
function A(t, e, r) {
|
|
235
|
+
return e ? r ? b("Cookie", `sid=${e}`, t) : b("Authorization", `Bearer ${e}`, t) : t;
|
|
236
|
+
}
|
|
237
|
+
function ge({
|
|
238
|
+
baseUrl: t,
|
|
239
|
+
accessToken: e,
|
|
240
|
+
lightningDomain: r,
|
|
241
|
+
isInternal: n = !1
|
|
242
|
+
}) {
|
|
243
|
+
return (a) => {
|
|
244
|
+
const [s, o] = a;
|
|
245
|
+
if (typeof s == "string" && !s.startsWith("http") && t) {
|
|
246
|
+
const i = s.startsWith("/") ? s : `/${s}`;
|
|
247
|
+
return K(o, n, r) ? p(
|
|
248
|
+
A([`${r}${i}`, o], e, !0)
|
|
249
|
+
) : p(A([`${t}${i}`, o], e, !1));
|
|
250
|
+
}
|
|
251
|
+
return p(A(a, e, !1));
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function we(t) {
|
|
255
|
+
const e = t.baseUrl || t.accessToken ? [ge(t)] : [];
|
|
256
|
+
return j({ request: e }).service;
|
|
257
|
+
}
|
|
259
258
|
const ve = {
|
|
259
|
+
"Content-Type": "application/json",
|
|
260
|
+
Accept: "application/json",
|
|
261
|
+
"X-Chatter-Entity-Encoding": "false"
|
|
262
|
+
};
|
|
263
|
+
function Se(t) {
|
|
264
|
+
if (t instanceof Headers) {
|
|
265
|
+
const e = [];
|
|
266
|
+
return t.forEach((r, n) => e.push([n, r])), e;
|
|
267
|
+
}
|
|
268
|
+
return Array.isArray(t) ? t.map(([e, r]) => [e, r]) : Object.entries(t);
|
|
269
|
+
}
|
|
270
|
+
function z(t, e) {
|
|
271
|
+
if (e === void 0) return { ...t };
|
|
272
|
+
const r = { ...t }, n = /* @__PURE__ */ new Map();
|
|
273
|
+
for (const s of Object.keys(r)) n.set(s.toLowerCase(), s);
|
|
274
|
+
const a = /* @__PURE__ */ new Set();
|
|
275
|
+
for (const [s, o] of Se(e)) {
|
|
276
|
+
const i = s.toLowerCase(), c = n.get(i);
|
|
277
|
+
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));
|
|
278
|
+
}
|
|
279
|
+
return r;
|
|
280
|
+
}
|
|
281
|
+
function J(t) {
|
|
282
|
+
return z(ve, t);
|
|
283
|
+
}
|
|
284
|
+
function Ee(t) {
|
|
285
|
+
if (t === void 0) return;
|
|
286
|
+
const e = {};
|
|
287
|
+
return new Headers(t).forEach((r, n) => {
|
|
288
|
+
e[n] = r;
|
|
289
|
+
}), Object.keys(e).length > 0 ? e : void 0;
|
|
290
|
+
}
|
|
291
|
+
const De = 512;
|
|
292
|
+
function Ce(t) {
|
|
293
|
+
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
294
|
+
}
|
|
295
|
+
class M extends Error {
|
|
296
|
+
status;
|
|
297
|
+
url;
|
|
298
|
+
constructor(e) {
|
|
299
|
+
const r = e.body.length === 0 ? "empty response body" : "unparseable response body", n = e.body.length === 0 ? "" : ` (starts with: ${JSON.stringify(Ce(e.body.slice(0, De)))})`;
|
|
300
|
+
super(
|
|
301
|
+
`${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.`
|
|
302
|
+
), this.name = "GraphQLTransportError", this.status = e.status, this.url = e.url, this.cause = e.cause;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
async function W(t, e, r) {
|
|
306
|
+
const n = await t.text();
|
|
307
|
+
let a;
|
|
308
|
+
try {
|
|
309
|
+
a = JSON.parse(n);
|
|
310
|
+
} catch (s) {
|
|
311
|
+
throw new M({ surface: e, url: r, status: t.status, body: n, cause: s });
|
|
312
|
+
}
|
|
313
|
+
if (a === null || typeof a != "object")
|
|
314
|
+
throw new M({
|
|
315
|
+
surface: e,
|
|
316
|
+
url: r,
|
|
317
|
+
status: t.status,
|
|
318
|
+
body: n,
|
|
319
|
+
cause: new Error("Parsed GraphQL response body was not a JSON object")
|
|
320
|
+
});
|
|
321
|
+
return a;
|
|
322
|
+
}
|
|
323
|
+
const Ae = {
|
|
260
324
|
"Content-Type": "application/json",
|
|
261
325
|
Accept: "application/json"
|
|
262
326
|
};
|
|
263
|
-
class
|
|
327
|
+
class Oe {
|
|
264
328
|
clientFetch;
|
|
265
329
|
pathData;
|
|
266
330
|
baseUrl;
|
|
@@ -269,18 +333,18 @@ class Ee {
|
|
|
269
333
|
apiVersion;
|
|
270
334
|
graphql;
|
|
271
335
|
constructor(e) {
|
|
272
|
-
const r =
|
|
336
|
+
const r = qe(), n = V(e?.instanceUrl ?? r.instanceUrl), a = e?.accessToken ?? r.accessToken, s = V(
|
|
273
337
|
e?.lightningDomain ?? r.lightningDomain
|
|
274
338
|
), o = e?.isInternal ?? r.isInternal ?? !1;
|
|
275
|
-
this.apiVersion = e?.apiVersion ?? r.apiVersion ??
|
|
339
|
+
this.apiVersion = e?.apiVersion ?? r.apiVersion ?? D, this.pathData = L(this.apiVersion), this.baseUrl = n || void 0, this.lightningDomain = s || void 0, this.isInternal = o, this.clientFetch = we({
|
|
276
340
|
baseUrl: n || void 0,
|
|
277
341
|
accessToken: a,
|
|
278
342
|
lightningDomain: this.lightningDomain,
|
|
279
343
|
isInternal: o
|
|
280
|
-
}), this.graphql =
|
|
344
|
+
}), this.graphql = T(this.executeRawGraphQL.bind(this));
|
|
281
345
|
}
|
|
282
346
|
async executeRawGraphQL({ query: e, variables: r, operationName: n, headers: a }, s) {
|
|
283
|
-
const o = `${this.pathData}/graphql`, i =
|
|
347
|
+
const o = `${this.pathData}/graphql`, i = z(Ae, a), c = K({ headers: i }, this.isInternal, this.lightningDomain) && !!this.baseUrl;
|
|
284
348
|
if (c && s === "mutation")
|
|
285
349
|
return {
|
|
286
350
|
data: void 0,
|
|
@@ -303,10 +367,10 @@ class Ee {
|
|
|
303
367
|
headers: i
|
|
304
368
|
}
|
|
305
369
|
}, l = await this.clientFetch(h, u), d = c ? `${o}?queryInput=<redacted>` : h;
|
|
306
|
-
return
|
|
370
|
+
return W(l, "Mosaic", d);
|
|
307
371
|
}
|
|
308
372
|
}
|
|
309
|
-
function
|
|
373
|
+
function qe() {
|
|
310
374
|
const t = globalThis.MOSAIC_ENV;
|
|
311
375
|
return {
|
|
312
376
|
instanceUrl: t?.instanceUrl,
|
|
@@ -316,16 +380,16 @@ function Se() {
|
|
|
316
380
|
isInternal: t?.isInternal
|
|
317
381
|
};
|
|
318
382
|
}
|
|
319
|
-
function
|
|
383
|
+
function V(t) {
|
|
320
384
|
if (!t || t === "/") return "";
|
|
321
385
|
let e = t;
|
|
322
386
|
return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
323
387
|
}
|
|
324
|
-
const
|
|
325
|
-
class
|
|
388
|
+
const xe = "graphqlQuery";
|
|
389
|
+
class $e {
|
|
326
390
|
graphql;
|
|
327
391
|
constructor() {
|
|
328
|
-
this.graphql =
|
|
392
|
+
this.graphql = T(this.executeRawGraphQL.bind(this));
|
|
329
393
|
}
|
|
330
394
|
/**
|
|
331
395
|
* This method does not forward the `headers` request option, by design.
|
|
@@ -340,7 +404,7 @@ class De {
|
|
|
340
404
|
variables: r,
|
|
341
405
|
operationName: n
|
|
342
406
|
}) {
|
|
343
|
-
return (await window.openai.callTool(
|
|
407
|
+
return (await window.openai.callTool(xe, {
|
|
344
408
|
query: e,
|
|
345
409
|
...r != null ? { variables: r } : {},
|
|
346
410
|
...n != null ? { operationName: n } : {}
|
|
@@ -348,49 +412,49 @@ class De {
|
|
|
348
412
|
}
|
|
349
413
|
}
|
|
350
414
|
const g = "Accept-Language";
|
|
351
|
-
function
|
|
415
|
+
function B(t) {
|
|
352
416
|
return t ? void 0 : globalThis.SFDC_ENV?.language;
|
|
353
417
|
}
|
|
354
|
-
function
|
|
355
|
-
const e = new Headers(t), r =
|
|
418
|
+
function Ne(t) {
|
|
419
|
+
const e = new Headers(t), r = B(e.has(g));
|
|
356
420
|
return r ? (e.set(g, r), e) : t;
|
|
357
421
|
}
|
|
358
|
-
const
|
|
359
|
-
const [e, r] = t, n = e instanceof Request && !r?.headers ? e.headers.has(g) : new Headers(r?.headers).has(g), a =
|
|
360
|
-
return a ? p(
|
|
361
|
-
},
|
|
362
|
-
let e =
|
|
363
|
-
return e =
|
|
364
|
-
},
|
|
365
|
-
function
|
|
422
|
+
const Pe = (t) => {
|
|
423
|
+
const [e, r] = t, n = e instanceof Request && !r?.headers ? e.headers.has(g) : new Headers(r?.headers).has(g), a = B(n);
|
|
424
|
+
return a ? p(b(g, a, t)) : p(t);
|
|
425
|
+
}, _e = "X-SFDC-Client-Name", Te = "X-SFDC-Client-Version", Le = "@salesforce/platform-sdk", Ie = "12.13.0", ke = (t) => {
|
|
426
|
+
let e = b(_e, Le, t);
|
|
427
|
+
return e = b(Te, Ie, e), p(e);
|
|
428
|
+
}, Re = "X-CSRF-Token";
|
|
429
|
+
function Me(t, e = {}) {
|
|
366
430
|
const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
|
|
367
431
|
return async (a) => {
|
|
368
432
|
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";
|
|
369
|
-
if (
|
|
433
|
+
if (G(n, i) || Ve(c) && G(r, i)) {
|
|
370
434
|
const u = await t.getToken();
|
|
371
|
-
a =
|
|
435
|
+
a = b(Re, u, a);
|
|
372
436
|
}
|
|
373
437
|
return p(a);
|
|
374
438
|
};
|
|
375
439
|
}
|
|
376
|
-
function
|
|
440
|
+
function Ve(t) {
|
|
377
441
|
const e = t.toLowerCase();
|
|
378
442
|
return e === "post" || e === "put" || e === "patch" || e === "delete";
|
|
379
443
|
}
|
|
380
|
-
function
|
|
444
|
+
function G(t, e) {
|
|
381
445
|
const r = new URL(e, globalThis.location?.href ?? "http://localhost");
|
|
382
446
|
return t.some((n) => r.pathname.includes(n));
|
|
383
447
|
}
|
|
384
|
-
function
|
|
385
|
-
const r =
|
|
448
|
+
function Ge(t, e = {}) {
|
|
449
|
+
const r = Me(t, e);
|
|
386
450
|
async function n(a) {
|
|
387
451
|
const s = await r(a);
|
|
388
452
|
return fetch(s[0], s[1]);
|
|
389
453
|
}
|
|
390
454
|
return (a, s) => s ? s.applyRetry(async () => n(a)) : n(a);
|
|
391
455
|
}
|
|
392
|
-
const
|
|
393
|
-
class
|
|
456
|
+
const Qe = [400, 401, 403];
|
|
457
|
+
class Ue extends ae {
|
|
394
458
|
constructor(e) {
|
|
395
459
|
super(e), this.csrfTokenManager = e;
|
|
396
460
|
}
|
|
@@ -399,7 +463,7 @@ class Le extends re {
|
|
|
399
463
|
* Returns true when a CSRF token issue caused the request to fail.
|
|
400
464
|
*/
|
|
401
465
|
async shouldRetry(e, r) {
|
|
402
|
-
return r.attempt >= 1 ? !1 :
|
|
466
|
+
return r.attempt >= 1 ? !1 : Qe.includes(e.status);
|
|
403
467
|
}
|
|
404
468
|
/**
|
|
405
469
|
* Returns zero, so the CSRF token refresh happens immediately with no added delay.
|
|
@@ -418,7 +482,7 @@ class Le extends re {
|
|
|
418
482
|
await this.csrfTokenManager.refreshToken();
|
|
419
483
|
}
|
|
420
484
|
}
|
|
421
|
-
class
|
|
485
|
+
class He {
|
|
422
486
|
constructor(e, r) {
|
|
423
487
|
this.endpoint = e, this.cacheName = r, this.tokenPromise = this.obtainToken();
|
|
424
488
|
}
|
|
@@ -472,29 +536,29 @@ class Me {
|
|
|
472
536
|
return;
|
|
473
537
|
}
|
|
474
538
|
}
|
|
475
|
-
const
|
|
476
|
-
function
|
|
539
|
+
const Q = /* @__PURE__ */ new Map();
|
|
540
|
+
function je(t) {
|
|
477
541
|
const { endpoint: e, cacheName: r, ...n } = t.csrf;
|
|
478
|
-
let a =
|
|
479
|
-
return a || (a = new
|
|
542
|
+
let a = Q.get(e);
|
|
543
|
+
return a || (a = new He(e, r), Q.set(e, a)), j(
|
|
480
544
|
{
|
|
481
|
-
retry:
|
|
482
|
-
request: [
|
|
545
|
+
retry: Ge(a, n),
|
|
546
|
+
request: [ke, Pe]
|
|
483
547
|
},
|
|
484
|
-
|
|
548
|
+
oe(new Ue(a)).service
|
|
485
549
|
).service;
|
|
486
550
|
}
|
|
487
|
-
const
|
|
488
|
-
function
|
|
489
|
-
let e =
|
|
551
|
+
const U = /* @__PURE__ */ new Map();
|
|
552
|
+
function Fe(t) {
|
|
553
|
+
let e = U.get(t);
|
|
490
554
|
if (!e) {
|
|
491
|
-
const r =
|
|
492
|
-
e = { cache: r, cacheController: a, pubSub: s },
|
|
555
|
+
const r = ie().service, n = ue(r).service, a = ce(r, n).service, s = he().service;
|
|
556
|
+
e = { cache: r, cacheController: a, pubSub: s }, U.set(t, e);
|
|
493
557
|
}
|
|
494
558
|
return e;
|
|
495
559
|
}
|
|
496
|
-
function
|
|
497
|
-
const r =
|
|
560
|
+
function Ke(t, e) {
|
|
561
|
+
const r = Fe(t);
|
|
498
562
|
return {
|
|
499
563
|
shared: r,
|
|
500
564
|
services: {
|
|
@@ -504,8 +568,8 @@ function Ue(t, e) {
|
|
|
504
568
|
}
|
|
505
569
|
};
|
|
506
570
|
}
|
|
507
|
-
const
|
|
508
|
-
function
|
|
571
|
+
const H = 300;
|
|
572
|
+
function ze(t, e) {
|
|
509
573
|
try {
|
|
510
574
|
return JSON.parse(JSON.stringify(t));
|
|
511
575
|
} catch (r) {
|
|
@@ -515,19 +579,19 @@ function Ge(t, e) {
|
|
|
515
579
|
throw a.cause = r, a;
|
|
516
580
|
}
|
|
517
581
|
}
|
|
518
|
-
function
|
|
582
|
+
function Je(t) {
|
|
519
583
|
if (typeof t == "object" && t.type === "max-age") {
|
|
520
584
|
const e = t.maxAge;
|
|
521
|
-
return Number.isFinite(e) && e >= 0 ? e :
|
|
585
|
+
return Number.isFinite(e) && e >= 0 ? e : H;
|
|
522
586
|
}
|
|
523
|
-
return
|
|
587
|
+
return H;
|
|
524
588
|
}
|
|
525
|
-
class
|
|
589
|
+
class We extends le {
|
|
526
590
|
constructor(e, r, n) {
|
|
527
|
-
super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables =
|
|
591
|
+
super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = ze(
|
|
528
592
|
e.variables ?? {},
|
|
529
593
|
this.normalizedOperationName
|
|
530
|
-
), this.cacheControl = e.cacheControl, this.resolvedMaxAge =
|
|
594
|
+
), this.cacheControl = e.cacheControl, this.resolvedMaxAge = Je(e.cacheControl), this.headers = e.headers, this.headersKey = Ee(e.headers);
|
|
531
595
|
}
|
|
532
596
|
url;
|
|
533
597
|
query;
|
|
@@ -542,7 +606,7 @@ class Qe extends ce {
|
|
|
542
606
|
this.url,
|
|
543
607
|
{
|
|
544
608
|
method: "POST",
|
|
545
|
-
headers:
|
|
609
|
+
headers: J(this.headers),
|
|
546
610
|
body: JSON.stringify({
|
|
547
611
|
query: this.query,
|
|
548
612
|
variables: this.normalizedVariables,
|
|
@@ -557,7 +621,7 @@ class Qe extends ce {
|
|
|
557
621
|
variables: this.normalizedVariables,
|
|
558
622
|
operationName: this.normalizedOperationName
|
|
559
623
|
};
|
|
560
|
-
return this.headersKey !== void 0 && (e.headers = this.headersKey),
|
|
624
|
+
return this.headersKey !== void 0 && (e.headers = this.headersKey), te(e);
|
|
561
625
|
}
|
|
562
626
|
/**
|
|
563
627
|
* Reads the cached result for this command, or returns an error.
|
|
@@ -576,8 +640,8 @@ class Qe extends ce {
|
|
|
576
640
|
readFromCache(e) {
|
|
577
641
|
const r = this.buildKey(), n = e.get(r)?.value;
|
|
578
642
|
return n === void 0 ? p(
|
|
579
|
-
|
|
580
|
-
) : p(
|
|
643
|
+
x(new re("No cached entry found for this query."))
|
|
644
|
+
) : p(q(n));
|
|
581
645
|
}
|
|
582
646
|
writeToCache(e, r) {
|
|
583
647
|
if (r.isOk() && r.value.data != null && Object.keys(r.value.data).length > 0) {
|
|
@@ -607,49 +671,49 @@ class Qe extends ce {
|
|
|
607
671
|
return e.errors && e.errors.length > 0;
|
|
608
672
|
}
|
|
609
673
|
processFetchReturnValue(e) {
|
|
610
|
-
return this.responseHasErrors(e) ?
|
|
674
|
+
return this.responseHasErrors(e) ? x(new ne(e)) : q(e);
|
|
611
675
|
}
|
|
612
676
|
}
|
|
613
|
-
const
|
|
614
|
-
function
|
|
677
|
+
const Be = "CACHE_MISS";
|
|
678
|
+
function Xe() {
|
|
615
679
|
return [
|
|
616
680
|
{
|
|
617
681
|
message: "No cached entry found for this query (cacheControl: 'only-if-cached').",
|
|
618
|
-
extensions: { code:
|
|
682
|
+
extensions: { code: Be }
|
|
619
683
|
}
|
|
620
684
|
];
|
|
621
685
|
}
|
|
622
|
-
function
|
|
623
|
-
if (
|
|
686
|
+
function X(t) {
|
|
687
|
+
if (se(t) && t.data && typeof t.data == "object") {
|
|
624
688
|
const e = t.data;
|
|
625
689
|
if (e.data != null)
|
|
626
690
|
return e.data;
|
|
627
691
|
}
|
|
628
692
|
}
|
|
629
|
-
function
|
|
693
|
+
function Ye(t) {
|
|
630
694
|
return (e) => {
|
|
631
695
|
if (e.isOk()) {
|
|
632
696
|
const r = e.value;
|
|
633
697
|
v(r), t({ data: r, errors: void 0 });
|
|
634
698
|
} else {
|
|
635
|
-
const r =
|
|
636
|
-
r && v(r), t({ data: r, errors:
|
|
699
|
+
const r = X(e.error);
|
|
700
|
+
r && v(r), t({ data: r, errors: y(e.error) });
|
|
637
701
|
}
|
|
638
702
|
};
|
|
639
703
|
}
|
|
640
|
-
async function
|
|
704
|
+
async function Ze(t, e = !1) {
|
|
641
705
|
let r, n, a;
|
|
642
706
|
try {
|
|
643
707
|
const s = await t.execute();
|
|
644
|
-
s.isOk() ? (r = s.value.data, v(r), a = (o) => s.value.subscribe(o)) : (r =
|
|
708
|
+
s.isOk() ? (r = s.value.data, v(r), a = (o) => s.value.subscribe(o)) : (r = X(s.error.failure), r && v(r), n = e && r === void 0 ? Xe() : y(s.error.failure), a = (o) => s.error.subscribe(o));
|
|
645
709
|
} catch (s) {
|
|
646
|
-
n =
|
|
710
|
+
n = y(s);
|
|
647
711
|
}
|
|
648
712
|
return {
|
|
649
713
|
data: r,
|
|
650
714
|
errors: n,
|
|
651
715
|
subscribe(s) {
|
|
652
|
-
return a ? a(
|
|
716
|
+
return a ? a(Ye(s)) : E;
|
|
653
717
|
},
|
|
654
718
|
async refresh() {
|
|
655
719
|
await t.refresh();
|
|
@@ -660,11 +724,11 @@ function O(t) {
|
|
|
660
724
|
return {
|
|
661
725
|
data: void 0,
|
|
662
726
|
errors: t,
|
|
663
|
-
subscribe: () =>
|
|
727
|
+
subscribe: () => E,
|
|
664
728
|
refresh: $
|
|
665
729
|
};
|
|
666
730
|
}
|
|
667
|
-
function
|
|
731
|
+
function et({
|
|
668
732
|
bundle: t,
|
|
669
733
|
url: e,
|
|
670
734
|
executeRaw: r,
|
|
@@ -680,7 +744,7 @@ function We({
|
|
|
680
744
|
}) {
|
|
681
745
|
const l = P(o);
|
|
682
746
|
if (l.isErr()) return O(l.error);
|
|
683
|
-
const d = l.value, f =
|
|
747
|
+
const d = l.value, f = _(d, c);
|
|
684
748
|
if (f !== "query")
|
|
685
749
|
return O([
|
|
686
750
|
{
|
|
@@ -690,7 +754,7 @@ function We({
|
|
|
690
754
|
let w;
|
|
691
755
|
try {
|
|
692
756
|
const C = n ? n(u) : u;
|
|
693
|
-
w = new
|
|
757
|
+
w = new We(
|
|
694
758
|
{
|
|
695
759
|
query: N(d),
|
|
696
760
|
variables: i,
|
|
@@ -702,17 +766,17 @@ function We({
|
|
|
702
766
|
e
|
|
703
767
|
);
|
|
704
768
|
} catch (C) {
|
|
705
|
-
return O(
|
|
769
|
+
return O(y(C));
|
|
706
770
|
}
|
|
707
|
-
return
|
|
771
|
+
return Ze(w, h === "only-if-cached");
|
|
708
772
|
}
|
|
709
773
|
return {
|
|
710
774
|
query: s,
|
|
711
|
-
mutate: (o) =>
|
|
775
|
+
mutate: (o) => F(r, o)
|
|
712
776
|
};
|
|
713
777
|
}
|
|
714
|
-
const
|
|
715
|
-
class
|
|
778
|
+
const tt = 1, rt = `@salesforce/platform-sdk-data_v${tt}`;
|
|
779
|
+
class nt {
|
|
716
780
|
baseUrl;
|
|
717
781
|
pathData;
|
|
718
782
|
clientFetch;
|
|
@@ -720,23 +784,23 @@ class Ye {
|
|
|
720
784
|
apiVersion;
|
|
721
785
|
graphql;
|
|
722
786
|
constructor(e) {
|
|
723
|
-
const r =
|
|
724
|
-
this.baseUrl =
|
|
787
|
+
const r = st();
|
|
788
|
+
this.baseUrl = at(e?.basePath ?? r.apiPath), this.apiVersion = e?.apiVersion ?? D, this.pathData = L(this.apiVersion);
|
|
725
789
|
const n = `${this.pathData}/ui-api`, a = `${this.pathData}/graphql`;
|
|
726
|
-
this.onStatus = e?.onStatus ?? {}, this.clientFetch =
|
|
790
|
+
this.onStatus = e?.onStatus ?? {}, this.clientFetch = je({
|
|
727
791
|
csrf: {
|
|
728
792
|
endpoint: `${this.baseUrl}${n}/session/csrf`,
|
|
729
|
-
cacheName:
|
|
793
|
+
cacheName: rt,
|
|
730
794
|
protectedUrls: ["services/data/v", "services/apexrest"],
|
|
731
795
|
alwaysProtectedUrls: ["services/apexrest"]
|
|
732
796
|
}
|
|
733
797
|
});
|
|
734
|
-
const s = (i, c) => this.fetch(i, c), o =
|
|
735
|
-
this.graphql =
|
|
798
|
+
const s = (i, c) => this.fetch(i, c), o = Ke(`${this.baseUrl}${this.pathData}`, s);
|
|
799
|
+
this.graphql = et({
|
|
736
800
|
bundle: o,
|
|
737
801
|
url: a,
|
|
738
802
|
executeRaw: this.executeRawGraphQL.bind(this),
|
|
739
|
-
resolveEffectiveHeaders:
|
|
803
|
+
resolveEffectiveHeaders: Ne
|
|
740
804
|
});
|
|
741
805
|
}
|
|
742
806
|
async fetch(e, r) {
|
|
@@ -760,9 +824,9 @@ class Ye {
|
|
|
760
824
|
const s = `${this.pathData}/graphql`, o = await this.fetch(s, {
|
|
761
825
|
method: "POST",
|
|
762
826
|
body: JSON.stringify({ query: e, variables: r, operationName: n }),
|
|
763
|
-
headers:
|
|
827
|
+
headers: J(a)
|
|
764
828
|
});
|
|
765
|
-
return
|
|
829
|
+
return W(o, "WebApp", s);
|
|
766
830
|
}
|
|
767
831
|
/**
|
|
768
832
|
* Converts a relative URL to an absolute Salesforce URL.
|
|
@@ -781,17 +845,17 @@ class Ye {
|
|
|
781
845
|
return e;
|
|
782
846
|
}
|
|
783
847
|
}
|
|
784
|
-
function
|
|
848
|
+
function st() {
|
|
785
849
|
return {
|
|
786
850
|
apiPath: globalThis.SFDC_ENV?.apiPath
|
|
787
851
|
};
|
|
788
852
|
}
|
|
789
|
-
function
|
|
853
|
+
function at(t) {
|
|
790
854
|
if (!t || t === "/") return "";
|
|
791
855
|
let e = t;
|
|
792
856
|
return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
793
857
|
}
|
|
794
|
-
function
|
|
858
|
+
function ot(t) {
|
|
795
859
|
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;
|
|
796
860
|
if (typeof a?.setup != "function")
|
|
797
861
|
throw new Error("Extension entry cannot attach: it is missing a setup function.");
|
|
@@ -805,14 +869,14 @@ function tt(t) {
|
|
|
805
869
|
label: s === a.name ? `"${a.name}"` : `"${a.name}" (aliased as "${s}")`
|
|
806
870
|
};
|
|
807
871
|
}
|
|
808
|
-
async function
|
|
872
|
+
async function it(t, e, r) {
|
|
809
873
|
if (e.length === 0)
|
|
810
874
|
return t;
|
|
811
875
|
if ("ext" in t)
|
|
812
876
|
throw new Error(
|
|
813
877
|
'Cannot attach extensions: the base SDK already declares an "ext" member, which the extension container reserves.'
|
|
814
878
|
);
|
|
815
|
-
const n = e.map(
|
|
879
|
+
const n = e.map(ot);
|
|
816
880
|
r?.preflight?.(n, t);
|
|
817
881
|
const a = Object.create(t), s = /* @__PURE__ */ Object.create(null), o = (h) => {
|
|
818
882
|
throw new Error(`Cannot write "ext.${String(h)}" — ext is immutable once attached.`);
|
|
@@ -866,27 +930,29 @@ async function rt(t, e, r) {
|
|
|
866
930
|
}
|
|
867
931
|
return Object.freeze(s), a;
|
|
868
932
|
}
|
|
869
|
-
function
|
|
933
|
+
function vt(t, ...e) {
|
|
870
934
|
let r = t[0] ?? "";
|
|
871
935
|
for (let n = 0; n < e.length; n += 1)
|
|
872
936
|
r += String(e[n]) + (t[n + 1] ?? "");
|
|
873
937
|
return r;
|
|
874
938
|
}
|
|
875
|
-
function
|
|
939
|
+
function St(t) {
|
|
876
940
|
return t;
|
|
877
941
|
}
|
|
878
|
-
async function
|
|
942
|
+
async function ct(t) {
|
|
879
943
|
try {
|
|
880
|
-
switch (await
|
|
881
|
-
case
|
|
882
|
-
return new
|
|
883
|
-
case
|
|
884
|
-
case
|
|
885
|
-
return new
|
|
886
|
-
case
|
|
887
|
-
return new
|
|
888
|
-
case
|
|
889
|
-
return
|
|
944
|
+
switch (await Y(t?.surface)) {
|
|
945
|
+
case m.OpenAI:
|
|
946
|
+
return new $e();
|
|
947
|
+
case m.WebApp:
|
|
948
|
+
case m.MicroFrontend:
|
|
949
|
+
return new nt(t?.webapp);
|
|
950
|
+
case m.Mosaic:
|
|
951
|
+
return new Oe(t?.mosaic);
|
|
952
|
+
case m.Claude:
|
|
953
|
+
return new R(await I.getInstance(), t?.claude);
|
|
954
|
+
case m.MCPApps:
|
|
955
|
+
return new R(await I.getInstance(), t?.mcpApps);
|
|
890
956
|
default:
|
|
891
957
|
return {};
|
|
892
958
|
}
|
|
@@ -894,19 +960,19 @@ async function nt(t) {
|
|
|
894
960
|
return {};
|
|
895
961
|
}
|
|
896
962
|
}
|
|
897
|
-
function
|
|
898
|
-
return
|
|
963
|
+
function Et(t) {
|
|
964
|
+
return Z(
|
|
899
965
|
(async () => {
|
|
900
|
-
const e = await
|
|
901
|
-
return
|
|
902
|
-
preflight:
|
|
966
|
+
const e = await ct(t);
|
|
967
|
+
return it(e, t?.extensions ?? [], {
|
|
968
|
+
preflight: pe
|
|
903
969
|
});
|
|
904
970
|
})(),
|
|
905
971
|
"createDataSDK"
|
|
906
972
|
);
|
|
907
973
|
}
|
|
908
974
|
export {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
975
|
+
Et as createDataSDK,
|
|
976
|
+
St as defineDataExtension,
|
|
977
|
+
vt as gql
|
|
912
978
|
};
|