{"_id":"o-gun-schema","_rev":"2-9159eb658629fce63d6bbe8e5cb79889","name":"o-gun-schema","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.1":{"name":"o-gun-schema","version":"0.1.1","description":"Validate GUN DB data with JSON-Schema","main":"o-gun-schema.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","bundle":"browserify index.js --standalone GunSchema > bundle.js"},"repository":{"type":"git","url":"git+https://github.com/RangerMauve/gun-schema.git"},"keywords":["gun","db","json","schema","model","graph"],"author":{"name":"rangermauve"},"license":"ISC","bugs":{"url":"https://github.com/RangerMauve/gun-schema/issues"},"homepage":"https://github.com/RangerMauve/gun-schema","devDependencies":{"browserify":"^11.2.0"},"peerDependencies":{"gun":"^0.2.x"},"dependencies":{"global":"^4.3.0","is-my-json-valid":"^2.12.2"},"browser":{"gun":false},"gitHead":"14d63cb809945b5ad48bacda883df9be02d7edb1","_id":"o-gun-schema@0.1.1","_npmVersion":"6.4.1","_nodeVersion":"8.14.0","_npmUser":{"name":"projectoblio","email":"satoshiquasimodo@gmail.com"},"dist":{"integrity":"sha512-FXSiI9unAT9+vydj8BUvuA/03aP87dzNvEEkzZPraTPCWZsJr+dn7EK86VbvJ/dno8r+d1t0IXTKRtW6/oMLwQ==","shasum":"b256893a7f08d7ff6339fbaf3852d409f5d84f69","tarball":"https://registry.npmjs.org/o-gun-schema/-/o-gun-schema-0.1.1.tgz","fileCount":5,"unpackedSize":6498,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcnX47CRA9TVsSAnZWagAAxDUP/ipIAx4U3jrr9nlhugxo\nHYjNehMrsH5sk0P9s7PeDOaZjTCMj0k4KHVDOW3TF+wxiSP7S9OEir/bFR1O\nEH+QMe98gYQbGR8DRWw7AqJPcKa8sIJEGuZ0Hlu9X5AKoiQWKsLpPgNRbfMv\nqUJ+Lthi0rGBfSPXnnLE9ju+IBOVtwAiVTSGBFO3l2wYgKbpp9W4CdwgQuKF\npcQKRdZ3ZfGeQfPeFI9ZAd25HRgInUp+C3ZVv2KIj+/KcQYv+dWqhdKDt2hO\nwxpy4fQcw70ns+mZyPQ01QAo0839UDzyHgNnQQlr38wIvOH6JhVahtAmWcHn\nkr1AmP/3pC4FK3k3Hk7cj3jRJmeRk7NE9bxN8s+WLSunK+6Z3QQkeJxRxaTI\n+aSuZK9u24cjYsE8giXgB10vydzkpoS9K4iFQZfe5DDQ/YLmgXuBdPNogZ2R\nTsaxQp84DkZjFOpW1cXi5FqqwYaOT9b9KZ0N441promZ9BVENOEwn1CgreP0\nKSC2LYCcjbju65b11MK3ZBBdwpJhos+TVKooxRu8VVTLFugbXeszZ+OV+A9d\nPR2Bsuhvv5yqwp4/y1vD11NDSdEr4FzJaM+hfU3w4MFcqzJd/ygsr5qzbERh\nmiybbqqqwII0DsFw8fjPxw+utb1X8ZXC101eu8di0YeJoM/bNe+2kf216eGP\nYlNJ\r\n=c0t4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDONVWEKmEbzzCSpdJ2hSSaVdJqhpAcO6Rp0Zqotfi5LgIhAMHw4qrEQQHFCJ51QMaEdwdAWEfpQL6sHQio1ZF8ggmc"}]},"maintainers":[{"name":"projectoblio","email":"satoshiquasimodo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-gun-schema_0.1.1_1553825338445_0.068696400418788"},"_hasShrinkwrap":false},"0.1.2":{"name":"o-gun-schema","version":"0.1.2","description":"Validate GUN DB data with JSON-Schema","main":"o-gun-schema.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","bundle":"browserify index.js --standalone GunSchema > bundle.js"},"repository":{"type":"git","url":"git+https://github.com/RangerMauve/gun-schema.git"},"keywords":["gun","db","json","schema","model","graph"],"author":{"name":"rangermauve"},"license":"ISC","bugs":{"url":"https://github.com/RangerMauve/gun-schema/issues"},"homepage":"https://github.com/RangerMauve/gun-schema","devDependencies":{"browserify":"^11.2.0"},"peerDependencies":{"gun":"^0.2.x"},"dependencies":{"global":"^4.3.0","is-my-json-valid":"^2.12.2"},"browser":{"gun":false},"gitHead":"09bcbb6a5390fef76533bd7078c79ccf43fcc313","_id":"o-gun-schema@0.1.2","_npmVersion":"6.4.1","_nodeVersion":"8.14.0","_npmUser":{"name":"projectoblio","email":"satoshiquasimodo@gmail.com"},"dist":{"integrity":"sha512-lUm+SXm4I3aCDWvhWH9ZjNhcJHiTrg74a5s0mzY7fRSqyXMN6Y+D3dJia8M+5L2o/1NmZiDSkDa2MYA0ZduPBA==","shasum":"d4835ecb7a6caa0f1490c16b3ee27d19dbe04216","tarball":"https://registry.npmjs.org/o-gun-schema/-/o-gun-schema-0.1.2.tgz","fileCount":5,"unpackedSize":6500,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcnX5wCRA9TVsSAnZWagAA+A0P/jEHmkLVL4VMlqyxpwl7\ni8Jkbb4d/CnNSQUJLMxYRhhhkXlk82RCLVgfnBgYFFD6o+b1+l2mnNftp/zU\nt9thpL88h8iSqbHPPMnNWGLFqzuSVKC4OTY1Bu2NKJjaFAnAGY/ELaAaq9BY\n0EJbEmhuuFoj6QO6tzwcqOcjSGXP8HFz5WtUTR3BS3g9wXLSXtxH41PtyS9P\nRQ34U46DdDgRo2I5zc3lwUHydOgqxFYx8+l0azd2VbRxZ9haEHewGtI/r4tQ\nuplfj/O6Q+b8akOFaCIKZYrcyZWPMXciJ76p9Z8bsHIwyeCVXp0/h8mxDe+x\n9B5nffhHiA6kdIH4vvQDnI2h/Kz1T+rxVcGAem3PqjwtaDwfZU5gjnh10ecv\nCDPDyK7b9vxU/hcV+gt0W/lXa3Hm+gZRFuiYXxiZmSH4LSybOToYcrk7RglW\nZ/mTRAZakuL1eQwW4TyCqWB3M9CPbP5wiGS8esr5VvQCqxVDbhHzFUXI0xFU\nLnImJY99tC6T7Poh+h+25QaFjI5LQI3x2fU5fjFlrCodNBYky2LwRxlaeMxs\nkc69sH4uvR3e74ORKxQbymbBQJ6VbIz+A7NnafMLW5UBJCTQT/M9l+4f2ztq\nwQQH+neJjyDAsYrB/aZZjAUKJraboFwygvY8WwbglFe/VpjSoVbOgqoDfKNI\ne0Zk\r\n=tqlY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCHwD6z/bcaL22Zhh0ocyYu41O6T8xFElI5xjAOGA1MmgCIQCsmMtDu5LwQTcaOpJRcWLOLubP52jG+F3oh5R6du4oYQ=="}]},"maintainers":[{"name":"projectoblio","email":"satoshiquasimodo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-gun-schema_0.1.2_1553825391945_0.8755054874759911"},"_hasShrinkwrap":false}},"time":{"created":"2019-03-29T02:08:58.264Z","0.1.1":"2019-03-29T02:08:58.584Z","modified":"2022-05-12T00:02:04.031Z","0.1.2":"2019-03-29T02:09:52.116Z"},"maintainers":[{"name":"projectoblio","email":"satoshiquasimodo@gmail.com"}],"description":"Validate GUN DB data with JSON-Schema","homepage":"https://github.com/RangerMauve/gun-schema","keywords":["gun","db","json","schema","model","graph"],"repository":{"type":"git","url":"git+https://github.com/RangerMauve/gun-schema.git"},"author":{"name":"rangermauve"},"bugs":{"url":"https://github.com/RangerMauve/gun-schema/issues"},"license":"ISC","readme":"# gun-schema\nValidate [Gun](http://gun.js.org/) data with JSON-Schema.\n\nValidation is done by [is-my-json-valid](https://github.com/mafintosh/is-my-json-valid)\n\n## Getting started\n### Browser\nDownload the js bundle from the [releases page](https://github.com/gundb/gun-schema/releases) and add it to the page. As well as attaching the required methods to Gun, it will create a GunSchema global.\n\n### Server\nInstall from NPM\n\n```bash\nnpm install --save o-gun-schema\n```\n\nRequire the module to have it attach itself to GUN\n\n```JavaScript\nvar Gun = require(\"gun\");\nrequire(\"o-gun-schema\");\n```\n\n### Example\n\n```JavaScript\n// Get a reference to your schema from wherever\n// This one was taken from the is-my-json-valid page\nvar schema = {\n    required: true,\n    type: 'object',\n    properties: {\n        hello: {\n            required: true,\n            type: 'string'\n        }\n    }\n};\n\nvar gun = Gun();\n\ngun.schema.add(\"example\", schema);\n\n// This is valid so it'll get put into the graph\ngun.schema.put(\"example\", {\n    hello: \"World!\"\n});\n\n// This will throw an error because `hello` was set as `required`\ngun.schema.put(\"example\", {\n    goodbye: \"World!\"\n});\n```\n\n## API\nAfter the plugin has been properly initialized, it adds the following methods on gun instances\n\n### `gun.schema.add(name, schema, options)`\nAdds a new type that will be recognized by `gun.save()`\n- `name` : The unique name for this type of node\n- `schema` : The JSON Schema definition to use for validating this type\n- `options` : Optional argument which gets passed down to [is-my-json-valid](https://github.com/mafintosh/is-my-json-valid)\n\n### `gun.schema.put(name, value)`\nSimilar to `gun.put()`, but uses the schema associated with `name` to ensure that `value` is valid. __This is different syntax from the original gun-schema__.\n- `name` : The name of the schema that `value` should match\n- `value` : The value that should be validated before being `put()` into the DB.\n\nIf `name` does not point to a schema name that has been registered, then an error will be thrown. If `value` doesn't validate against the schema, then an error will be thrown with a `errors` property which contains the list of things that are wrong with `value`.\n\n### `gun.schema.set(name, value)`\nSimilar to `gun.set()`, but uses the schema associated with `name` to ensure that `value` is valid. The above applies.\n\n### `gun.schema.addMany(map, options)`\nAdds a bunch of schemas in one go.\n- `map` : A map of `name`-`schema` pairs that get passed on to `gun.schema()`\n- `options` : Optional argument which gets passed down to `gun.schema()` to configure [is-my-json-valid](https://github.com/mafintosh/is-my-json-valid)\n\n### `gun.schema.getSchemas()`\ngets all your active schemas\n\n### `GunSchema(gun)`\nThis is what gets exported by the module in CommonJS and what is added as the `GunSchema` global in the bundle. It takes a gun instance and adds schema functionality to it.\n- `gun` The gun instance to attach to. Not, this isn't the `Gun` constructor, but an actual instance or `Gun.chain`.\n\n\n","readmeFilename":"README.md"}