Skip to content
View as Markdown
View as Markdown

@salesforce/b2c-tooling-sdk / operations/content / LibraryNode

Class: LibraryNode

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:25

A node in the content library tree.

Represents a library, page, content asset, component, or static asset reference.

Constructors

Constructor

new LibraryNode(values): LibraryNode

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:38

Parameters

values
children

LibraryNode[]

data

Record<string, unknown> | null

displayName?

string | null

hidden

boolean

id

string

parent

LibraryNode | null

type

LibraryNodeType

typeId

string | null

xml

Record<string, unknown> | null

Returns

LibraryNode

Properties

children

children: LibraryNode[]

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:33


data

data: Record<string, unknown> | null

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:31


displayName

displayName: string | null

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:30

Localized display name (x-default), when present. Content blocks (fragments) always have one.


hidden

hidden: boolean

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:34


id

id: string

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:26


parent

parent: LibraryNode | null

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:32


type

type: LibraryNodeType

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:27


typeId

typeId: string | null

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:28

Methods

convertToFragment()

convertToFragment(displayName): this

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:90

Convert this component node into a content block (fragment) in place.

Mirrors the element-level shape of Page Designer's "Convert to Content Block": the underlying <content> keeps its content-id, its <type> is rewritten from component.* to the matching fragment.*, a <display-name> is set (in schema-correct first position), and the element's own region content-link types are flipped to fragment.* to match.

NOTE: this only mutates the in-memory node. Importing just this element with a merge applies the type change but DROPS the element's own region content-links (orphaning a Layout block's children). To persist a conversion that keeps regions/children, use Library.buildContentBlockConversionXML.

Parameters

displayName

string

The x-default display name for the new content block.

Returns

this

this (for chaining)

Throws

If this node is not a component or has no backing XML.


toJSON()

toJSON(): Record<string, unknown>

Defined in: packages/b2c-tooling-sdk/src/operations/content/library.ts:60

Returns

Record<string, unknown>

Released under the Apache-2.0 License.