skipcheck

TM1 client · Docs · The client

Tm1Client

import { Tm1Client } from "@skipcheck/tm1-client";

Used in the walkthroughs Connect and list your cubes, Test your code against a real TM1, Add TM1 to a Spring Boot application.

The client for one TM1 server: one Tm1Session, and every service built on it, such as dimensions. Services arrive with the endpoint phases; session sends any request, for what has no service yet.

const tm1 = Tm1Client.builder().baseUrl("http://localhost:8010/api/v1/").basicAuth("admin", "apple").build();
try {
  for await (const cube of tm1.cubes.modelCubes(ODataQuery.none().select(Cube.Fields.Name))) {
    console.log(cube.Name);
  }
} finally {
  await tm1.close(); // once the list is done, not alongside it
}

Run a long process asynchronously, so no request stays open for its whole run:

// TM1 runs it in the background and the client polls for the result every 2 seconds, so
// no request stays open. Aborting the signal stops the process on TM1.
return tm1.withAsync(2000).processes.executeWithReturn("Rebuild Forecast", {}, null, { signal });

Members

session propertyThe session, which sends any request (Tm1Request).
dimensions propertyDimensions.
hierarchies propertyHierarchies.
elements propertyElements.
edges propertyEdges.
levels propertyLevels.
members propertyMembers.
subsets propertySubsets.
attributes propertyAttribute definitions.
localizedAttributes propertyTranslated attribute values.
cubes propertyCubes.
views propertyViews.
cellsets propertyCellsets.
cells propertyCell writes.
memberSets propertyMember sets.
sandboxes propertySandboxes.
changeSets propertyChange sets.
drillthrough propertyDrillthrough.
processes propertyProcesses.
processDebugging propertyProcess debugging.
chores propertyChores.
users propertyUsers.
groups propertyGroups.
sessions propertyServer sessions.
threads propertyServer threads.
server propertyThe server.
logs propertyThe server's logs.
contents propertyThe contents tree.
annotations propertyAnnotations on cube cells.
git propertyTM1 Git.
encryption propertyEncryption at rest.
oidcKeys propertyThe cached OpenID Connect keys.
sqlDataSources propertyThe ODBC data sources on TM1's host.
builder staticA builder for a client of one TM1 server.
of staticA client over session, which it shares.
batchA JSON $batch.
withAsyncA client whose requests TM1 runs asynchronously, polled every every milliseconds.
withoutAsyncA client on a synchronous view of this client's session (Tm1Session.withoutAsync).
withSandboxA client whose requests run in sandbox name.
withChangeSetA client whose writes are recorded in change set id.
connectLogs in now, rather than on the first request.
closeEnds the session on the server.
[Symbol.asyncDispose]Ends the session on the server, for await using.
toStringThe client and its service root, for logs.

session

property
session: Tm1Session

The session, which sends any request (Tm1Request).

dimensions

property
dimensions: DimensionService

Dimensions. The service, on this client's session.

hierarchies

property
hierarchies: HierarchyService

Hierarchies. The service, on this client's session.

elements

property
elements: ElementService

Elements. The service, on this client's session.

edges

property
edges: EdgeService

Edges. The service, on this client's session.

levels

property
levels: LevelService

Levels. The service, on this client's session.

members

property
members: MemberService

Members. The service, on this client's session.

subsets

property
subsets: SubsetService

Subsets. The service, on this client's session.

attributes

property
attributes: AttributeService

Attribute definitions. The service, on this client's session.

localizedAttributes

property
localizedAttributes: LocalizedAttributeService

Translated attribute values. The service, on this client's session.

cubes

property
cubes: CubeService

Cubes. The service, on this client's session.

views

property
views: ViewService

Views. The service, on this client's session.

cellsets

property
cellsets: CellsetService

Cellsets. The service, on this client's session.

cells

property
cells: CellService

Cell writes. The service, on this client's session.

memberSets

property
memberSets: MemberSetService

Member sets. The service, on this client's session.

sandboxes

property
sandboxes: SandboxService

Sandboxes. The service, on this client's session.

changeSets

property
changeSets: ChangeSetService

Change sets. The service, on this client's session.

drillthrough

property
drillthrough: DrillthroughService

Drillthrough. The service, on this client's session.

processes

property
processes: ProcessService

Processes. The service, on this client's session.

processDebugging

property
processDebugging: ProcessDebugService

Process debugging. The service, on this client's session.

chores

property
chores: ChoreService

Chores. The service, on this client's session.

users

property
users: UserService

Users. The service, on this client's session.

groups

property
groups: GroupService

Groups. The service, on this client's session.

sessions

property
sessions: SessionService

Server sessions. The service, on this client's session.

threads

property
threads: ThreadService

Server threads. The service, on this client's session.

server

property
server: ServerService

The server. The service, on this client's session.

logs

property
logs: LogService

The server's logs. The service, on this client's session.

contents

property
contents: ContentService

The contents tree. The service, on this client's session.

annotations

property
annotations: AnnotationService

Annotations on cube cells. The service, on this client's session.

git

property
git: GitService

TM1 Git. The service, on this client's session.

encryption

property
encryption: EncryptionService

Encryption at rest. The service, on this client's session.

oidcKeys

property
oidcKeys: OidcKeyService

The cached OpenID Connect keys. The service, on this client's session.

sqlDataSources

property
sqlDataSources: SqlDataSourceService

The ODBC data sources on TM1's host. The service, on this client's session.

builder

static
static builder(): Tm1ClientBuilder

A builder for a client of one TM1 server.

of

static
static of(session: Tm1Session): Tm1Client

A client over session, which it shares.

batch

batch(): Tm1Batch

A JSON $batch: calls through Tm1Batch.client are queued, and run() sends them together.

withAsync

withAsync(every: number): Tm1Client

A client whose requests TM1 runs asynchronously, polled every every milliseconds.

withoutAsync

withoutAsync(): Tm1Client

A client on a synchronous view of this client's session (Tm1Session.withoutAsync).

withSandbox

withSandbox(name: string): Tm1Client

A client whose requests run in sandbox name.

withChangeSet

withChangeSet(id: string): Tm1Client

A client whose writes are recorded in change set id.

connect

connect(options?: Tm1CallOptions): Promise<Tm1Client>

Logs in now, rather than on the first request.

close

close(): Promise<void>

Ends the session on the server.

[Symbol.asyncDispose]

[Symbol.asyncDispose](): Promise<void>

Ends the session on the server, for await using: the same as close.

toString

toString(): string

The client and its service root, for logs.