2.10.2 • Published 18 days ago

@appland/models v2.10.2

Weekly downloads
75
License
Commons Clause + ...
Repository
-
Last release
18 days ago

About

The models contained in src are useful for manipulating data extracted from AppMaps created by https://github.com/applandinc/appmap-ruby, https://github.com/applandinc/appmap-java, or https://github.com/applandinc/appland-browser-extension .

Table of Contents

API Reference

AppMap

Represents an AppMap. If pre-processing or normalization is required, see AppMapBuilder.

const appmap = new AppMap(data);

version

Returns the version of the AppMap.

metadata

Returns an object containing the AppMap's metadata section.

name

Returns the name of the AppMap. This is shorthand for metadata.name.

events

Returns the raw event array.

classMap

Returns an object representing the AppMap's class map section.

rootEvent

Returns the root CallNode, essentially the root of the call stack.

AppMapBuilder

AppMapBuilder allows for pre-processing of data before constructing an AppMap.

const appmap = buildAppMap()
      .source(await fromFile(file))
      .prune(cmd.size)
      .normalize()
      .build();

buildAppMap

Begins the construction of an AppMap with the ability to add pre-processing transformations. A data object or JSON string can be supplied instead of calling source.

event

Add an event transform. This transform will be called for each event still remaining in the AppMap after chunk and stack transforms have completed. The transform must return event data or undefined.

  builder.event((e) => {
    if (e.event === 'return') {
      delete e.path;
      delete e.lineno;
    }
    return e;
  })

stack

Add a stack transform. This transform will be called for each complete call call stack still remaining in the AppMap after chunk transforms have completed. The transform must an array of events or undefined.

chunk

Add a chunk transform. This transform will be called for each "chunk" in the AppMap. A chunk may consist of many or one stacks.

source

Specifies the data source. This method will accept stringified JSON or a JSON object.

  const appmap = buildAppMap()
    .source(await fromUrl(url))
    .build();

prune

Prune the event array to fit within a specified size in bytes. This method applies a chunk transformation to remove the largest and most frequent event types.

  // Cut down the AppMap event array to ~2MB
  const appmap = buildAppMap()
    .source(await fromUrl(url))
    .prune(2 /* MB */ * 1024 * 1024)
    .build();

normalize

Normalize cleans up common issues in an AppMap event array. This includes:

  • re-indexing of events
  • ordering by thread execution
  • re-balancing the stack if methods were still executing when recording stopped

If you're unsure of whether or not your AppMap requires normalization, it likely does.

const appmap = buildAppMap()
    .source(await fromFile(path))
    .normalize()
    .build();

build

Executes and finalizes pre-processing, returning an AppMap with the results. Pre-processing transforms are run in the following order:

chunk -> stack -> event

collectEvents

Collects and runs transforms the sorted event array. This method is slow and subsequent calls to this method are not cached.

2.10.2

18 days ago

2.10.1

2 months ago

2.10.0

5 months ago

2.9.0

6 months ago

2.8.0

6 months ago

2.6.3

10 months ago

2.7.0

7 months ago

2.6.5

8 months ago

2.6.4

10 months ago

2.6.2

11 months ago

2.6.1

12 months ago

2.4.3

1 year ago

2.6.0

1 year ago

2.5.0

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.4.1

1 year ago

2.4.0

1 year ago

2.4.2

1 year ago

2.0.0-next.1

1 year ago

2.3.0

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.23.2

1 year ago

1.23.0

1 year ago

1.23.1

1 year ago

1.21.0

2 years ago

1.22.0

1 year ago

1.20.0

2 years ago

1.18.3

2 years ago

1.18.2

2 years ago

1.19.0

2 years ago

1.18.1

2 years ago

1.18.0

2 years ago

1.16.2

2 years ago

1.17.0

2 years ago

1.16.1

2 years ago

1.16.0

2 years ago

1.15.0

2 years ago

1.14.5

2 years ago

1.14.4

2 years ago

1.14.3

2 years ago

1.14.2

2 years ago

1.14.1

2 years ago

1.14.0

2 years ago

1.13.0

2 years ago

1.12.1

2 years ago

1.12.0

2 years ago

1.9.0

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.11.0

2 years ago

1.10.1

2 years ago

1.10.0

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.0

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

0.7.0

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago