@salesforce/webapp-experimental 1.81.0 → 1.82.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.
Files changed (52) hide show
  1. package/dist/api/clients.js +72 -77
  2. package/dist/api/index.d.ts +4 -4
  3. package/dist/api/index.d.ts.map +1 -1
  4. package/dist/api/index.js +13 -11
  5. package/dist/api/utils/accounts.js +16 -30
  6. package/dist/api/utils/records.js +21 -20
  7. package/dist/api/utils/user.js +20 -28
  8. package/dist/app/index.d.ts +4 -4
  9. package/dist/app/index.d.ts.map +1 -1
  10. package/dist/app/index.js +7 -7
  11. package/dist/app/manifest.js +23 -37
  12. package/dist/app/org.js +45 -58
  13. package/dist/design/index.js +12 -19
  14. package/dist/design/interactions/interactionsController.d.ts +1 -6
  15. package/dist/design/interactions/interactionsController.d.ts.map +1 -1
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +25 -10
  19. package/dist/package.json.js +4 -0
  20. package/dist/proxy/handler.d.ts +2 -7
  21. package/dist/proxy/handler.d.ts.map +1 -1
  22. package/dist/proxy/handler.js +462 -523
  23. package/dist/proxy/index.d.ts +2 -2
  24. package/dist/proxy/index.d.ts.map +1 -1
  25. package/dist/proxy/index.js +7 -6
  26. package/dist/proxy/livePreviewScript.js +11 -26
  27. package/dist/proxy/routing.d.ts +1 -6
  28. package/dist/proxy/routing.d.ts.map +1 -1
  29. package/dist/proxy/routing.js +73 -103
  30. package/package.json +7 -6
  31. package/dist/api/clients.test.d.ts +0 -7
  32. package/dist/api/clients.test.d.ts.map +0 -1
  33. package/dist/api/clients.test.js +0 -167
  34. package/dist/api/graphql-operations-types.js +0 -44
  35. package/dist/api/utils/records.test.d.ts +0 -7
  36. package/dist/api/utils/records.test.d.ts.map +0 -1
  37. package/dist/api/utils/records.test.js +0 -190
  38. package/dist/api/utils/user.test.d.ts +0 -7
  39. package/dist/api/utils/user.test.d.ts.map +0 -1
  40. package/dist/api/utils/user.test.js +0 -108
  41. package/dist/design/interactions/communicationManager.js +0 -108
  42. package/dist/design/interactions/componentMatcher.js +0 -80
  43. package/dist/design/interactions/editableManager.js +0 -95
  44. package/dist/design/interactions/eventHandlers.js +0 -125
  45. package/dist/design/interactions/index.js +0 -47
  46. package/dist/design/interactions/interactionsController.js +0 -135
  47. package/dist/design/interactions/styleManager.js +0 -97
  48. package/dist/design/interactions/utils/cssUtils.js +0 -72
  49. package/dist/design/interactions/utils/sourceUtils.js +0 -99
  50. package/dist/proxy/livePreviewScript.test.d.ts +0 -7
  51. package/dist/proxy/livePreviewScript.test.d.ts.map +0 -1
  52. package/dist/proxy/livePreviewScript.test.js +0 -96
@@ -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
- // Project standard API version from environment variable with fallback
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
- baseURL;
15
- defaultOptions = {
16
- headers: {
17
- [HEADER_CONTENT_TYPE]: MIME_TYPE_JSON,
18
- Accept: MIME_TYPE_JSON,
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
- processBody(body, options) {
46
- if (body === undefined || body === null) {
47
- return undefined;
48
- }
49
- if (body instanceof FormData) {
50
- return body;
51
- }
52
- if (typeof body === "string") {
53
- return body;
54
- }
55
- if (typeof body === "object" && this.isJsonContentType(options.headers)) {
56
- return JSON.stringify(body);
57
- }
58
- return undefined;
59
- }
60
- async post(url, body, options = {}) {
61
- return this.fetch(url, {
62
- ...options,
63
- method: "POST",
64
- body: this.processBody(body, options),
65
- });
66
- }
67
- async get(url, options = {}) {
68
- return this.fetch(url, { ...options, method: "GET" });
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
- async put(url, body, options = {}) {
71
- return this.fetch(url, {
72
- ...options,
73
- method: "PUT",
74
- body: this.processBody(body, options),
75
- });
41
+ if (body instanceof FormData) {
42
+ return body;
76
43
  }
77
- async patch(url, body, options = {}) {
78
- return this.fetch(url, {
79
- ...options,
80
- method: "PATCH",
81
- body: this.processBody(body, options),
82
- });
44
+ if (typeof body === "string") {
45
+ return body;
83
46
  }
84
- async delete(url, options = {}) {
85
- return this.fetch(url, { ...options, method: "DELETE" });
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
- // Client for Salesforce UI API access
89
- export const uiApiClient = new ApiClient(UI_API_URL);
80
+ const uiApiClient = new ApiClient(UI_API_URL);
81
+ export {
82
+ API_VERSION,
83
+ uiApiClient
84
+ };
@@ -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 "./clients.js";
7
- export { getHighRevenueAccounts, type Account } from "./utils/accounts.js";
8
- export { getRecord, createRecord, updateRecord, deleteRecord } from "./utils/records.js";
9
- export { getCurrentUser } from "./utils/user.js";
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
@@ -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,cAAc,CAAC;AAG3C,OAAO,EAAE,sBAAsB,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEzF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
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
- * Copyright (c) 2026, Salesforce, Inc.,
3
- * All rights reserved.
4
- * For full license text, see the LICENSE.txt file
5
- */
6
- // Core clients
7
- export { uiApiClient } from "./clients.js";
8
- // Utility functions
9
- export { getHighRevenueAccounts } from "./utils/accounts.js";
10
- export { getRecord, createRecord, updateRecord, deleteRecord } from "./utils/records.js";
11
- export { getCurrentUser } from "./utils/user.js";
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 = /* GraphQL */ `
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
- * Fetch accounts with annual revenue greater than the specified amount
49
- *
50
- * @param variables - Query variables including minRevenue threshold
51
- * @returns Array of accounts matching the criteria
52
- */
53
- export async function getHighRevenueAccounts(variables) {
54
- const data = await getDataSDK();
55
- const response = await data.graphql?.(HIGH_REVENUE_ACCOUNTS_QUERY, variables);
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
- export async function getRecord(recordId, params = {}) {
8
- const searchParams = new URLSearchParams(params);
9
- const queryString = searchParams.toString();
10
- const url = `/records/${recordId}${queryString ? `?${queryString}` : ""}`;
11
- const response = await uiApiClient.get(url);
12
- return response.json();
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
- export async function createRecord(apiName, fields) {
15
- const response = await uiApiClient.post(`/records`, { apiName, fields });
16
- return response.json();
9
+ async function createRecord(apiName, fields) {
10
+ const response = await uiApiClient.post(`/records`, { apiName, fields });
11
+ return response.json();
17
12
  }
18
- export async function updateRecord(recordId, fields) {
19
- const response = await uiApiClient.patch(`/records/${recordId}`, { fields });
20
- return response.json();
13
+ async function updateRecord(recordId, fields) {
14
+ const response = await uiApiClient.patch(`/records/${recordId}`, { fields });
15
+ return response.json();
21
16
  }
22
- export async function deleteRecord(recordId) {
23
- await uiApiClient.delete(`/records/${recordId}`);
24
- return true;
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
+ };
@@ -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
- * Fetch current user information from Salesforce
10
- * Uses Chatter API to get current user details
11
- * @returns User info or null if no session
12
- */
13
- export async function getCurrentUser() {
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
- catch (error) {
30
- console.error("Error fetching user data:", error);
31
- throw error;
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
+ };
@@ -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 "./org.js";
7
- export { getOrgInfo, refreshOrgAuth } from "./org.js";
8
- export type { WebAppManifest, RoutingConfig, RewriteRule, RedirectRule } from "./manifest.js";
9
- export { loadManifest } from "./manifest.js";
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
@@ -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,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
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
- * Copyright (c) 2026, Salesforce, Inc.,
3
- * All rights reserved.
4
- * For full license text, see the LICENSE.txt file
5
- */
6
- export { getOrgInfo, refreshOrgAuth } from "./org.js";
7
- export { loadManifest } from "./manifest.js";
1
+ import { getOrgInfo, refreshOrgAuth } from "./org.js";
2
+ import { loadManifest } from "./manifest.js";
3
+ export {
4
+ getOrgInfo,
5
+ loadManifest,
6
+ refreshOrgAuth
7
+ };
@@ -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
- const errors = [];
15
- if (!manifest.outputDir) {
16
- errors.push("outputDir");
17
- }
18
- if (errors.length > 0) {
19
- throw new Error(`Manifest missing required field${errors.length > 1 ? "s" : ""}: ${errors.join(", ")}`);
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
- * Load and parse webapplication.json manifest
24
- *
25
- * @param manifestPath - Path to the webapplication.json file
26
- * @returns Promise resolving to the parsed manifest
27
- * @throws Error if manifest file not found or validation fails
28
- */
29
- export async function loadManifest(manifestPath) {
30
- try {
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
- * Get Salesforce org info and authentication details
9
- *
10
- * @param orgAlias - Optional org alias or username, uses default org if not provided
11
- * @returns Promise resolving to org info or null if authentication fails
12
- */
13
- export async function getOrgInfo(orgAlias) {
14
- const org = await createOrg(orgAlias);
15
- if (!org) {
16
- return;
17
- }
18
- const connection = org.getConnection();
19
- const authInfo = connection.getAuthInfo();
20
- const authFields = authInfo.getFields();
21
- return {
22
- apiVersion: connection.getApiVersion(),
23
- orgId: authFields.orgId ?? "",
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
- try {
33
- if (!orgAlias) {
34
- return await Org.create({});
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
- * Refresh Salesforce org authentication
44
- *
45
- * @param orgAlias
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
- const lastIndex = originalString.lastIndexOf(searchString);
54
- if (lastIndex === -1) {
55
- return originalString;
56
- }
57
- const before = originalString.slice(0, lastIndex);
58
- const after = originalString.slice(lastIndex + searchString.length);
59
- return before + replacementString + after;
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
- if (!instanceUrl.includes(".my.")) {
63
- return instanceUrl;
64
- }
65
- let url = replaceLast(instanceUrl, ".my.", ".lightning.");
66
- url = replaceLast(url, ".salesforce", ".force");
67
- return url;
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
+ };
@@ -1,21 +1,14 @@
1
- /**
2
- * Copyright (c) 2026, Salesforce, Inc.,
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
- * Read the bundled design mode interactions script content.
13
- * @returns The script content, or null if the file does not exist (e.g. build:design not run)
14
- * @throws Error if the file exists but cannot be read
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,wBAAwB,CAAC;AAEhC,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"}
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 "./api/index.js";
7
- export * from "./app/index.js";
8
- export * from "./proxy/index.js";
9
- export * from "./design/index.js";
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