UNPKG

ltijs

Version:

Easily turn your web application into a LTI 1.3 Learning Tool.

46 lines (45 loc) • 2.94 kB
import { NamesAndRoles } from '#services/names-and-roles/names-and-roles.service'; import { Grading } from '#services/grading/grading.service'; import { DeepLinking } from '#services/deep-linking/deep-linking.service'; import type { Platform } from '#services/platform-manager/platform-manager.types'; import type { AccessTokenManager } from '#services/access-token-manager/access-token-manager.service'; import type { RequestHandler } from '#services/request-handler/request-handler.types'; import type { Logger } from '#services/logger/logger.types'; import type { IdTokenRecord } from '#services/database-manager/database-manager.types'; import type { IdToken, LegacyIdToken } from '#services/launch/id-token.types'; import type { RedirectOptions } from '#services/launch/launch.types'; import type { HttpResponse } from '#services/http-handler/http-handler.types'; /** * Everything a launch handler needs about the current launch -- passed as the first argument to * `onResourceLink`/`onDeepLinking`/`onSubmissionReview`, and returned by `Provider.getLaunchContext(ltik)` * to resume a launch outside the original request. */ export declare class LaunchContext { /** The full validated id_token record as stored, keyed by its database `id`. */ readonly rawIdToken: IdTokenRecord; /** The id_token's claims, reshaped into ltijs's own (non-legacy) `IdToken` type. */ readonly idToken: IdToken; /** The platform this launch came from. */ readonly platform: Platform; /** Opaque token identifying this launch -- pass it to `Provider.getLaunchContext` to resume the launch later. */ readonly ltik: string; /** Names and Role Provisioning Service (NRPS) -- `getMembers()`. */ readonly namesAndRoles: NamesAndRoles; /** Assignment and Grade Services (AGS) -- line items and score submission. */ readonly grading: Grading; /** Deep Linking service -- `createDeepLinkingMessage`/`createDeepLinkingForm`. */ readonly deepLinking: DeepLinking; /** @deprecated Use {@link LaunchContext.idToken} instead. */ readonly legacyIdToken: LegacyIdToken; get contextId(): string; constructor(idToken: IdTokenRecord, platform: Platform, ltik: string, accessTokenManager: AccessTokenManager, requestHandler: RequestHandler, logger: Logger); /** * Redirects to `path`, preserving its existing query parameters, merging in `options.query`, and always * appending this launch's `ltik` (overriding any `ltik` already present in `path` or `options.query`), * so a follow-up request through this same URL can still be resolved via `Provider.getLaunchContext`. * `path` can be a plain path (`/grades`) or a full URL on another origin. Either way, only its query * string is touched; everything else about it is preserved as given. */ redirect(response: HttpResponse, path: string, options?: RedirectOptions): void; } export default LaunchContext;