@salesforce/platform-sdk 13.0.0 → 13.1.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/README.md +34 -0
- package/dist/analytics/analytics.d.ts.map +1 -1
- package/dist/analytics/index.d.ts +1 -1
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +1 -1
- package/dist/analytics/pdp.d.ts +46 -0
- package/dist/analytics/pdp.d.ts.map +1 -0
- package/dist/analytics/schemas.d.ts +1 -0
- package/dist/analytics/schemas.d.ts.map +1 -1
- package/dist/analytics/types.d.ts +60 -0
- package/dist/analytics/types.d.ts.map +1 -1
- package/dist/analytics-CqPkAIdv.js +195 -0
- package/dist/data/index.js +172 -175
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/pdp_event-DNU_h--P.js +8 -0
- package/package.json +3 -3
- package/dist/analytics-BqVdGxvp.js +0 -150
package/dist/data/index.js
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import { c as te, S as y, g as re, a as ne } from "../surface-DyglgPiz.js";
|
|
2
2
|
import { w as se } from "../sdk-promise-D0sy7OW1.js";
|
|
3
|
-
import { print as N, parse as
|
|
4
|
-
import { ok as O, err as k, resolvedPromiseLike as
|
|
5
|
-
import { buildServiceDescriptor as J, setHeader as
|
|
6
|
-
import {
|
|
3
|
+
import { print as N, parse as ae } from "@conduit-client/onestore-graphql-parser/v1";
|
|
4
|
+
import { ok as O, err as k, resolvedPromiseLike as p, stableJSONStringify as oe, DataNotFoundError as ie, UserVisibleError as ce, deepFreeze as S, isUserVisibleError as ue } from "@conduit-client/utils";
|
|
5
|
+
import { buildServiceDescriptor as J, setHeader as g } from "@conduit-client/service-fetch-network/v1";
|
|
6
|
+
import { p as he } from "../pdp_event-DNU_h--P.js";
|
|
7
|
+
import { RetryPolicy as le, buildServiceDescriptor as de } from "@conduit-client/service-retry/v1";
|
|
7
8
|
import { buildServiceDescriptor as pe } from "@conduit-client/service-cache/v1";
|
|
8
|
-
import { buildServiceDescriptor as
|
|
9
|
-
import { buildInMemoryCacheInclusionPolicyService as
|
|
10
|
-
import { buildServiceDescriptor as
|
|
11
|
-
import { HttpCacheControlCommand as
|
|
9
|
+
import { buildServiceDescriptor as fe } from "@conduit-client/service-cache-control/v1";
|
|
10
|
+
import { buildInMemoryCacheInclusionPolicyService as ye } from "@conduit-client/service-cache-inclusion-policy/v1";
|
|
11
|
+
import { buildServiceDescriptor as me } from "@conduit-client/service-pubsub/v1";
|
|
12
|
+
import { HttpCacheControlCommand as be } from "@conduit-client/command-http-cache-control/v1";
|
|
12
13
|
const v = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
13
|
-
function
|
|
14
|
-
const [, r, n] = v.exec(t), [, s,
|
|
15
|
-
return Number(r) - Number(s) || Number(n) - Number(
|
|
14
|
+
function we(t, e) {
|
|
15
|
+
const [, r, n] = v.exec(t), [, s, a] = v.exec(e);
|
|
16
|
+
return Number(r) - Number(s) || Number(n) - Number(a);
|
|
16
17
|
}
|
|
17
18
|
function ge(t, e) {
|
|
18
19
|
for (const r of t) {
|
|
19
|
-
const n = r.extension, { label: s } = r,
|
|
20
|
-
if (
|
|
21
|
-
if (typeof
|
|
20
|
+
const n = r.extension, { label: s } = r, a = n.minApiVersion;
|
|
21
|
+
if (a !== void 0) {
|
|
22
|
+
if (typeof a != "string" || !v.test(a))
|
|
22
23
|
throw new TypeError(
|
|
23
|
-
`Extension ${s} declares invalid minApiVersion ${JSON.stringify(
|
|
24
|
+
`Extension ${s} declares invalid minApiVersion ${JSON.stringify(a)}; expected a Salesforce API version such as "64.0".`
|
|
24
25
|
);
|
|
25
26
|
if (e.apiVersion !== void 0) {
|
|
26
27
|
if (!v.test(e.apiVersion))
|
|
27
28
|
throw new Error(
|
|
28
|
-
`Extension ${s} requires Salesforce API version ${
|
|
29
|
+
`Extension ${s} requires Salesforce API version ${a} or later, but the Data SDK exposes invalid apiVersion ${JSON.stringify(e.apiVersion)}.`
|
|
29
30
|
);
|
|
30
|
-
if (
|
|
31
|
+
if (we(e.apiVersion, a) < 0)
|
|
31
32
|
throw new Error(
|
|
32
|
-
`Extension ${s} requires Salesforce API version ${
|
|
33
|
+
`Extension ${s} requires Salesforce API version ${a} or later, but the Data SDK uses version ${e.apiVersion}.`
|
|
33
34
|
);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -40,7 +41,7 @@ const D = () => {
|
|
|
40
41
|
};
|
|
41
42
|
function P(t) {
|
|
42
43
|
try {
|
|
43
|
-
return O(
|
|
44
|
+
return O(ae(t));
|
|
44
45
|
} catch (e) {
|
|
45
46
|
return k(m(e));
|
|
46
47
|
}
|
|
@@ -60,9 +61,9 @@ function m(t) {
|
|
|
60
61
|
return t instanceof Error ? [{ message: t.message }] : typeof t == "string" ? [{ message: t }] : [{ message: "Unknown error" }];
|
|
61
62
|
}
|
|
62
63
|
async function W(t, { mutation: e, variables: r, operationName: n, headers: s }) {
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
64
|
+
const a = P(e);
|
|
65
|
+
if (a.isErr()) return { data: void 0, errors: a.error };
|
|
66
|
+
const o = a.value, i = $(o, n);
|
|
66
67
|
if (i !== "mutation")
|
|
67
68
|
return {
|
|
68
69
|
data: void 0,
|
|
@@ -75,7 +76,7 @@ async function W(t, { mutation: e, variables: r, operationName: n, headers: s })
|
|
|
75
76
|
try {
|
|
76
77
|
const c = await t(
|
|
77
78
|
{
|
|
78
|
-
query: N(
|
|
79
|
+
query: N(o),
|
|
79
80
|
variables: r,
|
|
80
81
|
operationName: n,
|
|
81
82
|
headers: s
|
|
@@ -91,13 +92,13 @@ async function W(t, { mutation: e, variables: r, operationName: n, headers: s })
|
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
function q(t) {
|
|
94
|
-
function e(n, s,
|
|
95
|
+
function e(n, s, a, o) {
|
|
95
96
|
return t(
|
|
96
97
|
{
|
|
97
98
|
query: N(n),
|
|
98
99
|
variables: s,
|
|
99
|
-
operationName:
|
|
100
|
-
headers:
|
|
100
|
+
operationName: a,
|
|
101
|
+
headers: o
|
|
101
102
|
},
|
|
102
103
|
"query"
|
|
103
104
|
).then(
|
|
@@ -111,8 +112,8 @@ function q(t) {
|
|
|
111
112
|
async function r({
|
|
112
113
|
query: n,
|
|
113
114
|
variables: s,
|
|
114
|
-
operationName:
|
|
115
|
-
headers:
|
|
115
|
+
operationName: a,
|
|
116
|
+
headers: o
|
|
116
117
|
}) {
|
|
117
118
|
const i = P(n);
|
|
118
119
|
if (i.isErr())
|
|
@@ -122,7 +123,7 @@ function q(t) {
|
|
|
122
123
|
subscribe: () => D,
|
|
123
124
|
refresh: T
|
|
124
125
|
};
|
|
125
|
-
const c = i.value, h = $(c,
|
|
126
|
+
const c = i.value, h = $(c, a);
|
|
126
127
|
if (h !== "query")
|
|
127
128
|
return {
|
|
128
129
|
data: void 0,
|
|
@@ -134,17 +135,17 @@ function q(t) {
|
|
|
134
135
|
subscribe: () => D,
|
|
135
136
|
refresh: T
|
|
136
137
|
};
|
|
137
|
-
const u = /* @__PURE__ */ new Set(),
|
|
138
|
+
const u = /* @__PURE__ */ new Set(), l = s, d = await e(c, l, a, o);
|
|
138
139
|
return {
|
|
139
|
-
data:
|
|
140
|
-
errors:
|
|
140
|
+
data: d.data,
|
|
141
|
+
errors: d.errors,
|
|
141
142
|
subscribe(f) {
|
|
142
143
|
return u.add(f), () => {
|
|
143
144
|
u.delete(f);
|
|
144
145
|
};
|
|
145
146
|
},
|
|
146
147
|
async refresh() {
|
|
147
|
-
const f = await e(c,
|
|
148
|
+
const f = await e(c, l, a, o);
|
|
148
149
|
for (const E of u) E(f);
|
|
149
150
|
}
|
|
150
151
|
};
|
|
@@ -158,7 +159,7 @@ const A = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
|
|
|
158
159
|
function x(t = A) {
|
|
159
160
|
return `/services/data/v${t}`;
|
|
160
161
|
}
|
|
161
|
-
function
|
|
162
|
+
function Ee(t) {
|
|
162
163
|
if (Array.isArray(t)) {
|
|
163
164
|
for (const e of t)
|
|
164
165
|
if (!(e?.type !== "text" || !e.text))
|
|
@@ -170,11 +171,11 @@ function we(t) {
|
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
|
-
function
|
|
174
|
+
function Se(t) {
|
|
174
175
|
const e = t;
|
|
175
176
|
return e?.code === -32601 || e?.code === -32602 && typeof e.message == "string" && /^Unknown tool\b/i.test(e.message);
|
|
176
177
|
}
|
|
177
|
-
function
|
|
178
|
+
function R(t) {
|
|
178
179
|
if (typeof t != "object" || Array.isArray(t)) return !1;
|
|
179
180
|
if (!Object.hasOwn(t, "errors")) return Object.hasOwn(t, "data");
|
|
180
181
|
const { errors: e } = t;
|
|
@@ -182,7 +183,7 @@ function V(t) {
|
|
|
182
183
|
(r) => r !== null && typeof r == "object" && !Array.isArray(r) && typeof r.message == "string"
|
|
183
184
|
);
|
|
184
185
|
}
|
|
185
|
-
class
|
|
186
|
+
class ve {
|
|
186
187
|
graphql;
|
|
187
188
|
apiVersion;
|
|
188
189
|
#e;
|
|
@@ -192,61 +193,61 @@ class Se {
|
|
|
192
193
|
this.graphql = q(this.#t.bind(this));
|
|
193
194
|
}
|
|
194
195
|
async #t({ query: e, variables: r, operationName: n }, s) {
|
|
195
|
-
const
|
|
196
|
+
const a = {
|
|
196
197
|
query: e,
|
|
197
198
|
...r != null ? { variables: r } : {},
|
|
198
199
|
...n != null ? { operationName: n } : {}
|
|
199
|
-
},
|
|
200
|
+
}, o = s === "query" ? { method: "GET", queryParams: { queryInput: JSON.stringify(a) } } : { method: "POST", body: a }, i = await this.#e.request("tools/call", {
|
|
200
201
|
name: s === "query" ? "dispatch_readonly" : "dispatch",
|
|
201
202
|
arguments: {
|
|
202
203
|
url: `${x(this.apiVersion)}/graphql`,
|
|
203
|
-
...
|
|
204
|
+
...o
|
|
204
205
|
}
|
|
205
|
-
}).catch((
|
|
206
|
+
}).catch((d) => {
|
|
206
207
|
throw new Error(
|
|
207
|
-
|
|
208
|
-
{ cause:
|
|
208
|
+
Se(d) ? "Data SDK GraphQL dispatch tool is unavailable." : "Data SDK GraphQL request failed.",
|
|
209
|
+
{ cause: d }
|
|
209
210
|
);
|
|
210
|
-
}), c = i?.structuredContent ??
|
|
211
|
+
}), c = i?.structuredContent ?? Ee(i?.content), h = c?.status_code, u = c?.body, l = i?.isError || c?.error_code !== void 0;
|
|
211
212
|
if (typeof h != "number" || !Number.isInteger(h))
|
|
212
213
|
throw new Error(
|
|
213
|
-
|
|
214
|
+
l ? "Data SDK GraphQL request failed." : "Data SDK GraphQL response is malformed."
|
|
214
215
|
);
|
|
215
|
-
if (
|
|
216
|
-
throw u != null &&
|
|
216
|
+
if (l || h < 200 || h >= 300)
|
|
217
|
+
throw u != null && R(u) && u.errors?.length ? (
|
|
217
218
|
// This method is wrapped by `buildUncachedGraphQL`, which handles thrown {data} errors
|
|
218
219
|
{ data: { errors: u.errors } }
|
|
219
220
|
) : new Error("Data SDK GraphQL request failed.");
|
|
220
|
-
if (u == null || !
|
|
221
|
+
if (u == null || !R(u))
|
|
221
222
|
throw new Error("Data SDK GraphQL response is malformed.");
|
|
222
223
|
return u;
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
|
-
function
|
|
226
|
+
function De(t) {
|
|
226
227
|
return (e) => {
|
|
227
228
|
const [r, n] = e;
|
|
228
229
|
if (typeof r == "string" && !r.startsWith("http")) {
|
|
229
230
|
const s = r.startsWith("/") ? r : `/${r}`;
|
|
230
|
-
return
|
|
231
|
+
return p([`${t}${s}`, n]);
|
|
231
232
|
}
|
|
232
|
-
return
|
|
233
|
+
return p(e);
|
|
233
234
|
};
|
|
234
235
|
}
|
|
235
|
-
function
|
|
236
|
-
return (e) =>
|
|
236
|
+
function Ae(t) {
|
|
237
|
+
return (e) => p(g("Authorization", `Bearer ${t}`, e));
|
|
237
238
|
}
|
|
238
|
-
function
|
|
239
|
+
function Ce(t, e) {
|
|
239
240
|
const r = [];
|
|
240
|
-
return t && r.push(
|
|
241
|
+
return t && r.push(De(t)), e && r.push(Ae(e)), J({
|
|
241
242
|
request: r
|
|
242
243
|
}).service;
|
|
243
244
|
}
|
|
244
|
-
const
|
|
245
|
+
const _e = {
|
|
245
246
|
"Content-Type": "application/json",
|
|
246
247
|
Accept: "application/json",
|
|
247
248
|
"X-Chatter-Entity-Encoding": "false"
|
|
248
249
|
};
|
|
249
|
-
function
|
|
250
|
+
function Oe(t) {
|
|
250
251
|
if (t instanceof Headers) {
|
|
251
252
|
const e = [];
|
|
252
253
|
return t.forEach((r, n) => e.push([n, r])), e;
|
|
@@ -256,33 +257,33 @@ function _e(t) {
|
|
|
256
257
|
function B(t, e) {
|
|
257
258
|
if (e === void 0) return { ...t };
|
|
258
259
|
const r = { ...t }, n = /* @__PURE__ */ new Map();
|
|
259
|
-
for (const
|
|
260
|
+
for (const a of Object.keys(r)) n.set(a.toLowerCase(), a);
|
|
260
261
|
const s = /* @__PURE__ */ new Set();
|
|
261
|
-
for (const [
|
|
262
|
-
const i =
|
|
263
|
-
c === void 0 ? (r[
|
|
262
|
+
for (const [a, o] of Oe(e)) {
|
|
263
|
+
const i = a.toLowerCase(), c = n.get(i);
|
|
264
|
+
c === void 0 ? (r[a] = o, n.set(i, a), s.add(i)) : s.has(i) ? r[c] = `${r[c]}, ${o}` : (r[c] = o, s.add(i));
|
|
264
265
|
}
|
|
265
266
|
return r;
|
|
266
267
|
}
|
|
267
268
|
function X(t) {
|
|
268
|
-
return B(
|
|
269
|
+
return B(_e, t);
|
|
269
270
|
}
|
|
270
|
-
function
|
|
271
|
+
function ke(t) {
|
|
271
272
|
if (t === void 0) return;
|
|
272
273
|
const e = {};
|
|
273
274
|
return new Headers(t).forEach((r, n) => {
|
|
274
275
|
e[n] = r;
|
|
275
276
|
}), Object.keys(e).length > 0 ? e : void 0;
|
|
276
277
|
}
|
|
277
|
-
const
|
|
278
|
-
function
|
|
278
|
+
const Te = 512;
|
|
279
|
+
function Ne(t) {
|
|
279
280
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
280
281
|
}
|
|
281
|
-
class
|
|
282
|
+
class V extends Error {
|
|
282
283
|
status;
|
|
283
284
|
url;
|
|
284
285
|
constructor(e) {
|
|
285
|
-
const r = e.body.length === 0 ? "empty response body" : "unparseable response body", n = e.body.length === 0 ? "" : ` (starts with: ${JSON.stringify(
|
|
286
|
+
const r = e.body.length === 0 ? "empty response body" : "unparseable response body", n = e.body.length === 0 ? "" : ` (starts with: ${JSON.stringify(Ne(e.body.slice(0, Te)))})`;
|
|
286
287
|
super(
|
|
287
288
|
`${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.`
|
|
288
289
|
), this.name = "GraphQLTransportError", this.status = e.status, this.url = e.url, this.cause = e.cause;
|
|
@@ -293,11 +294,11 @@ async function Y(t, e, r) {
|
|
|
293
294
|
let s;
|
|
294
295
|
try {
|
|
295
296
|
s = JSON.parse(n);
|
|
296
|
-
} catch (
|
|
297
|
-
throw new
|
|
297
|
+
} catch (a) {
|
|
298
|
+
throw new V({ surface: e, url: r, status: t.status, body: n, cause: a });
|
|
298
299
|
}
|
|
299
|
-
if (!
|
|
300
|
-
throw new
|
|
300
|
+
if (!Pe(s))
|
|
301
|
+
throw new V({
|
|
301
302
|
surface: e,
|
|
302
303
|
url: r,
|
|
303
304
|
status: t.status,
|
|
@@ -306,21 +307,21 @@ async function Y(t, e, r) {
|
|
|
306
307
|
});
|
|
307
308
|
return s;
|
|
308
309
|
}
|
|
309
|
-
function
|
|
310
|
+
function Pe(t) {
|
|
310
311
|
return t === null || typeof t != "object" || Array.isArray(t) ? !1 : "data" in t || Array.isArray(t.errors);
|
|
311
312
|
}
|
|
312
|
-
const
|
|
313
|
+
const $e = {
|
|
313
314
|
"Content-Type": "application/json",
|
|
314
315
|
Accept: "application/json"
|
|
315
316
|
};
|
|
316
|
-
class
|
|
317
|
+
class qe {
|
|
317
318
|
clientFetch;
|
|
318
319
|
pathData;
|
|
319
320
|
apiVersion;
|
|
320
321
|
graphql;
|
|
321
322
|
constructor(e) {
|
|
322
|
-
const r =
|
|
323
|
-
this.apiVersion = e?.apiVersion ?? r.apiVersion ?? A, this.pathData = x(this.apiVersion), this.clientFetch =
|
|
323
|
+
const r = xe(), n = Re(e?.instanceUrl ?? r.instanceUrl), s = e?.accessToken ?? r.accessToken;
|
|
324
|
+
this.apiVersion = e?.apiVersion ?? r.apiVersion ?? A, this.pathData = x(this.apiVersion), this.clientFetch = Ce(n || void 0, s), this.graphql = q(this.executeRawGraphQL.bind(this));
|
|
324
325
|
}
|
|
325
326
|
async executeRawGraphQL({
|
|
326
327
|
query: e,
|
|
@@ -328,15 +329,15 @@ class $e {
|
|
|
328
329
|
operationName: n,
|
|
329
330
|
headers: s
|
|
330
331
|
}) {
|
|
331
|
-
const
|
|
332
|
+
const a = `${this.pathData}/graphql`, o = await this.clientFetch(a, {
|
|
332
333
|
method: "POST",
|
|
333
334
|
body: JSON.stringify({ query: e, variables: r, operationName: n }),
|
|
334
|
-
headers: B(
|
|
335
|
+
headers: B($e, s)
|
|
335
336
|
});
|
|
336
|
-
return Y(
|
|
337
|
+
return Y(o, "Mosaic", a);
|
|
337
338
|
}
|
|
338
339
|
}
|
|
339
|
-
function
|
|
340
|
+
function xe() {
|
|
340
341
|
const t = globalThis.MOSAIC_ENV;
|
|
341
342
|
return {
|
|
342
343
|
instanceUrl: t?.instanceUrl,
|
|
@@ -344,13 +345,13 @@ function qe() {
|
|
|
344
345
|
apiVersion: t?.apiVersion
|
|
345
346
|
};
|
|
346
347
|
}
|
|
347
|
-
function
|
|
348
|
+
function Re(t) {
|
|
348
349
|
if (!t || t === "/") return "";
|
|
349
350
|
let e = t;
|
|
350
351
|
return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
351
352
|
}
|
|
352
353
|
const Ve = "graphqlQuery";
|
|
353
|
-
class
|
|
354
|
+
class Le {
|
|
354
355
|
graphql;
|
|
355
356
|
constructor() {
|
|
356
357
|
this.graphql = q(this.executeRawGraphQL.bind(this));
|
|
@@ -375,16 +376,12 @@ class Re {
|
|
|
375
376
|
})).structuredContent;
|
|
376
377
|
}
|
|
377
378
|
}
|
|
378
|
-
const
|
|
379
|
-
options: { proto3_optional: !0 },
|
|
380
|
-
id: 4,
|
|
381
|
-
type: "int32"
|
|
382
|
-
}, userId: { id: 9, type: "string" } } } } } } } } } }, Ie = 1, L = 256, I = "__SF_O11Y_QUEUE_1P__", Me = 1e3;
|
|
379
|
+
const Me = 1, L = 256, M = "__SF_O11Y_QUEUE_1P__", Ie = 1e3;
|
|
383
380
|
function Ge() {
|
|
384
381
|
const t = [], e = {
|
|
385
382
|
droppedCount: 0,
|
|
386
383
|
push(r) {
|
|
387
|
-
t.length >=
|
|
384
|
+
t.length >= Ie && (t.shift(), e.droppedCount++), t.push(r);
|
|
388
385
|
},
|
|
389
386
|
drain() {
|
|
390
387
|
return t.splice(0, t.length);
|
|
@@ -395,8 +392,8 @@ function Ge() {
|
|
|
395
392
|
function b(t, e, r) {
|
|
396
393
|
if (!(typeof window > "u"))
|
|
397
394
|
try {
|
|
398
|
-
const n = window, s = n[
|
|
399
|
-
s.push(
|
|
395
|
+
const n = window, s = n[M] ?? (n[M] = Ge()), a = { version: Me, name: t, verb: e, args: r };
|
|
396
|
+
s.push(a);
|
|
400
397
|
} catch {
|
|
401
398
|
}
|
|
402
399
|
}
|
|
@@ -414,8 +411,8 @@ function Ue(t) {
|
|
|
414
411
|
trackValue(e, r, n, s) {
|
|
415
412
|
b(t, "trackValue", [e, r, n, s]);
|
|
416
413
|
},
|
|
417
|
-
bucketValue(e, r, n, s,
|
|
418
|
-
b(t, "bucketValue", [e, r, n, s,
|
|
414
|
+
bucketValue(e, r, n, s, a) {
|
|
415
|
+
b(t, "bucketValue", [e, r, n, s, a]);
|
|
419
416
|
}
|
|
420
417
|
};
|
|
421
418
|
}
|
|
@@ -430,10 +427,10 @@ function Qe(t) {
|
|
|
430
427
|
function Fe(t) {
|
|
431
428
|
return Object.freeze({ kind: "log", ...t });
|
|
432
429
|
}
|
|
433
|
-
const Ke = /* @__PURE__ */ new Set([y.WebApp, y.MicroFrontend]),
|
|
430
|
+
const Ke = /* @__PURE__ */ new Set([y.WebApp, y.MicroFrontend]), I = /* @__PURE__ */ new Set();
|
|
434
431
|
function G(t, e) {
|
|
435
432
|
const { namespace: r, name: n } = t.schema, s = `${t.area}/${r}.${n}/${e}`;
|
|
436
|
-
|
|
433
|
+
I.has(s) || (I.add(s), console.debug(
|
|
437
434
|
`[platform-sdk:telemetry] Dropped ${r}.${n} for area "${t.area}". ${e}`
|
|
438
435
|
));
|
|
439
436
|
}
|
|
@@ -470,39 +467,39 @@ const je = {
|
|
|
470
467
|
}), We = /* @__PURE__ */ Fe({
|
|
471
468
|
area: "data",
|
|
472
469
|
description: "Data SDK adoption. Answers: how many distinct orgs use the Data SDK (PF MAT, trailing 28 days)?",
|
|
473
|
-
schema:
|
|
470
|
+
schema: he
|
|
474
471
|
});
|
|
475
472
|
let U = !1;
|
|
476
473
|
function Be() {
|
|
477
474
|
U || (U = !0, je.log(We, Je));
|
|
478
475
|
}
|
|
479
|
-
const
|
|
476
|
+
const w = "Accept-Language";
|
|
480
477
|
function Z(t) {
|
|
481
478
|
return t ? void 0 : globalThis.SFDC_ENV?.language;
|
|
482
479
|
}
|
|
483
480
|
function Xe(t) {
|
|
484
|
-
const e = new Headers(t), r = Z(e.has(
|
|
485
|
-
return r ? (e.set(
|
|
481
|
+
const e = new Headers(t), r = Z(e.has(w));
|
|
482
|
+
return r ? (e.set(w, r), e) : t;
|
|
486
483
|
}
|
|
487
484
|
const Ye = (t) => {
|
|
488
|
-
const [e, r] = t, n = e instanceof Request && !r?.headers ? e.headers.has(
|
|
489
|
-
return s ?
|
|
490
|
-
}, Ze = "X-SFDC-Client-Name", et = "X-SFDC-Client-Version", tt = "@salesforce/platform-sdk", rt = "13.
|
|
491
|
-
let e =
|
|
492
|
-
return e =
|
|
485
|
+
const [e, r] = t, n = e instanceof Request && !r?.headers ? e.headers.has(w) : new Headers(r?.headers).has(w), s = Z(n);
|
|
486
|
+
return s ? p(g(w, s, t)) : p(t);
|
|
487
|
+
}, Ze = "X-SFDC-Client-Name", et = "X-SFDC-Client-Version", tt = "@salesforce/platform-sdk", rt = "13.1.0", nt = (t) => {
|
|
488
|
+
let e = g(Ze, tt, t);
|
|
489
|
+
return e = g(et, rt, e), p(e);
|
|
493
490
|
}, st = "X-CSRF-Token";
|
|
494
|
-
function
|
|
491
|
+
function at(t, e = {}) {
|
|
495
492
|
const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
|
|
496
493
|
return async (s) => {
|
|
497
|
-
const [
|
|
498
|
-
if (Q(n, i) ||
|
|
494
|
+
const [a, o] = s, i = a instanceof Request ? a.url : a instanceof URL ? a.href : a, c = o?.method ?? (a instanceof Request ? a.method : void 0) ?? "GET";
|
|
495
|
+
if (Q(n, i) || ot(c) && Q(r, i)) {
|
|
499
496
|
const u = await t.getToken();
|
|
500
|
-
s =
|
|
497
|
+
s = g(st, u, s);
|
|
501
498
|
}
|
|
502
|
-
return
|
|
499
|
+
return p(s);
|
|
503
500
|
};
|
|
504
501
|
}
|
|
505
|
-
function
|
|
502
|
+
function ot(t) {
|
|
506
503
|
const e = t.toLowerCase();
|
|
507
504
|
return e === "post" || e === "put" || e === "patch" || e === "delete";
|
|
508
505
|
}
|
|
@@ -511,15 +508,15 @@ function Q(t, e) {
|
|
|
511
508
|
return t.some((n) => r.pathname.includes(n));
|
|
512
509
|
}
|
|
513
510
|
function it(t, e = {}) {
|
|
514
|
-
const r =
|
|
511
|
+
const r = at(t, e);
|
|
515
512
|
async function n(s) {
|
|
516
|
-
const
|
|
517
|
-
return fetch(
|
|
513
|
+
const a = await r(s);
|
|
514
|
+
return fetch(a[0], a[1]);
|
|
518
515
|
}
|
|
519
|
-
return (s,
|
|
516
|
+
return (s, a) => a ? a.applyRetry(async () => n(s)) : n(s);
|
|
520
517
|
}
|
|
521
518
|
const ct = [400, 401, 403];
|
|
522
|
-
class ut extends
|
|
519
|
+
class ut extends le {
|
|
523
520
|
constructor(e) {
|
|
524
521
|
super(e), this.csrfTokenManager = e;
|
|
525
522
|
}
|
|
@@ -606,7 +603,7 @@ class ht {
|
|
|
606
603
|
});
|
|
607
604
|
if (s)
|
|
608
605
|
return s;
|
|
609
|
-
await this.withCache((
|
|
606
|
+
await this.withCache((a) => a.delete(this.endpoint));
|
|
610
607
|
}
|
|
611
608
|
const r = await fetch(this.endpoint, { method: "get" });
|
|
612
609
|
if (!r.ok)
|
|
@@ -638,7 +635,7 @@ async function F(t) {
|
|
|
638
635
|
return typeof r == "string" && r !== "" ? r : void 0;
|
|
639
636
|
}
|
|
640
637
|
const K = /* @__PURE__ */ new Map();
|
|
641
|
-
function
|
|
638
|
+
function lt(t) {
|
|
642
639
|
const { endpoint: e, cacheName: r, ...n } = t.csrf;
|
|
643
640
|
let s = K.get(e);
|
|
644
641
|
return s || (s = new ht(e, r), K.set(e, s)), J(
|
|
@@ -650,16 +647,16 @@ function dt(t) {
|
|
|
650
647
|
).service;
|
|
651
648
|
}
|
|
652
649
|
const j = /* @__PURE__ */ new Map();
|
|
653
|
-
function
|
|
650
|
+
function dt(t) {
|
|
654
651
|
let e = j.get(t);
|
|
655
652
|
if (!e) {
|
|
656
|
-
const r = pe().service, n =
|
|
657
|
-
e = { cache: r, cacheController: s, pubSub:
|
|
653
|
+
const r = pe().service, n = ye(r).service, s = fe(r, n).service, a = me().service;
|
|
654
|
+
e = { cache: r, cacheController: s, pubSub: a }, j.set(t, e);
|
|
658
655
|
}
|
|
659
656
|
return e;
|
|
660
657
|
}
|
|
661
|
-
function
|
|
662
|
-
const r =
|
|
658
|
+
function pt(t, e) {
|
|
659
|
+
const r = dt(t);
|
|
663
660
|
return {
|
|
664
661
|
shared: r,
|
|
665
662
|
services: {
|
|
@@ -687,12 +684,12 @@ function yt(t) {
|
|
|
687
684
|
}
|
|
688
685
|
return H;
|
|
689
686
|
}
|
|
690
|
-
class mt extends
|
|
687
|
+
class mt extends be {
|
|
691
688
|
constructor(e, r, n) {
|
|
692
689
|
super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = ft(
|
|
693
690
|
e.variables ?? {},
|
|
694
691
|
this.normalizedOperationName
|
|
695
|
-
), this.cacheControl = e.cacheControl, this.resolvedMaxAge = yt(e.cacheControl), this.headers = e.headers, this.headersKey =
|
|
692
|
+
), this.cacheControl = e.cacheControl, this.resolvedMaxAge = yt(e.cacheControl), this.headers = e.headers, this.headersKey = ke(e.headers);
|
|
696
693
|
}
|
|
697
694
|
url;
|
|
698
695
|
query;
|
|
@@ -722,7 +719,7 @@ class mt extends me {
|
|
|
722
719
|
variables: this.normalizedVariables,
|
|
723
720
|
operationName: this.normalizedOperationName
|
|
724
721
|
};
|
|
725
|
-
return this.headersKey !== void 0 && (e.headers = this.headersKey),
|
|
722
|
+
return this.headersKey !== void 0 && (e.headers = this.headersKey), oe(e);
|
|
726
723
|
}
|
|
727
724
|
/**
|
|
728
725
|
* Reads the cached result for this command, or returns an error.
|
|
@@ -740,9 +737,9 @@ class mt extends me {
|
|
|
740
737
|
*/
|
|
741
738
|
readFromCache(e) {
|
|
742
739
|
const r = this.buildKey(), n = e.get(r)?.value;
|
|
743
|
-
return n === void 0 ?
|
|
740
|
+
return n === void 0 ? p(
|
|
744
741
|
k(new ie("No cached entry found for this query."))
|
|
745
|
-
) :
|
|
742
|
+
) : p(O(n));
|
|
746
743
|
}
|
|
747
744
|
writeToCache(e, r) {
|
|
748
745
|
if (r.isOk() && r.value.data != null && Object.keys(r.value.data).length > 0) {
|
|
@@ -758,7 +755,7 @@ class mt extends me {
|
|
|
758
755
|
}
|
|
759
756
|
});
|
|
760
757
|
}
|
|
761
|
-
return
|
|
758
|
+
return p(void 0);
|
|
762
759
|
}
|
|
763
760
|
get cacheControlStrategyConfig() {
|
|
764
761
|
const e = Math.floor(Date.now() / 1e3);
|
|
@@ -776,7 +773,7 @@ class mt extends me {
|
|
|
776
773
|
}
|
|
777
774
|
}
|
|
778
775
|
const bt = "CACHE_MISS";
|
|
779
|
-
function
|
|
776
|
+
function wt() {
|
|
780
777
|
return [
|
|
781
778
|
{
|
|
782
779
|
message: "No cached entry found for this query (cacheControl: 'only-if-cached').",
|
|
@@ -791,7 +788,7 @@ function ee(t) {
|
|
|
791
788
|
return e.data;
|
|
792
789
|
}
|
|
793
790
|
}
|
|
794
|
-
function
|
|
791
|
+
function gt(t) {
|
|
795
792
|
return (e) => {
|
|
796
793
|
if (e.isOk()) {
|
|
797
794
|
const r = e.value;
|
|
@@ -805,16 +802,16 @@ function wt(t) {
|
|
|
805
802
|
async function Et(t, e = !1) {
|
|
806
803
|
let r, n, s;
|
|
807
804
|
try {
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
} catch (
|
|
811
|
-
n = m(
|
|
805
|
+
const a = await t.execute();
|
|
806
|
+
a.isOk() ? (r = a.value.data, S(r), s = (o) => a.value.subscribe(o)) : (r = ee(a.error.failure), r && S(r), n = e && r === void 0 ? wt() : m(a.error.failure), s = (o) => a.error.subscribe(o));
|
|
807
|
+
} catch (a) {
|
|
808
|
+
n = m(a);
|
|
812
809
|
}
|
|
813
810
|
return {
|
|
814
811
|
data: r,
|
|
815
812
|
errors: n,
|
|
816
|
-
subscribe(
|
|
817
|
-
return s ? s(
|
|
813
|
+
subscribe(a) {
|
|
814
|
+
return s ? s(gt(a)) : D;
|
|
818
815
|
},
|
|
819
816
|
async refresh() {
|
|
820
817
|
await t.refresh();
|
|
@@ -836,16 +833,16 @@ function St({
|
|
|
836
833
|
resolveEffectiveHeaders: n
|
|
837
834
|
}) {
|
|
838
835
|
const { services: s } = t;
|
|
839
|
-
async function
|
|
840
|
-
query:
|
|
836
|
+
async function a({
|
|
837
|
+
query: o,
|
|
841
838
|
variables: i,
|
|
842
839
|
operationName: c,
|
|
843
840
|
cacheControl: h,
|
|
844
841
|
headers: u
|
|
845
842
|
}) {
|
|
846
|
-
const
|
|
847
|
-
if (
|
|
848
|
-
const
|
|
843
|
+
const l = P(o);
|
|
844
|
+
if (l.isErr()) return _(l.error);
|
|
845
|
+
const d = l.value, f = $(d, c);
|
|
849
846
|
if (f !== "query")
|
|
850
847
|
return _([
|
|
851
848
|
{
|
|
@@ -857,7 +854,7 @@ function St({
|
|
|
857
854
|
const C = n ? n(u) : u;
|
|
858
855
|
E = new mt(
|
|
859
856
|
{
|
|
860
|
-
query: N(
|
|
857
|
+
query: N(d),
|
|
861
858
|
variables: i,
|
|
862
859
|
operationName: c,
|
|
863
860
|
cacheControl: h,
|
|
@@ -872,8 +869,8 @@ function St({
|
|
|
872
869
|
return Et(E, h === "only-if-cached");
|
|
873
870
|
}
|
|
874
871
|
return {
|
|
875
|
-
query:
|
|
876
|
-
mutate: (
|
|
872
|
+
query: a,
|
|
873
|
+
mutate: (o) => W(r, o)
|
|
877
874
|
};
|
|
878
875
|
}
|
|
879
876
|
const vt = 1, Dt = `@salesforce/platform-sdk-data_v${vt}`;
|
|
@@ -888,7 +885,7 @@ class z {
|
|
|
888
885
|
const r = At();
|
|
889
886
|
this.baseUrl = Ct(e?.basePath ?? r.apiPath), this.apiVersion = e?.apiVersion ?? A, this.pathData = x(this.apiVersion);
|
|
890
887
|
const n = `${this.pathData}/ui-api`, s = `${this.pathData}/graphql`;
|
|
891
|
-
this.onStatus = e?.onStatus ?? {}, this.clientFetch =
|
|
888
|
+
this.onStatus = e?.onStatus ?? {}, this.clientFetch = lt({
|
|
892
889
|
csrf: {
|
|
893
890
|
endpoint: `${this.baseUrl}${n}/session/csrf`,
|
|
894
891
|
cacheName: Dt,
|
|
@@ -896,9 +893,9 @@ class z {
|
|
|
896
893
|
alwaysProtectedUrls: ["services/apexrest"]
|
|
897
894
|
}
|
|
898
895
|
});
|
|
899
|
-
const
|
|
896
|
+
const a = (i, c) => this.fetch(i, c), o = pt(`${this.baseUrl}${this.pathData}`, a);
|
|
900
897
|
this.graphql = St({
|
|
901
|
-
bundle:
|
|
898
|
+
bundle: o,
|
|
902
899
|
url: s,
|
|
903
900
|
executeRaw: this.executeRawGraphQL.bind(this),
|
|
904
901
|
resolveEffectiveHeaders: Xe
|
|
@@ -922,12 +919,12 @@ class z {
|
|
|
922
919
|
operationName: n,
|
|
923
920
|
headers: s
|
|
924
921
|
}) {
|
|
925
|
-
const
|
|
922
|
+
const a = `${this.pathData}/graphql`, o = await this.fetch(a, {
|
|
926
923
|
method: "POST",
|
|
927
924
|
body: JSON.stringify({ query: e, variables: r, operationName: n }),
|
|
928
925
|
headers: X(s)
|
|
929
926
|
});
|
|
930
|
-
return Y(
|
|
927
|
+
return Y(o, "WebApp", a);
|
|
931
928
|
}
|
|
932
929
|
/**
|
|
933
930
|
* Converts a relative URL to an absolute Salesforce URL.
|
|
@@ -957,17 +954,17 @@ function Ct(t) {
|
|
|
957
954
|
return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
958
955
|
}
|
|
959
956
|
function _t(t) {
|
|
960
|
-
const e = t, r = typeof e == "object" && e !== null ? e : void 0, n = r !== void 0 && "setup" in r, s = n ? r : r?.extension,
|
|
957
|
+
const e = t, r = typeof e == "object" && e !== null ? e : void 0, n = r !== void 0 && "setup" in r, s = n ? r : r?.extension, a = n ? s?.name : r?.as;
|
|
961
958
|
if (typeof s?.setup != "function")
|
|
962
959
|
throw new Error("Extension entry cannot attach: it is missing a setup function.");
|
|
963
|
-
if (typeof
|
|
960
|
+
if (typeof a != "string" || a.length === 0)
|
|
964
961
|
throw new Error(
|
|
965
962
|
n ? 'Extension entry cannot attach: "name" must be a non-empty string.' : 'Extension entry cannot attach: alias "as" must be a non-empty string.'
|
|
966
963
|
);
|
|
967
964
|
return {
|
|
968
965
|
extension: s,
|
|
969
|
-
mountName:
|
|
970
|
-
label:
|
|
966
|
+
mountName: a,
|
|
967
|
+
label: a === s.name ? `"${s.name}"` : `"${s.name}" (aliased as "${a}")`
|
|
971
968
|
};
|
|
972
969
|
}
|
|
973
970
|
async function Ot(t, e, r) {
|
|
@@ -979,19 +976,19 @@ async function Ot(t, e, r) {
|
|
|
979
976
|
);
|
|
980
977
|
const n = e.map(_t);
|
|
981
978
|
r?.preflight?.(n, t);
|
|
982
|
-
const s = Object.create(t),
|
|
979
|
+
const s = Object.create(t), a = /* @__PURE__ */ Object.create(null), o = (h) => {
|
|
983
980
|
throw new Error(`Cannot write "ext.${String(h)}" — ext is immutable once attached.`);
|
|
984
981
|
}, i = (h) => {
|
|
985
982
|
throw new Error(`Cannot ${h} "ext" — ext is immutable once attached.`);
|
|
986
|
-
}, c = new Proxy(
|
|
983
|
+
}, c = new Proxy(a, {
|
|
987
984
|
set(h, u) {
|
|
988
|
-
return
|
|
985
|
+
return o(u);
|
|
989
986
|
},
|
|
990
987
|
defineProperty(h, u) {
|
|
991
|
-
return
|
|
988
|
+
return o(u);
|
|
992
989
|
},
|
|
993
990
|
deleteProperty(h, u) {
|
|
994
|
-
return
|
|
991
|
+
return o(u);
|
|
995
992
|
},
|
|
996
993
|
// Without these two traps, `preventExtensions` and `setPrototypeOf`
|
|
997
994
|
// fall through to the real `store`, because no per-property trap
|
|
@@ -1011,40 +1008,40 @@ async function Ot(t, e, r) {
|
|
|
1011
1008
|
writable: !1,
|
|
1012
1009
|
configurable: !1
|
|
1013
1010
|
});
|
|
1014
|
-
for (const { extension: h, mountName: u, label:
|
|
1015
|
-
if (Object.hasOwn(
|
|
1011
|
+
for (const { extension: h, mountName: u, label: l } of n) {
|
|
1012
|
+
if (Object.hasOwn(a, u))
|
|
1016
1013
|
throw new Error(
|
|
1017
|
-
`Extension ${
|
|
1014
|
+
`Extension ${l} cannot attach: "${u}" is already defined by another extension.`
|
|
1018
1015
|
);
|
|
1019
|
-
let
|
|
1016
|
+
let d;
|
|
1020
1017
|
try {
|
|
1021
|
-
|
|
1018
|
+
d = await h.setup(s);
|
|
1022
1019
|
} catch (f) {
|
|
1023
|
-
throw new Error(`Extension ${
|
|
1020
|
+
throw new Error(`Extension ${l} failed during setup.`, { cause: f });
|
|
1024
1021
|
}
|
|
1025
|
-
Object.defineProperty(
|
|
1026
|
-
value:
|
|
1022
|
+
Object.defineProperty(a, u, {
|
|
1023
|
+
value: d,
|
|
1027
1024
|
enumerable: !0,
|
|
1028
1025
|
writable: !1,
|
|
1029
1026
|
configurable: !1
|
|
1030
1027
|
});
|
|
1031
1028
|
}
|
|
1032
|
-
return Object.freeze(
|
|
1029
|
+
return Object.freeze(a), s;
|
|
1033
1030
|
}
|
|
1034
|
-
function
|
|
1031
|
+
function Ut(t, ...e) {
|
|
1035
1032
|
let r = t[0] ?? "";
|
|
1036
1033
|
for (let n = 0; n < e.length; n += 1)
|
|
1037
1034
|
r += String(e[n]) + (t[n + 1] ?? "");
|
|
1038
1035
|
return r;
|
|
1039
1036
|
}
|
|
1040
|
-
function
|
|
1037
|
+
function Qt(t) {
|
|
1041
1038
|
return t;
|
|
1042
1039
|
}
|
|
1043
1040
|
async function kt(t) {
|
|
1044
1041
|
try {
|
|
1045
1042
|
switch (await re(t?.surface)) {
|
|
1046
1043
|
case y.OpenAI:
|
|
1047
|
-
return new
|
|
1044
|
+
return new Le();
|
|
1048
1045
|
case y.WebApp:
|
|
1049
1046
|
return new z(t?.webapp);
|
|
1050
1047
|
case y.MicroFrontend: {
|
|
@@ -1052,9 +1049,9 @@ async function kt(t) {
|
|
|
1052
1049
|
return typeof r == "object" && r !== null ? new z(t?.webapp) : {};
|
|
1053
1050
|
}
|
|
1054
1051
|
case y.Mosaic:
|
|
1055
|
-
return new
|
|
1052
|
+
return new qe(t?.mosaic);
|
|
1056
1053
|
case y.MCPApps:
|
|
1057
|
-
return new
|
|
1054
|
+
return new ve(await ne.getInstance(), t?.mcpApps);
|
|
1058
1055
|
default:
|
|
1059
1056
|
return {};
|
|
1060
1057
|
}
|
|
@@ -1062,7 +1059,7 @@ async function kt(t) {
|
|
|
1062
1059
|
return {};
|
|
1063
1060
|
}
|
|
1064
1061
|
}
|
|
1065
|
-
function
|
|
1062
|
+
function Ft(t) {
|
|
1066
1063
|
return se(
|
|
1067
1064
|
(async () => {
|
|
1068
1065
|
const e = await kt(t), r = await Ot(e, t?.extensions ?? [], {
|
|
@@ -1074,7 +1071,7 @@ function Qt(t) {
|
|
|
1074
1071
|
);
|
|
1075
1072
|
}
|
|
1076
1073
|
export {
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1074
|
+
Ft as createDataSDK,
|
|
1075
|
+
Qt as defineDataExtension,
|
|
1076
|
+
Ut as gql
|
|
1080
1077
|
};
|