Minim ALPS Namespace
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Minim ALPS

Build Status

This library provides an interface to the Refract ALPS. It extends upon the base types as defined in Minim.


npm install minim-alps

Usage Example

import minim from 'minim';
import alpsNamespace from 'minim-alps';

const namespace = minim

// Convert from Compact Refract
// Converted from
let compactRefract = [
  'alps', {}, {version: '1.0'}, [
    ['doc', {}, {format: 'text'}, 'A contact list.'],
    ['descriptor', {id:'collection'}, {type: 'safe', rt: 'contact'}, [
      ['doc', {}, {}, 'A simple link/form for getting a list of contacts.'],
      ['descriptor', {id: 'nameSearch'}, {type: 'semantic'}, [
        ['doc', {}, {}, 'Input for a search form.']
    ['descriptor', {id:'contact'}, {type: 'semantic'}, [
      ['descriptor', {id: 'item'}, {type: 'safe'}, [
        ['doc', {}, {}, 'A link to an individual contact.'],
        ['descriptor', {id:'fullName'}, {type: 'semantic'}, []],
        ['descriptor', {id:'email'}, {type: 'semantic'}, []],
        ['descriptor', {id:'phone'}, {type: 'semantic'}, []]

let alpsDoc = namespace.fromCompactRefract(compactRefract);

// Initialize elements directly
const Alps = namespace.getElementClass('alps');
const alps = new Alps();

// Set version
alps.attributes.set('version', '1.0');

const doc = alps.addDoc();
doc.attributes.set('type', 'text');
doc.set('A contact list.');

const collection = alps.addDescriptor(); = 'collection';
collection.attributes.set({type: 'safe', rt: 'contact'});

const collectionDoc = collection.addDoc();
doc.set('A simple link/form for getting a list of contacts.');

const nameSearch = collection.addDescriptor();
nameSearch.attributes.set('type', 'semantic');

Element Reference

Alps (Descriptor)

Indicates the root of the ALPS document.

Descriptor (ArrayElement)

A descriptor element defines the semantics of specific data elements or state transitions that MAY exist in an associated representation.

Doc (StringElement)

A text field that contains free-form, usually human-readable, text.