@salesforce/sdk-data 1.91.0 → 1.92.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/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSurface as T, Surface as h } from "@salesforce/sdk-core";
|
|
2
2
|
const m = "salesforce_graphql";
|
|
3
|
-
class
|
|
3
|
+
class C {
|
|
4
4
|
async graphql(e, r) {
|
|
5
5
|
return (await window.openai.callTool(m, {
|
|
6
6
|
query: e,
|
|
@@ -8,31 +8,31 @@ class v {
|
|
|
8
8
|
})).structuredContent;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
11
|
+
function u(t) {
|
|
12
|
+
return S(t) ? t.then((e) => e) : {
|
|
13
13
|
then: (e, r) => {
|
|
14
14
|
try {
|
|
15
|
-
return
|
|
15
|
+
return u(e(t));
|
|
16
16
|
} catch (n) {
|
|
17
|
-
return e === void 0 ?
|
|
17
|
+
return e === void 0 ? u(t) : _(n);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
22
|
+
function _(t) {
|
|
23
|
+
return S(t) ? t.then((e) => e) : {
|
|
24
24
|
then: (e, r) => {
|
|
25
25
|
if (typeof r == "function")
|
|
26
26
|
try {
|
|
27
|
-
return
|
|
27
|
+
return u(r(t));
|
|
28
28
|
} catch (n) {
|
|
29
|
-
return
|
|
29
|
+
return _(n);
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return _(t);
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function S(t) {
|
|
36
36
|
return typeof t?.then == "function";
|
|
37
37
|
}
|
|
38
38
|
function A(t = {
|
|
@@ -49,18 +49,18 @@ function A(t = {
|
|
|
49
49
|
const s = (n = t.createContext) == null ? void 0 : n.call(t), {
|
|
50
50
|
request: a = [],
|
|
51
51
|
retry: c = void 0,
|
|
52
|
-
response:
|
|
53
|
-
finally:
|
|
54
|
-
} = t,
|
|
55
|
-
(i, l) => i.then((
|
|
56
|
-
|
|
52
|
+
response: o = [],
|
|
53
|
+
finally: y = []
|
|
54
|
+
} = t, p = a.reduce(
|
|
55
|
+
(i, l) => i.then((w) => l(w, s)),
|
|
56
|
+
u(r)
|
|
57
57
|
);
|
|
58
|
-
return Promise.resolve(
|
|
59
|
-
(l,
|
|
60
|
-
|
|
58
|
+
return Promise.resolve(p).then((i) => c ? c(i, e, s) : e ? e.applyRetry(() => fetch(...i)) : fetch(...i)).then((i) => o.reduce(
|
|
59
|
+
(l, w) => l.then((v) => w(v, s)),
|
|
60
|
+
u(i)
|
|
61
61
|
)).finally(() => {
|
|
62
|
-
if (
|
|
63
|
-
return
|
|
62
|
+
if (y.length > 0)
|
|
63
|
+
return y.reduce(
|
|
64
64
|
(i, l) => i.then(() => l(s)),
|
|
65
65
|
Promise.resolve()
|
|
66
66
|
);
|
|
@@ -68,7 +68,7 @@ function A(t = {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function E(t, e, [r, n = {}], {
|
|
72
72
|
throwOnExisting: s = !1,
|
|
73
73
|
errorMessage: a = `Unexpected ${t} header encountered`
|
|
74
74
|
} = {}) {
|
|
@@ -92,7 +92,7 @@ function C(t, e, [r, n = {}], {
|
|
|
92
92
|
}
|
|
93
93
|
return [r, n];
|
|
94
94
|
}
|
|
95
|
-
class
|
|
95
|
+
class I {
|
|
96
96
|
constructor(e) {
|
|
97
97
|
this.defaultRetryPolicy = e;
|
|
98
98
|
}
|
|
@@ -107,8 +107,8 @@ class E {
|
|
|
107
107
|
lastResult: a
|
|
108
108
|
};
|
|
109
109
|
for (; await r.shouldRetry(a, c); ) {
|
|
110
|
-
const
|
|
111
|
-
await this.delay(
|
|
110
|
+
const o = await r.calculateDelay(a, c);
|
|
111
|
+
await this.delay(o), r.prepareRetry && await r.prepareRetry(a, c), s++, a = await e(), c = {
|
|
112
112
|
attempt: s,
|
|
113
113
|
totalElapsedMs: Date.now() - n,
|
|
114
114
|
lastResult: a
|
|
@@ -122,44 +122,44 @@ class E {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
class
|
|
125
|
+
class b {
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function D(t) {
|
|
128
128
|
return {
|
|
129
129
|
version: "1.0",
|
|
130
|
-
service: new
|
|
130
|
+
service: new I(t),
|
|
131
131
|
type: "retry"
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
function
|
|
136
|
-
const { protectedUrls: r = [] } = e;
|
|
137
|
-
return async (
|
|
138
|
-
const [
|
|
139
|
-
if (
|
|
140
|
-
const
|
|
141
|
-
|
|
134
|
+
const P = "X-CSRF-Token";
|
|
135
|
+
function q(t, e = {}) {
|
|
136
|
+
const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
|
|
137
|
+
return async (s) => {
|
|
138
|
+
const [a, c] = s, o = new Request(a, c);
|
|
139
|
+
if (!o.headers.has(P) && (R(n, o.url) || g(o.method) && R(r, o.url))) {
|
|
140
|
+
const p = await t.getToken();
|
|
141
|
+
s = E(P, p, s);
|
|
142
142
|
}
|
|
143
|
-
return
|
|
143
|
+
return u(s);
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function g(t) {
|
|
147
147
|
const e = t.toLowerCase();
|
|
148
148
|
return e === "post" || e === "put" || e === "patch" || e === "delete";
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function R(t, e) {
|
|
151
151
|
const r = new URL(e);
|
|
152
152
|
return t.some((n) => r.pathname.includes(n));
|
|
153
153
|
}
|
|
154
154
|
function F(t, e = {}) {
|
|
155
|
-
const r =
|
|
155
|
+
const r = q(t, e);
|
|
156
156
|
async function n(s) {
|
|
157
157
|
const a = await r(s);
|
|
158
158
|
return fetch(a[0], a[1]);
|
|
159
159
|
}
|
|
160
160
|
return (s, a) => a ? a.applyRetry(async () => n(s)) : n(s);
|
|
161
161
|
}
|
|
162
|
-
class H extends
|
|
162
|
+
class H extends b {
|
|
163
163
|
constructor(e) {
|
|
164
164
|
super(e), this.csrfTokenManager = e;
|
|
165
165
|
}
|
|
@@ -240,26 +240,27 @@ function $(t) {
|
|
|
240
240
|
const e = t.csrf, r = new O(e.endpoint, e.cacheName);
|
|
241
241
|
return A(
|
|
242
242
|
{ retry: F(r, e) },
|
|
243
|
-
|
|
243
|
+
D(new H(r)).service
|
|
244
244
|
).service;
|
|
245
245
|
}
|
|
246
|
-
const N = 1,
|
|
247
|
-
class
|
|
246
|
+
const N = 1, U = `@salesforce/sdk-data_v${N}`, x = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0", L = typeof __SF_SERVER_BASE_PATH__ < "u" ? __SF_SERVER_BASE_PATH__ : "", k = `/services/data/v${x}`, j = `${k}/ui-api`;
|
|
247
|
+
class B {
|
|
248
248
|
base;
|
|
249
249
|
clientFetch;
|
|
250
250
|
on401;
|
|
251
251
|
on403;
|
|
252
252
|
constructor(e) {
|
|
253
|
-
this.base = e?.basePath ??
|
|
253
|
+
this.base = e?.basePath ?? L, this.on401 = e?.on401, this.on403 = e?.on403, this.clientFetch = $({
|
|
254
254
|
csrf: {
|
|
255
|
-
endpoint: `${this.base}${
|
|
256
|
-
cacheName:
|
|
257
|
-
protectedUrls: ["/services/data/v"]
|
|
255
|
+
endpoint: `${this.base}${j}/session/csrf`,
|
|
256
|
+
cacheName: U,
|
|
257
|
+
protectedUrls: ["/services/data/v", "/services/apexrest"],
|
|
258
|
+
alwaysProtectedUrls: ["/services/apexrest"]
|
|
258
259
|
}
|
|
259
260
|
});
|
|
260
261
|
}
|
|
261
262
|
async graphql(e, r) {
|
|
262
|
-
return (await this.fetch(`${
|
|
263
|
+
return (await this.fetch(`${k}/graphql`, {
|
|
263
264
|
method: "POST",
|
|
264
265
|
body: JSON.stringify({ query: e, variables: r }),
|
|
265
266
|
headers: {
|
|
@@ -297,10 +298,10 @@ function W(t, ...e) {
|
|
|
297
298
|
async function K(t) {
|
|
298
299
|
switch (T(t?.surface)) {
|
|
299
300
|
case h.OpenAI:
|
|
300
|
-
return new
|
|
301
|
+
return new C();
|
|
301
302
|
case h.WebApp:
|
|
302
303
|
case h.MicroFrontend:
|
|
303
|
-
return new
|
|
304
|
+
return new B(t?.webapp);
|
|
304
305
|
case h.SalesforceACC:
|
|
305
306
|
return {};
|
|
306
307
|
case h.MCPApps:
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { RequestInterceptor } from '@conduit-client/service-fetch-network/v1';
|
|
2
2
|
import { CsrfTokenManager } from './token-manager';
|
|
3
3
|
export interface HeaderInterceptorConfig {
|
|
4
|
+
/** URLs that require CSRF tokens on mutating methods (POST, PUT, PATCH, DELETE). */
|
|
4
5
|
protectedUrls?: string[];
|
|
6
|
+
/**
|
|
7
|
+
* URLs that require CSRF tokens on all methods including GET.
|
|
8
|
+
* Use for endpoints that are sensitive regardless of HTTP method (e.g. Apex REST).
|
|
9
|
+
*/
|
|
10
|
+
alwaysProtectedUrls?: string[];
|
|
5
11
|
}
|
|
6
12
|
/**
|
|
7
13
|
* Builds a configured interceptor for applying CSRF header to requests
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.interceptor.d.ts","sourceRoot":"","sources":["../../../src/webapp/csrf/header.interceptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,MAAM,WAAW,uBAAuB;IACvC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"header.interceptor.d.ts","sourceRoot":"","sources":["../../../src/webapp/csrf/header.interceptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,MAAM,WAAW,uBAAuB;IACvC,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,GAAE,uBAA4B,GAClC,kBAAkB,CAmBpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webapp/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AASrD,eAAO,MAAM,WAAW,QAA0E,CAAC;AAKnG;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAgC;IACvD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAgC;gBAE3C,OAAO,CAAC,EAAE,oBAAoB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webapp/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AASrD,eAAO,MAAM,WAAW,QAA0E,CAAC;AAKnG;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAgC;IACvD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAgC;gBAE3C,OAAO,CAAC,EAAE,oBAAoB;IAepC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAaxE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAiBjF;;;OAGG;IACH,OAAO,CAAC,mBAAmB;CAY3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/sdk-data",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.92.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@conduit-client/service-fetch-network": "3.17.0",
|
|
30
30
|
"@conduit-client/utils": "3.17.0",
|
|
31
|
-
"@salesforce/sdk-core": "^1.
|
|
31
|
+
"@salesforce/sdk-core": "^1.92.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"vite": "^7.3.1",
|