@salesforce/platform-sdk 11.69.1 → 11.69.3
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.
|
@@ -23,11 +23,13 @@ import { ExtendedSDK, ExtensionsFor } from './extension-types';
|
|
|
23
23
|
* Each `setup` receives the base SDK, and that is all the type promises it:
|
|
24
24
|
* `setup(sdk)` is typed as `Base`, never the accumulating shape. Because every
|
|
25
25
|
* namespace mounts onto one shared `ext` object (below) attached before the
|
|
26
|
-
* loop, a later extension *can*
|
|
26
|
+
* loop, a later extension *can* read an earlier extension's namespace at runtime via
|
|
27
27
|
* `sdk.ext.<name>` — but that reachability is an untyped byproduct, not a WI-1
|
|
28
28
|
* contract to build on. Typed cross-extension access (a extension declaring the
|
|
29
29
|
* namespaces it needs and receiving them in `setup`) is WI-3, via the reserved
|
|
30
30
|
* `Deps` seam on {@link Extension}; until then, author setups as independent.
|
|
31
|
+
* Writing through `sdk.ext` is always blocked, during `setup` and after — see the
|
|
32
|
+
* guard below.
|
|
31
33
|
*
|
|
32
34
|
* Atomic and non-mutating: namespaces mount onto a fresh `ext` object hung off
|
|
33
35
|
* a fresh SDK view whose prototype is `base`, so the base's own and inherited
|
|
@@ -50,7 +52,10 @@ import { ExtendedSDK, ExtensionsFor } from './extension-types';
|
|
|
50
52
|
* already claimed by another extension in this call, or a `setup` that throws or
|
|
51
53
|
* rejects surfaces as an error (the extension cases name the extension and chain
|
|
52
54
|
* the cause). The `ext` slot is locked, so a `setup` reassigning the container
|
|
53
|
-
* wholesale throws rather than silently dropping every namespace.
|
|
55
|
+
* wholesale throws rather than silently dropping every namespace. `ext` itself is
|
|
56
|
+
* immutable to everyone but this loop: a `setup` that writes `sdk.ext.<name> = …`
|
|
57
|
+
* directly throws instead of pre-claiming a mount name, and the same holds for any
|
|
58
|
+
* caller after attach returns — `ext` never becomes writable.
|
|
54
59
|
*/
|
|
55
60
|
export declare function attachExtensions<Base extends object, const Extensions extends ExtensionsFor<Base>>(base: Base, extensions: Extensions): Promise<ExtendedSDK<Base, Extensions>>;
|
|
56
61
|
//# sourceMappingURL=extension-attach.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-attach.d.ts","sourceRoot":"","sources":["../../src/core/extension-attach.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAoB,WAAW,EAAa,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA4CjG
|
|
1
|
+
{"version":3,"file":"extension-attach.d.ts","sourceRoot":"","sources":["../../src/core/extension-attach.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAoB,WAAW,EAAa,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA4CjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,wBAAsB,gBAAgB,CACrC,IAAI,SAAS,MAAM,EACnB,KAAK,CAAC,UAAU,SAAS,aAAa,CAAC,IAAI,CAAC,EAC3C,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAsH5E"}
|
package/dist/data/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { g as U, S as
|
|
1
|
+
import { g as U, S as m } from "../surface-Dd2tqrPi.js";
|
|
2
2
|
import { w as Q } from "../sdk-promise-D0sy7OW1.js";
|
|
3
3
|
import { c as V } from "../extension-factory-CJkfM4km.js";
|
|
4
|
-
import { buildServiceDescriptor as
|
|
5
|
-
import { resolvedPromiseLike as
|
|
4
|
+
import { buildServiceDescriptor as $, setHeader as b } from "@conduit-client/service-fetch-network/v1";
|
|
5
|
+
import { resolvedPromiseLike as l, ok as C, err as D, stableJSONStringify as j, DataNotFoundError as K, UserVisibleError as z, deepFreeze as w, isUserVisibleError as W } from "@conduit-client/utils";
|
|
6
6
|
import { print as q, parse as J } from "@conduit-client/onestore-graphql-parser/v1";
|
|
7
7
|
import { RetryPolicy as B, buildServiceDescriptor as X } from "@conduit-client/service-retry/v1";
|
|
8
8
|
import { buildServiceDescriptor as Y } from "@conduit-client/service-cache/v1";
|
|
@@ -15,17 +15,17 @@ function ne(t) {
|
|
|
15
15
|
const [r, n] = e;
|
|
16
16
|
if (typeof r == "string" && !r.startsWith("http")) {
|
|
17
17
|
const s = r.startsWith("/") ? r : `/${r}`;
|
|
18
|
-
return
|
|
18
|
+
return l([`${t}${s}`, n]);
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return l(e);
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
function se(t) {
|
|
24
|
-
return (e) =>
|
|
24
|
+
return (e) => l(b("Authorization", `Bearer ${t}`, e));
|
|
25
25
|
}
|
|
26
26
|
function ae(t, e) {
|
|
27
27
|
const r = [];
|
|
28
|
-
return t && r.push(ne(t)), e && r.push(se(e)),
|
|
28
|
+
return t && r.push(ne(t)), e && r.push(se(e)), $({
|
|
29
29
|
request: r
|
|
30
30
|
}).service;
|
|
31
31
|
}
|
|
@@ -41,19 +41,19 @@ function ie(t) {
|
|
|
41
41
|
}
|
|
42
42
|
return Array.isArray(t) ? t.map(([e, r]) => [e, r]) : Object.entries(t);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function R(t, e) {
|
|
45
45
|
if (e === void 0) return { ...t };
|
|
46
46
|
const r = { ...t }, n = /* @__PURE__ */ new Map();
|
|
47
47
|
for (const a of Object.keys(r)) n.set(a.toLowerCase(), a);
|
|
48
48
|
const s = /* @__PURE__ */ new Set();
|
|
49
|
-
for (const [a,
|
|
50
|
-
const
|
|
51
|
-
|
|
49
|
+
for (const [a, c] of ie(e)) {
|
|
50
|
+
const o = a.toLowerCase(), i = n.get(o);
|
|
51
|
+
i === void 0 ? (r[a] = c, n.set(o, a), s.add(o)) : s.has(o) ? r[i] = `${r[i]}, ${c}` : (r[i] = c, s.add(o));
|
|
52
52
|
}
|
|
53
53
|
return r;
|
|
54
54
|
}
|
|
55
55
|
function L(t) {
|
|
56
|
-
return
|
|
56
|
+
return R(oe, t);
|
|
57
57
|
}
|
|
58
58
|
function ce(t) {
|
|
59
59
|
if (t === void 0) return;
|
|
@@ -66,7 +66,7 @@ const ue = 512;
|
|
|
66
66
|
function he(t) {
|
|
67
67
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
68
68
|
}
|
|
69
|
-
class
|
|
69
|
+
class P extends Error {
|
|
70
70
|
status;
|
|
71
71
|
url;
|
|
72
72
|
constructor(e) {
|
|
@@ -82,10 +82,10 @@ async function M(t, e, r) {
|
|
|
82
82
|
try {
|
|
83
83
|
s = JSON.parse(n);
|
|
84
84
|
} catch (a) {
|
|
85
|
-
throw new
|
|
85
|
+
throw new P({ surface: e, url: r, status: t.status, body: n, cause: a });
|
|
86
86
|
}
|
|
87
87
|
if (s === null || typeof s != "object")
|
|
88
|
-
throw new
|
|
88
|
+
throw new P({
|
|
89
89
|
surface: e,
|
|
90
90
|
url: r,
|
|
91
91
|
status: t.status,
|
|
@@ -97,20 +97,20 @@ async function M(t, e, r) {
|
|
|
97
97
|
const S = () => {
|
|
98
98
|
}, O = async () => {
|
|
99
99
|
};
|
|
100
|
-
function
|
|
100
|
+
function x(t) {
|
|
101
101
|
try {
|
|
102
102
|
return C(J(t));
|
|
103
103
|
} catch (e) {
|
|
104
|
-
return D(
|
|
104
|
+
return D(y(e));
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function N(t, e) {
|
|
108
108
|
const r = t.definitions.filter(
|
|
109
109
|
(n) => n.kind === "OperationDefinition"
|
|
110
110
|
);
|
|
111
111
|
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";
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function y(t) {
|
|
114
114
|
if (t && typeof t == "object" && "data" in t) {
|
|
115
115
|
const e = t.data;
|
|
116
116
|
if (e && typeof e == "object" && "errors" in e && Array.isArray(e.errors))
|
|
@@ -119,86 +119,86 @@ function p(t) {
|
|
|
119
119
|
return t instanceof Error ? [{ message: t.message }] : typeof t == "string" ? [{ message: t }] : [{ message: "Unknown error" }];
|
|
120
120
|
}
|
|
121
121
|
async function I(t, { mutation: e, variables: r, operationName: n, headers: s }) {
|
|
122
|
-
const a =
|
|
122
|
+
const a = x(e);
|
|
123
123
|
if (a.isErr()) return { data: void 0, errors: a.error };
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
124
|
+
const c = a.value, o = N(c, n);
|
|
125
|
+
if (o !== "mutation")
|
|
126
126
|
return {
|
|
127
127
|
data: void 0,
|
|
128
128
|
errors: [
|
|
129
129
|
{
|
|
130
|
-
message: `DataSDK.graphql.mutate() requires a GraphQL mutation, received ${
|
|
130
|
+
message: `DataSDK.graphql.mutate() requires a GraphQL mutation, received ${o}.`
|
|
131
131
|
}
|
|
132
132
|
]
|
|
133
133
|
};
|
|
134
134
|
try {
|
|
135
|
-
const
|
|
136
|
-
query: q(
|
|
135
|
+
const i = await t({
|
|
136
|
+
query: q(c),
|
|
137
137
|
variables: r,
|
|
138
138
|
operationName: n,
|
|
139
139
|
headers: s
|
|
140
140
|
});
|
|
141
141
|
return {
|
|
142
|
-
data:
|
|
143
|
-
errors:
|
|
142
|
+
data: i.data ?? void 0,
|
|
143
|
+
errors: i.errors
|
|
144
144
|
};
|
|
145
|
-
} catch (
|
|
146
|
-
return { data: void 0, errors:
|
|
145
|
+
} catch (i) {
|
|
146
|
+
return { data: void 0, errors: y(i) };
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
function G(t) {
|
|
150
|
-
function e(n, s, a,
|
|
150
|
+
function e(n, s, a, c) {
|
|
151
151
|
return t({
|
|
152
152
|
query: q(n),
|
|
153
153
|
variables: s,
|
|
154
154
|
operationName: a,
|
|
155
|
-
headers:
|
|
155
|
+
headers: c
|
|
156
156
|
}).then(
|
|
157
|
-
(
|
|
158
|
-
data:
|
|
159
|
-
errors:
|
|
157
|
+
(o) => ({
|
|
158
|
+
data: o.data ?? void 0,
|
|
159
|
+
errors: o.errors
|
|
160
160
|
}),
|
|
161
|
-
(
|
|
161
|
+
(o) => ({ data: void 0, errors: y(o) })
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
164
|
async function r({
|
|
165
165
|
query: n,
|
|
166
166
|
variables: s,
|
|
167
167
|
operationName: a,
|
|
168
|
-
headers:
|
|
168
|
+
headers: c
|
|
169
169
|
}) {
|
|
170
|
-
const
|
|
171
|
-
if (
|
|
170
|
+
const o = x(n);
|
|
171
|
+
if (o.isErr())
|
|
172
172
|
return {
|
|
173
173
|
data: void 0,
|
|
174
|
-
errors:
|
|
174
|
+
errors: o.error,
|
|
175
175
|
subscribe: () => S,
|
|
176
176
|
refresh: O
|
|
177
177
|
};
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
178
|
+
const i = o.value, h = N(i, a);
|
|
179
|
+
if (h !== "query")
|
|
180
180
|
return {
|
|
181
181
|
data: void 0,
|
|
182
182
|
errors: [
|
|
183
183
|
{
|
|
184
|
-
message: `DataSDK.graphql.query() requires a GraphQL query, received ${
|
|
184
|
+
message: `DataSDK.graphql.query() requires a GraphQL query, received ${h}.`
|
|
185
185
|
}
|
|
186
186
|
],
|
|
187
187
|
subscribe: () => S,
|
|
188
188
|
refresh: O
|
|
189
189
|
};
|
|
190
|
-
const
|
|
190
|
+
const u = /* @__PURE__ */ new Set(), d = s, p = await e(i, d, a, c);
|
|
191
191
|
return {
|
|
192
|
-
data:
|
|
193
|
-
errors:
|
|
194
|
-
subscribe(
|
|
195
|
-
return
|
|
196
|
-
|
|
192
|
+
data: p.data,
|
|
193
|
+
errors: p.errors,
|
|
194
|
+
subscribe(f) {
|
|
195
|
+
return u.add(f), () => {
|
|
196
|
+
u.delete(f);
|
|
197
197
|
};
|
|
198
198
|
},
|
|
199
199
|
async refresh() {
|
|
200
|
-
const
|
|
201
|
-
for (const
|
|
200
|
+
const f = await e(i, d, a, c);
|
|
201
|
+
for (const g of u) g(f);
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
}
|
|
@@ -220,7 +220,7 @@ class pe {
|
|
|
220
220
|
pathData;
|
|
221
221
|
graphql;
|
|
222
222
|
constructor(e) {
|
|
223
|
-
const r = fe(), n =
|
|
223
|
+
const r = fe(), n = ye(e?.instanceUrl ?? r.instanceUrl), s = e?.accessToken ?? r.accessToken;
|
|
224
224
|
this.pathData = H(e?.apiVersion ?? r.apiVersion), this.clientFetch = ae(n || void 0, s), this.graphql = G(this.executeRawGraphQL.bind(this));
|
|
225
225
|
}
|
|
226
226
|
async executeRawGraphQL({
|
|
@@ -229,12 +229,12 @@ class pe {
|
|
|
229
229
|
operationName: n,
|
|
230
230
|
headers: s
|
|
231
231
|
}) {
|
|
232
|
-
const a = `${this.pathData}/graphql`,
|
|
232
|
+
const a = `${this.pathData}/graphql`, c = await this.clientFetch(a, {
|
|
233
233
|
method: "POST",
|
|
234
234
|
body: JSON.stringify({ query: e, variables: r, operationName: n }),
|
|
235
|
-
headers:
|
|
235
|
+
headers: R(de, s)
|
|
236
236
|
});
|
|
237
|
-
return M(
|
|
237
|
+
return M(c, "Mosaic", a);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
function fe() {
|
|
@@ -245,12 +245,12 @@ function fe() {
|
|
|
245
245
|
apiVersion: t?.apiVersion
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function ye(t) {
|
|
249
249
|
if (!t || t === "/") return "";
|
|
250
250
|
let e = t;
|
|
251
251
|
return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
252
252
|
}
|
|
253
|
-
const
|
|
253
|
+
const me = "graphqlQuery";
|
|
254
254
|
class be {
|
|
255
255
|
graphql;
|
|
256
256
|
constructor() {
|
|
@@ -266,32 +266,32 @@ class be {
|
|
|
266
266
|
variables: r,
|
|
267
267
|
operationName: n
|
|
268
268
|
}) {
|
|
269
|
-
return (await window.openai.callTool(
|
|
269
|
+
return (await window.openai.callTool(me, {
|
|
270
270
|
query: e,
|
|
271
271
|
...r != null ? { variables: r } : {},
|
|
272
272
|
...n != null ? { operationName: n } : {}
|
|
273
273
|
})).structuredContent;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
const
|
|
276
|
+
const v = "Accept-Language", we = (t) => {
|
|
277
277
|
const e = globalThis.SFDC_ENV?.language;
|
|
278
278
|
if (!e)
|
|
279
|
-
return
|
|
279
|
+
return l(t);
|
|
280
280
|
const [r, n] = t;
|
|
281
|
-
return (r instanceof Request && !n?.headers ? r.headers.has(
|
|
282
|
-
}, Se = "X-SFDC-Client-Name",
|
|
283
|
-
let e = b(Se,
|
|
284
|
-
return e = b(
|
|
281
|
+
return (r instanceof Request && !n?.headers ? r.headers.has(v) : new Headers(n?.headers).has(v)) ? l(t) : l(b(v, e, t));
|
|
282
|
+
}, Se = "X-SFDC-Client-Name", ge = "X-SFDC-Client-Version", ve = "@salesforce/platform-sdk", Ee = "11.69.3", Ce = (t) => {
|
|
283
|
+
let e = b(Se, ve, t);
|
|
284
|
+
return e = b(ge, Ee, e), l(e);
|
|
285
285
|
}, De = "X-CSRF-Token";
|
|
286
286
|
function Oe(t, e = {}) {
|
|
287
287
|
const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
|
|
288
288
|
return async (s) => {
|
|
289
|
-
const [a,
|
|
290
|
-
if (_(n,
|
|
291
|
-
const
|
|
292
|
-
s = b(De,
|
|
289
|
+
const [a, c] = s, o = a instanceof Request ? a.url : a instanceof URL ? a.href : a, i = c?.method ?? (a instanceof Request ? a.method : void 0) ?? "GET";
|
|
290
|
+
if (_(n, o) || qe(i) && _(r, o)) {
|
|
291
|
+
const u = await t.getToken();
|
|
292
|
+
s = b(De, u, s);
|
|
293
293
|
}
|
|
294
|
-
return
|
|
294
|
+
return l(s);
|
|
295
295
|
};
|
|
296
296
|
}
|
|
297
297
|
function qe(t) {
|
|
@@ -302,7 +302,7 @@ function _(t, e) {
|
|
|
302
302
|
const r = new URL(e, globalThis.location?.href ?? "http://localhost");
|
|
303
303
|
return t.some((n) => r.pathname.includes(n));
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function xe(t, e = {}) {
|
|
306
306
|
const r = Oe(t, e);
|
|
307
307
|
async function n(s) {
|
|
308
308
|
const a = await r(s);
|
|
@@ -310,8 +310,8 @@ function Ne(t, e = {}) {
|
|
|
310
310
|
}
|
|
311
311
|
return (s, a) => a ? a.applyRetry(async () => n(s)) : n(s);
|
|
312
312
|
}
|
|
313
|
-
const
|
|
314
|
-
class
|
|
313
|
+
const Ne = [400, 401, 403];
|
|
314
|
+
class Pe extends B {
|
|
315
315
|
constructor(e) {
|
|
316
316
|
super(e), this.csrfTokenManager = e;
|
|
317
317
|
}
|
|
@@ -319,7 +319,7 @@ class Ae extends B {
|
|
|
319
319
|
* Determines if a failed request should be retried due to CSRF token issues.
|
|
320
320
|
*/
|
|
321
321
|
async shouldRetry(e, r) {
|
|
322
|
-
return r.attempt >= 1 ? !1 :
|
|
322
|
+
return r.attempt >= 1 ? !1 : Ne.includes(e.status);
|
|
323
323
|
}
|
|
324
324
|
/**
|
|
325
325
|
* CSRF token refresh should happen immediately with no delay.
|
|
@@ -385,29 +385,29 @@ class _e {
|
|
|
385
385
|
return;
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
const
|
|
389
|
-
function
|
|
388
|
+
const k = /* @__PURE__ */ new Map();
|
|
389
|
+
function ke(t) {
|
|
390
390
|
const { endpoint: e, cacheName: r, ...n } = t.csrf;
|
|
391
|
-
let s =
|
|
392
|
-
return s || (s = new _e(e, r),
|
|
391
|
+
let s = k.get(e);
|
|
392
|
+
return s || (s = new _e(e, r), k.set(e, s)), $(
|
|
393
393
|
{
|
|
394
|
-
retry:
|
|
394
|
+
retry: xe(s, n),
|
|
395
395
|
request: [Ce, we]
|
|
396
396
|
},
|
|
397
|
-
X(new
|
|
397
|
+
X(new Pe(s)).service
|
|
398
398
|
).service;
|
|
399
399
|
}
|
|
400
|
-
const
|
|
401
|
-
function
|
|
402
|
-
let e =
|
|
400
|
+
const A = /* @__PURE__ */ new Map();
|
|
401
|
+
function Ae(t) {
|
|
402
|
+
let e = A.get(t);
|
|
403
403
|
if (!e) {
|
|
404
404
|
const r = Y().service, n = ee(r).service, s = Z(r, n).service, a = te().service;
|
|
405
|
-
e = { cache: r, cacheController: s, pubSub: a },
|
|
405
|
+
e = { cache: r, cacheController: s, pubSub: a }, A.set(t, e);
|
|
406
406
|
}
|
|
407
407
|
return e;
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
const r =
|
|
409
|
+
function Te(t, e) {
|
|
410
|
+
const r = Ae(t);
|
|
411
411
|
return {
|
|
412
412
|
shared: r,
|
|
413
413
|
services: {
|
|
@@ -417,8 +417,8 @@ function xe(t, e) {
|
|
|
417
417
|
}
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
|
-
const
|
|
421
|
-
function
|
|
420
|
+
const T = 300;
|
|
421
|
+
function $e(t, e) {
|
|
422
422
|
try {
|
|
423
423
|
return JSON.parse(JSON.stringify(t));
|
|
424
424
|
} catch (r) {
|
|
@@ -428,19 +428,19 @@ function Re(t, e) {
|
|
|
428
428
|
throw s.cause = r, s;
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function Re(t) {
|
|
432
432
|
if (typeof t == "object" && t.type === "max-age") {
|
|
433
433
|
const e = t.maxAge;
|
|
434
|
-
return Number.isFinite(e) && e >= 0 ? e :
|
|
434
|
+
return Number.isFinite(e) && e >= 0 ? e : T;
|
|
435
435
|
}
|
|
436
|
-
return
|
|
436
|
+
return T;
|
|
437
437
|
}
|
|
438
438
|
class Le extends re {
|
|
439
439
|
constructor(e, r, n) {
|
|
440
|
-
super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables =
|
|
440
|
+
super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = $e(
|
|
441
441
|
e.variables ?? {},
|
|
442
442
|
this.normalizedOperationName
|
|
443
|
-
), this.cacheControl = e.cacheControl, this.resolvedMaxAge =
|
|
443
|
+
), this.cacheControl = e.cacheControl, this.resolvedMaxAge = Re(e.cacheControl), this.headers = e.headers, this.headersKey = ce(e.headers);
|
|
444
444
|
}
|
|
445
445
|
query;
|
|
446
446
|
normalizedVariables;
|
|
@@ -469,7 +469,7 @@ class Le extends re {
|
|
|
469
469
|
variables: this.normalizedVariables,
|
|
470
470
|
operationName: this.normalizedOperationName
|
|
471
471
|
};
|
|
472
|
-
return this.headersKey !== void 0 && (e.headers = this.headersKey),
|
|
472
|
+
return this.headersKey !== void 0 && (e.headers = this.headersKey), j(e);
|
|
473
473
|
}
|
|
474
474
|
/**
|
|
475
475
|
* Reads from the cache and returns the cache result or error
|
|
@@ -486,9 +486,9 @@ class Le extends re {
|
|
|
486
486
|
*/
|
|
487
487
|
readFromCache(e) {
|
|
488
488
|
const r = this.buildKey(), n = e.get(r)?.value;
|
|
489
|
-
return n === void 0 ?
|
|
490
|
-
D(new
|
|
491
|
-
) :
|
|
489
|
+
return n === void 0 ? l(
|
|
490
|
+
D(new K("No cached entry found for this query."))
|
|
491
|
+
) : l(C(n));
|
|
492
492
|
}
|
|
493
493
|
writeToCache(e, r) {
|
|
494
494
|
if (r.isOk() && r.value.data != null && Object.keys(r.value.data).length > 0) {
|
|
@@ -504,7 +504,7 @@ class Le extends re {
|
|
|
504
504
|
}
|
|
505
505
|
});
|
|
506
506
|
}
|
|
507
|
-
return
|
|
507
|
+
return l(void 0);
|
|
508
508
|
}
|
|
509
509
|
get cacheControlStrategyConfig() {
|
|
510
510
|
const e = Math.floor(Date.now() / 1e3);
|
|
@@ -544,7 +544,7 @@ function Ge(t) {
|
|
|
544
544
|
w(r), t({ data: r, errors: void 0 });
|
|
545
545
|
} else {
|
|
546
546
|
const r = F(e.error);
|
|
547
|
-
r && w(r), t({ data: r, errors:
|
|
547
|
+
r && w(r), t({ data: r, errors: y(e.error) });
|
|
548
548
|
}
|
|
549
549
|
};
|
|
550
550
|
}
|
|
@@ -552,9 +552,9 @@ async function He(t, e = !1) {
|
|
|
552
552
|
let r, n, s;
|
|
553
553
|
try {
|
|
554
554
|
const a = await t.execute();
|
|
555
|
-
a.isOk() ? (r = a.value.data, w(r), s = (
|
|
555
|
+
a.isOk() ? (r = a.value.data, w(r), s = (c) => a.value.subscribe(c)) : (r = F(a.error.failure), r && w(r), n = e && r === void 0 ? Ie() : y(a.error.failure), s = (c) => a.error.subscribe(c));
|
|
556
556
|
} catch (a) {
|
|
557
|
-
n =
|
|
557
|
+
n = y(a);
|
|
558
558
|
}
|
|
559
559
|
return {
|
|
560
560
|
data: r,
|
|
@@ -567,7 +567,7 @@ async function He(t, e = !1) {
|
|
|
567
567
|
}
|
|
568
568
|
};
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function E(t) {
|
|
571
571
|
return {
|
|
572
572
|
data: void 0,
|
|
573
573
|
errors: t,
|
|
@@ -583,37 +583,37 @@ function Fe({
|
|
|
583
583
|
const { services: n } = t;
|
|
584
584
|
async function s({
|
|
585
585
|
query: a,
|
|
586
|
-
variables:
|
|
587
|
-
operationName:
|
|
588
|
-
cacheControl:
|
|
589
|
-
headers:
|
|
586
|
+
variables: c,
|
|
587
|
+
operationName: o,
|
|
588
|
+
cacheControl: i,
|
|
589
|
+
headers: h
|
|
590
590
|
}) {
|
|
591
|
-
const
|
|
592
|
-
if (
|
|
593
|
-
const
|
|
594
|
-
if (
|
|
595
|
-
return
|
|
591
|
+
const u = x(a);
|
|
592
|
+
if (u.isErr()) return E(u.error);
|
|
593
|
+
const d = u.value, p = N(d, o);
|
|
594
|
+
if (p !== "query")
|
|
595
|
+
return E([
|
|
596
596
|
{
|
|
597
|
-
message: `DataSDK.graphql.query() requires a GraphQL query, received ${
|
|
597
|
+
message: `DataSDK.graphql.query() requires a GraphQL query, received ${p}.`
|
|
598
598
|
}
|
|
599
599
|
]);
|
|
600
|
-
let
|
|
600
|
+
let f;
|
|
601
601
|
try {
|
|
602
|
-
|
|
602
|
+
f = new Le(
|
|
603
603
|
{
|
|
604
|
-
query: q(
|
|
605
|
-
variables:
|
|
606
|
-
operationName:
|
|
607
|
-
cacheControl:
|
|
608
|
-
headers:
|
|
604
|
+
query: q(d),
|
|
605
|
+
variables: c,
|
|
606
|
+
operationName: o,
|
|
607
|
+
cacheControl: i,
|
|
608
|
+
headers: h
|
|
609
609
|
},
|
|
610
610
|
n,
|
|
611
611
|
e
|
|
612
612
|
);
|
|
613
|
-
} catch (
|
|
614
|
-
return
|
|
613
|
+
} catch (g) {
|
|
614
|
+
return E(y(g));
|
|
615
615
|
}
|
|
616
|
-
return He(
|
|
616
|
+
return He(f, i === "only-if-cached");
|
|
617
617
|
}
|
|
618
618
|
return {
|
|
619
619
|
query: s,
|
|
@@ -628,10 +628,10 @@ class Ve {
|
|
|
628
628
|
onStatus;
|
|
629
629
|
graphql;
|
|
630
630
|
constructor(e) {
|
|
631
|
-
const r =
|
|
632
|
-
this.baseUrl =
|
|
631
|
+
const r = je();
|
|
632
|
+
this.baseUrl = Ke(e?.basePath ?? r.apiPath), this.pathData = H(e?.apiVersion);
|
|
633
633
|
const n = `${this.pathData}/ui-api`, s = `${this.pathData}/graphql`;
|
|
634
|
-
this.onStatus = e?.onStatus ?? {}, this.clientFetch =
|
|
634
|
+
this.onStatus = e?.onStatus ?? {}, this.clientFetch = ke({
|
|
635
635
|
csrf: {
|
|
636
636
|
endpoint: `${this.baseUrl}${n}/session/csrf`,
|
|
637
637
|
cacheName: Qe,
|
|
@@ -639,9 +639,9 @@ class Ve {
|
|
|
639
639
|
alwaysProtectedUrls: ["services/apexrest"]
|
|
640
640
|
}
|
|
641
641
|
});
|
|
642
|
-
const a = (
|
|
642
|
+
const a = (o, i) => this.fetch(o, i), c = Te(`${this.baseUrl}${this.pathData}`, a);
|
|
643
643
|
this.graphql = Fe({
|
|
644
|
-
bundle:
|
|
644
|
+
bundle: c,
|
|
645
645
|
url: s,
|
|
646
646
|
executeRaw: this.executeRawGraphQL.bind(this)
|
|
647
647
|
});
|
|
@@ -662,12 +662,12 @@ class Ve {
|
|
|
662
662
|
operationName: n,
|
|
663
663
|
headers: s
|
|
664
664
|
}) {
|
|
665
|
-
const a = `${this.pathData}/graphql`,
|
|
665
|
+
const a = `${this.pathData}/graphql`, c = await this.fetch(a, {
|
|
666
666
|
method: "POST",
|
|
667
667
|
body: JSON.stringify({ query: e, variables: r, operationName: n }),
|
|
668
668
|
headers: L(s)
|
|
669
669
|
});
|
|
670
|
-
return M(
|
|
670
|
+
return M(c, "WebApp", a);
|
|
671
671
|
}
|
|
672
672
|
/**
|
|
673
673
|
* If the url is relative, convert to it to an absolute Salesforce URL. This is due to the way Code
|
|
@@ -683,12 +683,12 @@ class Ve {
|
|
|
683
683
|
return e;
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function je() {
|
|
687
687
|
return {
|
|
688
688
|
apiPath: globalThis.SFDC_ENV?.apiPath
|
|
689
689
|
};
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function Ke(t) {
|
|
692
692
|
if (!t || t === "/") return "";
|
|
693
693
|
let e = t;
|
|
694
694
|
return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
@@ -710,33 +710,57 @@ async function We(t, e) {
|
|
|
710
710
|
throw new Error(
|
|
711
711
|
'Cannot attach extensions: the base SDK already declares an "ext" member, which the extension container reserves.'
|
|
712
712
|
);
|
|
713
|
-
const r = Object.create(t), n = {
|
|
713
|
+
const r = Object.create(t), n = /* @__PURE__ */ Object.create(null), s = (o) => {
|
|
714
|
+
throw new Error(`Cannot write "ext.${String(o)}" — ext is immutable once attached.`);
|
|
715
|
+
}, a = (o) => {
|
|
716
|
+
throw new Error(`Cannot ${o} "ext" — ext is immutable once attached.`);
|
|
717
|
+
}, c = new Proxy(n, {
|
|
718
|
+
set(o, i) {
|
|
719
|
+
return s(i);
|
|
720
|
+
},
|
|
721
|
+
defineProperty(o, i) {
|
|
722
|
+
return s(i);
|
|
723
|
+
},
|
|
724
|
+
deleteProperty(o, i) {
|
|
725
|
+
return s(i);
|
|
726
|
+
},
|
|
727
|
+
// Without these two, `preventExtensions`/`setPrototypeOf` fall through to the
|
|
728
|
+
// real `store` (no per-property trap catches them) — the first would silently
|
|
729
|
+
// block later extensions from mounting, the second could inject a readable
|
|
730
|
+
// property via the prototype chain that no extension ever returned.
|
|
731
|
+
preventExtensions() {
|
|
732
|
+
return a("prevent extensions on");
|
|
733
|
+
},
|
|
734
|
+
setPrototypeOf() {
|
|
735
|
+
return a("change the prototype of");
|
|
736
|
+
}
|
|
737
|
+
});
|
|
714
738
|
Object.defineProperty(r, "ext", {
|
|
715
|
-
value:
|
|
739
|
+
value: c,
|
|
716
740
|
enumerable: !0,
|
|
717
741
|
writable: !1,
|
|
718
742
|
configurable: !1
|
|
719
743
|
});
|
|
720
|
-
for (const
|
|
721
|
-
const { extension:
|
|
722
|
-
if (Object.hasOwn(n,
|
|
744
|
+
for (const o of e) {
|
|
745
|
+
const { extension: i, mountName: h } = ze(o), u = h === i.name ? `"${i.name}"` : `"${i.name}" (aliased as "${h}")`;
|
|
746
|
+
if (Object.hasOwn(n, h))
|
|
723
747
|
throw new Error(
|
|
724
|
-
`Extension ${
|
|
748
|
+
`Extension ${u} cannot attach: "${h}" is already defined by another extension.`
|
|
725
749
|
);
|
|
726
|
-
let
|
|
750
|
+
let d;
|
|
727
751
|
try {
|
|
728
|
-
|
|
729
|
-
} catch (
|
|
730
|
-
throw new Error(`Extension ${
|
|
752
|
+
d = await i.setup(r);
|
|
753
|
+
} catch (p) {
|
|
754
|
+
throw new Error(`Extension ${u} failed during setup.`, { cause: p });
|
|
731
755
|
}
|
|
732
|
-
Object.defineProperty(n,
|
|
733
|
-
value:
|
|
756
|
+
Object.defineProperty(n, h, {
|
|
757
|
+
value: d,
|
|
734
758
|
enumerable: !0,
|
|
735
|
-
writable: !
|
|
736
|
-
configurable: !
|
|
759
|
+
writable: !1,
|
|
760
|
+
configurable: !1
|
|
737
761
|
});
|
|
738
762
|
}
|
|
739
|
-
return r;
|
|
763
|
+
return Object.freeze(n), r;
|
|
740
764
|
}
|
|
741
765
|
function ct(t, ...e) {
|
|
742
766
|
let r = t[0] ?? "";
|
|
@@ -748,14 +772,14 @@ const ut = V();
|
|
|
748
772
|
async function Je(t) {
|
|
749
773
|
try {
|
|
750
774
|
switch (await U(t?.surface)) {
|
|
751
|
-
case
|
|
775
|
+
case m.OpenAI:
|
|
752
776
|
return new be();
|
|
753
|
-
case
|
|
754
|
-
case
|
|
777
|
+
case m.WebApp:
|
|
778
|
+
case m.MicroFrontend:
|
|
755
779
|
return new Ve(t?.webapp);
|
|
756
|
-
case
|
|
780
|
+
case m.Mosaic:
|
|
757
781
|
return new pe(t?.mosaic);
|
|
758
|
-
case
|
|
782
|
+
case m.MCPApps:
|
|
759
783
|
return {};
|
|
760
784
|
default:
|
|
761
785
|
return {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/platform-sdk",
|
|
3
|
-
"version": "11.69.
|
|
3
|
+
"version": "11.69.3",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"@conduit-client/service-pubsub": "3.19.6",
|
|
135
135
|
"@conduit-client/service-retry": "3.19.6",
|
|
136
136
|
"@conduit-client/utils": "3.19.6",
|
|
137
|
-
"@salesforce/jsonrpc": "^11.69.
|
|
137
|
+
"@salesforce/jsonrpc": "^11.69.3",
|
|
138
138
|
"@salesforce/sf-embedding-bridge": "2.2.5-rc.2"
|
|
139
139
|
},
|
|
140
140
|
"peerDependencies": {
|