@salesforce/ui-bundle 11.14.0 → 11.15.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.
@@ -5,6 +5,8 @@
5
5
  */
6
6
  export type { OrgInfo } from './org';
7
7
  export { getOrgInfo, refreshOrgAuth } from './org';
8
- export type { UIBundleManifest, RoutingConfig, RewriteRule, RedirectRule } from './manifest';
9
- export { loadManifest } from './manifest';
8
+ export type { UIBundleManifest, UIBundleTarget, RoutingConfig, RewriteRule, RedirectRule, } from './manifest';
9
+ export { loadManifest, resolveMetaTarget, UI_BUNDLE_TARGETS } from './manifest';
10
+ export type { MetaXmlOptions } from './meta-xml';
11
+ export { generateUIBundleMetaXml } from './meta-xml';
10
12
  //# 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,OAAO,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACnD,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,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,EACX,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,WAAW,EACX,YAAY,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAChF,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
package/dist/app/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  import { getOrgInfo, refreshOrgAuth } from "./org.js";
2
- import { loadManifest } from "./manifest.js";
2
+ import { UI_BUNDLE_TARGETS, loadManifest, resolveMetaTarget } from "./manifest.js";
3
+ import { generateUIBundleMetaXml } from "./meta-xml.js";
3
4
  export {
5
+ UI_BUNDLE_TARGETS,
6
+ generateUIBundleMetaXml,
4
7
  getOrgInfo,
5
8
  loadManifest,
6
- refreshOrgAuth
9
+ refreshOrgAuth,
10
+ resolveMetaTarget
7
11
  };
@@ -3,11 +3,42 @@
3
3
  * All rights reserved.
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
+ /**
7
+ * Deployment target for a full UI Bundle web app. Declares where the bundle
8
+ * surfaces in Salesforce; drives the `<target>` of the generated
9
+ * `*.uibundle-meta.xml` (and any companion metadata).
10
+ *
11
+ * NOTE: This is a BUILD-TIME concept, not a field of the deployed
12
+ * `ui-bundle.json` manifest. The platform's manifest schema only accepts
13
+ * `outputDir`, `routing`, and `headers`; declaring `target` in the manifest
14
+ * makes the bundle fail deploy with InvalidUiBundleConfigError. The target is
15
+ * therefore supplied to the build (see the vite plugin's `generateMetaXml`
16
+ * option) and emitted into the `*.uibundle-meta.xml`, which is the metadata
17
+ * artifact the platform actually reads for targets.
18
+ *
19
+ * - `Experience` — surfaced through an Experience Site (site-container metadata).
20
+ * - `CustomApplication` — surfaced as a Lightning Custom Application.
21
+ * - `AppLauncher` — reachable from the Lightning App Launcher. This is a
22
+ * convenience alias: App Launcher visibility is provided by a Custom
23
+ * Application, so it maps to the same `CustomApplication` bundle target plus
24
+ * the companion app + permission-set metadata.
25
+ */
26
+ export type UIBundleTarget = "Experience" | "CustomApplication" | "AppLauncher";
6
27
  export interface UIBundleManifest {
7
28
  name?: string;
8
29
  outputDir: string;
9
30
  routing?: RoutingConfig;
10
31
  }
32
+ export declare const UI_BUNDLE_TARGETS: readonly UIBundleTarget[];
33
+ /**
34
+ * Resolve a build-time target to the value emitted in the `*.uibundle-meta.xml`
35
+ * `<target>` element. `AppLauncher` is an alias that maps to `CustomApplication`
36
+ * (App Launcher visibility is provided by a Custom Application).
37
+ *
38
+ * @param target - The build-time target
39
+ * @returns The `<target>` value for the UIBundle metadata, or undefined for none
40
+ */
41
+ export declare function resolveMetaTarget(target?: UIBundleTarget): "Experience" | "CustomApplication" | undefined;
11
42
  export interface RoutingConfig {
12
43
  rewrites?: RewriteRule[];
13
44
  redirects?: RedirectRule[];
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/app/manifest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,gBAAgB;IAEhC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,SAAS,EAAE,MAAM,CAAC;IAElB,OAAO,CAAC,EAAE,aAAa,CAAC;CACxB;AAGD,MAAM,WAAW,aAAa;IAE7B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IAEzB,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;IAE3B,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAE5C,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,WAAW;IAE3B,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,YAAY;IAE5B,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAClC;AAsBD;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAclF"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/app/manifest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,mBAAmB,GAAG,aAAa,CAAC;AAIhF,MAAM,WAAW,gBAAgB;IAEhC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,SAAS,EAAE,MAAM,CAAC;IAElB,OAAO,CAAC,EAAE,aAAa,CAAC;CACxB;AAGD,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAItD,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,CAAC,EAAE,cAAc,GACrB,YAAY,GAAG,mBAAmB,GAAG,SAAS,CAQhD;AAGD,MAAM,WAAW,aAAa;IAE7B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IAEzB,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;IAE3B,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAE5C,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,WAAW;IAE3B,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,YAAY;IAE5B,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAClC;AAsBD;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAclF"}
@@ -1,4 +1,18 @@
1
1
  import { readFile } from "node:fs/promises";
2
+ const UI_BUNDLE_TARGETS = [
3
+ "Experience",
4
+ "CustomApplication",
5
+ "AppLauncher"
6
+ ];
7
+ function resolveMetaTarget(target) {
8
+ if (target === "Experience") {
9
+ return "Experience";
10
+ }
11
+ if (target === "CustomApplication" || target === "AppLauncher") {
12
+ return "CustomApplication";
13
+ }
14
+ return void 0;
15
+ }
2
16
  function validateManifest(manifest) {
3
17
  const errors = [];
4
18
  if (!manifest.outputDir) {
@@ -24,5 +38,7 @@ async function loadManifest(manifestPath) {
24
38
  }
25
39
  }
26
40
  export {
27
- loadManifest
41
+ UI_BUNDLE_TARGETS,
42
+ loadManifest,
43
+ resolveMetaTarget
28
44
  };
@@ -0,0 +1,22 @@
1
+ import { UIBundleManifest, UIBundleTarget } from './manifest';
2
+ /** Options for generating a UIBundle meta XML. */
3
+ export interface MetaXmlOptions {
4
+ target?: UIBundleTarget;
5
+ masterLabel?: string;
6
+ description?: string;
7
+ isActive?: boolean;
8
+ version?: number;
9
+ }
10
+ /**
11
+ * Generate the contents of a `*.uibundle-meta.xml` file. The `target` option
12
+ * drives the `<target>` element (see {@link resolveMetaTarget}); `AppLauncher`
13
+ * resolves to `CustomApplication`. The manifest supplies the default master
14
+ * label (via `manifest.name`).
15
+ *
16
+ * @param manifest - The parsed ui-bundle.json manifest (for the name fallback)
17
+ * @param bundleName - The bundle's developer name (used as the default label)
18
+ * @param options - Target + optional overrides (label, description, isActive, version)
19
+ * @returns The XML document text for the `*.uibundle-meta.xml` file
20
+ */
21
+ export declare function generateUIBundleMetaXml(manifest: UIBundleManifest, bundleName: string, options?: MetaXmlOptions): string;
22
+ //# sourceMappingURL=meta-xml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta-xml.d.ts","sourceRoot":"","sources":["../../src/app/meta-xml.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAqB,MAAM,YAAY,CAAC;AAc3F,kDAAkD;AAClD,MAAM,WAAW,cAAc;IAI9B,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,cAAmB,GAC1B,MAAM,CA0BR"}
@@ -0,0 +1,29 @@
1
+ import { resolveMetaTarget } from "./manifest.js";
2
+ const META_XML_NS = "http://soap.sforce.com/2006/04/metadata";
3
+ function escapeXml(value) {
4
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
5
+ }
6
+ function generateUIBundleMetaXml(manifest, bundleName, options = {}) {
7
+ const masterLabel = options.masterLabel ?? manifest.name ?? bundleName;
8
+ const isActive = options.isActive ?? true;
9
+ const version = options.version ?? 1;
10
+ const metaTarget = resolveMetaTarget(options.target);
11
+ const lines = [
12
+ '<?xml version="1.0" encoding="UTF-8"?>',
13
+ `<UIBundle xmlns="${META_XML_NS}">`,
14
+ ` <masterLabel>${escapeXml(masterLabel)}</masterLabel>`
15
+ ];
16
+ if (options.description) {
17
+ lines.push(` <description>${escapeXml(options.description)}</description>`);
18
+ }
19
+ lines.push(` <isActive>${isActive}</isActive>`);
20
+ lines.push(` <version>${version}</version>`);
21
+ if (metaTarget) {
22
+ lines.push(` <target>${metaTarget}</target>`);
23
+ }
24
+ lines.push("</UIBundle>");
25
+ return lines.join("\n") + "\n";
26
+ }
27
+ export {
28
+ generateUIBundleMetaXml
29
+ };
package/dist/index.js CHANGED
@@ -3,14 +3,17 @@ import { getHighRevenueAccounts } from "./api/utils/accounts.js";
3
3
  import { createRecord, deleteRecord, getRecord, updateRecord } from "./api/utils/records.js";
4
4
  import { getCurrentUser } from "./api/utils/user.js";
5
5
  import { getOrgInfo, refreshOrgAuth } from "./app/org.js";
6
- import { loadManifest } from "./app/manifest.js";
6
+ import { UI_BUNDLE_TARGETS, loadManifest, resolveMetaTarget } from "./app/manifest.js";
7
+ import { generateUIBundleMetaXml } from "./app/meta-xml.js";
7
8
  import { UIBUNDLE_HEALTH_CHECK_PARAM, UIBUNDLE_PROXY_HEADER, createProxyHandler, injectLivePreviewScript } from "./proxy/handler.js";
8
9
  export {
9
10
  UIBUNDLE_HEALTH_CHECK_PARAM,
10
11
  UIBUNDLE_PROXY_HEADER,
12
+ UI_BUNDLE_TARGETS,
11
13
  createProxyHandler,
12
14
  createRecord,
13
15
  deleteRecord,
16
+ generateUIBundleMetaXml,
14
17
  getCurrentUser,
15
18
  getHighRevenueAccounts,
16
19
  getOrgInfo,
@@ -18,6 +21,7 @@ export {
18
21
  injectLivePreviewScript,
19
22
  loadManifest,
20
23
  refreshOrgAuth,
24
+ resolveMetaTarget,
21
25
  uiApiClient,
22
26
  updateRecord
23
27
  };
@@ -1,4 +1,4 @@
1
- const version = "11.14.0";
1
+ const version = "11.15.0";
2
2
  export {
3
3
  version
4
4
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/ui-bundle",
3
3
  "description": "Core package for Salesforce UI Bundles",
4
- "version": "11.14.0",
4
+ "version": "11.15.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@salesforce/core": "^8.23.4",
42
- "@salesforce/platform-sdk": "^11.14.0",
42
+ "@salesforce/platform-sdk": "^11.15.0",
43
43
  "micromatch": "^4.0.8",
44
44
  "path-to-regexp": "^8.3.0"
45
45
  },