View Source modules
oli / Exports
oli
Table of contents
Enumerations
Classes
Interfaces
- ActivityContext
- ActivityLevelScoring
- ActivityModelSchema
- ActivityState
- AuthoringElementProps
- Choice
- CreationContext
- CreationData
- DeliveryElementProps
- EvaluationResponse
- Explanation
- Feedback
- FeedbackAction
- HasChoices
- HasContent
- HasParts
- HasPerPartSubmissionOption
- HasPreviewText
- HasStem
- HasTransformations
- Hint
- IsAction
- NavigationAction
- Part
- PartActivityResponse
- PartState
- RegistrationResult
- RequestHintResponse
- ResetActivityResponse
- Response
- SectionAuthoringProps
- SpecifiesEditor
- SpecifiesTextDirection
- StateUpdateAction
- Stem
- StudentResponse
- SubmissionAction
- Success
- Transformation
Type aliases
- Action
- ChoiceId
- ChoiceIdsToResponseId
- ClientEvaluation
- DeliveryMode
- FileMetaData
- HasHints
- HasStems
- Manifest
- MatchStyle
- MediaItemRequest
- ModeSpecification
- PartId
- PartResponse
- PostUndoable
- ResponseId
- RichText
- Undoable
- creationFn
Functions
- feedbackToString
- invokeCreationFunc
- makeChoice
- makeContent
- makeFeedback
- makeHint
- makePart
- makePreviewText
- makeResponse
- makeStem
- makeTransformation
- makeUndoable
- register
- registerCreationFunc
Type aliases
Action
Ƭ Action: NavigationAction
\| FeedbackAction
\| StateUpdateAction
\| SubmissionAction
Supported actions.
Defined in
src/components/activities/types.ts:533
ChoiceId
Ƭ ChoiceId: ID
Alias for the identifier of a choice.
Defined in
src/components/activities/types.ts:94
ChoiceIdsToResponseId
Ƭ ChoiceIdsToResponseId: [ChoiceId
[], ResponseId
]
Defines a mapping of a collection of choices to a response.
Defined in
src/components/activities/types.ts:720
ClientEvaluation
Ƭ ClientEvaluation: Object
Allows submission of a client-side evaluation for an activity submission.
Type declaration
Name | Type |
---|---|
attemptGuid | string |
feedback | any |
outOf | number | null |
response | any |
score | number | null |
Defined in
src/components/activities/types.ts:170
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:53
FileMetaData
Ƭ FileMetaData: Object
File response metadata.
Type declaration
Name | Type |
---|---|
creationTime | number |
fileSize | number |
url | string |
Defined in
src/components/activities/types.ts:725
HasHints
Ƭ HasHints: HasParts
Marker interface for an entity that has hints.
Defined in
src/components/activities/types.ts:393
HasStems
Ƭ HasStems: Object
Marker interface for an entity that has a collection of stems.
Type declaration
Name | Type |
---|---|
stems | Stem [] |
Defined in
src/components/activities/types.ts:381
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
Name | Type |
---|---|
authoring | ModeSpecification |
delivery | ModeSpecification |
description | string |
friendlyName | string |
id | ID |
Defined in
src/components/activities/types.ts:197
MatchStyle
Ƭ MatchStyle: "any"
\| "all"
\| "none"
Defined in
src/components/activities/types.ts:466
MediaItemRequest
Ƭ MediaItemRequest: Object
Request for a media item from the media library.
Type declaration
Name | Type |
---|---|
mimeTypes | string [] |
type | "MediaItemRequest" |
Defined in
src/components/activities/types.ts:58
ModeSpecification
Ƭ ModeSpecification: Object
Type declaration
Name | Type |
---|---|
element | string |
entry | string |
Defined in
src/components/activities/types.ts:152
PartId
Ƭ PartId: ID
Alias for the identifier of a part.
Defined in
src/components/activities/types.ts:99
PartResponse
Ƭ PartResponse: Object
Type type allows the submission of a response for a specific part of an activity.
Type declaration
Name | Type |
---|---|
attemptGuid | string |
response | StudentResponse |
Defined in
src/components/activities/types.ts:161
PostUndoable
Ƭ PostUndoable: (undoable
: Undoable
) => void
Type declaration
▸ (undoable
): void
Type for the post undo function.
Parameters
Name | Type |
---|---|
undoable | Undoable |
Returns
void
Defined in
src/components/activities/types.ts:41
ResponseId
Ƭ ResponseId: ID
Alias for the identifier of a response.
Defined in
src/components/activities/types.ts:104
RichText
Ƭ RichText: ModelElement
[]
Rich text definition, an array of ModelElement
instances.
Defined in
src/components/activities/types.ts:109
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
Name | Type |
---|---|
description | string |
operations | PathOperation [] |
type | "Undoable" |
Defined in
src/components/activities/types.ts:71
creationFn
Ƭ creationFn: (context
: CreationContext
) => Promise
<ActivityModelSchema
>
Type declaration
▸ (context
): Promise
<ActivityModelSchema
>
Parameters
Name | Type |
---|---|
context | CreationContext |
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
Name | Type | Description |
---|---|---|
feedback | Feedback | rich text capable feedback |
Returns
string
only the string text found within the feedback
Defined in
src/components/activities/types.ts:22
invokeCreationFunc
▸ invokeCreationFunc(id
, context
): Promise
<ActivityModelSchema
>
Parameters
Name | Type |
---|---|
id | string |
context | ResourceContext |
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
Name | Type |
---|---|
text | string |
id? | string |
Returns
Defined in
src/components/activities/types.ts:352
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
Name | Type | Description |
---|---|---|
text | string | text string |
id? | string | optional identifier |
Returns
Object
content
Name | Type |
---|---|
content | RichText |
editor | EditorType |
id | string |
textDirection | TextDirection |
Defined in
src/components/activities/types.ts:130
makeFeedback
▸ makeFeedback(text
): Feedback
Helper function to create Feedback from simple text.
Parameters
Name | Type |
---|---|
text | string |
Returns
Defined in
src/components/activities/types.ts:413
makeHint
▸ makeHint(text
): Hint
Helper function to create a hint from simple text.
Parameters
Name | Type |
---|---|
text | string |
Returns
Defined in
src/components/activities/types.ts:397
makePart
▸ makePart(responses
, hints?
, id?
, targets?
): Part
Helper function to create a part.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
responses | Response [] | undefined | responses to use |
hints | Hint [] | undefined | hints to use |
id? | string | undefined | the part id |
targets | string [] | [] | - |
Returns
the formulated part
Defined in
src/components/activities/types.ts:595
makePreviewText
▸ makePreviewText(): string
Helper function to create preview text.
Returns
string
Defined in
src/components/activities/types.ts:715
makeResponse
▸ makeResponse(rule
, score
, text?
, correct?
): Response
Helper function to create a response.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
rule | string | undefined | match rule |
score | number | undefined | score to assign |
text | string | '' | simple text to formulate a Feedback from |
correct? | boolean | undefined | - |
Returns
Defined in
src/components/activities/types.ts:508
makeStem
▸ makeStem(text
): Stem
Helper function to create a stem from a simple string.
Parameters
Name | Type |
---|---|
text | string |
Returns
Defined in
src/components/activities/types.ts:385
makeTransformation
▸ makeTransformation(path
, operation
, firstAttemptOnly
, partId?
): Transformation
Helper function to create a transformation.
Parameters
Name | Type | Description |
---|---|---|
path | string | JSON path of the node within the model to transform |
operation | shuffle | The transformation operation |
firstAttemptOnly | boolean | - |
partId? | string | - |
Returns
Defined in
src/components/activities/types.ts:445
makeUndoable
▸ makeUndoable(description
, operations
): Undoable
Helper function to create an instance of an Undoable
Parameters
Name | Type | Description |
---|---|---|
description | string | Description of the undoable |
operations | PathOperation [] | Collection of path operations on the model that implements the undoable |
Returns
an undoable instance
Defined in
src/components/activities/types.ts:83
register
▸ register(localFile
, torusHost
, token
): Promise
<RegistrationResult
\| ServerError
>
Helper function to register an activity from a zip bundle into a specific Torus instance.
Parameters
Name | Type | Description |
---|---|---|
localFile | string | path to the local file that is the activity zip bundle |
torusHost | string | URL specifying protocol, host and port of the Torus instance to register this activity into. Example: "https://proton.oli.cmu.edu/" |
token | string | encoded 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
Name | Type | Description |
---|---|---|
manifest | Manifest | manifest file JSON |
fn | creationFn | the creation function to use |
Returns
void