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 property | The session, which sends any request (Tm1Request). |
dimensions property | Dimensions. |
hierarchies property | Hierarchies. |
elements property | Elements. |
edges property | Edges. |
levels property | Levels. |
members property | Members. |
subsets property | Subsets. |
attributes property | Attribute definitions. |
localizedAttributes property | Translated attribute values. |
cubes property | Cubes. |
views property | Views. |
cellsets property | Cellsets. |
cells property | Cell writes. |
memberSets property | Member sets. |
sandboxes property | Sandboxes. |
changeSets property | Change sets. |
drillthrough property | Drillthrough. |
processes property | Processes. |
processDebugging property | Process debugging. |
chores property | Chores. |
users property | Users. |
groups property | Groups. |
sessions property | Server sessions. |
threads property | Server threads. |
server property | The server. |
logs property | The server's logs. |
contents property | The contents tree. |
annotations property | Annotations on cube cells. |
git property | TM1 Git. |
encryption property | Encryption at rest. |
oidcKeys property | The cached OpenID Connect keys. |
sqlDataSources property | The ODBC data sources on TM1's host. |
builder static | A builder for a client of one TM1 server. |
of static | A client over session, which it shares. |
batch | A JSON $batch. |
withAsync | A client whose requests TM1 runs asynchronously, polled every every milliseconds. |
withoutAsync | A client on a synchronous view of this client's session (Tm1Session.withoutAsync). |
withSandbox | A client whose requests run in sandbox name. |
withChangeSet | A client whose writes are recorded in change set id. |
connect | Logs in now, rather than on the first request. |
close | Ends the session on the server. |
[Symbol.asyncDispose] | Ends the session on the server, for await using. |
toString | The client and its service root, for logs. |
session
propertysession: Tm1SessionThe session, which sends any request (Tm1Request).
dimensions
propertydimensions: DimensionServiceDimensions. The service, on this client's session.
hierarchies
propertyhierarchies: HierarchyServiceHierarchies. The service, on this client's session.
elements
propertyelements: ElementServiceElements. The service, on this client's session.
edges
propertyedges: EdgeServiceEdges. The service, on this client's session.
levels
propertylevels: LevelServiceLevels. The service, on this client's session.
members
propertymembers: MemberServiceMembers. The service, on this client's session.
subsets
propertysubsets: SubsetServiceSubsets. The service, on this client's session.
attributes
propertyattributes: AttributeServiceAttribute definitions. The service, on this client's session.
localizedAttributes
propertylocalizedAttributes: LocalizedAttributeServiceTranslated attribute values. The service, on this client's session.
cubes
propertycubes: CubeServiceCubes. The service, on this client's session.
views
propertyviews: ViewServiceViews. The service, on this client's session.
cellsets
propertycellsets: CellsetServiceCellsets. The service, on this client's session.
cells
propertycells: CellServiceCell writes. The service, on this client's session.
memberSets
propertymemberSets: MemberSetServiceMember sets. The service, on this client's session.
sandboxes
propertysandboxes: SandboxServiceSandboxes. The service, on this client's session.
changeSets
propertychangeSets: ChangeSetServiceChange sets. The service, on this client's session.
drillthrough
propertydrillthrough: DrillthroughServiceDrillthrough. The service, on this client's session.
processes
propertyprocesses: ProcessServiceProcesses. The service, on this client's session.
processDebugging
propertyprocessDebugging: ProcessDebugServiceProcess debugging. The service, on this client's session.
chores
propertychores: ChoreServiceChores. The service, on this client's session.
users
propertyusers: UserServiceUsers. The service, on this client's session.
groups
propertygroups: GroupServiceGroups. The service, on this client's session.
sessions
propertysessions: SessionServiceServer sessions. The service, on this client's session.
threads
propertythreads: ThreadServiceServer threads. The service, on this client's session.
server
propertyserver: ServerServiceThe server. The service, on this client's session.
logs
propertylogs: LogServiceThe server's logs. The service, on this client's session.
contents
propertycontents: ContentServiceThe contents tree. The service, on this client's session.
annotations
propertyannotations: AnnotationServiceAnnotations on cube cells. The service, on this client's session.
git
propertygit: GitServiceTM1 Git. The service, on this client's session.
encryption
propertyencryption: EncryptionServiceEncryption at rest. The service, on this client's session.
oidcKeys
propertyoidcKeys: OidcKeyServiceThe cached OpenID Connect keys. The service, on this client's session.
sqlDataSources
propertysqlDataSources: SqlDataSourceServiceThe ODBC data sources on TM1's host. The service, on this client's session.
builder
staticstatic builder(): Tm1ClientBuilderA builder for a client of one TM1 server.
of
staticstatic of(session: Tm1Session): Tm1ClientA client over session, which it shares.
batch
batch(): Tm1BatchA JSON $batch: calls through Tm1Batch.client are queued, and run() sends them together.
withAsync
withAsync(every: number): Tm1ClientA client whose requests TM1 runs asynchronously, polled every every milliseconds.
withoutAsync
withoutAsync(): Tm1ClientA client on a synchronous view of this client's session (Tm1Session.withoutAsync).
withSandbox
withSandbox(name: string): Tm1ClientA client whose requests run in sandbox name.
withChangeSet
withChangeSet(id: string): Tm1ClientA 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(): stringThe client and its service root, for logs.