livesqrd-sdk
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -8,3 +8,4 @@ var _ = require('underscore') | ||
this.token = token; | ||
this.options = _.defaults(options,{"apiVersion":"v1"}); | ||
this.options = _.isObject(options) ? options : {}; | ||
this.options = _.defaults(this.options,{"apiVersion":"v1"}); | ||
return this; | ||
@@ -61,3 +62,3 @@ } | ||
data.key = collection; | ||
this.apiCall("read",data,callback) | ||
this.apiCall("read",data,options,callback) | ||
@@ -92,3 +93,3 @@ } | ||
data.key = collection; | ||
this.apiCall("update",data,callback) | ||
this.apiCall("update",data,options,callback) | ||
@@ -122,3 +123,3 @@ } | ||
data.key = collection; | ||
this.apiCall("delete",data,callback) | ||
this.apiCall("delete",data,options,callback) | ||
@@ -153,7 +154,13 @@ } | ||
op.method = "POST"; | ||
op.path = "/api/"+self.apiVersion+"/"+data.key; | ||
op.path = "/api/"+self.options.apiVersion+"/"+data.key; | ||
body = _.extend(body,options); | ||
body.model = _.isObject(data.model) ? data.model : {}; | ||
body.query = _.isObject(data.query) ? data.query : {}; | ||
if(_.isString(data.id)) | ||
body.id = data.id; | ||
if(_.isString(data.id)) | ||
body.id = data.id; | ||
if(_.has(this.options,"user")&&_.has(this.options,"pass")) | ||
op.auth = this.options.user +":"+this.options.pass; | ||
switch(method){ | ||
@@ -181,4 +188,6 @@ case "create": | ||
} | ||
var d = new Buffer(JSON.stringify({data:body})); | ||
op.headers ={'Content-Length': d.length,'Content-Type': 'application/json'}; | ||
req = https.request(op, function(res) { | ||
@@ -190,3 +199,3 @@ res.setEncoding('utf8'); | ||
res.on("end",function(){ | ||
callback(error,result); | ||
callback(error,JSON.parse(result)); | ||
}) | ||
@@ -193,0 +202,0 @@ }); |
{ | ||
"name": "livesqrd-sdk", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Live Sqrd Node sdk", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"readmeFilename": "Readme.md", | ||
"readme": "# Live Sqrd SDK - lsq.io\n\n\n### Allows you to use your api\n===\n\nstart with setup with a require and your domain with the token\n\n```javascript\n\nvar LSQ = require(\"./lib\")\n ,lsq= new LSQ(\"your-url.lsq.io\",\"yourToken\");\n\n```\n\n#### then you can do \n* Create\n* Read\n* Update\n* Delete\n\nJust specify the collection your calling then the data your passing\n\n### Create\n\n```javascript\nlsq.create(collection,model,options,function(err,result){\n console.log(err,result)\n})\n```\n\n### Read\n\n```javascript\nlsq.read(collection,query,options,function(err,result){\n console.log(err,result)\n})\n```\n### Update\n\n```javascript\nlsq.update(collection,query,options,model,function(err,result){\n console.log(err,result)\n})\n```\n\n### Delete\n\n```javascript\nlsq.delete(collection,query,options,function(err,result){\n console.log(err,result)\n})\n```\n\n---\n\n#### The collection is the data collection name (string) :\n* [item](#item)\n* [instance](#instance)\n* [client](#client)\n* [profile](#profile)\n* [grid](#grid)\n* [blob](#blob)\n* [loader](#loader)\n* [level](#level)\n* [role](#role)\n* [event](#event)\n* [report](#report)\n\n\n#### Model is the data that will become the data object (object):\nData that will be saved or updated\nThe data being updated can be saved with deep model meaning if you have an object \n```javascript\n{ name : {\n first :\"john\"\n ,last :\"smith\"\n }\n}\n```\nyou can update just the first name with :\n```javascript\n{ \"name.first\":\"jane\"}\n```\n\n\nor with arrays you can :\n```javascript\n{ toys : [\"car\",\"truck\",\"drums\"] }\n```\nyou can update just truck with :\n```javascript\n{ \"toys.1\":\"bus\"}\n```\nwhere 1 is the index\n\n#### Query is the search lookup using normal mongodb queries (object):\n[Mongo Basic Queries](http://docs.mongodb.org/manual/core/read)\n[Mongo Adv Queries](http://docs.mongodb.org/manual/reference/operator/)\njust {} will return all and with the addition of just \n```javascript\n{ _id : \"\"}\n```\n\n#### Options (object) [optional]:\n\n* skip (int)\n* limit (int)\n* sort (object)\n\nSchemas\n========================\n## Instance\n* Short life span, public user client identification information\n* Created and destroyed with Socket.io events\n* Output\n\n```json\n {\n \"touch\": false,\n \"date\": \"2013-07-12T20:11:13.598Z\",\n \"os\": \"Mac OS X\",\n \"osVersion\": \"10.8.4\",\n \"browser\": \"Chrome\",\n \"version\": \"27.0.1453.116\",\n \"device\": \"Desktop\",\n \"deviceType\": \"pc\",\n \"client\": \"51def86fe7ae632a2b0000b8\",\n \"profile\": \"41aef86fa4ae62fa2b0000a8\",\n \"page\": \"projects\",\n \"_id\": \"51e062e1178e53e46500000e\", \n \"height\": 1079,\n \"width\": 1049\n }\n```\n* Save custom terms, etc, in the states ObjectId\n\n```json\n \"states\": {\n \"type\": \"Schema.Types.Mixed\" \n }\n```\n* Ex: save number of clicks user makes, and number of no results are served\n\n```json\n \"states\": {\n \"click_counter\": 1,\n \"noresults\": 11\n }\n```\n\n##Client\n\n* Session based storage and identification, used for user login, credentials, and other pertaining parameters\n* Session based entails anonymous and profile attached logins. Unlike [Instances](#instance) they have a long life span: 30 days (subject to change)\n\n* Output\n\n```json\n { \n \"_id\": \"51e06df7a3cd97400c000001\",\n \"a\": \"uebkjvhg9uwdBBdBflJ1zvej\",\n \"date\": \"2013-07-12T20:58:31.585Z\",\n \"email\": \"user@example.com\",\n \"gender\": \"m\",\n \"page\": \"login\",\n \"path\": \"uebkjvhg9uwdbbdbflj1zvej\",\n \"profile\": \"41aef86fa4ae62fa2b0000a8\",\n \"photo\": \"\",\n \"states\": {},\n \"timezone\": 0,\n \"event\": [],\n \"ver\": false,\n \"lang\": \"en\",\n \"v\": [],\n \"login\": [],\n \"ip\": [\n \"165.254.85.1\"\n ]\n }\n```\n* ver is for verification of a user via email: boolean\n* a is the session token: auto generated string\n* login is the array of oAuth credentials and there tokens for later access: can be multiple, e.g., Facebook, twitter, Linkedin, etc. \n* Save custom terms, etc, in the states Object\n\n```json\n \"states\": {\n \"type\": \"Schema.Types.Mixed\" \n }\n```\n* Ex: save number of pages user goes to, and number of errors are served\n\n```json\n \"states\": {\n \"page_counter\":1,\n \"errors\":11\n }\n```\n\n##Profile\n*Used for user profiles, levels (groups, collaborations, companies, teams)\n\n\n```json\n {\n \"states\": {\n \"type\": \"Schema.Types.Mixed\",\n \"hidden\": true\n },\n \"body\": {\n \"type\": \"Schema.Types.Mixed\",\n \"hidden\": true\n },\n \"title\": {\n \"type\": \"String\",\n \"required\": true\n },\n \"path\": {\n \"type\": \"String\",\n \"required\": true,\n \"unique\":true\n },\n \"photo\": {\n \"type\": \"String\"\n },\n \"gender\": {\n \"type\": \"String\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"info\": {\n \"type\": \"String\",\n \"editor\": true\n },\n \"email\": {\n \"type\": \"String\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"group\": {\n \"type\": \"String\",\n \"default\": \"\",\n \"lowercase\": true,\n \"trim\": true\n },\n\n \"lang\": {\n \"type\": \"String\"\n },\n \"link\":{\"type\": \"Schema.Types.Mixed\"},\n \"contact\":{\"type\": \"Schema.Types.Mixed\"},\n \"birthday\": {\n \"type\": \"Date\"\n },\n \"timezone\":{\n \"type\":\"Number\"\n },\n \"profile\": [\n {\n \"id\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"profile\"\n },\n \"title\": {\n \"type\": \"String\"\n },\n \"start\": {\n \"type\": \"Date\"\n },\n \"end\": {\n \"type\": \"Date\"\n }\n }\n ]\n }\n\n \n```\n* Example Usage\n\n```json\n {\n \"__v\": 0,\n \"_id\": \"51cf7a5894831db810000009\",\n \"email\": \"user@example.com\",\n \"gender\": \"m\",\n \"lang\": \"en\",\n \"link\": {\n \"facebook\": \"https://www.facebook.com/zuck\",\n \"twitter\": \"https://www.twitter.com/mark\",\n \"linkedin\": \"http://www.linkedin.com/pub/mark-zuckerberg/46/895/358\"\n },\n \"path\": \"yj5iluktq5rlhgqcgvdaxdrq\",\n \"photo\": \"\",\n \"timezone\": -4,\n \"title\": \"First Last\",\n \"profile\": [],\n \"group\": \"client\",\n \"body\":{\n \"firstname\": \"Mark\",\n \"lastname\": \"Zuckerberg\"\n }\n \"states\":{\n \"rating\": 20\n }\n }\n \n```\n\n##Role\n* Use to define rights, such as create, delete, update, read, add, remove, edit, destroy, master etc. \n* CRUD (Create Read Update Delete): for the current item.\n* The defined role permission set is applied to different Objects such as [Levels](#level), [Loaders](#loader), [Items](#item)\n\n\n\n\n```json\n \"role\": {\n \"states\": {\n \"type\": \"Schema.Types.Mixed\"\n },\n \"path\": {\n \"type\": \"String\",\n \"required\": true,\n \"lowercase\": true,\n \"trim\": true,\n \"unique\": true\n },\n \"title\": {\n \"type\": \"String\",\n \"required\": true\n },\n \"create\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"delete\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"update\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"read\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"add\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"remove\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"edit\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"destroy\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"master\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"custom\": {\n \"type\": \"Schema.Types.Mixed\"\n }\n }\n```\n* Example role: owner with all permissions, master.\n\n```json \n {\n \"data\":{\n \"token\":\"123456\",\n \"model\": {\n \"title\":\"owner\",\n \"path\":\"owner\",\n \"master\": 1\n },\n \"query\":{},\n \"request\":\"create\"\n }\n }\n```\n\n* Example role: private, default role, by not defining a permission, the default rights are 0, none. \n\n```json \n {\n \"data\":{\n \"token\":\"123456\",\n \"model\": {\n \"title\":\"private\",\n \"path\":\"private\" \n },\n \"query\":{},\n \"request\":\"create\"\n }\n }\n```\n\n* Example role: public, default role, default state for read only.\n\n```json \n {\n \"data\":{\n \"token\":\"123456\",\n \"model\": {\n \"title\":\"public\",\n \"path\":\"public\",\n \"read\": 1 \n },\n \"query\":{},\n \"request\":\"create\"\n }\n }\n```\n\n##Loader\n* Used for projects\n\n\n```json\n \"loader\": {\n \"states\": {\n \"type\": \"Schema.Types.Mixed\",\n \"hidden\": true\n },\n \"path\": {\n \"type\": \"String\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"title\": {\n \"type\": \"String\",\n \"required\": true\n },\n \"photo\": {\n \"type\": \"String\"\n },\n \"level\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"level\",\n \"required\": true\n },\n \"publish\": {\n \"type\": \"Boolean\",\n \"default\": true\n },\n \"date\": {\n \"type\": \"Date\",\n \"required\": true\n },\n \"body\":{\n \"type\": \"Schema.Types.Mixed\"\n },\n \"module\": [{\n \"item\":{\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"item\"\n }\n ,\"extra\":{\n \"type\": \"Schema.Types.Mixed\"\n }\n ,\"group\":{\n \"type\": \"String\"\n }\n }],\n \"time\": {\n \"now\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"jump\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"nextTime\": {\n \"type\": \"Number\",\n \"default\": 1\n },\n \"gotoTime\": {\n \"type\": \"Number\",\n \"default\": -2\n },\n \"cutTime\": [\n {\n \"time\": {\n \"type\": \"Number\"\n },\n \"duration\": {\n \"type\": \"Number\"\n }\n }\n ],\n \"tags\":{\"type\":\"[String]\"}\n },\n \"loader\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"loader\"\n },\n \"role\": {\n \"type\": \"Schema.Types.ObjectId\"\n },\n \"group\": {\n \"type\": \"String\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"permisson\": [\n {\n \"id\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"profile\"\n },\n \"role\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"role\"\n }\n }\n ]\n }\n \n```\n##Item\n```json\n\n \"item\": {\n \"states\": {\n \"type\": \"Schema.Types.Mixed\",\n \"hidden\": true\n },\n \"path\": {\n \"type\": \"String\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"title\": {\n \"type\": \"String\",\n \"default\": \"\"\n },\n \"photo\": {\n \"type\": \"String\"\n },\n \"body\": {\n \"type\": \"Schema.Types.Mixed\"\n },\n \"group\": {\n \"type\": \"String\",\n \"default\": \"\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"x\": {\n \"type\": \"Number\"\n },\n \"y\": {\n \"type\": \"Number\"\n },\n \"z\": {\n \"type\": \"Number\"\n },\n \"width\": {\n \"type\": \"Number\"\n },\n \"height\": {\n \"type\": \"Number\"\n },\n \"color\": {\n \"type\": \"String\"\n },\n \"role\":{\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"role\"\n },\n \"permisson\": [\n {\n \"id\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"profile\"\n },\n \"role\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"role\"\n }\n }\n ],\n \"item\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"item\"\n },\n \"lock\": {\n \"type\": \"Schema.Types.Mixed\"\n },\n \"date\": {\n \"type\": \"Date\"\n },\n \"geo\": { \n \"type\": \"[Number]\", \n \"index\": \"2dsphere\",\n \"sparse\": true \n },\n \"box\":{\n \"type\": \"[Number]\", \n \"index\": \"2d\",\n \"sparse\": true \n },\n \"due\": {\n \"date\": {\n \"type\": \"Date\"\n },\n \"period\": {\n \"type\": \"Number\"\n },\n \"freq\": {\n \"type\": \"Number\"\n }\n },\n \"tags\":{\"type\":\"[String]\"}\n }\n```\n\n\n\n\n" | ||
"readme": "# Live Sqrd SDK - lsq.io\n\n\n### Allows you to use your api\n===\n\nstart with setup with a require and your domain with the token\n\n```javascript\n\nvar LSQ = require(\"./lib\")\n ,lsq= new LSQ(\"your-url.lsq.io\",\"yourToken\");\n\n```\n\n#### then you can do \n* Create\n* Read\n* Update\n* Delete\n\nJust specify the collection your calling then the data your passing\n\n### Create\n\n```javascript\nlsq.create(collection,model,options,function(err,result,total,response){\n console.log(err,result)\n})\n```\n\n### Read\n\n```javascript\nlsq.read(collection,query,options,function(err,result,total,response){\n console.log(err,result)\n})\n```\n### Update\n\n```javascript\nlsq.update(collection,query,options,model,function(err,result,total,response){\n console.log(err,result)\n})\n```\n\n### Delete\n\n```javascript\nlsq.delete(collection,query,options,function(err,result,total,response){\n console.log(err,result)\n})\n```\n\n---\n\n#### The collection is the data collection name (string) :\n* [item](#item)\n* [instance](#instance)\n* [client](#client)\n* [profile](#profile)\n* [grid](#grid)\n* [blob](#blob)\n* [loader](#loader)\n* [level](#level)\n* [role](#role)\n* [event](#event)\n* [report](#report)\n\n\n#### Model is the data that will become the data object (object):\nData that will be saved or updated\nThe data being updated can be saved with deep model meaning if you have an object \n```javascript\n{ name : {\n first :\"john\"\n ,last :\"smith\"\n }\n}\n```\nyou can update just the first name with :\n```javascript\n{ \"name.first\":\"jane\"}\n```\n\n\nor with arrays you can :\n```javascript\n{ toys : [\"car\",\"truck\",\"drums\"] }\n```\nyou can update just truck with :\n```javascript\n{ \"toys.1\":\"bus\"}\n```\nwhere 1 is the index\n\n#### Query is the search lookup using normal mongodb queries (object):\n[Mongo Basic Queries](http://docs.mongodb.org/manual/core/read)\n[Mongo Adv Queries](http://docs.mongodb.org/manual/reference/operator/)\njust {} will return all and with the addition of just \n```javascript\n{ _id : \"\"}\n```\n\n#### Options (object) [optional]:\n\n* skip (int)\n* limit (int)\n* sort (object)\n\nSchemas\n========================\n## Instance\n* Short life span, public user client identification information\n* Created and destroyed with Socket.io events\n* Output\n\n```json\n {\n \"touch\": false,\n \"date\": \"2013-07-12T20:11:13.598Z\",\n \"os\": \"Mac OS X\",\n \"osVersion\": \"10.8.4\",\n \"browser\": \"Chrome\",\n \"version\": \"27.0.1453.116\",\n \"device\": \"Desktop\",\n \"deviceType\": \"pc\",\n \"client\": \"51def86fe7ae632a2b0000b8\",\n \"profile\": \"41aef86fa4ae62fa2b0000a8\",\n \"page\": \"projects\",\n \"_id\": \"51e062e1178e53e46500000e\", \n \"height\": 1079,\n \"width\": 1049\n }\n```\n* Save custom terms, etc, in the states ObjectId\n\n```json\n \"states\": {\n \"type\": \"Schema.Types.Mixed\" \n }\n```\n* Ex: save number of clicks user makes, and number of no results are served\n\n```json\n \"states\": {\n \"click_counter\": 1,\n \"noresults\": 11\n }\n```\n\n##Client\n\n* Session based storage and identification, used for user login, credentials, and other pertaining parameters\n* Session based entails anonymous and profile attached logins. Unlike [Instances](#instance) they have a long life span: 30 days (subject to change)\n\n* Output\n\n```json\n { \n \"_id\": \"51e06df7a3cd97400c000001\",\n \"a\": \"uebkjvhg9uwdBBdBflJ1zvej\",\n \"date\": \"2013-07-12T20:58:31.585Z\",\n \"email\": \"user@example.com\",\n \"gender\": \"m\",\n \"page\": \"login\",\n \"path\": \"uebkjvhg9uwdbbdbflj1zvej\",\n \"profile\": \"41aef86fa4ae62fa2b0000a8\",\n \"photo\": \"\",\n \"states\": {},\n \"timezone\": 0,\n \"event\": [],\n \"ver\": false,\n \"lang\": \"en\",\n \"v\": [],\n \"login\": [],\n \"ip\": [\n \"165.254.85.1\"\n ]\n }\n```\n* ver is for verification of a user via email: boolean\n* a is the session token: auto generated string\n* login is the array of oAuth credentials and there tokens for later access: can be multiple, e.g., Facebook, twitter, Linkedin, etc. \n* Save custom terms, etc, in the states Object\n\n```json\n \"states\": {\n \"type\": \"Schema.Types.Mixed\" \n }\n```\n* Ex: save number of pages user goes to, and number of errors are served\n\n```json\n \"states\": {\n \"page_counter\":1,\n \"errors\":11\n }\n```\n\n##Profile\n*Used for user profiles, levels (groups, collaborations, companies, teams)\n\n\n```json\n {\n \"states\": {\n \"type\": \"Schema.Types.Mixed\",\n \"hidden\": true\n },\n \"body\": {\n \"type\": \"Schema.Types.Mixed\",\n \"hidden\": true\n },\n \"title\": {\n \"type\": \"String\",\n \"required\": true\n },\n \"path\": {\n \"type\": \"String\",\n \"required\": true,\n \"unique\":true\n },\n \"photo\": {\n \"type\": \"String\"\n },\n \"gender\": {\n \"type\": \"String\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"info\": {\n \"type\": \"String\",\n \"editor\": true\n },\n \"email\": {\n \"type\": \"String\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"group\": {\n \"type\": \"String\",\n \"default\": \"\",\n \"lowercase\": true,\n \"trim\": true\n },\n\n \"lang\": {\n \"type\": \"String\"\n },\n \"link\":{\"type\": \"Schema.Types.Mixed\"},\n \"contact\":{\"type\": \"Schema.Types.Mixed\"},\n \"birthday\": {\n \"type\": \"Date\"\n },\n \"timezone\":{\n \"type\":\"Number\"\n },\n \"profile\": [\n {\n \"id\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"profile\"\n },\n \"title\": {\n \"type\": \"String\"\n },\n \"start\": {\n \"type\": \"Date\"\n },\n \"end\": {\n \"type\": \"Date\"\n }\n }\n ]\n }\n\n \n```\n* Example Usage\n\n```json\n {\n \"__v\": 0,\n \"_id\": \"51cf7a5894831db810000009\",\n \"email\": \"user@example.com\",\n \"gender\": \"m\",\n \"lang\": \"en\",\n \"link\": {\n \"facebook\": \"https://www.facebook.com/zuck\",\n \"twitter\": \"https://www.twitter.com/mark\",\n \"linkedin\": \"http://www.linkedin.com/pub/mark-zuckerberg/46/895/358\"\n },\n \"path\": \"yj5iluktq5rlhgqcgvdaxdrq\",\n \"photo\": \"\",\n \"timezone\": -4,\n \"title\": \"First Last\",\n \"profile\": [],\n \"group\": \"client\",\n \"body\":{\n \"firstname\": \"Mark\",\n \"lastname\": \"Zuckerberg\"\n }\n \"states\":{\n \"rating\": 20\n }\n }\n \n```\n\n##Role\n* Use to define rights, such as create, delete, update, read, add, remove, edit, destroy, master etc. \n* CRUD (Create Read Update Delete): for the current item.\n* The defined role permission set is applied to different Objects such as [Levels](#level), [Loaders](#loader), [Items](#item)\n\n\n\n\n```json\n \"role\": {\n \"states\": {\n \"type\": \"Schema.Types.Mixed\"\n },\n \"path\": {\n \"type\": \"String\",\n \"required\": true,\n \"lowercase\": true,\n \"trim\": true,\n \"unique\": true\n },\n \"title\": {\n \"type\": \"String\",\n \"required\": true\n },\n \"create\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"delete\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"update\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"read\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"add\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"remove\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"edit\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"destroy\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"master\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"custom\": {\n \"type\": \"Schema.Types.Mixed\"\n }\n }\n```\n* Example role: owner with all permissions, master.\n\n```json \n {\n \"data\":{\n \"token\":\"123456\",\n \"model\": {\n \"title\":\"owner\",\n \"path\":\"owner\",\n \"master\": 1\n },\n \"query\":{},\n \"request\":\"create\"\n }\n }\n```\n\n* Example role: private, default role, by not defining a permission, the default rights are 0, none. \n\n```json \n {\n \"data\":{\n \"token\":\"123456\",\n \"model\": {\n \"title\":\"private\",\n \"path\":\"private\" \n },\n \"query\":{},\n \"request\":\"create\"\n }\n }\n```\n\n* Example role: public, default role, default state for read only.\n\n```json \n {\n \"data\":{\n \"token\":\"123456\",\n \"model\": {\n \"title\":\"public\",\n \"path\":\"public\",\n \"read\": 1 \n },\n \"query\":{},\n \"request\":\"create\"\n }\n }\n```\n\n##Loader\n* Used for projects\n\n\n```json\n \"loader\": {\n \"states\": {\n \"type\": \"Schema.Types.Mixed\",\n \"hidden\": true\n },\n \"path\": {\n \"type\": \"String\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"title\": {\n \"type\": \"String\",\n \"required\": true\n },\n \"photo\": {\n \"type\": \"String\"\n },\n \"level\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"level\",\n \"required\": true\n },\n \"publish\": {\n \"type\": \"Boolean\",\n \"default\": true\n },\n \"date\": {\n \"type\": \"Date\",\n \"required\": true\n },\n \"body\":{\n \"type\": \"Schema.Types.Mixed\"\n },\n \"module\": [{\n \"item\":{\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"item\"\n }\n ,\"extra\":{\n \"type\": \"Schema.Types.Mixed\"\n }\n ,\"group\":{\n \"type\": \"String\"\n }\n }],\n \"time\": {\n \"now\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"jump\": {\n \"type\": \"Number\",\n \"default\": 0\n },\n \"nextTime\": {\n \"type\": \"Number\",\n \"default\": 1\n },\n \"gotoTime\": {\n \"type\": \"Number\",\n \"default\": -2\n },\n \"cutTime\": [\n {\n \"time\": {\n \"type\": \"Number\"\n },\n \"duration\": {\n \"type\": \"Number\"\n }\n }\n ],\n \"tags\":{\"type\":\"[String]\"}\n },\n \"loader\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"loader\"\n },\n \"role\": {\n \"type\": \"Schema.Types.ObjectId\"\n },\n \"group\": {\n \"type\": \"String\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"permisson\": [\n {\n \"id\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"profile\"\n },\n \"role\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"role\"\n }\n }\n ]\n }\n \n```\n##Item\n```json\n\n \"item\": {\n \"states\": {\n \"type\": \"Schema.Types.Mixed\",\n \"hidden\": true\n },\n \"path\": {\n \"type\": \"String\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"title\": {\n \"type\": \"String\",\n \"default\": \"\"\n },\n \"photo\": {\n \"type\": \"String\"\n },\n \"body\": {\n \"type\": \"Schema.Types.Mixed\"\n },\n \"group\": {\n \"type\": \"String\",\n \"default\": \"\",\n \"lowercase\": true,\n \"trim\": true\n },\n \"x\": {\n \"type\": \"Number\"\n },\n \"y\": {\n \"type\": \"Number\"\n },\n \"z\": {\n \"type\": \"Number\"\n },\n \"width\": {\n \"type\": \"Number\"\n },\n \"height\": {\n \"type\": \"Number\"\n },\n \"color\": {\n \"type\": \"String\"\n },\n \"role\":{\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"role\"\n },\n \"permisson\": [\n {\n \"id\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"profile\"\n },\n \"role\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"role\"\n }\n }\n ],\n \"item\": {\n \"type\": \"Schema.Types.ObjectId\",\n \"ref\": \"item\"\n },\n \"lock\": {\n \"type\": \"Schema.Types.Mixed\"\n },\n \"date\": {\n \"type\": \"Date\"\n },\n \"geo\": { \n \"type\": \"[Number]\", \n \"index\": \"2dsphere\",\n \"sparse\": true \n },\n \"box\":{\n \"type\": \"[Number]\", \n \"index\": \"2d\",\n \"sparse\": true \n },\n \"due\": {\n \"date\": {\n \"type\": \"Date\"\n },\n \"period\": {\n \"type\": \"Number\"\n },\n \"freq\": {\n \"type\": \"Number\"\n }\n },\n \"tags\":{\"type\":\"[String]\"}\n }\n```\n\n\n\n\n" | ||
} |
@@ -0,1 +1,3 @@ | ||
[<-](https://github.com/LiveSqrd/docs#some-usefull-resources) | ||
# LiveSqrd SDK - lsq.io | ||
@@ -633,3 +635,3 @@ | ||
[<-](https://github.com/LiveSqrd/docs#some-usefull-resources) | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31225
208
637