npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

lores-util

v3.0.0

Published

: Utilities for interacting with the Learning Objective Registry Service ( LOReS )

Downloads

47

Readme

NPM version Build status Coverage Status Dependency Status

A set of utilities that make it easy to interact with LOReS. There is two components: RegistryService and RegistryUtilities. RegistryService contains a set of APIs to call LOReS that return a promise which will be fulfilled when the request is complete. The service calls use 'superagent-d2l-promise-queue' which allows queuing requests in order to perform sequential writes.It also provides the ability to retry requests which have failed due to a connection error. Calls that perform updates or writes will use the queue. Get calls will be performed without a queue. Each RegistryService API call returns a promise. RegistryUtilities contains helper functions to perform actions on the registry and the objectives contained within the registry.

Usage

import { RegistryService, RegistryUtilities } from 'lores-util';

var registryService = RegistryService( serviceEndPoint );

registryService.getRegistryAsync( 1 )
.then( registry => {
	
	RegistryUtilities.cacheStructure( registry );

	return registry;
});

RegistryService API

Use LOReS API which can be found here: http://docs.objectivelistservice.apiary.io


additionalAuthorization: Object: (OPTIONAL) Additional Authorization data in JSON format

getManyRegistriesAsync( registryIds, additionalAuthorization )
getManyRegistriesCachedAsync( registryIds, additionalAuthorization )

registryIds: Array: List of registryIds to fetch Cached version of call returns array of registries with cache structure applied to each registry

getRegistryAsync( registryId, additionalAuthorization )
getRegistryCachedAsync( registryId, additionalAuthorization )

registryId: Int: Id of registry to fetch Cached version of call returns cacheStructure applied to registry

updateRegistriesBulkAsync( registries, additionalAuthorization )

registries: Array: List of registries to update

updateRegistryAsync( registry, registryId, additionalAuthorization )

Update registry

createRegistryAsync( owner, additionalAuthorization )

Create registry

owner: String: consumer stack

deleteRegistryAsync( registryId )

registryId: Int: Id of registry

createAuthoredObjectiveAsync( owner, notation, description, groupId, type, additionalAuthorization )

Create authored objective first and then perform a bulk create to create objective mapping

owner: String: consumer stack notation: String: Objective notation description: String: Description of objective groupId: Int: Group which objective will belong to type: String: Type of objective: 'CLO' or 'PLO'

updateAuthoredObjectiveAsync( notation, description, groupId, type, objectiveId )

objectiveId: Int: Source Id of objective Uses the same parameters as in createAuthoredObjectiveAsync

createObjectiveGroupAsync( owner, additionalAuthorization )

Create objective group for authored objectives to be mapped to

owner: String: consumer stack

bulkCreateObjectivesAsync( owner, sources, additionalAuthorization )

owner: String: consumer stack sources: Array: List of sources to create

sources = [{
	source_id: 2,
	source_type: 'lores'
}]

RegistryUtilities API


cacheStructure( registry )

Create a cache structure for objectives and appends it to the registry object. Leaves hash and list will contain PLO Leaves and not CLO leaves.

RegistryUtilities.cache( registry );
registry.cache.leaves // Array of plo leaves
registry.cache.leavesMap // objectiveIdToObjectiveHash of plo leaves
registry.cache.objectives // Array of objectives
registry.cache.objectivesMap // objectiveIdToObjectiveHash of all objectives
//Ancestor cache found in each objective in above hashMap or Array
registry.cache.leaves[0].cache.ancestorIdsHashSet // ancestor Hash
registry.cache.leaves[0].cache.ancestorIds // List of ancestor Ids. Found
sortCLOs( plo, cloId, afterCloId )

Sorts clos within a plo

removeCLO( plo, cloId )

Removes a CLO from a PLO

createUpdatedRegistryPayload( registry )

Will create the payload registry to attach when updating a registry. Will remove objectives that contain the property isTempOutcome.

Ex. Objective with Id: 3 will not be included in the registry payload

{
	id: 1
	objectives: [ 
		{ id: 2, children: [] }, 
		{ id: 3, children: [], isTempOutcome: true } 
	]
}