Skip to main content

SummaryTreeBuilder Class

A helper class for building summary trees.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/runtime-utils/legacy.

For more information about our API support guarantees, see here.

Signature

export declare class SummaryTreeBuilder implements ISummaryTreeWithStats

Implements: ISummaryTreeWithStats

Remarks

Uses the builder pattern.

Constructors

ConstructorAlertsDescription
(constructor)(params)BetaConstructs a new instance of the SummaryTreeBuilder class

Properties

PropertyAlertsModifiersTypeDescription
statsBetareadonlyReadonly<ISummaryStats>
summaryBetareadonlyISummaryTree

Methods

MethodAlertsReturn TypeDescription
addAttachment(id)BetavoidAdds an ISummaryAttachment to the summary. This blob needs to already be uploaded to storage.
addBlob(key, content)BetavoidAdd a blob to the summary tree. This blob will be stored at the given key in the summary tree.
addHandle(key, handleType, handle)BetavoidAdds an ISummaryHandle that references a subtree, blob, or attachment in a previous summary.
addWithStats(key, summarizeResult)BetavoidAdds a child and updates the stats accordingly.
getSummaryTree()BetaISummaryTreeWithStatsGives you the in-memory summary tree with stats built by the SummaryTreeBuilder.

Constructor Details

(constructor)

Constructs a new instance of the SummaryTreeBuilder class

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

constructor(params?: {
groupId?: string;
});

Parameters

ParameterModifiersTypeDescription
paramsoptional{ groupId?: string; }

Property Details

stats

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

get stats(): Readonly<ISummaryStats>;

Type: Readonly<ISummaryStats>

summary

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

get summary(): ISummaryTree;

Type: ISummaryTree

Method Details

addAttachment

Adds an ISummaryAttachment to the summary. This blob needs to already be uploaded to storage.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

addAttachment(id: string): void;

Parameters

ParameterTypeDescription
idstringThe id of the uploaded attachment to be added to the summary tree.

addBlob

Add a blob to the summary tree. This blob will be stored at the given key in the summary tree.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

addBlob(key: string, content: string | Uint8Array): void;

Parameters

ParameterTypeDescription
keystringThe key to store the blob at in the current summary tree being generated. Should not contain any "/" characters.
contentstring | Uint8ArrayThe content of the blob to be added to the summary tree.

addHandle

Adds an ISummaryHandle that references a subtree, blob, or attachment in a previous summary.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;

Parameters

ParameterTypeDescription
keystringThe key to store the handle at in the current summary tree being generated. Should not contain any "/" characters.
handleTypeSummaryType.Tree | SummaryType.Blob | SummaryType.Attachmentthe type of SummaryObject besides a SummaryHandle, i.e. @fluidframework/driver-definitions#SummaryType.Tree, @fluidframework/driver-definitions#SummaryType.Blob, @fluidframework/driver-definitions#SummaryType.Attachment
handlestringThe path pointing to the part of the previous summary being used to duplicate the data. Use handle to help generate proper handle strings. Should not contain any "/" characters.

addWithStats

Adds a child and updates the stats accordingly.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

addWithStats(key: string, summarizeResult: ISummarizeResult): void;

Parameters

ParameterTypeDescription
keystringThe key to store the handle at in the current summary tree being generated. Should not contain any "/" characters. The key should be unique within the current summary tree, and not transform when encodeURIComponent is called.
summarizeResultISummarizeResultSimilar to ISummaryTreeWithStats. The provided summary can be either a ISummaryHandle or ISummaryTree.

getSummaryTree

Gives you the in-memory summary tree with stats built by the SummaryTreeBuilder.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

getSummaryTree(): ISummaryTreeWithStats;

Remarks

Use this once you're done building the summary tree, the stats should automatically be generated.

Returns

The summary tree and stats built by the SummaryTreeBuilder.

Return type: ISummaryTreeWithStats