View Source modules

oli / Exports

oli

Table of contents

Enumerations

Classes

Interfaces

Type aliases

Functions

Type aliases

Action

Ƭ Action: NavigationAction \| FeedbackAction \| StateUpdateAction \| SubmissionAction

Supported actions.

Defined in

src/components/activities/types.ts:532


ChoiceId

Ƭ ChoiceId: ID

Alias for the identifier of a choice.

Defined in

src/components/activities/types.ts:93


ChoiceIdsToResponseId

Ƭ ChoiceIdsToResponseId: [ChoiceId[], ResponseId]

Defines a mapping of a collection of choices to a response.

Defined in

src/components/activities/types.ts:693


ClientEvaluation

Ƭ ClientEvaluation: Object

Allows submission of a client-side evaluation for an activity submission.

Type declaration

NameType
attemptGuidstring
feedbackany
outOfnumber | null
responseany
scorenumber | null

Defined in

src/components/activities/types.ts:169


DeliveryMode

Ƭ DeliveryMode: "delivery" \| "review" \| "preview"

Three different modes of activity delivery.

'delivery' is the standard mode where a student is interacting with a an activity 'review' mode is when a student is reviewing a previously submitted activity, in a read only mode 'preview' mode is instructor specific and allows access to responses and hints

Defined in

src/components/activities/types.ts:52


FileMetaData

Ƭ FileMetaData: Object

File response metadata.

Type declaration

NameType
creationTimenumber
fileSizenumber
urlstring

Defined in

src/components/activities/types.ts:698


HasHints

Ƭ HasHints: HasParts

Marker interface for an entity that has hints.

Defined in

src/components/activities/types.ts:392


HasStems

Ƭ HasStems: Object

Marker interface for an entity that has a collection of stems.

Type declaration

NameType
stemsStem[]

Defined in

src/components/activities/types.ts:380


Manifest

Ƭ Manifest: Object

Structure of an activity manifest.

The id field must be unique amongst all activities registered in a Torus instance. The format for the id field is <namespace>_<descriptor> where <namespace> is the designated namespace for this family of activities and <descriptor> is a terse description of this specific activity. Examples include: oli_multiple_choice, example_tf.

The friendlyName attribute is a short, human readable string that the UX within Torus will display to students, instructors and authors in various contexts. Words within it should be space separated and capitalized. For example: "Multiple Choice"

The descriptions attribute is a slightly longer human readable description of the activity. For example, "A traditional multiple choice question with one correct answer"

delivery and authoring attributes specify the element tag names that the activity is implemented within.

Type declaration

NameType
authoringModeSpecification
deliveryModeSpecification
descriptionstring
friendlyNamestring
idID

Defined in

src/components/activities/types.ts:196


MatchStyle

Ƭ MatchStyle: "any" \| "all" \| "none"

Defined in

src/components/activities/types.ts:465


MediaItemRequest

Ƭ MediaItemRequest: Object

Request for a media item from the media library.

Type declaration

NameType
mimeTypesstring[]
type"MediaItemRequest"

Defined in

src/components/activities/types.ts:57


ModeSpecification

Ƭ ModeSpecification: Object

Type declaration

NameType
elementstring
entrystring

Defined in

src/components/activities/types.ts:151


PartId

Ƭ PartId: ID

Alias for the identifier of a part.

Defined in

src/components/activities/types.ts:98


PartResponse

Ƭ PartResponse: Object

Type type allows the submission of a response for a specific part of an activity.

Type declaration

NameType
attemptGuidstring
responseStudentResponse

Defined in

src/components/activities/types.ts:160


PostUndoable

Ƭ PostUndoable: (undoable: Undoable) => void

Type declaration

▸ (undoable): void

Type for the post undo function.

Parameters
NameType
undoableUndoable
Returns

void

Defined in

src/components/activities/types.ts:40


ResponseId

Ƭ ResponseId: ID

Alias for the identifier of a response.

Defined in

src/components/activities/types.ts:103


RichText

Ƭ RichText: ModelElement[]

Rich text definition, an array of ModelElement instances.

Defined in

src/components/activities/types.ts:108


Undoable

Ƭ Undoable: Object

An Undoable action that an activity defines as a result of some (usually destructive) operation.

For example, if a choice is deleted via the user interface of an activity, the activity can create and post an Undoable that, if invoked by the page editor, would result in the choice being restored.

Type declaration

NameType
descriptionstring
operationsPathOperation[]
type"Undoable"

Defined in

src/components/activities/types.ts:70


creationFn

Ƭ creationFn: (context: CreationContext) => Promise<ActivityModelSchema>

Type declaration

▸ (context): Promise<ActivityModelSchema>

Parameters
NameType
contextCreationContext
Returns

Promise<ActivityModelSchema>

Defined in

src/components/activities/creation.ts:4

Functions

feedbackToString

feedbackToString(feedback): string

Converts a rich text feedback, that may contain inline markup and block-level elements, to text.

This function should only be used in contexts where there is a guarantee that the loss of data via this conversion is not a problem.

Parameters

NameTypeDescription
feedbackFeedbackrich text capable feedback

Returns

string

only the string text found within the feedback

Defined in

src/components/activities/types.ts:21


invokeCreationFunc

invokeCreationFunc(id, context): Promise<ActivityModelSchema>

Parameters

NameType
idstring
contextResourceContext

Returns

Promise<ActivityModelSchema>

Defined in

src/components/activities/creation.ts:26


makeChoice

makeChoice(text, id?): Choice

Helper function to create a choice from simple text.

Parameters

NameType
textstring
id?string

Returns

Choice

Defined in

src/components/activities/types.ts:351


makeContent

makeContent(text, id?): Object

Helper function to create a content object out of a raw string. Returns the string as a single paragraph within rich text, within the content object.

Parameters

NameTypeDescription
textstringtext string
id?stringoptional identifier

Returns

Object

content

NameType
contentRichText
editorEditorType
idstring
textDirectionTextDirection

Defined in

src/components/activities/types.ts:129


makeFeedback

makeFeedback(text): Feedback

Helper function to create Feedback from simple text.

Parameters

NameType
textstring

Returns

Feedback

Defined in

src/components/activities/types.ts:412


makeHint

makeHint(text): Hint

Helper function to create a hint from simple text.

Parameters

NameType
textstring

Returns

Hint

Defined in

src/components/activities/types.ts:396


makePart

makePart(responses, hints?, id?, targets?): Part

Helper function to create a part.

Parameters

NameTypeDefault valueDescription
responsesResponse[]undefinedresponses to use
hintsHint[]undefinedhints to use
id?stringundefinedthe part id
targetsstring[][]-

Returns

Part

the formulated part

Defined in

src/components/activities/types.ts:593


makePreviewText

makePreviewText(): string

Helper function to create preview text.

Returns

string

Defined in

src/components/activities/types.ts:688


makeResponse

makeResponse(rule, score, text?, correct?): Response

Helper function to create a response.

Parameters

NameTypeDefault valueDescription
rulestringundefinedmatch rule
scorenumberundefinedscore to assign
textstring''simple text to formulate a Feedback from
correct?booleanundefined-

Returns

Response

Defined in

src/components/activities/types.ts:507


makeStem

makeStem(text): Stem

Helper function to create a stem from a simple string.

Parameters

NameType
textstring

Returns

Stem

Defined in

src/components/activities/types.ts:384


makeTransformation

makeTransformation(path, operation, firstAttemptOnly, partId?): Transformation

Helper function to create a transformation.

Parameters

NameTypeDescription
pathstringJSON path of the node within the model to transform
operationshuffleThe transformation operation
firstAttemptOnlyboolean-
partId?string-

Returns

Transformation

Defined in

src/components/activities/types.ts:444


makeUndoable

makeUndoable(description, operations): Undoable

Helper function to create an instance of an Undoable

Parameters

NameTypeDescription
descriptionstringDescription of the undoable
operationsPathOperation[]Collection of path operations on the model that implements the undoable

Returns

Undoable

an undoable instance

Defined in

src/components/activities/types.ts:82


register

register(localFile, torusHost, token): Promise<RegistrationResult \| ServerError>

Helper function to register an activity from a zip bundle into a specific Torus instance.

Parameters

NameTypeDescription
localFilestringpath to the local file that is the activity zip bundle
torusHoststringURL specifying protocol, host and port of the Torus instance to register this activity into. Example: "https://proton.oli.cmu.edu/"
tokenstringencoded API token

Returns

Promise<RegistrationResult \| ServerError>

RegistrationResult on success

Defined in

src/components/activities/registrar.ts:19


registerCreationFunc

registerCreationFunc(manifest, fn): void

Registers a creation function for an activity type. The creation function is what the system will execute to create new instances of this activity type in an authoring context. The most usual implementation of a creation function is to simply return (i.e. resolve) a default activity model. But given the async interface here, a creation function can have a more interesting implementation where it makes a network request to a third-party server to retrieve data to use in constructing the activity instance.

Parameters

NameTypeDescription
manifestManifestmanifest file JSON
fncreationFnthe creation function to use

Returns

void

Defined in

src/components/activities/creation.ts:18