@salesforce/webapp-experimental 1.81.0 → 1.83.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/api/clients.js +72 -77
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +13 -11
- package/dist/api/utils/accounts.js +16 -30
- package/dist/api/utils/records.js +21 -20
- package/dist/api/utils/user.js +20 -28
- package/dist/app/index.d.ts +4 -4
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +7 -7
- package/dist/app/manifest.js +23 -37
- package/dist/app/org.js +45 -58
- package/dist/design/index.js +12 -19
- package/dist/design/interactions/interactionsController.d.ts +1 -6
- package/dist/design/interactions/interactionsController.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -10
- package/dist/package.json.js +4 -0
- package/dist/proxy/handler.d.ts +2 -7
- package/dist/proxy/handler.d.ts.map +1 -1
- package/dist/proxy/handler.js +462 -523
- package/dist/proxy/index.d.ts +2 -2
- package/dist/proxy/index.d.ts.map +1 -1
- package/dist/proxy/index.js +7 -6
- package/dist/proxy/livePreviewScript.js +11 -26
- package/dist/proxy/routing.d.ts +1 -6
- package/dist/proxy/routing.d.ts.map +1 -1
- package/dist/proxy/routing.js +73 -103
- package/package.json +7 -6
- package/dist/api/clients.test.d.ts +0 -7
- package/dist/api/clients.test.d.ts.map +0 -1
- package/dist/api/clients.test.js +0 -167
- package/dist/api/graphql-operations-types.js +0 -44
- package/dist/api/utils/records.test.d.ts +0 -7
- package/dist/api/utils/records.test.d.ts.map +0 -1
- package/dist/api/utils/records.test.js +0 -190
- package/dist/api/utils/user.test.d.ts +0 -7
- package/dist/api/utils/user.test.d.ts.map +0 -1
- package/dist/api/utils/user.test.js +0 -108
- package/dist/design/interactions/communicationManager.js +0 -108
- package/dist/design/interactions/componentMatcher.js +0 -80
- package/dist/design/interactions/editableManager.js +0 -95
- package/dist/design/interactions/eventHandlers.js +0 -125
- package/dist/design/interactions/index.js +0 -47
- package/dist/design/interactions/interactionsController.js +0 -135
- package/dist/design/interactions/styleManager.js +0 -97
- package/dist/design/interactions/utils/cssUtils.js +0 -72
- package/dist/design/interactions/utils/sourceUtils.js +0 -99
- package/dist/proxy/livePreviewScript.test.d.ts +0 -7
- package/dist/proxy/livePreviewScript.test.d.ts.map +0 -1
- package/dist/proxy/livePreviewScript.test.js +0 -96
package/dist/api/clients.js
CHANGED
|
@@ -1,89 +1,84 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* For full license text, see the LICENSE.txt file
|
|
5
|
-
*/
|
|
6
1
|
import { getDataSDK } from "@salesforce/sdk-data";
|
|
7
|
-
|
|
8
|
-
export const API_VERSION = typeof __SF_API_VERSION__ !== "undefined" ? __SF_API_VERSION__ : "65.0";
|
|
2
|
+
const API_VERSION = typeof __SF_API_VERSION__ !== "undefined" ? __SF_API_VERSION__ : "65.0";
|
|
9
3
|
const BASE_DATA_URL = `/services/data/v${API_VERSION}`;
|
|
10
4
|
const UI_API_URL = `${BASE_DATA_URL}/ui-api`;
|
|
11
5
|
const MIME_TYPE_JSON = "application/json";
|
|
12
6
|
const HEADER_CONTENT_TYPE = "Content-Type";
|
|
13
7
|
class ApiClient {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
constructor(baseURL) {
|
|
22
|
-
this.baseURL = baseURL;
|
|
23
|
-
}
|
|
24
|
-
isJsonContentType(headers) {
|
|
25
|
-
// default to JSON if no headers specified
|
|
26
|
-
if (!headers)
|
|
27
|
-
return true;
|
|
28
|
-
const headersObj = new Headers(headers);
|
|
29
|
-
const contentType = headersObj.get(HEADER_CONTENT_TYPE);
|
|
30
|
-
return !contentType || contentType.includes(MIME_TYPE_JSON);
|
|
31
|
-
}
|
|
32
|
-
async fetch(info, options = {}) {
|
|
33
|
-
const fullURL = info instanceof URL || info.startsWith("http") ? info : `${this.baseURL}${info}`;
|
|
34
|
-
const mergedOptions = {
|
|
35
|
-
...this.defaultOptions,
|
|
36
|
-
...options,
|
|
37
|
-
headers: {
|
|
38
|
-
...this.defaultOptions.headers,
|
|
39
|
-
...(options.headers || {}),
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
const sdk = await getDataSDK();
|
|
43
|
-
return await sdk.fetch(fullURL, mergedOptions);
|
|
8
|
+
baseURL;
|
|
9
|
+
defaultOptions = {
|
|
10
|
+
headers: {
|
|
11
|
+
[HEADER_CONTENT_TYPE]: MIME_TYPE_JSON,
|
|
12
|
+
Accept: MIME_TYPE_JSON
|
|
44
13
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
14
|
+
};
|
|
15
|
+
constructor(baseURL) {
|
|
16
|
+
this.baseURL = baseURL;
|
|
17
|
+
}
|
|
18
|
+
isJsonContentType(headers) {
|
|
19
|
+
if (!headers) return true;
|
|
20
|
+
const headersObj = new Headers(headers);
|
|
21
|
+
const contentType = headersObj.get(HEADER_CONTENT_TYPE);
|
|
22
|
+
return !contentType || contentType.includes(MIME_TYPE_JSON);
|
|
23
|
+
}
|
|
24
|
+
async fetch(info, options = {}) {
|
|
25
|
+
const fullURL = info instanceof URL || info.startsWith("http") ? info : `${this.baseURL}${info}`;
|
|
26
|
+
const mergedOptions = {
|
|
27
|
+
...this.defaultOptions,
|
|
28
|
+
...options,
|
|
29
|
+
headers: {
|
|
30
|
+
...this.defaultOptions.headers,
|
|
31
|
+
...options.headers || {}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const sdk = await getDataSDK();
|
|
35
|
+
return await sdk.fetch(fullURL, mergedOptions);
|
|
36
|
+
}
|
|
37
|
+
processBody(body, options) {
|
|
38
|
+
if (body === void 0 || body === null) {
|
|
39
|
+
return void 0;
|
|
69
40
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
...options,
|
|
73
|
-
method: "PUT",
|
|
74
|
-
body: this.processBody(body, options),
|
|
75
|
-
});
|
|
41
|
+
if (body instanceof FormData) {
|
|
42
|
+
return body;
|
|
76
43
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
...options,
|
|
80
|
-
method: "PATCH",
|
|
81
|
-
body: this.processBody(body, options),
|
|
82
|
-
});
|
|
44
|
+
if (typeof body === "string") {
|
|
45
|
+
return body;
|
|
83
46
|
}
|
|
84
|
-
|
|
85
|
-
|
|
47
|
+
if (typeof body === "object" && this.isJsonContentType(options.headers)) {
|
|
48
|
+
return JSON.stringify(body);
|
|
86
49
|
}
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
async post(url, body, options = {}) {
|
|
53
|
+
return this.fetch(url, {
|
|
54
|
+
...options,
|
|
55
|
+
method: "POST",
|
|
56
|
+
body: this.processBody(body, options)
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async get(url, options = {}) {
|
|
60
|
+
return this.fetch(url, { ...options, method: "GET" });
|
|
61
|
+
}
|
|
62
|
+
async put(url, body, options = {}) {
|
|
63
|
+
return this.fetch(url, {
|
|
64
|
+
...options,
|
|
65
|
+
method: "PUT",
|
|
66
|
+
body: this.processBody(body, options)
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async patch(url, body, options = {}) {
|
|
70
|
+
return this.fetch(url, {
|
|
71
|
+
...options,
|
|
72
|
+
method: "PATCH",
|
|
73
|
+
body: this.processBody(body, options)
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
async delete(url, options = {}) {
|
|
77
|
+
return this.fetch(url, { ...options, method: "DELETE" });
|
|
78
|
+
}
|
|
87
79
|
}
|
|
88
|
-
|
|
89
|
-
export
|
|
80
|
+
const uiApiClient = new ApiClient(UI_API_URL);
|
|
81
|
+
export {
|
|
82
|
+
API_VERSION,
|
|
83
|
+
uiApiClient
|
|
84
|
+
};
|
package/dist/api/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
|
-
export { uiApiClient } from
|
|
7
|
-
export { getHighRevenueAccounts, type Account } from
|
|
8
|
-
export { getRecord, createRecord, updateRecord, deleteRecord } from
|
|
9
|
-
export { getCurrentUser } from
|
|
6
|
+
export { uiApiClient } from './clients';
|
|
7
|
+
export { getHighRevenueAccounts, type Account } from './utils/accounts';
|
|
8
|
+
export { getRecord, createRecord, updateRecord, deleteRecord } from './utils/records';
|
|
9
|
+
export { getCurrentUser } from './utils/user';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,OAAO,EAAE,sBAAsB,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEtF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/api/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { uiApiClient } from "./clients.js";
|
|
2
|
+
import { getHighRevenueAccounts } from "./utils/accounts.js";
|
|
3
|
+
import { createRecord, deleteRecord, getRecord, updateRecord } from "./utils/records.js";
|
|
4
|
+
import { getCurrentUser } from "./utils/user.js";
|
|
5
|
+
export {
|
|
6
|
+
createRecord,
|
|
7
|
+
deleteRecord,
|
|
8
|
+
getCurrentUser,
|
|
9
|
+
getHighRevenueAccounts,
|
|
10
|
+
getRecord,
|
|
11
|
+
uiApiClient,
|
|
12
|
+
updateRecord
|
|
13
|
+
};
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* For full license text, see the LICENSE.txt file
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @attention agents
|
|
8
|
-
* This file serves as a reference example for accessing Salesforce data via GraphQL.
|
|
9
|
-
* Use this pattern when implementing new data fetching utilities:
|
|
10
|
-
* 1. Define TypeScript interfaces for the response shape
|
|
11
|
-
* 2. Write the GraphQL query using UIAPI syntax
|
|
12
|
-
* 3. Use getDataSDK() then data.graphql?.() with proper typing
|
|
13
|
-
* 4. Extract and return the relevant data from the response
|
|
14
|
-
*/
|
|
15
1
|
import { getDataSDK } from "@salesforce/sdk-data";
|
|
16
|
-
const HIGH_REVENUE_ACCOUNTS_QUERY =
|
|
2
|
+
const HIGH_REVENUE_ACCOUNTS_QUERY = (
|
|
3
|
+
/* GraphQL */
|
|
4
|
+
`
|
|
17
5
|
query GetHighRevenueAccounts($minRevenue: Currency) {
|
|
18
6
|
uiapi {
|
|
19
7
|
query {
|
|
@@ -43,19 +31,17 @@ const HIGH_REVENUE_ACCOUNTS_QUERY = /* GraphQL */ `
|
|
|
43
31
|
}
|
|
44
32
|
}
|
|
45
33
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (response?.errors?.length) {
|
|
57
|
-
const errorMessages = response.errors.map((e) => e.message).join("; ");
|
|
58
|
-
throw new Error(`GraphQL Error: ${errorMessages}`);
|
|
59
|
-
}
|
|
60
|
-
return response?.data?.uiapi?.query?.Account?.edges?.map((edge) => edge?.node) || [];
|
|
34
|
+
`
|
|
35
|
+
);
|
|
36
|
+
async function getHighRevenueAccounts(variables) {
|
|
37
|
+
const data = await getDataSDK();
|
|
38
|
+
const response = await data.graphql?.(HIGH_REVENUE_ACCOUNTS_QUERY, variables);
|
|
39
|
+
if (response?.errors?.length) {
|
|
40
|
+
const errorMessages = response.errors.map((e) => e.message).join("; ");
|
|
41
|
+
throw new Error(`GraphQL Error: ${errorMessages}`);
|
|
42
|
+
}
|
|
43
|
+
return response?.data?.uiapi?.query?.Account?.edges?.map((edge) => edge?.node) || [];
|
|
61
44
|
}
|
|
45
|
+
export {
|
|
46
|
+
getHighRevenueAccounts
|
|
47
|
+
};
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* For full license text, see the LICENSE.txt file
|
|
5
|
-
*/
|
|
6
1
|
import { uiApiClient } from "../clients.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
async function getRecord(recordId, params = {}) {
|
|
3
|
+
const searchParams = new URLSearchParams(params);
|
|
4
|
+
const queryString = searchParams.toString();
|
|
5
|
+
const url = `/records/${recordId}${queryString ? `?${queryString}` : ""}`;
|
|
6
|
+
const response = await uiApiClient.get(url);
|
|
7
|
+
return response.json();
|
|
13
8
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
async function createRecord(apiName, fields) {
|
|
10
|
+
const response = await uiApiClient.post(`/records`, { apiName, fields });
|
|
11
|
+
return response.json();
|
|
17
12
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
async function updateRecord(recordId, fields) {
|
|
14
|
+
const response = await uiApiClient.patch(`/records/${recordId}`, { fields });
|
|
15
|
+
return response.json();
|
|
21
16
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
async function deleteRecord(recordId) {
|
|
18
|
+
await uiApiClient.delete(`/records/${recordId}`);
|
|
19
|
+
return true;
|
|
25
20
|
}
|
|
21
|
+
export {
|
|
22
|
+
createRecord,
|
|
23
|
+
deleteRecord,
|
|
24
|
+
getRecord,
|
|
25
|
+
updateRecord
|
|
26
|
+
};
|
package/dist/api/utils/user.js
CHANGED
|
@@ -1,33 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* For full license text, see the LICENSE.txt file
|
|
5
|
-
*/
|
|
6
1
|
import { getDataSDK } from "@salesforce/sdk-data";
|
|
7
2
|
import { API_VERSION } from "../clients.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
const sdk = await getDataSDK();
|
|
16
|
-
const response = await sdk.fetch(`/services/data/v${API_VERSION}/chatter/users/me`);
|
|
17
|
-
if (!response.ok) {
|
|
18
|
-
throw new Error(`HTTP ${response.status}`);
|
|
19
|
-
}
|
|
20
|
-
const userData = await response.json();
|
|
21
|
-
if (!userData || !userData.id) {
|
|
22
|
-
throw new Error("No user data found in Chatter API response");
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
id: userData.id,
|
|
26
|
-
name: userData.name || "User",
|
|
27
|
-
};
|
|
3
|
+
async function getCurrentUser() {
|
|
4
|
+
try {
|
|
5
|
+
const sdk = await getDataSDK();
|
|
6
|
+
const response = await sdk.fetch(`/services/data/v${API_VERSION}/chatter/users/me`);
|
|
7
|
+
if (!response.ok) {
|
|
8
|
+
throw new Error(`HTTP ${response.status}`);
|
|
28
9
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
10
|
+
const userData = await response.json();
|
|
11
|
+
if (!userData || !userData.id) {
|
|
12
|
+
throw new Error("No user data found in Chatter API response");
|
|
32
13
|
}
|
|
14
|
+
return {
|
|
15
|
+
id: userData.id,
|
|
16
|
+
name: userData.name || "User"
|
|
17
|
+
};
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error("Error fetching user data:", error);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
33
22
|
}
|
|
23
|
+
export {
|
|
24
|
+
getCurrentUser
|
|
25
|
+
};
|
package/dist/app/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
|
-
export type { OrgInfo } from
|
|
7
|
-
export { getOrgInfo, refreshOrgAuth } from
|
|
8
|
-
export type { WebAppManifest, RoutingConfig, RewriteRule, RedirectRule } from
|
|
9
|
-
export { loadManifest } from
|
|
6
|
+
export type { OrgInfo } from './org';
|
|
7
|
+
export { getOrgInfo, refreshOrgAuth } from './org';
|
|
8
|
+
export type { WebAppManifest, RoutingConfig, RewriteRule, RedirectRule } from './manifest';
|
|
9
|
+
export { loadManifest } from './manifest';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/app/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/app/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { getOrgInfo, refreshOrgAuth } from "./org.js";
|
|
2
|
+
import { loadManifest } from "./manifest.js";
|
|
3
|
+
export {
|
|
4
|
+
getOrgInfo,
|
|
5
|
+
loadManifest,
|
|
6
|
+
refreshOrgAuth
|
|
7
|
+
};
|
package/dist/app/manifest.js
CHANGED
|
@@ -1,42 +1,28 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* For full license text, see the LICENSE.txt file
|
|
5
|
-
*/
|
|
6
1
|
import { readFile } from "node:fs/promises";
|
|
7
|
-
/**
|
|
8
|
-
* Validate required fields in webapp manifest
|
|
9
|
-
*
|
|
10
|
-
* @param manifest - The manifest object to validate
|
|
11
|
-
* @throws Error if any required field is missing
|
|
12
|
-
*/
|
|
13
2
|
function validateManifest(manifest) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
const errors = [];
|
|
4
|
+
if (!manifest.outputDir) {
|
|
5
|
+
errors.push("outputDir");
|
|
6
|
+
}
|
|
7
|
+
if (errors.length > 0) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
`Manifest missing required field${errors.length > 1 ? "s" : ""}: ${errors.join(", ")}`
|
|
10
|
+
);
|
|
11
|
+
}
|
|
21
12
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const content = await readFile(manifestPath, "utf-8");
|
|
32
|
-
const manifest = JSON.parse(content);
|
|
33
|
-
validateManifest(manifest);
|
|
34
|
-
return manifest;
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
38
|
-
throw new Error(`Manifest not found at: ${manifestPath}`);
|
|
39
|
-
}
|
|
40
|
-
throw error;
|
|
13
|
+
async function loadManifest(manifestPath) {
|
|
14
|
+
try {
|
|
15
|
+
const content = await readFile(manifestPath, "utf-8");
|
|
16
|
+
const manifest = JSON.parse(content);
|
|
17
|
+
validateManifest(manifest);
|
|
18
|
+
return manifest;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
21
|
+
throw new Error(`Manifest not found at: ${manifestPath}`);
|
|
41
22
|
}
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
42
25
|
}
|
|
26
|
+
export {
|
|
27
|
+
loadManifest
|
|
28
|
+
};
|
package/dist/app/org.js
CHANGED
|
@@ -1,68 +1,55 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* For full license text, see the LICENSE.txt file
|
|
5
|
-
*/
|
|
6
1
|
import { Org } from "@salesforce/core";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
instanceUrl: toLightningDomain(connection.instanceUrl),
|
|
25
|
-
rawInstanceUrl: connection.instanceUrl,
|
|
26
|
-
username: authFields.username ?? "",
|
|
27
|
-
accessToken: connection.accessToken ?? "",
|
|
28
|
-
orgAlias,
|
|
29
|
-
};
|
|
2
|
+
async function getOrgInfo(orgAlias) {
|
|
3
|
+
const org = await createOrg(orgAlias);
|
|
4
|
+
if (!org) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const connection = org.getConnection();
|
|
8
|
+
const authInfo = connection.getAuthInfo();
|
|
9
|
+
const authFields = authInfo.getFields();
|
|
10
|
+
return {
|
|
11
|
+
apiVersion: connection.getApiVersion(),
|
|
12
|
+
orgId: authFields.orgId ?? "",
|
|
13
|
+
instanceUrl: toLightningDomain(connection.instanceUrl),
|
|
14
|
+
rawInstanceUrl: connection.instanceUrl,
|
|
15
|
+
username: authFields.username ?? "",
|
|
16
|
+
accessToken: connection.accessToken ?? "",
|
|
17
|
+
orgAlias
|
|
18
|
+
};
|
|
30
19
|
}
|
|
31
20
|
async function createOrg(orgAlias) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
return await Org.create({ aliasOrUsername: orgAlias });
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
console.error("Failed to get SF org info:", error);
|
|
21
|
+
try {
|
|
22
|
+
if (!orgAlias) {
|
|
23
|
+
return await Org.create({});
|
|
40
24
|
}
|
|
25
|
+
return await Org.create({ aliasOrUsername: orgAlias });
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error("Failed to get SF org info:", error);
|
|
28
|
+
}
|
|
41
29
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*/
|
|
47
|
-
export async function refreshOrgAuth(orgAlias) {
|
|
48
|
-
const org = await Org.create({ aliasOrUsername: orgAlias });
|
|
49
|
-
await org.refreshAuth();
|
|
50
|
-
return getOrgInfo(orgAlias);
|
|
30
|
+
async function refreshOrgAuth(orgAlias) {
|
|
31
|
+
const org = await Org.create({ aliasOrUsername: orgAlias });
|
|
32
|
+
await org.refreshAuth();
|
|
33
|
+
return getOrgInfo(orgAlias);
|
|
51
34
|
}
|
|
52
35
|
function replaceLast(originalString, searchString, replacementString) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
const lastIndex = originalString.lastIndexOf(searchString);
|
|
37
|
+
if (lastIndex === -1) {
|
|
38
|
+
return originalString;
|
|
39
|
+
}
|
|
40
|
+
const before = originalString.slice(0, lastIndex);
|
|
41
|
+
const after = originalString.slice(lastIndex + searchString.length);
|
|
42
|
+
return before + replacementString + after;
|
|
60
43
|
}
|
|
61
44
|
function toLightningDomain(instanceUrl) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
45
|
+
if (!instanceUrl.includes(".my.")) {
|
|
46
|
+
return instanceUrl;
|
|
47
|
+
}
|
|
48
|
+
let url = replaceLast(instanceUrl, ".my.", ".lightning.");
|
|
49
|
+
url = replaceLast(url, ".salesforce", ".force");
|
|
50
|
+
return url;
|
|
68
51
|
}
|
|
52
|
+
export {
|
|
53
|
+
getOrgInfo,
|
|
54
|
+
refreshOrgAuth
|
|
55
|
+
};
|
package/dist/design/index.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* For full license text, see the LICENSE.txt file
|
|
5
|
-
*/
|
|
6
|
-
import { readFileSync, existsSync } from "node:fs";
|
|
7
|
-
import { join, dirname } from "node:path";
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
8
3
|
import { fileURLToPath } from "node:url";
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const DESIGN_MODE_SCRIPT_PATH = join(__dirname, "../../dist/design/design-mode-interactions.js");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export function getDesignModeScriptContent() {
|
|
17
|
-
if (!existsSync(DESIGN_MODE_SCRIPT_PATH)) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return readFileSync(DESIGN_MODE_SCRIPT_PATH, "utf-8");
|
|
4
|
+
const __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
const DESIGN_MODE_SCRIPT_PATH = join(__dirname$1, "../../dist/design/design-mode-interactions.js");
|
|
6
|
+
function getDesignModeScriptContent() {
|
|
7
|
+
if (!existsSync(DESIGN_MODE_SCRIPT_PATH)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return readFileSync(DESIGN_MODE_SCRIPT_PATH, "utf-8");
|
|
21
11
|
}
|
|
12
|
+
export {
|
|
13
|
+
getDesignModeScriptContent
|
|
14
|
+
};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* For full license text, see the LICENSE.txt file
|
|
5
|
-
*/
|
|
6
|
-
import { type SourceLocation } from "./utils/sourceUtils.js";
|
|
1
|
+
import { SourceLocation } from './utils/sourceUtils';
|
|
7
2
|
export declare class InteractionsController {
|
|
8
3
|
private enabled;
|
|
9
4
|
private isActive;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/design/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/design/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAE7B,qBAAa,sBAAsB;IAClC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAAgB;gBAEzB,OAAO,UAAO;IAwD1B;;OAEG;IACH,UAAU,IAAI,IAAI;IAiBlB;;OAEG;IACH,MAAM,IAAI,IAAI;IAKd;;OAEG;IACH,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,cAAc;IAWtB;;;;OAIG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IAMxF,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IAMpE;;OAEG;IACH,OAAO,IAAI,IAAI;CAOf"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
6
|
+
export * from './api/index';
|
|
7
|
+
export * from './app/index';
|
|
8
|
+
export * from './proxy/index';
|
|
9
|
+
export * from './design/index';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|