Class NonValidatingDocumentCombiner

Base class for any code that wants to compose JSON documents (primarily in the form of JS objects or arrays) together into a single output document.

Hierarchy (View Summary)

Constructors

Properties

baseDocument: JsonDocumentLike
contributions: Map<string, JsonDocumentLike> = ...
latestOutput: undefined | JsonDocumentLike
onDidRebuild: PlatformEvent<undefined> = ...

Event that emits to announce that the document has been rebuilt and the output has been updated

Accessors

Methods

  • Add or update one of the contribution documents for the composition process

    Note: the order in which contribution documents are added can be considered indeterminate as it depends on the order in which Map.forEach iterates over the contributions. However, the order matters when merging two arrays into one. Also, when options.ignoreDuplicateProperties is is true, the order also matters when adding the same property to an object that is already provided previously. Please let us know if you have trouble because of indeterminate contribution ordering.

    Parameters

    • documentName: string

      Name of the contributed document to combine

    • document: JsonDocumentLike

      Content of the contributed document to combine

    Returns undefined | JsonDocumentLike

    Recalculated output document given the new or updated contribution and existing other documents

  • Transform the contributed document associated with documentName. This transformation occurs after validating the contributed document and before combining with other documents.

    WARNING: If you do not create the combiner with option copyDocuments: true or clone inside this method, this method will directly modify the contributed document passed in.

    Parameters

    • documentName: string

      Name of the contributed document to combine

    • document: JsonDocumentLike

      Content of the contributed document to combine. Already validated via validateContribution

    Returns JsonDocumentLike

    Transformed contributed document