X-Git-Url: https://git.kengrimes.com/?p=henge%2Fkiak.git;a=blobdiff_plain;f=strappProtocolManager.js;fp=strappProtocolManager.js;h=8aa9bfb8d0bbfabeef3a1fc7afa16f2e4905f0ef;hp=0000000000000000000000000000000000000000;hb=44e0b2d571c71ebd410b78366c8bc9dc463a96c4;hpb=d17ac76d8256b00eb253138a554c7d3d51139b9e diff --git a/strappProtocolManager.js b/strappProtocolManager.js new file mode 100644 index 0000000..8aa9bfb --- /dev/null +++ b/strappProtocolManager.js @@ -0,0 +1,35 @@ +/** + * @file Strapp Protocol Manager + * @author Jordan Lavatai and Ken Grimes + * @version 0.0.1 + * @license AGPL-3.0 + * @copyright Strapp.io + */ + +import send from 'spc' + +/* KLMID == Key Location Method msgID Data */ +/* Convert from KLMID to HTTP */ +/* Convert from HTTP to KLMID */ +/* Parse KLMID -> Execute method based on location */ +/* Convert Object with KLMID keys to a string */ + +/** @func Parse the strapp protocol string + * @desc KLMID stands for Location Key Method ID Data + * [Optional] Key is the clientKey that is used to authorize the method + * If not specified, this message will not have any authorizations + * [Optional] Location is the location of the target file that the method will execute upon + * If not specified, target file is the current file + * [Required] Method is one of the file commands available + * [Required] ID is the message ID, used when multiple messages are being sent and received + * [Optional] Data is a parameter for the method e.g. PUT will replace the target files data property + * + * An unincluded message part needs to be indicated by a whitespace, i.e. ' ' i.e. /u{0020}. + * This function is mainly called by a SPCs receive event that processes every message that a SPC + * receives + * @arg {String} msg - String conforming to the strapp protocol + * @return {Object} - Parsed object with keys corresponding to segments of strapp Protocol + */ +function parseSPM(msg) { + /* if no location, then call the method in LMKID on the local file, i.e. "." */ +}