Tm1SessionBuilder
import { Tm1SessionBuilder } from "@skipcheck/tm1-client"; Builds a Tm1Session. Only baseUrl and credentials are required.
Members
baseUrl | The service root, such as http://localhost:8010/api/v1/. |
address | The server's address, such as http://tm1:8010. |
dialect | The kind of deployment, for address. |
basicAuth | Basic authentication, for TM1 security modes 1 and 2. |
authenticator | How to log in. |
impersonate | Logs in as the service account but acts as user (TM1-Impersonate). |
withoutImpersonation | Logs in as the credentials' own user. |
sessionContext | A label TM1 shows for the session (TM1-SessionContext, sent with the login), such as the application's name. |
timeouts | Timeouts by kind of work; Tm1Timeouts.DEFAULTS unless set. |
errorClassifier | How error responses are classified; Tm1ErrorClassifier.defaults unless set. |
transport | What sends the requests (Java's webClient and connector). |
checkCapabilities | Whether requests check the server's $metadata for what they need. |
clock | The clock refused logins are timed by, in milliseconds (for tests). |
copy | A copy of these settings, for a pool to build one session per identity. |
baseUrlOrUnset | @internal The service root, or a placeholder if it isn't set yet, for the pool's messages. |
build | The session. |
baseUrl
baseUrl(baseUrl: string): thisThe service root, such as http://localhost:8010/api/v1/: an absolute URL with no query or fragment. A missing trailing / is added.
Throws
- RangeError if
baseUrlisn't absolute or has a query or fragment
address
address(address: string): thisThe server's address, such as http://tm1:8010: its scheme, host and HTTP port. The service root comes from the dialect, Tm1Dialect.V11 unless set (before this), which adds /api/v1/. Use baseUrl to give the service root itself.
Throws
- RangeError if the address doesn't fit the dialect
dialect
dialect(dialect: Tm1Dialect): thisThe kind of deployment, for address: Tm1Dialect.V11 unless set.
basicAuth
basicAuth(user: string, password?: string | null): thisBasic authentication, for TM1 security modes 1 and 2: shorthand for authenticator(Tm1Authenticator.basic(user, password)). A null password counts as empty.
authenticator
authenticator(authenticator: Tm1Authenticator): thisHow to log in: TM1's own security, CAM, or credentials of your own. Asked for credentials on every login.
impersonate
impersonate(user: string): thisLogs in as the service account but acts as user (TM1-Impersonate). TM1 matches the name ignoring case and spaces. A name with characters outside ASCII goes out as UTF-8, which is how TM1 (11.8) reads the header: the value is handed to fetch as one character for each UTF-8 byte, which Node's fetch and, by the Fetch standard, a browser's send as those bytes. A custom Tm1Transport must send each character of a header value as one byte, as fetch does.
Throws
- RangeError if
useris blank, which TM1 would take as no impersonation at all, or has a control character
withoutImpersonation
withoutImpersonation(): thisLogs in as the credentials' own user: no impersonation.
sessionContext
sessionContext(sessionContext: string): thisA label TM1 shows for the session (TM1-SessionContext, sent with the login), such as the application's name: in TM1's thread and session lists and its audit log. At most 250 characters, which is all TM1 keeps. It goes out as UTF-8, as TM1 reads it.
timeouts
timeouts(timeouts: Tm1Timeouts): thisTimeouts by kind of work; Tm1Timeouts.DEFAULTS unless set.
errorClassifier
errorClassifier(classifier: Tm1ErrorClassifier): thisHow error responses are classified; Tm1ErrorClassifier.defaults unless set.
transport
transport(transport: Tm1Transport): thisWhat sends the requests (Java's webClient and connector): fetchTransport by default.
checkCapabilities
checkCapabilities(check: boolean): thisWhether requests check the server's $metadata for what they need.
clock
clock(clock: () => number): thisThe clock refused logins are timed by, in milliseconds (for tests).
copy
copy(): Tm1SessionBuilderA copy of these settings, for a pool to build one session per identity.
baseUrlOrUnset
baseUrlOrUnset(): string@internal The service root, or a placeholder if it isn't set yet, for the pool's messages.
build
build(): Tm1SessionThe session. Nothing is sent to TM1 until the first request. @throws Error if the base URL or credentials aren't set