@salesforce/sdk-data 1.103.0 → 1.103.1
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.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -40
- package/dist/webapp/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIhE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIhE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAe9E;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAMhE;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAc3E;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS;IAC3C,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;CAC3B,GAAG,IAAI,GACL,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,GAClC,CAAC,GACD,KAAK,GACN,KAAK,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { getSurface as
|
|
2
|
-
const
|
|
3
|
-
class
|
|
1
|
+
import { getSurface as C, Surface as h } from "@salesforce/sdk-core";
|
|
2
|
+
const S = "salesforce_graphql";
|
|
3
|
+
class T {
|
|
4
4
|
async graphql(e, r) {
|
|
5
|
-
return (await window.openai.callTool(
|
|
5
|
+
return (await window.openai.callTool(S, {
|
|
6
6
|
query: e,
|
|
7
7
|
...r != null ? { variables: r } : {}
|
|
8
8
|
})).structuredContent;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
function u(t) {
|
|
12
|
-
return
|
|
12
|
+
return k(t) ? t.then((e) => e) : {
|
|
13
13
|
then: (e, r) => {
|
|
14
14
|
try {
|
|
15
15
|
return u(e(t));
|
|
@@ -20,7 +20,7 @@ function u(t) {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
function P(t) {
|
|
23
|
-
return
|
|
23
|
+
return k(t) ? t.then((e) => e) : {
|
|
24
24
|
then: (e, r) => {
|
|
25
25
|
if (typeof r == "function")
|
|
26
26
|
try {
|
|
@@ -32,7 +32,7 @@ function P(t) {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function k(t) {
|
|
36
36
|
return typeof t?.then == "function";
|
|
37
37
|
}
|
|
38
38
|
function I(t = {
|
|
@@ -56,7 +56,7 @@ function I(t = {
|
|
|
56
56
|
u(r)
|
|
57
57
|
);
|
|
58
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((
|
|
59
|
+
(l, w) => l.then((R) => w(R, s)),
|
|
60
60
|
u(i)
|
|
61
61
|
)).finally(() => {
|
|
62
62
|
if (y.length > 0)
|
|
@@ -92,7 +92,7 @@ function E(t, e, [r, n = {}], {
|
|
|
92
92
|
}
|
|
93
93
|
return [r, n];
|
|
94
94
|
}
|
|
95
|
-
class
|
|
95
|
+
class b {
|
|
96
96
|
constructor(e) {
|
|
97
97
|
this.defaultRetryPolicy = e;
|
|
98
98
|
}
|
|
@@ -122,28 +122,28 @@ class D {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
class
|
|
125
|
+
class D {
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function A(t) {
|
|
128
128
|
return {
|
|
129
129
|
version: "1.0",
|
|
130
|
-
service: new
|
|
130
|
+
service: new b(t),
|
|
131
131
|
type: "retry"
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
const m = "X-CSRF-Token";
|
|
135
|
-
function
|
|
135
|
+
function g(t, e = {}) {
|
|
136
136
|
const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
|
|
137
137
|
return async (s) => {
|
|
138
138
|
const [a, c] = s, o = new Request(a, c);
|
|
139
|
-
if (!o.headers.has(m) && (_(n, o.url) ||
|
|
139
|
+
if (!o.headers.has(m) && (_(n, o.url) || $(o.method) && _(r, o.url))) {
|
|
140
140
|
const p = await t.getToken();
|
|
141
141
|
s = E(m, p, s);
|
|
142
142
|
}
|
|
143
143
|
return u(s);
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function $(t) {
|
|
147
147
|
const e = t.toLowerCase();
|
|
148
148
|
return e === "post" || e === "put" || e === "patch" || e === "delete";
|
|
149
149
|
}
|
|
@@ -151,15 +151,15 @@ function _(t, e) {
|
|
|
151
151
|
const r = new URL(e);
|
|
152
152
|
return t.some((n) => r.pathname.includes(n));
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
const r =
|
|
154
|
+
function q(t, e = {}) {
|
|
155
|
+
const r = g(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
|
|
162
|
+
class U extends D {
|
|
163
163
|
constructor(e) {
|
|
164
164
|
super(e), this.csrfTokenManager = e;
|
|
165
165
|
}
|
|
@@ -167,7 +167,7 @@ class M extends A {
|
|
|
167
167
|
* Determines if a failed request should be retried due to CSRF token issues.
|
|
168
168
|
*/
|
|
169
169
|
async shouldRetry(e, r) {
|
|
170
|
-
return r.attempt >= 1 || e.status !== 400 ? !1 : await
|
|
170
|
+
return r.attempt >= 1 || e.status !== 400 ? !1 : await M(e);
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* CSRF token refresh should happen immediately with no delay.
|
|
@@ -185,14 +185,14 @@ class M extends A {
|
|
|
185
185
|
await this.csrfTokenManager.refreshToken();
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
async function
|
|
188
|
+
async function M(t) {
|
|
189
189
|
try {
|
|
190
190
|
return (await t.clone().json())[0]?.errorCode === "INVALID_ACCESS_TOKEN";
|
|
191
191
|
} catch {
|
|
192
192
|
return !1;
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
class
|
|
195
|
+
class F {
|
|
196
196
|
constructor(e, r) {
|
|
197
197
|
this.endpoint = e, this.cacheName = r, this.tokenPromise = this.obtainToken();
|
|
198
198
|
}
|
|
@@ -236,32 +236,32 @@ class N {
|
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
const e = t.csrf, r = new
|
|
239
|
+
function N(t) {
|
|
240
|
+
const e = t.csrf, r = new F(e.endpoint, e.cacheName);
|
|
241
241
|
return I(
|
|
242
|
-
{ retry:
|
|
243
|
-
|
|
242
|
+
{ retry: q(r, e) },
|
|
243
|
+
A(new U(r)).service
|
|
244
244
|
).service;
|
|
245
245
|
}
|
|
246
|
-
const
|
|
247
|
-
class
|
|
246
|
+
const O = 1, H = `@salesforce/sdk-data_v${O}`, x = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0", v = `/services/data/v${x}`, L = `${v}/ui-api`;
|
|
247
|
+
class j {
|
|
248
248
|
baseUrl;
|
|
249
249
|
clientFetch;
|
|
250
250
|
on401;
|
|
251
251
|
on403;
|
|
252
252
|
constructor(e) {
|
|
253
|
-
const r =
|
|
254
|
-
this.baseUrl =
|
|
253
|
+
const r = W();
|
|
254
|
+
this.baseUrl = K(e?.basePath ?? r.apiPath), this.on401 = e?.on401, this.on403 = e?.on403, this.clientFetch = N({
|
|
255
255
|
csrf: {
|
|
256
|
-
endpoint: `${this.baseUrl}${
|
|
257
|
-
cacheName:
|
|
256
|
+
endpoint: `${this.baseUrl}${L}/session/csrf`,
|
|
257
|
+
cacheName: H,
|
|
258
258
|
protectedUrls: ["services/data/v", "services/apexrest"],
|
|
259
259
|
alwaysProtectedUrls: ["services/apexrest"]
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
async graphql(e, r) {
|
|
264
|
-
return (await this.fetch(`${
|
|
264
|
+
return (await this.fetch(`${v}/graphql`, {
|
|
265
265
|
method: "POST",
|
|
266
266
|
body: JSON.stringify({ query: e, variables: r }),
|
|
267
267
|
headers: {
|
|
@@ -296,14 +296,12 @@ class W {
|
|
|
296
296
|
return e;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
const t = globalThis.SFDC_ENV;
|
|
299
|
+
function W() {
|
|
301
300
|
return {
|
|
302
|
-
|
|
303
|
-
apiPath: t?.apiPath
|
|
301
|
+
apiPath: globalThis.SFDC_ENV?.apiPath
|
|
304
302
|
};
|
|
305
303
|
}
|
|
306
|
-
function
|
|
304
|
+
function K(t) {
|
|
307
305
|
if (!t || t === "/") return "";
|
|
308
306
|
let e = t;
|
|
309
307
|
return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
@@ -315,12 +313,12 @@ function z(t, ...e) {
|
|
|
315
313
|
return r;
|
|
316
314
|
}
|
|
317
315
|
async function V(t) {
|
|
318
|
-
switch (
|
|
316
|
+
switch (C(t?.surface)) {
|
|
319
317
|
case h.OpenAI:
|
|
320
|
-
return new
|
|
318
|
+
return new T();
|
|
321
319
|
case h.WebApp:
|
|
322
320
|
case h.MicroFrontend:
|
|
323
|
-
return new
|
|
321
|
+
return new j(t?.webapp);
|
|
324
322
|
case h.SalesforceACC:
|
|
325
323
|
return {};
|
|
326
324
|
case h.MCPApps:
|
|
@@ -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;AAMrD,eAAO,MAAM,WAAW,QAA0E,CAAC;AAInG;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,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;AAMrD,eAAO,MAAM,WAAW,QAA0E,CAAC;AAInG;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,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;IAkBpC,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;CAa3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/sdk-data",
|
|
3
|
-
"version": "1.103.
|
|
3
|
+
"version": "1.103.1",
|
|
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.103.
|
|
31
|
+
"@salesforce/sdk-core": "^1.103.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"vite": "^7.3.1",
|