Skip to content
This repository has been archived by the owner on Mar 12, 2022. It is now read-only.
/ clark-entity Public archive

CLARK business rules encapsulated in TypeScript modules

Notifications You must be signed in to change notification settings

Cyber4All/clark-entity

Repository files navigation

Entities

CLARK business rules encapsulated in TypeScript modules

Installation

npm install --save clark-entity

Test

npm run test

Serialization

The standard JSON.stringify function will work on entities, but data will be extraneous. If you are sending an entity over a network, you must first convert its information to a string by:

let serialized = <Entity>.serialize(entity);

On the receiving end, you must unserialize by:

let entity = <Entity>.unserialize(serialized, parent);

If you are not working with a parent entity, pass null as the second argument.

Interfaces

User (user.ts)

A class to represent Bloomin' Onion users.

Kind: global class

new User(username, name)

Construct a new User, given starting user id and name.

Param Type Description
username string the user's unique log-in username
name string the user's real-life name

user.username

Kind: instance property of User Properties

Name Type Description
id string a user's unique log-in username

user.name

Kind: instance property of User Properties

Name Type Description
name string a user's real-life name

user.email

Kind: instance property of User Properties

Name Type Description
email string a user's email on file

user.pwd

Kind: instance property of User Properties

Name Type Description
pwdhash string a user's password authentication

user.objects

Kind: instance property of User Properties

Name Type Description
objects Array.<LearningObject> (immutable) an array of a user's learning objects NOTE: individual elements are freely accessible, but the array reference itself is immutable, and elements canonly be added and removed by the below functions

user.addObject() ⇒ LearningObject

Adds a new, blank learning object to this user.

Kind: instance method of User Returns: LearningObject - a reference to the new learning object

user.removeObject(i) ⇒ LearningObject

Removes the user's i-th learning object.

Kind: instance method of User Returns: LearningObject - the learning object which was removed

Param Type Description
i number the index to remove from the objects array

LearningObject (learning-object.ts)

A class to represent a learning object.

Kind: global class

new LearningObject(source)

Construct a new, blank LearningOutcome.

Param Type Description
source User the author the new object belongs to TODO: current constructor parameters (author required, name optional) are in place for reverse compatibility, but actually they should be backwards (name required, author optional [default to null]) TODO: constructor should confirm uniqueness of name if author is not null

learningObject.author

Kind: instance property of LearningObject Properties

Name Type Description
author User (immutable) the user this learning object belongs to

learningObject.name

Kind: instance property of LearningObject Properties

Name Type Description
length string the object's identifying name, unique over a user TODO: ensure uniqueness of name if author is not null

learningObject.date

Kind: instance property of LearningObject Properties

Name Type Description
length string the object's last-modified date FIXME: if there's a reason to use an actual Date class

learningObject.length

Kind: instance property of LearningObject Properties

Name Type Description
length string the object's class, determining its length (eg. module) values are resetricted according to available lengths

learningObject.goals

Kind: instance property of LearningObject Properties

Name Type Description
goals Array.<LearningGoal> (immutable) goals this learning object should achieve NOTE: individual elements are freely accessible, but the array reference itself is immutable, and elements canonly be added and removed by the below functions

learningObject.outcomes

Kind: instance property of LearningObject Properties

Name Type Description
outcomes Array.<LearningOutcome> (immutable) outcomes this object should enable students to achieve NOTE: individual elements are freely accessible, but the array reference itself is immutable, and elements can only be added and removed by the below functions

learningObject.repository

Kind: instance property of LearningObject Properties

Name Type Description
repository Repository neutrino file/url storage TODO: extend constituents into full-fledged entities

learningObject.addGoal()

Adds a new learning goal to this object.

Kind: instance method of LearningObject

learningObject.removeGoal(i) ⇒ LearningObject

Removes the object's i-th learning goal.

Kind: instance method of LearningObject Returns: LearningObject - the goal which was removed

Param Type Description
i number the index to remove from the goals array

learningObject.addOutcome() ⇒ AssessmentPlan

Adds a new, blank learning outcome to this object.

Kind: instance method of LearningObject Returns: AssessmentPlan - a reference to the new outcome

learningObject.removeOutcome(i) ⇒ LearningObject

Removes the object's i-th learning outcome.

Kind: instance method of LearningObject Returns: LearningObject - the learning outcome which was removed

Param Type Description
i number the index to remove from the outcomes array

LearningGoal (learning-goal.ts)

A class to represent a learning object's learning goal.

Kind: global class

new LearningGoal(text)

Construct a new Learning Goal with text.

Param Type Description
text string the text of the new Learning Goal

learningGoal.text

Kind: instance property of LearningGoal Properties

Name Type Description
text string text content of this learning goal

LearningOutcome (learning-outcome.ts)

A class to represent a learning outcome.

Kind: global class

new LearningOutcome(source)

Construct a new, blank LearningOutcome.

Param Type Description
source LearningObject the learning object the new learning outcome belongs to TODO: constructor should take EITHER source OR tag (the other should be null) If tag is given (0 allowed), If source exists, validate that tag is unique, Otherwise, trust it Otherwise, auto-increment tag as necessary based on source The order of parameters should be consistent with LearningObject, ultimatelythat should be (tag, source)

learningOutcome.source

Kind: instance property of LearningOutcome Properties

Name Type Description
source LearningOutcomeSource (immutable) the author, name, and date of the learning object this outcome belongs to

learningOutcome.tag

Kind: instance property of LearningOutcome Properties

Name Type Description
tag number (immutable) a unique (over the source) identifier

learningOutcome.bloom

Kind: instance property of LearningOutcome Properties

Name Type Description
instruction string the bloom taxon of this learning outcome values are resetricted according to available levels

learningOutcome.verb

Kind: instance property of LearningOutcome Properties

Name Type Description
instruction string the verb this outcome text starts with (eg. define) values are resetricted according to the bloom taxon

learningOutcome.text

Kind: instance property of LearningOutcome Properties

Name Type Description
text string full text description of this outcome, except the verb

learningOutcome.mappings

Kind: instance property of LearningOutcome Properties

Name Type Description
mappings Array.<Outcome> (immutable) outcomes which presumably achieve similar things as this NOTE: individual elements are freely accessible, but the array reference itself is immutable, andelements can only be added and removed by the below functions

learningOutcome.assessments

Kind: instance property of LearningOutcome Properties

Name Type Description
assessments Array.<AssessmentPlan> (immutable) plans to assess how well the outcome is achieved NOTE: individual elements are freely accessible, but the array reference itself is immutable, and elements can only be added and removed by the below functions

learningOutcome.strategies

Kind: instance property of LearningOutcome Properties

Name Type Description
strategies Array.<InstructionalStrategy> (immutable) strategies on how to achieve the outcome NOTE: individual elements are freely accessible, but the array reference itself is immutable, andelements can only be added and removed by the below functions

learningOutcome.author

properties for consistency with the Outcome interface

Kind: instance property of LearningOutcome Properties

Name Type
author string
name string
date string
outcome string

learningOutcome.mapTo() ⇒ number

Maps an outcome to this learning outcome.

Kind: instance method of LearningOutcome Returns: number - the new length of the mappings array

learningOutcome.unmap(i) ⇒ Outcome

Removes the outcome's i-th mapping.

Kind: instance method of LearningOutcome Returns: Outcome - the outcome which was removed

Param Type Description
i number the index to remove from the mappings array

learningOutcome.addAssessment() ⇒ AssessmentPlan

Adds a new, blank assessment plan to this outcome.

Kind: instance method of LearningOutcome Returns: AssessmentPlan - a reference to the new assessment plan

learningOutcome.removeAssessment(i) ⇒ LearningObject

Removes the outcome's i-th assessment plan.

Kind: instance method of LearningOutcome Returns: LearningObject - the assessment plan which was removed

Param Type Description
i number the index to remove from the assessments array

learningOutcome.addStrategy() ⇒ InstructionalStrategy

Adds a new, blank instructional strategy to this outcome.

Kind: instance method of LearningOutcome Returns: InstructionalStrategy - a reference to the new strategy

learningOutcome.removeStrategy(i) ⇒ LearningObject

Removes the outcome's i-th instructional strategy.

Kind: instance method of LearningOutcome Returns: LearningObject - the strategy which was removed

Param Type Description
i number the index to remove from the strategies array

StandardOutcome (standard-outcome.ts)

A class to represent a standard outcome. Immutable.

Kind: global class

new StandardOutcome(author, name, outcome)

Create a new StandardOutcome.

Param Type Description
author string the new outcome's source
name string the new outcome's label
outcome string the new outcome's text

standardOutcome.author

Kind: instance property of StandardOutcome Properties

Name Type Description
source string the organization or document this outcome is drawn from

standardOutcome.name

Kind: instance property of StandardOutcome Properties

Name Type Description
name string the label or unit of the outcome

standardOutcome.date

Kind: instance property of StandardOutcome Properties

Name Type Description
date string the year this standard was established

standardOutcome.outcome

Kind: instance property of StandardOutcome Properties

Name Type Description
outcome string the text of the outcome

InstructionalStrategy (instructional-strategy.ts)

A class to represent a learning outcome's instructional strategy.

Kind: global class

new InstructionalStrategy(source)

Construct a new, blank InstructionalStrategy.

Param Type Description
source LearningOutcome the learning outcome the new instructional strategy belongs to

instructionalStrategy.sourceBloom

Kind: instance property of InstructionalStrategy Properties

Name Type Description
sourceBloom string (immutable) the outcome's bloom taxon this assessment plan belongs to

instructionalStrategy.instruction

Kind: instance property of InstructionalStrategy Properties

Name Type Description
instruction string the class of this instructional strategy (eg. lecture) values are resetricted according to source's bloom taxon

instructionalStrategy.text

Kind: instance property of InstructionalStrategy Properties

Name Type Description
text string full text description of this instructional strategy

AssessmentPlan (assessment-plan.ts)

A class to represent a learning outcome's assessment plan.

Kind: global class

new AssessmentPlan(source)

Construct a new, blank AssessmentPlan.

Param Type Description
source LearningOutcome the learning outcome the new assessment plan belongs to

assessmentPlan.sourceBloom

Kind: instance property of AssessmentPlan Properties

Name Type Description
sourceBloom string (immutable) the outcome's bloom taxon this assessment plan belongs to

assessmentPlan.plan

Kind: instance property of AssessmentPlan Properties

Name Type Description
instruction string the class of this assessment plan (essay, test, etc.) values are resetricted according to source's bloom taxon

assessmentPlan.text

Kind: instance property of AssessmentPlan Properties

Name Type Description
text string full text description of this instructional strategy

About

CLARK business rules encapsulated in TypeScript modules

Resources

Stars

Watchers

Forks

Packages

No packages published