@salesforce/platform-sdk 11.64.0 → 11.66.2
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/core/extension-attach.d.ts +56 -0
- package/dist/core/extension-attach.d.ts.map +1 -0
- package/dist/core/{plugin-factory.d.ts → extension-factory.d.ts} +16 -16
- package/dist/core/extension-factory.d.ts.map +1 -0
- package/dist/core/extension-types.d.ts +231 -0
- package/dist/core/extension-types.d.ts.map +1 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -5
- package/dist/data/extensions/index.d.ts +19 -0
- package/dist/data/extensions/index.d.ts.map +1 -0
- package/dist/data/{plugins → extensions}/index.js +12 -12
- package/dist/data/{plugins → extensions}/labels/index.d.ts +18 -18
- package/dist/data/extensions/labels/index.d.ts.map +1 -0
- package/dist/data/{plugins → extensions}/labels/query.d.ts +1 -1
- package/dist/data/extensions/labels/query.d.ts.map +1 -0
- package/dist/data/index.d.ts +35 -27
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +158 -153
- package/dist/data/shared/graphql/cache/services.d.ts +7 -7
- package/dist/data/shared/graphql/cache/services.d.ts.map +1 -1
- package/dist/data/webapp/index.d.ts.map +1 -1
- package/dist/{plugin-factory-BC3b3BOy.js → extension-factory-CJkfM4km.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -21
- package/package.json +8 -8
- package/dist/core/plugin-attach.d.ts +0 -46
- package/dist/core/plugin-attach.d.ts.map +0 -1
- package/dist/core/plugin-factory.d.ts.map +0 -1
- package/dist/core/plugin-types.d.ts +0 -208
- package/dist/core/plugin-types.d.ts.map +0 -1
- package/dist/data/plugins/index.d.ts +0 -19
- package/dist/data/plugins/index.d.ts.map +0 -1
- package/dist/data/plugins/labels/index.d.ts.map +0 -1
- package/dist/data/plugins/labels/query.d.ts.map +0 -1
- package/dist/data/reserved.d.ts +0 -3
- package/dist/data/reserved.d.ts.map +0 -1
package/dist/data/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { g as
|
|
1
|
+
import { g as U, S as y } from "../surface-Dd2tqrPi.js";
|
|
2
2
|
import { w as Q } from "../sdk-promise-D0sy7OW1.js";
|
|
3
|
-
import { c as
|
|
4
|
-
import { buildServiceDescriptor as
|
|
5
|
-
import { resolvedPromiseLike as u, ok as
|
|
3
|
+
import { c as V } from "../extension-factory-CJkfM4km.js";
|
|
4
|
+
import { buildServiceDescriptor as _, setHeader as b } from "@conduit-client/service-fetch-network/v1";
|
|
5
|
+
import { resolvedPromiseLike as u, ok as C, err as D, stableJSONStringify as K, DataNotFoundError as j, 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";
|
|
@@ -25,7 +25,7 @@ function se(t) {
|
|
|
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 $(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
|
-
c === void 0 ? (r[a] =
|
|
49
|
+
for (const [a, i] of ie(e)) {
|
|
50
|
+
const o = a.toLowerCase(), c = n.get(o);
|
|
51
|
+
c === void 0 ? (r[a] = i, n.set(o, a), s.add(o)) : s.has(o) ? r[c] = `${r[c]}, ${i}` : (r[c] = i, s.add(o));
|
|
52
52
|
}
|
|
53
53
|
return r;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
return
|
|
55
|
+
function L(t) {
|
|
56
|
+
return $(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) {
|
|
@@ -76,16 +76,16 @@ class A extends Error {
|
|
|
76
76
|
), this.name = "GraphQLTransportError", this.status = e.status, this.url = e.url, this.cause = e.cause;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
async function
|
|
79
|
+
async function M(t, e, r) {
|
|
80
80
|
const n = await t.text();
|
|
81
81
|
let s;
|
|
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,
|
|
@@ -94,17 +94,17 @@ async function G(t, e, r) {
|
|
|
94
94
|
});
|
|
95
95
|
return s;
|
|
96
96
|
}
|
|
97
|
-
const
|
|
98
|
-
},
|
|
97
|
+
const v = () => {
|
|
98
|
+
}, O = async () => {
|
|
99
99
|
};
|
|
100
|
-
function
|
|
100
|
+
function N(t) {
|
|
101
101
|
try {
|
|
102
|
-
return
|
|
102
|
+
return C(J(t));
|
|
103
103
|
} catch (e) {
|
|
104
|
-
return
|
|
104
|
+
return D(p(e));
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function k(t, e) {
|
|
108
108
|
const r = t.definitions.filter(
|
|
109
109
|
(n) => n.kind === "OperationDefinition"
|
|
110
110
|
);
|
|
@@ -118,22 +118,22 @@ function p(t) {
|
|
|
118
118
|
}
|
|
119
119
|
return t instanceof Error ? [{ message: t.message }] : typeof t == "string" ? [{ message: t }] : [{ message: "Unknown error" }];
|
|
120
120
|
}
|
|
121
|
-
async function
|
|
122
|
-
const a =
|
|
121
|
+
async function G(t, { mutation: e, variables: r, operationName: n, headers: s }) {
|
|
122
|
+
const a = N(e);
|
|
123
123
|
if (a.isErr()) return { data: void 0, errors: a.error };
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
124
|
+
const i = a.value, o = k(i, 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
135
|
const c = await t({
|
|
136
|
-
query: q(
|
|
136
|
+
query: q(i),
|
|
137
137
|
variables: r,
|
|
138
138
|
operationName: n,
|
|
139
139
|
headers: s
|
|
@@ -146,36 +146,36 @@ async function I(t, { mutation: e, variables: r, operationName: n, headers: s })
|
|
|
146
146
|
return { data: void 0, errors: p(c) };
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
function e(n, s, a,
|
|
149
|
+
function I(t) {
|
|
150
|
+
function e(n, s, a, i) {
|
|
151
151
|
return t({
|
|
152
152
|
query: q(n),
|
|
153
153
|
variables: s,
|
|
154
154
|
operationName: a,
|
|
155
|
-
headers:
|
|
155
|
+
headers: i
|
|
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: p(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: i
|
|
169
169
|
}) {
|
|
170
|
-
const
|
|
171
|
-
if (
|
|
170
|
+
const o = N(n);
|
|
171
|
+
if (o.isErr())
|
|
172
172
|
return {
|
|
173
173
|
data: void 0,
|
|
174
|
-
errors:
|
|
175
|
-
subscribe: () =>
|
|
176
|
-
refresh:
|
|
174
|
+
errors: o.error,
|
|
175
|
+
subscribe: () => v,
|
|
176
|
+
refresh: O
|
|
177
177
|
};
|
|
178
|
-
const c =
|
|
178
|
+
const c = o.value, l = k(c, a);
|
|
179
179
|
if (l !== "query")
|
|
180
180
|
return {
|
|
181
181
|
data: void 0,
|
|
@@ -184,10 +184,10 @@ function F(t) {
|
|
|
184
184
|
message: `DataSDK.graphql.query() requires a GraphQL query, received ${l}.`
|
|
185
185
|
}
|
|
186
186
|
],
|
|
187
|
-
subscribe: () =>
|
|
188
|
-
refresh:
|
|
187
|
+
subscribe: () => v,
|
|
188
|
+
refresh: O
|
|
189
189
|
};
|
|
190
|
-
const h = /* @__PURE__ */ new Set(), f = s, m = await e(c, f, a,
|
|
190
|
+
const h = /* @__PURE__ */ new Set(), f = s, m = await e(c, f, a, i);
|
|
191
191
|
return {
|
|
192
192
|
data: m.data,
|
|
193
193
|
errors: m.errors,
|
|
@@ -197,18 +197,18 @@ function F(t) {
|
|
|
197
197
|
};
|
|
198
198
|
},
|
|
199
199
|
async refresh() {
|
|
200
|
-
const d = await e(c, f, a,
|
|
200
|
+
const d = await e(c, f, a, i);
|
|
201
201
|
for (const S of h) S(d);
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
205
|
return {
|
|
206
206
|
query: r,
|
|
207
|
-
mutate: (n) =>
|
|
207
|
+
mutate: (n) => G(t, n)
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
210
|
const le = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
|
|
211
|
-
function
|
|
211
|
+
function F(t = le) {
|
|
212
212
|
return `/services/data/v${t}`;
|
|
213
213
|
}
|
|
214
214
|
const de = {
|
|
@@ -221,7 +221,7 @@ class pe {
|
|
|
221
221
|
graphql;
|
|
222
222
|
constructor(e) {
|
|
223
223
|
const r = fe(), n = me(e?.instanceUrl ?? r.instanceUrl), s = e?.accessToken ?? r.accessToken;
|
|
224
|
-
this.pathData =
|
|
224
|
+
this.pathData = F(e?.apiVersion ?? r.apiVersion), this.clientFetch = ae(n || void 0, s), this.graphql = I(this.executeRawGraphQL.bind(this));
|
|
225
225
|
}
|
|
226
226
|
async executeRawGraphQL({
|
|
227
227
|
query: e,
|
|
@@ -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`, i = await this.clientFetch(a, {
|
|
233
233
|
method: "POST",
|
|
234
234
|
body: JSON.stringify({ query: e, variables: r, operationName: n }),
|
|
235
|
-
headers:
|
|
235
|
+
headers: $(de, s)
|
|
236
236
|
});
|
|
237
|
-
return
|
|
237
|
+
return M(i, "Mosaic", a);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
function fe() {
|
|
@@ -254,7 +254,7 @@ const ye = "graphqlQuery";
|
|
|
254
254
|
class be {
|
|
255
255
|
graphql;
|
|
256
256
|
constructor() {
|
|
257
|
-
this.graphql =
|
|
257
|
+
this.graphql = I(this.executeRawGraphQL.bind(this));
|
|
258
258
|
}
|
|
259
259
|
/**
|
|
260
260
|
* The `headers` request option is intentionally not forwarded: this surface
|
|
@@ -273,39 +273,36 @@ class be {
|
|
|
273
273
|
})).structuredContent;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
const
|
|
277
|
-
graphql: !0,
|
|
278
|
-
fetch: !0
|
|
279
|
-
}, we = new Set(Object.keys(ge)), v = "Accept-Language", Se = (t) => {
|
|
276
|
+
const g = "Accept-Language", we = (t) => {
|
|
280
277
|
const e = globalThis.SFDC_ENV?.language;
|
|
281
278
|
if (!e)
|
|
282
279
|
return u(t);
|
|
283
280
|
const [r, n] = t;
|
|
284
|
-
return (r instanceof Request && !n?.headers ? r.headers.has(
|
|
285
|
-
}, ve = "X-SFDC-Client-Name",
|
|
286
|
-
let e = b(ve,
|
|
287
|
-
return e = b(
|
|
288
|
-
},
|
|
281
|
+
return (r instanceof Request && !n?.headers ? r.headers.has(g) : new Headers(n?.headers).has(g)) ? u(t) : u(b(g, e, t));
|
|
282
|
+
}, ve = "X-SFDC-Client-Name", Se = "X-SFDC-Client-Version", ge = "@salesforce/platform-sdk", Ee = "11.66.2", Ce = (t) => {
|
|
283
|
+
let e = b(ve, ge, t);
|
|
284
|
+
return e = b(Se, Ee, e), u(e);
|
|
285
|
+
}, De = "X-CSRF-Token";
|
|
289
286
|
function Oe(t, e = {}) {
|
|
290
287
|
const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
|
|
291
288
|
return async (s) => {
|
|
292
|
-
const [a,
|
|
293
|
-
if (
|
|
289
|
+
const [a, i] = s, o = a instanceof Request ? a.url : a instanceof URL ? a.href : a, c = i?.method ?? (a instanceof Request ? a.method : void 0) ?? "GET";
|
|
290
|
+
if (T(n, o) || qe(c) && T(r, o)) {
|
|
294
291
|
const h = await t.getToken();
|
|
295
|
-
s = b(
|
|
292
|
+
s = b(De, h, s);
|
|
296
293
|
}
|
|
297
294
|
return u(s);
|
|
298
295
|
};
|
|
299
296
|
}
|
|
300
|
-
function
|
|
297
|
+
function qe(t) {
|
|
301
298
|
const e = t.toLowerCase();
|
|
302
299
|
return e === "post" || e === "put" || e === "patch" || e === "delete";
|
|
303
300
|
}
|
|
304
|
-
function
|
|
301
|
+
function T(t, e) {
|
|
305
302
|
const r = new URL(e, globalThis.location?.href ?? "http://localhost");
|
|
306
303
|
return t.some((n) => r.pathname.includes(n));
|
|
307
304
|
}
|
|
308
|
-
function
|
|
305
|
+
function Ne(t, e = {}) {
|
|
309
306
|
const r = Oe(t, e);
|
|
310
307
|
async function n(s) {
|
|
311
308
|
const a = await r(s);
|
|
@@ -314,7 +311,7 @@ function Ae(t, e = {}) {
|
|
|
314
311
|
return (s, a) => a ? a.applyRetry(async () => n(s)) : n(s);
|
|
315
312
|
}
|
|
316
313
|
const ke = [400, 401, 403];
|
|
317
|
-
class
|
|
314
|
+
class Pe extends B {
|
|
318
315
|
constructor(e) {
|
|
319
316
|
super(e), this.csrfTokenManager = e;
|
|
320
317
|
}
|
|
@@ -340,7 +337,7 @@ class _e extends B {
|
|
|
340
337
|
await this.csrfTokenManager.refreshToken();
|
|
341
338
|
}
|
|
342
339
|
}
|
|
343
|
-
class
|
|
340
|
+
class Te {
|
|
344
341
|
constructor(e, r) {
|
|
345
342
|
this.endpoint = e, this.cacheName = r, this.tokenPromise = this.obtainToken();
|
|
346
343
|
}
|
|
@@ -388,29 +385,29 @@ class Re {
|
|
|
388
385
|
return;
|
|
389
386
|
}
|
|
390
387
|
}
|
|
391
|
-
const
|
|
392
|
-
function
|
|
388
|
+
const A = /* @__PURE__ */ new Map();
|
|
389
|
+
function Ae(t) {
|
|
393
390
|
const { endpoint: e, cacheName: r, ...n } = t.csrf;
|
|
394
|
-
let s =
|
|
395
|
-
return s || (s = new
|
|
391
|
+
let s = A.get(e);
|
|
392
|
+
return s || (s = new Te(e, r), A.set(e, s)), _(
|
|
396
393
|
{
|
|
397
|
-
retry:
|
|
398
|
-
request: [
|
|
394
|
+
retry: Ne(s, n),
|
|
395
|
+
request: [Ce, we]
|
|
399
396
|
},
|
|
400
|
-
X(new
|
|
397
|
+
X(new Pe(s)).service
|
|
401
398
|
).service;
|
|
402
399
|
}
|
|
403
|
-
const
|
|
404
|
-
function
|
|
405
|
-
let e =
|
|
400
|
+
const x = /* @__PURE__ */ new Map();
|
|
401
|
+
function xe(t) {
|
|
402
|
+
let e = x.get(t);
|
|
406
403
|
if (!e) {
|
|
407
404
|
const r = Y().service, n = ee(r).service, s = Z(r, n).service, a = te().service;
|
|
408
|
-
e = { cache: r, cacheController: s, pubSub: a },
|
|
405
|
+
e = { cache: r, cacheController: s, pubSub: a }, x.set(t, e);
|
|
409
406
|
}
|
|
410
407
|
return e;
|
|
411
408
|
}
|
|
412
|
-
function
|
|
413
|
-
const r =
|
|
409
|
+
function Re(t, e) {
|
|
410
|
+
const r = xe(t);
|
|
414
411
|
return {
|
|
415
412
|
shared: r,
|
|
416
413
|
services: {
|
|
@@ -420,8 +417,8 @@ function Le(t, e) {
|
|
|
420
417
|
}
|
|
421
418
|
};
|
|
422
419
|
}
|
|
423
|
-
const
|
|
424
|
-
function
|
|
420
|
+
const R = 300;
|
|
421
|
+
function _e(t, e) {
|
|
425
422
|
try {
|
|
426
423
|
return JSON.parse(JSON.stringify(t));
|
|
427
424
|
} catch (r) {
|
|
@@ -431,19 +428,19 @@ function Me(t, e) {
|
|
|
431
428
|
throw s.cause = r, s;
|
|
432
429
|
}
|
|
433
430
|
}
|
|
434
|
-
function
|
|
431
|
+
function $e(t) {
|
|
435
432
|
if (typeof t == "object" && t.type === "max-age") {
|
|
436
433
|
const e = t.maxAge;
|
|
437
|
-
return Number.isFinite(e) && e >= 0 ? e :
|
|
434
|
+
return Number.isFinite(e) && e >= 0 ? e : R;
|
|
438
435
|
}
|
|
439
|
-
return
|
|
436
|
+
return R;
|
|
440
437
|
}
|
|
441
|
-
class
|
|
438
|
+
class Le extends re {
|
|
442
439
|
constructor(e, r, n) {
|
|
443
|
-
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(
|
|
444
441
|
e.variables ?? {},
|
|
445
442
|
this.normalizedOperationName
|
|
446
|
-
), this.cacheControl = e.cacheControl, this.resolvedMaxAge =
|
|
443
|
+
), this.cacheControl = e.cacheControl, this.resolvedMaxAge = $e(e.cacheControl), this.headers = e.headers, this.headersKey = ce(e.headers);
|
|
447
444
|
}
|
|
448
445
|
query;
|
|
449
446
|
normalizedVariables;
|
|
@@ -457,7 +454,7 @@ class Ie extends re {
|
|
|
457
454
|
this.url,
|
|
458
455
|
{
|
|
459
456
|
method: "POST",
|
|
460
|
-
headers:
|
|
457
|
+
headers: L(this.headers),
|
|
461
458
|
body: JSON.stringify({
|
|
462
459
|
query: this.query,
|
|
463
460
|
variables: this.normalizedVariables,
|
|
@@ -472,7 +469,7 @@ class Ie extends re {
|
|
|
472
469
|
variables: this.normalizedVariables,
|
|
473
470
|
operationName: this.normalizedOperationName
|
|
474
471
|
};
|
|
475
|
-
return this.headersKey !== void 0 && (e.headers = this.headersKey),
|
|
472
|
+
return this.headersKey !== void 0 && (e.headers = this.headersKey), K(e);
|
|
476
473
|
}
|
|
477
474
|
/**
|
|
478
475
|
* Reads from the cache and returns the cache result or error
|
|
@@ -489,7 +486,7 @@ class Ie extends re {
|
|
|
489
486
|
*/
|
|
490
487
|
readFromCache(e) {
|
|
491
488
|
const r = this.buildKey(), n = e.get(r)?.value;
|
|
492
|
-
return n === void 0 ? u(
|
|
489
|
+
return n === void 0 ? u(D(new j())) : u(C(n));
|
|
493
490
|
}
|
|
494
491
|
writeToCache(e, r) {
|
|
495
492
|
if (r.isOk() && r.value.data != null && Object.keys(r.value.data).length > 0) {
|
|
@@ -519,32 +516,32 @@ class Ie extends re {
|
|
|
519
516
|
return e.errors && e.errors.length > 0;
|
|
520
517
|
}
|
|
521
518
|
processFetchReturnValue(e) {
|
|
522
|
-
return this.responseHasErrors(e) ?
|
|
519
|
+
return this.responseHasErrors(e) ? D(new z(e)) : C(e);
|
|
523
520
|
}
|
|
524
521
|
}
|
|
525
|
-
function
|
|
522
|
+
function H(t) {
|
|
526
523
|
if (W(t) && t.data && typeof t.data == "object") {
|
|
527
524
|
const e = t.data;
|
|
528
525
|
if (e.data != null)
|
|
529
526
|
return e.data;
|
|
530
527
|
}
|
|
531
528
|
}
|
|
532
|
-
function
|
|
529
|
+
function Me(t) {
|
|
533
530
|
return (e) => {
|
|
534
531
|
if (e.isOk()) {
|
|
535
532
|
const r = e.value;
|
|
536
|
-
|
|
533
|
+
w(r), t({ data: r, errors: void 0 });
|
|
537
534
|
} else {
|
|
538
|
-
const r =
|
|
539
|
-
r &&
|
|
535
|
+
const r = H(e.error);
|
|
536
|
+
r && w(r), t({ data: r, errors: p(e.error) });
|
|
540
537
|
}
|
|
541
538
|
};
|
|
542
539
|
}
|
|
543
|
-
async function
|
|
540
|
+
async function Ge(t) {
|
|
544
541
|
let e, r, n;
|
|
545
542
|
try {
|
|
546
543
|
const s = await t.execute();
|
|
547
|
-
s.isOk() ? (e = s.value.data,
|
|
544
|
+
s.isOk() ? (e = s.value.data, w(e), n = (a) => s.value.subscribe(a)) : (e = H(s.error.failure), e && w(e), r = p(s.error.failure), n = (a) => s.error.subscribe(a));
|
|
548
545
|
} catch (s) {
|
|
549
546
|
r = p(s);
|
|
550
547
|
}
|
|
@@ -552,7 +549,7 @@ async function He(t) {
|
|
|
552
549
|
data: e,
|
|
553
550
|
errors: r,
|
|
554
551
|
subscribe(s) {
|
|
555
|
-
return n ? n(
|
|
552
|
+
return n ? n(Me(s)) : v;
|
|
556
553
|
},
|
|
557
554
|
async refresh() {
|
|
558
555
|
await t.refresh();
|
|
@@ -563,11 +560,11 @@ function E(t) {
|
|
|
563
560
|
return {
|
|
564
561
|
data: void 0,
|
|
565
562
|
errors: t,
|
|
566
|
-
subscribe: () =>
|
|
567
|
-
refresh:
|
|
563
|
+
subscribe: () => v,
|
|
564
|
+
refresh: O
|
|
568
565
|
};
|
|
569
566
|
}
|
|
570
|
-
function
|
|
567
|
+
function Ie({
|
|
571
568
|
bundle: t,
|
|
572
569
|
url: e,
|
|
573
570
|
executeRaw: r
|
|
@@ -575,14 +572,14 @@ function xe({
|
|
|
575
572
|
const { services: n } = t;
|
|
576
573
|
async function s({
|
|
577
574
|
query: a,
|
|
578
|
-
variables:
|
|
579
|
-
operationName:
|
|
575
|
+
variables: i,
|
|
576
|
+
operationName: o,
|
|
580
577
|
cacheControl: c,
|
|
581
578
|
headers: l
|
|
582
579
|
}) {
|
|
583
|
-
const h =
|
|
580
|
+
const h = N(a);
|
|
584
581
|
if (h.isErr()) return E(h.error);
|
|
585
|
-
const f = h.value, m =
|
|
582
|
+
const f = h.value, m = k(f, o);
|
|
586
583
|
if (m !== "query")
|
|
587
584
|
return E([
|
|
588
585
|
{
|
|
@@ -591,11 +588,11 @@ function xe({
|
|
|
591
588
|
]);
|
|
592
589
|
let d;
|
|
593
590
|
try {
|
|
594
|
-
d = new
|
|
591
|
+
d = new Le(
|
|
595
592
|
{
|
|
596
593
|
query: q(f),
|
|
597
|
-
variables:
|
|
598
|
-
operationName:
|
|
594
|
+
variables: i,
|
|
595
|
+
operationName: o,
|
|
599
596
|
cacheControl: c,
|
|
600
597
|
headers: l
|
|
601
598
|
},
|
|
@@ -605,14 +602,14 @@ function xe({
|
|
|
605
602
|
} catch (S) {
|
|
606
603
|
return E(p(S));
|
|
607
604
|
}
|
|
608
|
-
return
|
|
605
|
+
return Ge(d);
|
|
609
606
|
}
|
|
610
607
|
return {
|
|
611
608
|
query: s,
|
|
612
|
-
mutate: (a) =>
|
|
609
|
+
mutate: (a) => G(r, a)
|
|
613
610
|
};
|
|
614
611
|
}
|
|
615
|
-
const
|
|
612
|
+
const Fe = 1, He = `@salesforce/platform-sdk-data_v${Fe}`;
|
|
616
613
|
class Ue {
|
|
617
614
|
baseUrl;
|
|
618
615
|
pathData;
|
|
@@ -620,20 +617,20 @@ class Ue {
|
|
|
620
617
|
onStatus;
|
|
621
618
|
graphql;
|
|
622
619
|
constructor(e) {
|
|
623
|
-
const r =
|
|
624
|
-
this.baseUrl =
|
|
620
|
+
const r = Qe();
|
|
621
|
+
this.baseUrl = Ve(e?.basePath ?? r.apiPath), this.pathData = F(e?.apiVersion);
|
|
625
622
|
const n = `${this.pathData}/ui-api`, s = `${this.pathData}/graphql`;
|
|
626
|
-
this.onStatus = e?.onStatus ?? {}, this.clientFetch =
|
|
623
|
+
this.onStatus = e?.onStatus ?? {}, this.clientFetch = Ae({
|
|
627
624
|
csrf: {
|
|
628
625
|
endpoint: `${this.baseUrl}${n}/session/csrf`,
|
|
629
|
-
cacheName:
|
|
626
|
+
cacheName: He,
|
|
630
627
|
protectedUrls: ["services/data/v", "services/apexrest"],
|
|
631
628
|
alwaysProtectedUrls: ["services/apexrest"]
|
|
632
629
|
}
|
|
633
630
|
});
|
|
634
|
-
const a = (
|
|
635
|
-
this.graphql =
|
|
636
|
-
bundle:
|
|
631
|
+
const a = (o, c) => this.fetch(o, c), i = Re(`${this.baseUrl}${this.pathData}`, a);
|
|
632
|
+
this.graphql = Ie({
|
|
633
|
+
bundle: i,
|
|
637
634
|
url: s,
|
|
638
635
|
executeRaw: this.executeRawGraphQL.bind(this)
|
|
639
636
|
});
|
|
@@ -654,12 +651,12 @@ class Ue {
|
|
|
654
651
|
operationName: n,
|
|
655
652
|
headers: s
|
|
656
653
|
}) {
|
|
657
|
-
const a = `${this.pathData}/graphql`,
|
|
654
|
+
const a = `${this.pathData}/graphql`, i = await this.fetch(a, {
|
|
658
655
|
method: "POST",
|
|
659
656
|
body: JSON.stringify({ query: e, variables: r, operationName: n }),
|
|
660
|
-
headers:
|
|
657
|
+
headers: L(s)
|
|
661
658
|
});
|
|
662
|
-
return
|
|
659
|
+
return M(i, "WebApp", a);
|
|
663
660
|
}
|
|
664
661
|
/**
|
|
665
662
|
* If the url is relative, convert to it to an absolute Salesforce URL. This is due to the way Code
|
|
@@ -675,63 +672,71 @@ class Ue {
|
|
|
675
672
|
return e;
|
|
676
673
|
}
|
|
677
674
|
}
|
|
678
|
-
function
|
|
675
|
+
function Qe() {
|
|
679
676
|
return {
|
|
680
677
|
apiPath: globalThis.SFDC_ENV?.apiPath
|
|
681
678
|
};
|
|
682
679
|
}
|
|
683
|
-
function
|
|
680
|
+
function Ve(t) {
|
|
684
681
|
if (!t || t === "/") return "";
|
|
685
682
|
let e = t;
|
|
686
683
|
return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
687
684
|
}
|
|
688
|
-
function
|
|
689
|
-
const e = typeof t == "object" && t !== null && "setup" in t, r = e ? t : t.
|
|
685
|
+
function Ke(t) {
|
|
686
|
+
const e = typeof t == "object" && t !== null && "setup" in t, r = e ? t : t.extension, n = e ? r?.name : t.as;
|
|
690
687
|
if (typeof r?.setup != "function")
|
|
691
|
-
throw new Error("
|
|
688
|
+
throw new Error("Extension entry cannot attach: it is missing a setup function.");
|
|
692
689
|
if (typeof n != "string" || n.length === 0)
|
|
693
690
|
throw new Error(
|
|
694
|
-
e ? '
|
|
691
|
+
e ? 'Extension entry cannot attach: "name" must be a non-empty string.' : 'Extension entry cannot attach: alias "as" must be a non-empty string.'
|
|
695
692
|
);
|
|
696
|
-
return {
|
|
693
|
+
return { extension: r, mountName: n };
|
|
697
694
|
}
|
|
698
|
-
async function
|
|
695
|
+
async function je(t, e) {
|
|
699
696
|
if (e.length === 0)
|
|
700
697
|
return t;
|
|
701
|
-
|
|
698
|
+
if ("ext" in t)
|
|
699
|
+
throw new Error(
|
|
700
|
+
'Cannot attach extensions: the base SDK already declares an "ext" member, which the extension container reserves.'
|
|
701
|
+
);
|
|
702
|
+
const r = Object.create(t), n = {};
|
|
703
|
+
Object.defineProperty(r, "ext", {
|
|
704
|
+
value: n,
|
|
705
|
+
enumerable: !0,
|
|
706
|
+
writable: !1,
|
|
707
|
+
configurable: !1
|
|
708
|
+
});
|
|
702
709
|
for (const s of e) {
|
|
703
|
-
const {
|
|
704
|
-
if (
|
|
705
|
-
throw new Error(`Plugin ${i} cannot attach: "${o}" is a reserved SDK name.`);
|
|
706
|
-
if (o in n)
|
|
710
|
+
const { extension: a, mountName: i } = Ke(s), o = i === a.name ? `"${a.name}"` : `"${a.name}" (aliased as "${i}")`;
|
|
711
|
+
if (Object.hasOwn(n, i))
|
|
707
712
|
throw new Error(
|
|
708
|
-
`
|
|
713
|
+
`Extension ${o} cannot attach: "${i}" is already defined by another extension.`
|
|
709
714
|
);
|
|
710
715
|
let c;
|
|
711
716
|
try {
|
|
712
|
-
c = await a.setup(
|
|
717
|
+
c = await a.setup(r);
|
|
713
718
|
} catch (l) {
|
|
714
|
-
throw new Error(`
|
|
719
|
+
throw new Error(`Extension ${o} failed during setup.`, { cause: l });
|
|
715
720
|
}
|
|
716
|
-
Object.defineProperty(n,
|
|
721
|
+
Object.defineProperty(n, i, {
|
|
717
722
|
value: c,
|
|
718
723
|
enumerable: !0,
|
|
719
724
|
writable: !0,
|
|
720
725
|
configurable: !0
|
|
721
726
|
});
|
|
722
727
|
}
|
|
723
|
-
return
|
|
728
|
+
return r;
|
|
724
729
|
}
|
|
725
|
-
function
|
|
730
|
+
function ot(t, ...e) {
|
|
726
731
|
let r = t[0] ?? "";
|
|
727
732
|
for (let n = 0; n < e.length; n += 1)
|
|
728
733
|
r += String(e[n]) + (t[n + 1] ?? "");
|
|
729
734
|
return r;
|
|
730
735
|
}
|
|
731
|
-
const
|
|
732
|
-
async function
|
|
736
|
+
const it = V();
|
|
737
|
+
async function ze(t) {
|
|
733
738
|
try {
|
|
734
|
-
switch (await
|
|
739
|
+
switch (await U(t?.surface)) {
|
|
735
740
|
case y.OpenAI:
|
|
736
741
|
return new be();
|
|
737
742
|
case y.WebApp:
|
|
@@ -748,17 +753,17 @@ async function Je(t) {
|
|
|
748
753
|
return {};
|
|
749
754
|
}
|
|
750
755
|
}
|
|
751
|
-
function
|
|
756
|
+
function ct(t) {
|
|
752
757
|
return Q(
|
|
753
758
|
(async () => {
|
|
754
|
-
const e = await
|
|
755
|
-
return
|
|
759
|
+
const e = await ze(t);
|
|
760
|
+
return je(e, t?.extensions ?? []);
|
|
756
761
|
})(),
|
|
757
762
|
"createDataSDK"
|
|
758
763
|
);
|
|
759
764
|
}
|
|
760
765
|
export {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
766
|
+
ct as createDataSDK,
|
|
767
|
+
it as defineDataExtension,
|
|
768
|
+
ot as gql
|
|
764
769
|
};
|