diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..f59f9b2 Binary files /dev/null and b/.DS_Store differ diff --git a/README.md b/README.md index 24bef4b..a1f7d4b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,146 @@ iron_cache_node -=============== \ No newline at end of file +=============== + + +Node.js Implementation of IronCache + +Please follow the steps on this link to setup nodejs. + +https://docs.npmjs.com/downloading-and-installing-node-js-and-npm/ + + +Usage + +To utilize the IronCache API with this Node.js module, follow these steps: + +Create an Iron project. +In your dashboard, click the credentials link (the key icon) to find your Project ID and Token. These credentials are necessary for API usage. +Initialize the module using your Project ID and Token. +Specify environment variables to your application (IRON_CACHE_PROJECT and IRON_CACHE_TOKEN). + + + +API Reference +APIClient(options) +Constructor for creating an instance of the APIClient. It requires the following options: + +project_id: Your Iron Cache project ID. +token: Your Iron Cache authentication token. +api_version: (Optional) The version of the Iron Cache API to use. Defaults to 1. + +``` +export IRON_PROJECT_ID=xxx + + +export IRON_TOKEN=yyy +``` + + +Example: List all caches + +``` +client.cachesList({}, (error, response) => { + if (error) { + console.error('Error:', error); + } else { + console.log('Caches:', response); + } +}); +``` + + Example: Get information about a specific cache + ``` +const cacheName = 'example_cache'; +client.getCache(cacheName, {}, (error, response) => { + if (error) { + console.error('Error:', error); + } else { + console.log('Cache Info:', response); + } +}); +``` + +Delete a specific cache identified by cache_name. This operation permanently removes the cache and all its associated items. +``` +client.deleteCache('example_cache', {}, (error, response) => { + if (error) { + console.error('Error:', error); + } else { + console.log('Cache deleted:', response); + } +}); +``` + +Clear all items in a specific cache identified by cache_name. The cache structure remains intact, but all stored items are removed. +``` +client.clearCache('example_cache', {}, (error, response) => { + if (error) { + console.error('Error:', error); + } else { + console.log('Cache cleared:', response); + } +}); +``` + +Put an item into a specific cache identified by cache_name. The key parameter represents the unique identifier for the item. + +``` +const key = 'example_key'; +const value = 'example_value'; + +client.putItem(key, 'example_cache', { value }, (error, response) => { + if (error) { + console.error('Error:', error); + } else { + console.log('Item added:', response); + } +}); +``` +Increment the value of a numeric item in a specific cache. This is useful for managing counters or other numeric data. + + +``` +const key = 'example_key'; + +client.IncrementItem(key, 'example_cache', {}, (error, response) => { + if (error) { + console.error('Error:', error); + } else { + console.log('Item incremented:', response); + } +}); +``` + +Get information about a specific item identified by key in a cache identified by cache_name. + +``` +const key = 'example_key'; + +client.getItem(key, 'example_cache', {}, (error, response) => { + if (error) { + console.error('Error:', error); + } else { + console.log('Item information:', response); + } +}); +``` + +Delete a specific item identified by key from a cache identified by cache_name. + +``` +const key = 'example_key'; + +client.deleteItem(key, 'example_cache', {}, (error, response) => { + if (error) { + console.error('Error:', error); + } else { + console.log('Item deleted:', response); + } +}); +``` + + + + + + diff --git a/lib/api_client.js b/lib/api_client.js new file mode 100644 index 0000000..0cb0135 --- /dev/null +++ b/lib/api_client.js @@ -0,0 +1,116 @@ +// Generated by CoffeeScript 1.12.7 +(function() { + var APIClient, _, ironCore, version, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + require('pkginfo')(module); + + version = this.version; + + _ = require('underscore'); + + ironCore = require('iron_core'); + + APIClient = (function(superClass) { + extend(APIClient, superClass); + + APIClient.prototype.AWS_US_EAST_HOST = 'cache-aws-us-east-1.iron.io'; + + function APIClient(options) { + var defaultOptions; + defaultOptions = { + scheme: 'https', + host: this.AWS_US_EAST_HOST, + port: 443, + api_version: 1, + user_agent: this.version() + }; + APIClient.__super__.constructor.call(this, 'iron', 'cache', options, defaultOptions, ['project_id', 'token', 'api_version']); + } + + APIClient.prototype.version = function() { + return "iron_cache_node-" + version + " (" + (APIClient.__super__.version.call(this)) + ")"; + }; + + APIClient.prototype.url = function() { + return APIClient.__super__.url.call(this) + this.options.api_version.toString() + ("/projects/" + this.options.project_id + "/caches"); + }; + + APIClient.prototype.headers = function() { + return _.extend({}, APIClient.__super__.headers.call(this), { + 'Authorization': "OAuth " + this.options.token + }); + }; + + APIClient.prototype.cachesList = function(options, cb) { + var parseResponseBind; + parseResponseBind = _.bind(this.parseResponse, this); + return this.get("", options, function(error, response, body) { + return parseResponseBind(error, response, body, cb); + }); + }; + + APIClient.prototype.getCache = function(cache_name, options, cb) { + var parseResponseBind; + parseResponseBind = _.bind(this.parseResponse, this); + return this.get("/" + cache_name, options, function(error, response, body) { + return parseResponseBind(error, response, body, cb); + }); + }; + + APIClient.prototype.deleteCache = function(cache_name, options, cb) { + var parseResponseBind; + parseResponseBind = _.bind(this.parseResponse, this); + return this["delete"]("/" + cache_name, options, function(error, response, body) { + return parseResponseBind(error, response, body, cb); + }); + }; + + APIClient.prototype.clearCache = function(cache_name, options, cb) { + var parseResponseBind; + parseResponseBind = _.bind(this.parseResponse, this); + return this.post("/" + cache_name + "/clear", options, function(error, response, body) { + return parseResponseBind(error, response, body, cb); + }); + }; + + APIClient.prototype.putItem = function(key, cache_name, options, cb) { + var parseResponseBind; + parseResponseBind = _.bind(this.parseResponse, this); + return this.put("/" + cache_name + "/items/" + key, options, function(error, response, body) { + return parseResponseBind(error, response, body, cb); + }); + }; + + APIClient.prototype.IncrementItem = function(key, cache_name, options, cb) { + var parseResponseBind; + parseResponseBind = _.bind(this.parseResponse, this); + return this.post("/" + cache_name + "/items/" + key + "/increment", options, function(error, response, body) { + return parseResponseBind(error, response, body, cb); + }); + }; + + APIClient.prototype.getItem = function(key, cache_name, options, cb) { + var parseResponseBind; + parseResponseBind = _.bind(this.parseResponse, this); + return this.get("/" + cache_name + "/items/" + key, options, function(error, response, body) { + return parseResponseBind(error, response, body, cb); + }); + }; + + APIClient.prototype.deleteItem = function(key, cache_name, options, cb) { + var parseResponseBind; + parseResponseBind = _.bind(this.parseResponse, this); + return this["delete"]("/" + cache_name + "/items/" + key, options, function(error, response, body) { + return parseResponseBind(error, response, body, cb); + }); + }; + + return APIClient; + + })(ironCore.Client); + + module.exports.APIClient = APIClient; + +}).call(this); diff --git a/lib/client.js b/lib/client.js new file mode 100644 index 0000000..a8a5098 --- /dev/null +++ b/lib/client.js @@ -0,0 +1,100 @@ +// Generated by CoffeeScript 1.12.7 +(function() { + var Client, _, apiClient; + + _ = require('underscore'); + + apiClient = require('./api_client'); + + Client = (function() { + function Client(options) { + this.api = new apiClient.APIClient(options); + } + + Client.prototype.cachesList = function(options, cb) { + return this.api.cachesList(options, function(error, body) { + if (error == null) { + return cb(error, body); + } else { + return cb(error, body); + } + }); + }; + + Client.prototype.getCache = function(cache_name, options, cb) { + return this.api.getCache(cache_name, options, function(error, body) { + if (error == null) { + return cb(error, body); + } else { + return cb(error, body); + } + }); + }; + + Client.prototype.deleteCache = function(cache_name, options, cb) { + return this.api.deleteCache(cache_name, options, function(error, body) { + if (error === null) { + return cb(error, body); + } else { + return cb(error, body); + } + }); + }; + + Client.prototype.clearCache = function(cache_name, options, cb) { + return this.api.clearCache(cache_name, options, function(error, body) { + if (error === null) { + return cb(error, body); + } else { + return cb(error, body); + } + }); + }; + + Client.prototype.putItem = function(key, cache_name, options, cb) { + return this.api.putItem(key, cache_name, options, function(error, body) { + if (error === null) { + return cb(error, body); + } else { + return cb(error, body); + } + }); + }; + + Client.prototype.IncrementItem = function(key, cache_name, options, cb) { + return this.api.IncrementItem(key, cache_name, options, function(error, body) { + if (error === null) { + return cb(error, body); + } else { + return cb(error, body); + } + }); + }; + + Client.prototype.getItem = function(key, cache_name, options, cb) { + return this.api.getItem(key, cache_name, options, function(error, body) { + if (error === null) { + return cb(error, body); + } else { + return cb(error, body); + } + }); + }; + + Client.prototype.deleteItem = function(key, cache_name, options, cb) { + return this.api.deleteItem(key, cache_name, options, function(error, body) { + if (error === null) { + return cb(error, body); + } else { + return cb(error, body); + } + }); + }; + + return Client; + + })(); + + module.exports.Client = Client; + +}).call(this); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..8d2ed66 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,707 @@ +{ + "name": "iron_cache", + "version": "0.0.1", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "iron_cache", + "version": "0.0.1", + "dependencies": { + "iron_core": ">=0.2.4", + "pkginfo": "0.3.0", + "underscore": "1.12.1" + }, + "devDependencies": { + "coffee-script": "1.12.7" + }, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/asn1": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz", + "integrity": "sha512-Fh9zh3G2mZ8qM/kwsiKwL2U2FmXxVsboP4x1mXjnhKHv3SmzaBZoYvxEQJz/YS2gnCgd8xlAVWcZnQyC9qZBsA==", + "engines": { + "node": ">=0.4.9" + } + }, + "node_modules/assert-plus": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz", + "integrity": "sha512-brU24g7ryhRwGCI2y+1dGQmQXiZF7TtIj583S96y0jjdajIe6wn8BuXyELYhvD22dtIxDQVFk04YTJwwdwOYJw==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/async": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "integrity": "sha512-l6ToIJIotphWahxxHyzK9bnLR6kM4jJIIgLShZeqLY7iboHoGkdgFl7W2/Ivi4SkMJYGKqW8vSuk0uKUj6qsSw==" + }, + "node_modules/aws-sign2": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz", + "integrity": "sha512-oqUX0DM5j7aPWPCnpWebiyNIj2wiNI87ZxnOMoGv0aE4TGlBy2N+5iWc6dQ/NOKZaBD2W6PVz8jtOGkWzSC5EA==", + "engines": { + "node": "*" + } + }, + "node_modules/bl": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/bl/-/bl-0.9.5.tgz", + "integrity": "sha512-njlCs8XLBIK7LCChTWfzWuIAxkpmmLXcL7/igCofFT1B039Sz0IPnAmosN5QaO22lU4qr8LcUz2ojUlE6pLkRQ==", + "dependencies": { + "readable-stream": "~1.0.26" + } + }, + "node_modules/boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha512-KbiZEa9/vofNcVJXGwdWWn25reQ3V3dHBWbS07FTF3/TOehLnm9GEhJV4T6ZvGPkShRpmUqYwnaCrkj0mRnP6Q==", + "deprecated": "This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).", + "dependencies": { + "hoek": "2.x.x" + }, + "engines": { + "node": ">=0.10.40" + } + }, + "node_modules/caseless": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.9.0.tgz", + "integrity": "sha512-6msL6rlJApxKoPTh2QkZF+pn7/4fqQZAJb8s5noLh/GQxFGnGYfvFaz0JGNFOip/JBM3oP3RjCdwyc4uDXWJwQ==" + }, + "node_modules/coffee-script": { + "version": "1.12.7", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", + "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", + "deprecated": "CoffeeScript on NPM has moved to \"coffeescript\" (no hyphen)", + "dev": true, + "bin": { + "cake": "bin/cake", + "coffee": "bin/coffee" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/combined-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", + "integrity": "sha512-qfexlmLp9MyrkajQVyjEDb0Vj+KhRgR/rxLiVhaihlT+ZkX0lReqtH6Ack40CvMDERR4b5eFp3CreskpBs1Pig==", + "dependencies": { + "delayed-stream": "0.0.5" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "node_modules/cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha512-FFN5KwpvvQTTS5hWPxrU8/QE4kQUc6uwZcrnlMBN82t1MgAtq8mnoDwINBly9Tdr02seeIIhtdF+UH1feBYGog==", + "deprecated": "This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).", + "dependencies": { + "boom": "2.x.x" + }, + "engines": { + "node": ">=0.10.40" + } + }, + "node_modules/ctype": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz", + "integrity": "sha512-T6CEkoSV4q50zW3TlTHMbzy1E5+zlnNcY+yb7tWVYlTwPhx9LpnfAkd4wecpWknDyptp4k97LUZeInlf6jdzBg==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/delayed-stream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", + "integrity": "sha512-v+7uBd1pqe5YtgPacIIbZ8HuHeLFVNe4mUEyFDXL6KiqzEykjbw+5mXZXpGFgNVasdL4jWKgaKIXrEHiynN1LA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/forever-agent": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz", + "integrity": "sha512-PDG5Ef0Dob/JsZUxUltJOhm/Y9mlteAE+46y3M9RBz/Rd3QVENJ75aGRhN56yekTUboaBIkd8KVWX2NjF6+91A==", + "engines": { + "node": "*" + } + }, + "node_modules/form-data": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz", + "integrity": "sha512-LkinaG6JazVhYj2AKi67NOIAhqXcBOQACraT0WdhWW4ZO3kTiS0X7C1nJ1jFZf6wak4bVHIA/oOzWkh2ThAipg==", + "dependencies": { + "async": "~0.9.0", + "combined-stream": "~0.0.4", + "mime-types": "~2.0.3" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/hawk": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-2.3.1.tgz", + "integrity": "sha512-Pnn5Bomr1ypnBHCwhsnj+5zhP3nel9ZPa9wdzFoanaN5+1/g5dtDfBZVVZR112sfYiAftUTFczmiWGkuG0SkSQ==", + "deprecated": "This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.", + "dependencies": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha512-V6Yw1rIcYV/4JsnggjBU0l4Kr+EXhpwqXRusENU1Xx6ro00IHPHYNynCuBTOZAPlr3AAmLvchH9I7N/VUdvOwQ==", + "deprecated": "This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).", + "engines": { + "node": ">=0.10.40" + } + }, + "node_modules/http-signature": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.10.1.tgz", + "integrity": "sha512-coK8uR5rq2IMj+Hen+sKPA5ldgbCc1/spPdKCL1Fw6h+D0s/2LzMcRK0Cqufs1h0ryx/niwBHGFu8HC3hwU+lA==", + "dependencies": { + "asn1": "0.1.11", + "assert-plus": "^0.1.5", + "ctype": "0.5.3" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/iron_core": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/iron_core/-/iron_core-0.2.7.tgz", + "integrity": "sha512-0cFjOjrdv19tOU6bvZDAB7OC0TsLoXZbjsaqjioOGa5B664qiKlVCj+/nE/i8BO0lXk3NlUxwHMkn1TF55zVHA==", + "dependencies": { + "pkginfo": "0.3.0", + "request": "2.53.0", + "underscore": "1.7.0" + }, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/iron_core/node_modules/underscore": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "integrity": "sha512-cp0oQQyZhUM1kpJDLdGO1jPZHgS/MpzoWYfe9+CM2h/QGDZlqwT2T3YGukuBdaNJ/CAPoeyAZRRHz8JFo176vA==" + }, + "node_modules/isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, + "node_modules/mime-db": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz", + "integrity": "sha512-5aMAW7I4jZoZB27fXRuekqc4DVvJ7+hM8UcWrNj2mqibE54gXgPSonBYBdQW5hyaVNGmiYjY0ZMqn9fBefWYvA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz", + "integrity": "sha512-2ZHUEstNkIf2oTWgtODr6X0Cc4Ns/RN/hktdozndiEhhAC2wxXejF1FH0XLHTEImE9h6gr/tcnr3YOnSGsxc7Q==", + "dependencies": { + "mime-db": "~1.12.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-uuid": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", + "integrity": "sha512-TkCET/3rr9mUuRp+CpO7qfgT++aAxfDRaalQhwPFzI9BY/2rCDn6OfpZOVggi1AXfTPpfkTrg5f5WQx5G1uLxA==", + "deprecated": "Use uuid module instead", + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/oauth-sign": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.6.0.tgz", + "integrity": "sha512-E65G/AGfoCE6FILW9X+4cfJu27PNIi40brTmDmnrWIjOdPaaJSNti1XZ/+WzFkyIdMxYk0/WtwGNiQr6puZGWQ==", + "engines": { + "node": "*" + } + }, + "node_modules/pkginfo": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.0.tgz", + "integrity": "sha512-Q4uZFfasmQ7GagbOAcVXGKlcL2Lt01A7Mt+qBd1Geo4hiqo8k+SG+NEiEbTR2R1UjbHQUOIpB7FtJXc36PL4yw==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-2.3.3.tgz", + "integrity": "sha512-f5M0HQqZWkzU8GELTY8LyMrGkr3bPjKoFtTkwUEqJQbcljbeK8M7mliP9Ia2xoOI6oMerp+QPS7oYJtpGmWe/A==" + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "node_modules/readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/request": { + "version": "2.53.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.53.0.tgz", + "integrity": "sha512-E/kWR29ujsKySEMwTRod7i8fzxIV0v58itPRcvG3FyE0Uv/l8wujgPeXlXstBybNF0EdSVounY+vcnkBn03woQ==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", + "dependencies": { + "aws-sign2": "~0.5.0", + "bl": "~0.9.0", + "caseless": "~0.9.0", + "combined-stream": "~0.0.5", + "forever-agent": "~0.5.0", + "form-data": "~0.2.0", + "hawk": "~2.3.0", + "http-signature": "~0.10.0", + "isstream": "~0.1.1", + "json-stringify-safe": "~5.0.0", + "mime-types": "~2.0.1", + "node-uuid": "~1.4.0", + "oauth-sign": "~0.6.0", + "qs": "~2.3.1", + "stringstream": "~0.0.4", + "tough-cookie": ">=0.12.0", + "tunnel-agent": "~0.4.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha512-7bgVOAnPj3XjrKY577S+puCKGCRlUrcrEdsMeRXlg9Ghf5df/xNi6sONUa43WrHUd3TjJBF7O04jYoiY0FVa0A==", + "deprecated": "This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.", + "dependencies": { + "hoek": "2.x.x" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" + }, + "node_modules/stringstream": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", + "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==" + }, + "node_modules/tough-cookie": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "integrity": "sha512-e0IoVDWx8SDHc/hwFTqJDQ7CCDTEeGhmcT9jkWJjoGQSpgBz20nAMr80E3Tpk7PatJ1b37DQDgJR3CNSzcMOZQ==", + "engines": { + "node": "*" + } + }, + "node_modules/underscore": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.12.1.tgz", + "integrity": "sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==" + }, + "node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + } + }, + "dependencies": { + "asn1": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz", + "integrity": "sha512-Fh9zh3G2mZ8qM/kwsiKwL2U2FmXxVsboP4x1mXjnhKHv3SmzaBZoYvxEQJz/YS2gnCgd8xlAVWcZnQyC9qZBsA==" + }, + "assert-plus": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz", + "integrity": "sha512-brU24g7ryhRwGCI2y+1dGQmQXiZF7TtIj583S96y0jjdajIe6wn8BuXyELYhvD22dtIxDQVFk04YTJwwdwOYJw==" + }, + "async": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "integrity": "sha512-l6ToIJIotphWahxxHyzK9bnLR6kM4jJIIgLShZeqLY7iboHoGkdgFl7W2/Ivi4SkMJYGKqW8vSuk0uKUj6qsSw==" + }, + "aws-sign2": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz", + "integrity": "sha512-oqUX0DM5j7aPWPCnpWebiyNIj2wiNI87ZxnOMoGv0aE4TGlBy2N+5iWc6dQ/NOKZaBD2W6PVz8jtOGkWzSC5EA==" + }, + "bl": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/bl/-/bl-0.9.5.tgz", + "integrity": "sha512-njlCs8XLBIK7LCChTWfzWuIAxkpmmLXcL7/igCofFT1B039Sz0IPnAmosN5QaO22lU4qr8LcUz2ojUlE6pLkRQ==", + "requires": { + "readable-stream": "~1.0.26" + } + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha512-KbiZEa9/vofNcVJXGwdWWn25reQ3V3dHBWbS07FTF3/TOehLnm9GEhJV4T6ZvGPkShRpmUqYwnaCrkj0mRnP6Q==", + "requires": { + "hoek": "2.x.x" + } + }, + "caseless": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.9.0.tgz", + "integrity": "sha512-6msL6rlJApxKoPTh2QkZF+pn7/4fqQZAJb8s5noLh/GQxFGnGYfvFaz0JGNFOip/JBM3oP3RjCdwyc4uDXWJwQ==" + }, + "coffee-script": { + "version": "1.12.7", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", + "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", + "dev": true + }, + "combined-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", + "integrity": "sha512-qfexlmLp9MyrkajQVyjEDb0Vj+KhRgR/rxLiVhaihlT+ZkX0lReqtH6Ack40CvMDERR4b5eFp3CreskpBs1Pig==", + "requires": { + "delayed-stream": "0.0.5" + } + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha512-FFN5KwpvvQTTS5hWPxrU8/QE4kQUc6uwZcrnlMBN82t1MgAtq8mnoDwINBly9Tdr02seeIIhtdF+UH1feBYGog==", + "requires": { + "boom": "2.x.x" + } + }, + "ctype": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz", + "integrity": "sha512-T6CEkoSV4q50zW3TlTHMbzy1E5+zlnNcY+yb7tWVYlTwPhx9LpnfAkd4wecpWknDyptp4k97LUZeInlf6jdzBg==" + }, + "delayed-stream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", + "integrity": "sha512-v+7uBd1pqe5YtgPacIIbZ8HuHeLFVNe4mUEyFDXL6KiqzEykjbw+5mXZXpGFgNVasdL4jWKgaKIXrEHiynN1LA==" + }, + "forever-agent": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz", + "integrity": "sha512-PDG5Ef0Dob/JsZUxUltJOhm/Y9mlteAE+46y3M9RBz/Rd3QVENJ75aGRhN56yekTUboaBIkd8KVWX2NjF6+91A==" + }, + "form-data": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz", + "integrity": "sha512-LkinaG6JazVhYj2AKi67NOIAhqXcBOQACraT0WdhWW4ZO3kTiS0X7C1nJ1jFZf6wak4bVHIA/oOzWkh2ThAipg==", + "requires": { + "async": "~0.9.0", + "combined-stream": "~0.0.4", + "mime-types": "~2.0.3" + } + }, + "hawk": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-2.3.1.tgz", + "integrity": "sha512-Pnn5Bomr1ypnBHCwhsnj+5zhP3nel9ZPa9wdzFoanaN5+1/g5dtDfBZVVZR112sfYiAftUTFczmiWGkuG0SkSQ==", + "requires": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha512-V6Yw1rIcYV/4JsnggjBU0l4Kr+EXhpwqXRusENU1Xx6ro00IHPHYNynCuBTOZAPlr3AAmLvchH9I7N/VUdvOwQ==" + }, + "http-signature": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.10.1.tgz", + "integrity": "sha512-coK8uR5rq2IMj+Hen+sKPA5ldgbCc1/spPdKCL1Fw6h+D0s/2LzMcRK0Cqufs1h0ryx/niwBHGFu8HC3hwU+lA==", + "requires": { + "asn1": "0.1.11", + "assert-plus": "^0.1.5", + "ctype": "0.5.3" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "iron_core": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/iron_core/-/iron_core-0.2.7.tgz", + "integrity": "sha512-0cFjOjrdv19tOU6bvZDAB7OC0TsLoXZbjsaqjioOGa5B664qiKlVCj+/nE/i8BO0lXk3NlUxwHMkn1TF55zVHA==", + "requires": { + "pkginfo": "0.3.0", + "request": "2.53.0", + "underscore": "1.7.0" + }, + "dependencies": { + "underscore": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "integrity": "sha512-cp0oQQyZhUM1kpJDLdGO1jPZHgS/MpzoWYfe9+CM2h/QGDZlqwT2T3YGukuBdaNJ/CAPoeyAZRRHz8JFo176vA==" + } + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, + "mime-db": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz", + "integrity": "sha512-5aMAW7I4jZoZB27fXRuekqc4DVvJ7+hM8UcWrNj2mqibE54gXgPSonBYBdQW5hyaVNGmiYjY0ZMqn9fBefWYvA==" + }, + "mime-types": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz", + "integrity": "sha512-2ZHUEstNkIf2oTWgtODr6X0Cc4Ns/RN/hktdozndiEhhAC2wxXejF1FH0XLHTEImE9h6gr/tcnr3YOnSGsxc7Q==", + "requires": { + "mime-db": "~1.12.0" + } + }, + "node-uuid": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", + "integrity": "sha512-TkCET/3rr9mUuRp+CpO7qfgT++aAxfDRaalQhwPFzI9BY/2rCDn6OfpZOVggi1AXfTPpfkTrg5f5WQx5G1uLxA==" + }, + "oauth-sign": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.6.0.tgz", + "integrity": "sha512-E65G/AGfoCE6FILW9X+4cfJu27PNIi40brTmDmnrWIjOdPaaJSNti1XZ/+WzFkyIdMxYk0/WtwGNiQr6puZGWQ==" + }, + "pkginfo": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.0.tgz", + "integrity": "sha512-Q4uZFfasmQ7GagbOAcVXGKlcL2Lt01A7Mt+qBd1Geo4hiqo8k+SG+NEiEbTR2R1UjbHQUOIpB7FtJXc36PL4yw==" + }, + "psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + }, + "qs": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-2.3.3.tgz", + "integrity": "sha512-f5M0HQqZWkzU8GELTY8LyMrGkr3bPjKoFtTkwUEqJQbcljbeK8M7mliP9Ia2xoOI6oMerp+QPS7oYJtpGmWe/A==" + }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "request": { + "version": "2.53.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.53.0.tgz", + "integrity": "sha512-E/kWR29ujsKySEMwTRod7i8fzxIV0v58itPRcvG3FyE0Uv/l8wujgPeXlXstBybNF0EdSVounY+vcnkBn03woQ==", + "requires": { + "aws-sign2": "~0.5.0", + "bl": "~0.9.0", + "caseless": "~0.9.0", + "combined-stream": "~0.0.5", + "forever-agent": "~0.5.0", + "form-data": "~0.2.0", + "hawk": "~2.3.0", + "http-signature": "~0.10.0", + "isstream": "~0.1.1", + "json-stringify-safe": "~5.0.0", + "mime-types": "~2.0.1", + "node-uuid": "~1.4.0", + "oauth-sign": "~0.6.0", + "qs": "~2.3.1", + "stringstream": "~0.0.4", + "tough-cookie": ">=0.12.0", + "tunnel-agent": "~0.4.0" + } + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha512-7bgVOAnPj3XjrKY577S+puCKGCRlUrcrEdsMeRXlg9Ghf5df/xNi6sONUa43WrHUd3TjJBF7O04jYoiY0FVa0A==", + "requires": { + "hoek": "2.x.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" + }, + "stringstream": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", + "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==" + }, + "tough-cookie": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + } + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "integrity": "sha512-e0IoVDWx8SDHc/hwFTqJDQ7CCDTEeGhmcT9jkWJjoGQSpgBz20nAMr80E3Tpk7PatJ1b37DQDgJR3CNSzcMOZQ==" + }, + "underscore": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.12.1.tgz", + "integrity": "sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==" + }, + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..b6e924a --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "iron_cache", + "version": "0.0.1", + "description": "Node client for IronCache", + "homepage": "https://github.com/iron-io/iron_cache_node", + "author": "Iron.io, Inc", + "main": "./lib/client", + "dependencies": { + "pkginfo": "0.3.0", + "underscore": "1.12.1", + "iron_core": ">=0.2.4" + + }, + "devDependencies": { + "coffee-script": "1.12.7" + }, + "repository": { + "type": "git", + "url": "https://github.com/iron-io/iron_cache_node.git" + }, + "engines": { + "node": ">= 0.6.0" + } +} diff --git a/src/api_client.coffee b/src/api_client.coffee new file mode 100644 index 0000000..ea73f4d --- /dev/null +++ b/src/api_client.coffee @@ -0,0 +1,80 @@ +require('pkginfo')(module) +version = @version + +_ = require('underscore') + +ironCore = require('iron_core'); + +class APIClient extends ironCore.Client + AWS_US_EAST_HOST: 'cache-aws-us-east-1.iron.io' + + constructor: (options) -> + defaultOptions = + scheme: 'https', + host: @AWS_US_EAST_HOST, + port: 443, + api_version: 1, + user_agent: @version() + + super('iron', 'cache', options, defaultOptions, ['project_id', 'token', 'api_version']) + + version: -> + "iron_cache_node-#{version} (#{super()})" + + url: -> + super() + @options.api_version.toString() + "/projects/#{@options.project_id}/caches" + + headers: -> + _.extend({}, super(), {'Authorization': "OAuth #{@options.token}"}) + + cachesList: (options, cb) -> + parseResponseBind = _.bind(@parseResponse, @) + + @get("", options, (error, response, body) -> + parseResponseBind(error, response, body, cb) + ) + + getCache: (cache_name, options, cb) -> + parseResponseBind = _.bind(@parseResponse, @) + + @get("/#{cache_name}", options, (error, response, body) -> + parseResponseBind(error, response, body, cb) + ) + + deleteCache: (cache_name, options, cb) -> + parseResponseBind = _.bind(@parseResponse, @) + @delete("/#{cache_name}", options, (error, response, body) -> + parseResponseBind(error, response, body, cb) + ) + + clearCache: (cache_name, options, cb) -> + parseResponseBind = _.bind(@parseResponse, @) + @post("/#{cache_name}/clear", options, (error, response, body) -> + parseResponseBind(error, response, body, cb) + ) + + putItem: (key, cache_name, options, cb) -> + parseResponseBind = _.bind(@parseResponse, @) + @put("/#{cache_name}/items/#{key}", options, (error, response, body) -> + parseResponseBind(error, response, body, cb) + ) + + IncrementItem: (key, cache_name, options, cb) -> + parseResponseBind = _.bind(@parseResponse, @) + @post("/#{cache_name}/items/#{key}/increment", options, (error, response, body) -> + parseResponseBind(error, response, body, cb) + ) + + getItem: (key, cache_name, options, cb) -> + parseResponseBind = _.bind(@parseResponse, @) + @get("/#{cache_name}/items/#{key}", options, (error, response, body) -> + parseResponseBind(error, response, body, cb) + ) + + deleteItem: (key, cache_name, options, cb) -> + parseResponseBind = _.bind(@parseResponse, @) + @delete("/#{cache_name}/items/#{key}", options, (error, response, body) -> + parseResponseBind(error, response, body, cb) + ) + +module.exports.APIClient = APIClient diff --git a/src/client.coffee b/src/client.coffee new file mode 100644 index 0000000..3b3a978 --- /dev/null +++ b/src/client.coffee @@ -0,0 +1,74 @@ +_ = require('underscore') + +apiClient = require('./api_client') + +class Client + constructor: (options) -> + @api = new apiClient.APIClient(options) + + cachesList: (options, cb) -> + @api.cachesList(options, (error, body) -> + if not error? + cb(error, body) + else + cb(error, body) + ) + + getCache: (cache_name, options, cb) -> + @api.getCache(cache_name, options, (error, body) -> + if not error? + cb(error, body) + else + cb(error, body) + ) + + deleteCache: (cache_name, options, cb) -> + @api.deleteCache(cache_name, options, (error, body) -> + if error == null + cb(error, body) + else + cb(error, body) + ) + + clearCache: (cache_name, options, cb) -> + @api.clearCache(cache_name, options, (error, body) -> + if error == null + cb(error, body) + else + cb(error, body) + ) + + putItem: (key, cache_name, options, cb) -> + @api.putItem(key, cache_name, options, (error, body) -> + if error == null + cb(error, body) + else + cb(error, body) + ) + + IncrementItem: (key, cache_name, options, cb) -> + @api.IncrementItem(key, cache_name, options, (error, body) -> + if error == null + cb(error, body) + else + cb(error, body) + ) + + getItem: (key, cache_name, options, cb) -> + @api.getItem(key, cache_name, options, (error, body) -> + if error == null + cb(error, body) + else + cb(error, body) + ) + + deleteItem: (key, cache_name, options, cb) -> + @api.deleteItem(key, cache_name, options, (error, body) -> + if error == null + cb(error, body) + else + cb(error, body) + ) + + +module.exports.Client = Client