Merge branch 'master' of github.com:Jlavatai/strapp
[henge/kiak.git] / src / strappProtocolManager.js
1 /**
2 * @file Strapp Protocol Manager
3 * @author Jordan Lavatai and Ken Grimes
4 * @version 0.0.1
5 * @license AGPL-3.0
6 * @copyright Strapp.io
7 */
8
9 import send from 'spc'
10
11 /* KLMID == Key Location Method msgID Data */
12 /* Convert from KLMID to HTTP */
13 /* Convert from HTTP to KLMID */
14 /* Parse KLMID -> Execute method based on location */
15 /* Convert Object with KLMID keys to a string */
16
17 /** @func Parse the strapp protocol string
18 * @desc KLMID stands for Location Key Method ID Data
19 * [Optional] Key is the clientKey that is used to authorize the method
20 * If not specified, this message will not have any authorizations
21 * [Optional] Location is the location of the target file that the method will execute upon
22 * If not specified, target file is the current file
23 * [Required] Method is one of the file commands available
24 * [Required] ID is the message ID, used when multiple messages are being sent and received
25 * [Optional] Data is a parameter for the method e.g. PUT will replace the target files data property
26 *
27 * An unincluded message part needs to be indicated by a whitespace, i.e. ' ' i.e. /u{0020}.
28 * This function is mainly called by a SPCs receive event that processes every message that a SPC
29 * receives
30 * @arg {String} msg - String conforming to the strapp protocol
31 * @return {Object} - Parsed object with keys corresponding to segments of strapp Protocol
32 */
33 function parseSPM(msg) {
34 /* if no location, then call the method in LMKID on the local file, i.e. "." */
35 }