Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 16 commits
  • 39 files changed
  • 0 commit comments
  • 3 contributors
Showing with 1,401 additions and 14,308 deletions.
  1. +4 −0 .gitignore
  2. +14 −12 Gruntfile.js
  3. +30 −8 README.md
  4. +1 −1  component.json
  5. +0 −1,850 dist/aerogear.js
  6. +0 −1  dist/aerogear.js.map
  7. +0 −17 dist/aerogear.min.js
  8. +0 −122 docs/134779558e.html
  9. +0 −418 docs/16d174296b.html
  10. +0 −117 docs/39b39c364a.html
  11. +0 −179 docs/5bda6a95a1.html
  12. +0 −567 docs/6b2ce5cca5.html
  13. +0 −456 docs/9e1e419dfc.html
  14. +0 −1,480 docs/AeroGear.Auth.adapters.Rest.html
  15. +0 −797 docs/AeroGear.Auth.html
  16. +0 −1,047 docs/AeroGear.DataManager.adapters.Memory.html
  17. +0 −819 docs/AeroGear.DataManager.adapters.SessionLocal.html
  18. +0 −834 docs/AeroGear.DataManager.html
  19. +0 −2,123 docs/AeroGear.Pipeline.adapters.Rest.html
  20. +0 −834 docs/AeroGear.Pipeline.html
  21. +0 −134 docs/AeroGear.html
  22. +0 −164 docs/aerogear.core.js.html
  23. +0 −115 docs/f25d3e32ae.html
  24. +0 −86 docs/index.html
  25. +0 −202 docs/scripts/prettify/Apache-License-2.0.txt
  26. +0 −2  docs/scripts/prettify/lang-css.js
  27. +0 −28 docs/scripts/prettify/prettify.js
  28. +0 −286 docs/styles/jsdoc-default.css
  29. +0 −111 docs/styles/prettify-jsdoc.css
  30. +0 −132 docs/styles/prettify-tomorrow.css
  31. +1 −1  package.json
  32. +1 −1  src/aerogear.core.js
  33. +312 −314 src/authentication/adapters/rest.js
  34. +42 −44 src/authentication/aerogear.auth.js
  35. +343 −345 src/data-manager/adapters/memory.js
  36. +101 −103 src/data-manager/adapters/session-local.js
  37. +47 −49 src/data-manager/aerogear.datamanager.js
  38. +462 −464 src/pipeline/adapters/rest.js
  39. +43 −45 src/pipeline/aerogear.pipeline.js
View
4 .gitignore
@@ -0,0 +1,4 @@
+*.yaml
+dist/
+docs/
+node_modules/
View
26 Gruntfile.js
@@ -29,19 +29,19 @@ module.exports = function(grunt) {
banner: "<%= meta.banner %>"
},
dist: {
- src: ['src/aerogear.core.js', 'src/utilities/aerogear.utilities.js', 'external/uuid/uuid.js', 'src/pipeline/aerogear.pipeline.js', 'src/pipeline/adapters/rest.js', 'src/data-manager/aerogear.datamanager.js', 'src/data-manager/adapters/memory.js', 'src/data-manager/adapters/session-local.js', 'src/authentication/aerogear.auth.js', 'src/authentication/adapters/rest.js', 'src/notifier/aerogear.notifier.js', 'src/notifier/adapters/vertx.js'],
+ src: ['src/aerogear.core.js', 'external/uuid/uuid.js', 'src/pipeline/aerogear.pipeline.js', 'src/pipeline/adapters/rest.js', 'src/data-manager/aerogear.datamanager.js', 'src/data-manager/adapters/memory.js', 'src/data-manager/adapters/session-local.js', 'src/authentication/aerogear.auth.js', 'src/authentication/adapters/rest.js'],
dest: 'dist/<%= pkg.name %>.js'
},
pipeline: {
- src: ['src/aerogear.core.js', 'src/utilities/aerogear.utilities.js', 'external/uuid/uuid.js', 'src/pipeline/aerogear.pipeline.js', 'src/pipeline/adapters/rest.js'],
+ src: ['src/aerogear.core.js', 'external/uuid/uuid.js', 'src/pipeline/aerogear.pipeline.js', 'src/pipeline/adapters/rest.js'],
dest: 'dist/<%= pkg.name %>.custom.js'
},
dataManager: {
- src: ['src/aerogear.core.js', 'src/utilities/aerogear.utilities.js', 'external/uuid/uuid.js', 'src/data-manager/aerogear.datamanager.js', 'src/data-manager/adapters/memory.js', 'src/data-manager/adapters/session-local.js'],
+ src: ['src/aerogear.core.js', 'external/uuid/uuid.js', 'src/data-manager/aerogear.datamanager.js', 'src/data-manager/adapters/memory.js', 'src/data-manager/adapters/session-local.js'],
dest: 'dist/<%= pkg.name %>.custom.js'
},
auth: {
- src: ['src/aerogear.core.js', 'src/utilities/aerogear.utilities.js', 'src/authentication/aerogear.auth.js', 'src/authentication/adapters/rest.js'],
+ src: ['src/aerogear.core.js', 'src/authentication/aerogear.auth.js', 'src/authentication/adapters/rest.js'],
dest: 'dist/<%= pkg.name %>.custom.js'
},
notifier: {
@@ -68,6 +68,8 @@ module.exports = function(grunt) {
options: {
banner: "<%= meta.banner %>",
sourceMap: "dist/<%= pkg.name %>.js.map",
+ sourceMappingURL: "<%= pkg.name %>.js.map",
+ sourceMapPrefix: 1,
beautify: {
ascii_only: true
}
@@ -88,13 +90,14 @@ module.exports = function(grunt) {
}
});
- var exec = require('child_process').exec;
- grunt.registerTask('docs', function() {
- grunt.log.writeln('Remove old docs');
- exec('rm -r docs');
- grunt.log.writeln('Old docs removed\nGenerate new docs');
- exec('jsdoc src/ -r -d docs README.md');
- grunt.log.writeln('New docs generated');
+ // IIFE wrapper task
+ grunt.registerTask('iife', function( custom ) {
+ var fs = require("fs"),
+ fileName = "dist/" + grunt.config("pkg").name + (custom ? ".custom" : "") + ".js",
+ fileText = fs.readFileSync( fileName, "utf-8" );
+
+ fileText = fileText.replace( /\*\//, "*/\n(function( window, undefined ) {\n" );
+ fs.writeFileSync( fileName, fileText + "})( this );\n", "utf-8" );
});
// grunt-contrib tasks
@@ -106,7 +109,6 @@ module.exports = function(grunt) {
// Default task
grunt.registerTask('default', ['jshint', 'qunit', 'concat:dist', 'uglify:all']);
grunt.registerTask('dev', ['jshint', 'concat:dist', 'uglify:all']);
- grunt.registerTask('build+docs', ['jshint', 'qunit', 'concat:dist', 'uglify:all', 'docs']);
grunt.registerTask('pipeline', ['jshint', 'qunit', 'concat:pipeline', 'uglify:custom']);
grunt.registerTask('data-manager', ['jshint', 'qunit', 'concat:dataManager', 'uglify:custom']);
grunt.registerTask('auth', ['jshint', 'qunit', 'concat:auth', 'uglify:custom']);
View
38 README.md
@@ -1,25 +1,47 @@
-aerogear-js
-===========
+# aerogear-js
JavaScript client library implementation for AeroGear. Eventually, this will include API's for persistence, security, data synchronization and more.
-Auth
-----
+## Auth
+- - -
The AeroGear.Auth namespace provides an authentication and enrollment API. Through the use of adapters, this library provides common methods like enroll, login and logout that will just work.
See the [Auth API docs](http://aerogear.org/docs/specs/aerogear-js/AeroGear.Auth.html) for more info.
-DataManager
------------
+## DataManager
+- - -
A collection of data connections (stores) and their corresponding data models. This object provides a standard way to interact with client side data no matter the data format or storage mechanism used.
See the [DataManager API docs](http://aerogear.org/docs/specs/aerogear-js/AeroGear.DataManager.html) for more info.
-Pipeline
---------
+## Pipeline
+- - -
Pipeline is a JavaScript library that provides a persistence API that is protocol agnostic and does not depend on any certain data model. Through the use of adapters, both provided and custom, user supplied, this library provides common methods like read, save and delete that will just work.
See the [Pipeline API docs](http://aerogear.org/docs/specs/aerogear-js/AeroGear.Pipeline.html) for more info.
+
+## Building
+- - -
+
+### Grunt
+
+[Grunt](http://gruntjs.com/) is used as the build tool which requires [Node.js](http://nodejs.org/) version >= 0.8.0.
+Please refer to [nodejs.org](http://nodejs.org) for details regarding installing Node.js.
+Please refer to Grunt's [getting started](http://gruntjs.com/getting-started) guide for details regarding installing Grunt.
+
+### Installing Dependencies
+To install the dependencies of the project run the following command:
+
+ $ npm install
+
+This will install the versions of the dependencies declared in package.json. This is only requried to be done once before
+building the first time, or if the dependencies in package.json have been updated.
+
+### Building the project
+
+ $ grunt
+
+The produced JavaScript will be in the __dist__ directory.
View
2  component.json
@@ -2,7 +2,7 @@
"name": "aerogear",
"title": "AeroGear JavaScript Library",
"description": "Provides a lightweight set of utilities for communication, security, storage and more.",
- "version": "1.0.0-M3",
+ "version": "1.0.0-CR1",
"main": "./dist/aerogear.min.js",
"homepage": "https://github.com/aerogear/aerogear-js",
"author": {
View
1,850 dist/aerogear.js
@@ -1,1850 +0,0 @@
-/*! AeroGear JavaScript Library - v1.0.0-M3 - 2013-02-15
-* https://github.com/aerogear/aerogear-js
-* JBoss, Home of Professional Open Source
-* Copyright Red Hat, Inc., and individual contributors
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-* http://www.apache.org/licenses/LICENSE-2.0
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/**
- The AeroGear namespace provides a way to encapsulate the library's properties and methods away from the global namespace
- @namespace
- */
-var AeroGear = {};
-
-/**
- AeroGear.Core is a base for all of the library modules to extend. It is not to be instantiated and will throw an error when attempted
- @class
- @private
- */
-AeroGear.Core = function() {
- // Prevent instantiation of this base class
- if ( this instanceof AeroGear.Core ) {
- throw "Invalid instantiation of base class AeroGear.Core";
- }
-
- /**
- This function is used internally by pipeline, datamanager, etc. to add a new Object (pipe, store, etc.) to the respective collection.
- @method
- @param {String|Array|Object} config - This can be a variety of types specifying how to create the object
- @returns {Object} The object containing the collection that was updated
- */
- this.add = function ( config ) {
- var i,
- current,
- collection = this[ this.collectionName ] || {};
-
- if ( !config ) {
- return this;
- } else if ( typeof config === "string" ) {
- // config is a string so use default adapter type
- collection[ config ] = AeroGear[ this.lib ].adapters[ this.type ]( config );
- } else if ( AeroGear.isArray( config ) ) {
- // config is an array so loop through each item in the array
- for ( i = 0; i < config.length; i++ ) {
- current = config[ i ];
-
- if ( typeof current === "string" ) {
- collection[ current ] = AeroGear[ this.lib ].adapters[ this.type ]( current );
- } else {
- collection[ current.name ] = AeroGear[ this.lib ].adapters[ current.type || this.type ]( current.name, current.settings || {} );
- }
- }
- } else {
- // config is an object so use that signature
- collection[ config.name ] = AeroGear[ this.lib ].adapters[ config.type || this.type ]( config.name, config.settings || {} );
- }
-
- // reset the collection instance
- this[ this.collectionName ] = collection;
-
- return this;
- };
- /**
- This function is used internally by pipeline, datamanager, etc. to remove an Object (pipe, store, etc.) from the respective collection.
- @method
- @param {String|String[]|Object[]|Object} config - This can be a variety of types specifying how to remove the object
- @returns {Object} The object containing the collection that was updated
- */
- this.remove = function( config ) {
- var i,
- current,
- collection = this[ this.collectionName ] || {};
-
- if ( typeof config === "string" ) {
- // config is a string so delete that item by name
- delete collection[ config ];
- } else if ( AeroGear.isArray( config ) ) {
- // config is an array so loop through each item in the array
- for ( i = 0; i < config.length; i++ ) {
- current = config[ i ];
-
- if ( typeof current === "string" ) {
- delete collection[ current ];
- } else {
- delete collection[ current.name ];
- }
- }
- } else if ( config ) {
- // config is an object so use that signature
- delete collection[ config.name ];
- }
-
- // reset the collection instance
- this[ this.collectionName ] = collection;
-
- return this;
- };
-};
-
-/**
- Utility function to test if an object is an Array
- @private
- @method
- @param {Object} obj - This can be any object to test
-*/
-AeroGear.isArray = function( obj ) {
- return ({}).toString.call( obj ) === "[object Array]";
-};
-
-// node-uuid/uuid.js
-//
-// Copyright (c) 2010 Robert Kieffer
-// Dual licensed under the MIT and GPL licenses.
-// Documentation and details at https://github.com/broofa/node-uuid
-(function() {
- var _global = this;
-
- // Unique ID creation requires a high quality random # generator, but
- // Math.random() does not guarantee "cryptographic quality". So we feature
- // detect for more robust APIs, normalizing each method to return 128-bits
- // (16 bytes) of random data.
- var mathRNG, nodeRNG, whatwgRNG;
-
- // Math.random()-based RNG. All platforms, very fast, unknown quality
- var _rndBytes = new Array(16);
- mathRNG = function() {
- var r, b = _rndBytes, i = 0;
-
- for (var i = 0, r; i < 16; i++) {
- if ((i & 0x03) == 0) r = Math.random() * 0x100000000;
- b[i] = r >>> ((i & 0x03) << 3) & 0xff;
- }
-
- return b;
- }
-
- // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
- // WebKit only (currently), moderately fast, high quality
- if (_global.crypto && crypto.getRandomValues) {
- var _rnds = new Uint32Array(4);
- whatwgRNG = function() {
- crypto.getRandomValues(_rnds);
-
- for (var c = 0 ; c < 16; c++) {
- _rndBytes[c] = _rnds[c >> 2] >>> ((c & 0x03) * 8) & 0xff;
- }
- return _rndBytes;
- }
- }
-
- // Node.js crypto-based RNG - http://nodejs.org/docs/v0.6.2/api/crypto.html
- // Node.js only, moderately fast, high quality
- try {
- var _rb = require('crypto').randomBytes;
- nodeRNG = _rb && function() {
- return _rb(16);
- };
- } catch (e) {}
-
- // Select RNG with best quality
- var _rng = nodeRNG || whatwgRNG || mathRNG;
-
- // Buffer class to use
- var BufferClass = typeof(Buffer) == 'function' ? Buffer : Array;
-
- // Maps for number <-> hex string conversion
- var _byteToHex = [];
- var _hexToByte = {};
- for (var i = 0; i < 256; i++) {
- _byteToHex[i] = (i + 0x100).toString(16).substr(1);
- _hexToByte[_byteToHex[i]] = i;
- }
-
- // **`parse()` - Parse a UUID into it's component bytes**
- function parse(s, buf, offset) {
- var i = (buf && offset) || 0, ii = 0;
-
- buf = buf || [];
- s.toLowerCase().replace(/[0-9a-f]{2}/g, function(byte) {
- if (ii < 16) { // Don't overflow!
- buf[i + ii++] = _hexToByte[byte];
- }
- });
-
- // Zero out remaining bytes if string was short
- while (ii < 16) {
- buf[i + ii++] = 0;
- }
-
- return buf;
- }
-
- // **`unparse()` - Convert UUID byte array (ala parse()) into a string**
- function unparse(buf, offset) {
- var i = offset || 0, bth = _byteToHex;
- return bth[buf[i++]] + bth[buf[i++]] +
- bth[buf[i++]] + bth[buf[i++]] + '-' +
- bth[buf[i++]] + bth[buf[i++]] + '-' +
- bth[buf[i++]] + bth[buf[i++]] + '-' +
- bth[buf[i++]] + bth[buf[i++]] + '-' +
- bth[buf[i++]] + bth[buf[i++]] +
- bth[buf[i++]] + bth[buf[i++]] +
- bth[buf[i++]] + bth[buf[i++]];
- }
-
- // **`v1()` - Generate time-based UUID**
- //
- // Inspired by https://github.com/LiosK/UUID.js
- // and http://docs.python.org/library/uuid.html
-
- // random #'s we need to init node and clockseq
- var _seedBytes = _rng();
-
- // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
- var _nodeId = [
- _seedBytes[0] | 0x01,
- _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
- ];
-
- // Per 4.2.2, randomize (14 bit) clockseq
- var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
-
- // Previous uuid creation time
- var _lastMSecs = 0, _lastNSecs = 0;
-
- // See https://github.com/broofa/node-uuid for API details
- function v1(options, buf, offset) {
- var i = buf && offset || 0;
- var b = buf || [];
-
- options = options || {};
-
- var clockseq = options.clockseq != null ? options.clockseq : _clockseq;
-
- // UUID timestamps are 100 nano-second units since the Gregorian epoch,
- // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
- // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
- // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
- var msecs = options.msecs != null ? options.msecs : new Date().getTime();
-
- // Per 4.2.1.2, use count of uuid's generated during the current clock
- // cycle to simulate higher resolution clock
- var nsecs = options.nsecs != null ? options.nsecs : _lastNSecs + 1;
-
- // Time since last uuid creation (in msecs)
- var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
-
- // Per 4.2.1.2, Bump clockseq on clock regression
- if (dt < 0 && options.clockseq == null) {
- clockseq = clockseq + 1 & 0x3fff;
- }
-
- // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
- // time interval
- if ((dt < 0 || msecs > _lastMSecs) && options.nsecs == null) {
- nsecs = 0;
- }
-
- // Per 4.2.1.2 Throw error if too many uuids are requested
- if (nsecs >= 10000) {
- throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
- }
-
- _lastMSecs = msecs;
- _lastNSecs = nsecs;
- _clockseq = clockseq;
-
- // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
- msecs += 12219292800000;
-
- // `time_low`
- var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
- b[i++] = tl >>> 24 & 0xff;
- b[i++] = tl >>> 16 & 0xff;
- b[i++] = tl >>> 8 & 0xff;
- b[i++] = tl & 0xff;
-
- // `time_mid`
- var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
- b[i++] = tmh >>> 8 & 0xff;
- b[i++] = tmh & 0xff;
-
- // `time_high_and_version`
- b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
- b[i++] = tmh >>> 16 & 0xff;
-
- // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
- b[i++] = clockseq >>> 8 | 0x80;
-
- // `clock_seq_low`
- b[i++] = clockseq & 0xff;
-
- // `node`
- var node = options.node || _nodeId;
- for (var n = 0; n < 6; n++) {
- b[i + n] = node[n];
- }
-
- return buf ? buf : unparse(b);
- }
-
- // **`v4()` - Generate random UUID**
-
- // See https://github.com/broofa/node-uuid for API details
- function v4(options, buf, offset) {
- // Deprecated - 'format' argument, as supported in v1.2
- var i = buf && offset || 0;
-
- if (typeof(options) == 'string') {
- buf = options == 'binary' ? new BufferClass(16) : null;
- options = null;
- }
- options = options || {};
-
- var rnds = options.random || (options.rng || _rng)();
-
- // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
-
- // Copy bytes to buffer, if provided
- if (buf) {
- for (var ii = 0; ii < 16; ii++) {
- buf[i + ii] = rnds[ii];
- }
- }
-
- return buf || unparse(rnds);
- }
-
- // Export public API
- var uuid = v4;
- uuid.v1 = v1;
- uuid.v4 = v4;
- uuid.parse = parse;
- uuid.unparse = unparse;
- uuid.BufferClass = BufferClass;
-
- // Export RNG options
- uuid.mathRNG = mathRNG;
- uuid.nodeRNG = nodeRNG;
- uuid.whatwgRNG = whatwgRNG;
-
- if (typeof(module) != 'undefined') {
- // Play nice with node.js
- module.exports = uuid;
- } else {
- // Play nice with browsers
- var _previousRoot = _global.uuid;
-
- // **`noConflict()` - (browser only) to reset global 'uuid' var**
- uuid.noConflict = function() {
- _global.uuid = _previousRoot;
- return uuid;
- }
- _global.uuid = uuid;
- }
-}());
-
-(function( AeroGear, $, undefined ) {
- /**
- The AeroGear.Pipeline provides a persistence API that is protocol agnostic and does not depend on any certain data model. Through the use of adapters, this library provides common methods like read, save and delete that will just work.
- @class
- @augments AeroGear.Core
- @param {String|Array|Object} [config] - A configuration for the pipe(s) being created along with the Pipeline. If an object or array containing objects is used, the objects can have the following properties:
- @param {String} config.name - the name that the pipe will later be referenced by
- @param {String} [config.type="rest"] - the type of pipe as determined by the adapter used
- @param {String} [config.recordId="id"] - the identifier used to denote the unique id for each record in the data associated with this pipe
- @param {Object} [config.settings={}] - the settings to be passed to the adapter
- @returns {Object} pipeline - The created Pipeline containing any pipes that may have been created
- @example
- // Create an empty Pipeline
- var pl = AeroGear.Pipeline();
-
- // Create a single pipe using the default adapter
- var pl2 = AeroGear.Pipeline( "tasks" );
-
- // Create multiple pipes using the default adapter
- var pl3 = AeroGear.Pipeline( [ "tasks", "projects" ] );
- */
- AeroGear.Pipeline = function( config ) {
- // Allow instantiation without using new
- if ( !( this instanceof AeroGear.Pipeline ) ) {
- return new AeroGear.Pipeline( config );
- }
-
- // Super constructor
- AeroGear.Core.call( this );
-
- this.lib = "Pipeline";
- this.type = config ? config.type || "Rest" : "Rest";
-
- /**
- The name used to reference the collection of pipe instances created from the adapters
- @memberOf AeroGear.Pipeline
- @type Object
- @default pipes
- */
- this.collectionName = "pipes";
-
- this.add( config );
- };
-
- AeroGear.Pipeline.prototype = AeroGear.Core;
- AeroGear.Pipeline.constructor = AeroGear.Pipeline;
-
- /**
- The adapters object is provided so that adapters can be added to the AeroGear.Pipeline namespace dynamically and still be accessible to the add method
- @augments AeroGear.Pipeline
- */
- AeroGear.Pipeline.adapters = {};
-})( AeroGear, jQuery );
-
-(function( AeroGear, $, uuid, undefined ) {
- /**
- The REST adapter is the default type used when creating a new pipe. It uses jQuery.ajax to communicate with the server. By default, the RESTful endpoint used by this pipe is the app's current context, followed by the pipe name. For example, if the app is running on http://mysite.com/myApp, then a pipe named `tasks` would use http://mysite.com/myApp/tasks as its REST endpoint.
- @constructs AeroGear.Pipeline.adapters.Rest
- @param {String} pipeName - the name used to reference this particular pipe
- @param {String} [type="Rest"] - the name used to reference this particular pipe
- @param {Object} [settings={}] - the settings to be passed to the adapter
- @param {Object} [settings.authenticator=null] - the AeroGear.auth object used to pass credentials to a secure endpoint
- @param {String} [settings.baseURL] - defines the base URL to use for an endpoint
- @param {String} [settings.endpoint=pipename] - overrides the default naming of the endpoint which uses the pipeName
- @param {Object|Boolean} [settings.pageConfig] - an object containing the current paging configuration, true to use all defaults or false/undefined to not use paging
- @param {String} [settings.pageConfig.metadataLocation="webLinking"] - indicates whether paging information is received from the response "header", the response "body" or via RFC 5988 "webLinking", which is the default.
- @param {String} [settings.pageConfig.previousIdentifier="previous"] - the name of the prev link header, content var or web link rel
- @param {String} [settings.pageConfig.nextIdentifier="next"] - the name of the next link header, content var or web link rel
- @param {Function} [settings.pageConfig.parameterProvider] - a function for handling custom parameter placement within header and body based paging - for header paging, the function receives a jqXHR object and for body paging, the function receives the JSON formatted body as an object. the function should then return an object containing keys named for the previous/nextIdentifier options and whos values are either a map of parameters and values or a properly formatted query string
- @param {String} [settings.recordId="id"] - the name of the field used to uniquely identify a "record" in the data
- @returns {Object} The created pipe
- */
- AeroGear.Pipeline.adapters.Rest = function( pipeName, settings ) {
- // Allow instantiation without using new
- if ( !( this instanceof AeroGear.Pipeline.adapters.Rest ) ) {
- return new AeroGear.Pipeline.adapters.Rest( pipeName, settings );
- }
-
- settings = settings || {};
-
- // Private Instance vars
- var endpoint = settings.endpoint || pipeName,
- ajaxSettings = {
- // use the pipeName as the default rest endpoint
- url: settings.baseURL ? settings.baseURL + endpoint : endpoint,
- contentType: "application/json",
- dataType: "json"
- },
- recordId = settings.recordId || "id",
- authenticator = settings.authenticator || null,
- type = "Rest",
- pageConfig = settings.pageConfig;
-
- // Privileged Methods
- /**
- Adds the auth token to the headers and returns the modified version of the settings
- @private
- @augments Rest
- @param {Object} settings - the settings object that will have the auth identifier added
- @returns {Object} Settings extended with auth identifier
- */
- this.addAuthIdentifier = function( settings ) {
- return authenticator ? authenticator.addAuthIdentifier( settings ) : settings;
- };
-
- /**
- Removes the stored token effectively telling the client it must re-authenticate with the server
- @private
- @augments Rest
- */
- this.deauthorize = function() {
- if ( authenticator ) {
- authenticator.deauthorize();
- }
- };
-
- /**
- Returns the value of the private ajaxSettings var
- @private
- @augments Rest
- @returns {Object}
- */
- this.getAjaxSettings = function() {
- return ajaxSettings;
- };
-
- /**
- Returns the value of the private recordId var
- @private
- @augments Rest
- @returns {String}
- */
- this.getRecordId = function() {
- return recordId;
- };
-
- /**
- Returns the value of the private pageConfig var
- @private
- @augments Rest
- @returns {Object}
- */
- this.getPageConfig = function() {
- return pageConfig;
- };
-
- /**
- Updates the value of the private pageConfig var with only the items specified in newConfig unless the reset option is specified
- @private
- @augments Rest
- */
- this.updatePageConfig = function( newConfig, reset ) {
- if ( reset ) {
- pageConfig = {};
- pageConfig.metadataLocation = newConfig.metadataLocation ? newConfig.metadataLocation : "webLinking";
- pageConfig.previousIdentifier = newConfig.previousIdentifier ? newConfig.previousIdentifier : "previous";
- pageConfig.nextIdentifier = newConfig.nextIdentifier ? newConfig.nextIdentifier : "next";
- pageConfig.parameterProvider = newConfig.parameterProvider ? newConfig.parameterProvider : null;
- } else {
- $.extend( pageConfig, newConfig );
- }
- };
-
- // Set pageConfig defaults
- if ( pageConfig ) {
- this.updatePageConfig( pageConfig, true );
- }
-
- // Paging Helpers
- this.webLinkingPageParser = function( jqXHR ) {
- var linkAr, linksAr, currentLink, params, paramAr, identifier,
- query = {};
-
- linksAr = jqXHR.getResponseHeader( "Link" ).split( "," );
- for ( var link in linksAr ) {
- linkAr = linksAr[ link ].trim().split( ";" );
- for ( var item in linkAr ) {
- currentLink = linkAr[ item ].trim();
- if ( currentLink.indexOf( "<" ) === 0 && currentLink.lastIndexOf( ">" ) === linkAr[ item ].length - 1 ) {
- params = currentLink.substr( 1, currentLink.length - 2 ).split( "?" )[ 1 ];
- } else if ( currentLink.indexOf( "rel=" ) === 0 ) {
- if ( currentLink.indexOf( pageConfig.previousIdentifier ) >= 0 ) {
- identifier = pageConfig.previousIdentifier;
- } else if ( currentLink.indexOf( pageConfig.nextIdentifier ) >= 0 ) {
- identifier = pageConfig.nextIdentifier;
- }
- }
- }
-
- if( identifier ) {
- query[ identifier ] = params;
- identifier = undefined;
- }
- }
-
- return query;
- };
-
- this.headerPageParser = function( jqXHR ) {
- var previousQueryString = jqXHR.getResponseHeader( pageConfig.previousIdentifier ),
- nextQueryString = jqXHR.getResponseHeader( pageConfig.nextIdentifier ),
- pagingMetadata = {},
- query = {};
-
- if ( pageConfig.parameterProvider ) {
- pagingMetadata = pageConfig.parameterProvider( jqXHR );
- query[ pageConfig.previousIdentifier ] = pagingMetadata[ pageConfig.previousIdentifier ];
- query[ pageConfig.nextIdentifier ] = pagingMetadata[ pageConfig.nextIdentifier ];
- } else {
- query[ pageConfig.previousIdentifier ] = previousQueryString ? previousQueryString.split( "?" )[ 1 ] : null;
- query[ pageConfig.nextIdentifier ] = nextQueryString ? nextQueryString.split( "?" )[ 1 ] : null;
- }
-
- return query;
- };
-
- this.bodyPageParser = function( body ) {
- var query = {},
- pagingMetadata = {};
-
- if ( pageConfig.parameterProvider ) {
- pagingMetadata = pageConfig.parameterProvider( body );
-
- query[ pageConfig.previousIdentifier ] = pagingMetadata[ pageConfig.previousIdentifier ];
- query[ pageConfig.nextIdentifier ] = pagingMetadata[ pageConfig.nextIdentifier ];
- } else {
- query[ pageConfig.previousIdentifier ] = body[ pageConfig.previousIdentifier ];
- query[ pageConfig.nextIdentifier ] = body[ pageConfig.nextIdentifier ];
- }
-
- return query;
- };
-
- this.formatJSONError = function( xhr ) {
- if ( this.getAjaxSettings().dataType === "json" ) {
- try {
- xhr.responseJSON = JSON.parse( xhr.responseText );
- } catch( error ) {
- // Response was not JSON formatted
- }
- }
- return xhr;
- };
- };
-
- // Public Methods
- /**
- Reads data from the specified endpoint
- @param {Object} [options={}] - Additional options
- @param {Function} [options.complete] - a callback to be called when the result of the request to the server is complete, regardless of success
- @param {Function} [options.error] - a callback to be called when the request to the server results in an error
- @param {Object} [options.id] - the value to append to the endpoint URL, should be the same as the pipelines recordId
- @param {Mixed} [options.jsonp] - Turns jsonp on/off for reads, Set to true, or an object with options
- @param {String} [options.jsonp.callback] - Override the callback function name in a jsonp request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url
- @param {String} [options.jsonp.customCallback] - Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery
- @param {Number} [options.limitValue=10] - the maximum number of results the server should return when using a paged pipe
- @param {String} [options.offsetValue="0"] - the offset of the first element that should be included in the returned collection when using a paged pipe
- @param {Object|Boolean} [options.paging] - this object can be used to overwrite the default paging parameters to request data from other pages or completely customize the paging functionality, leaving undefined will cause paging to use defaults, setting to false will turn off paging and request all data for this single read request
- @param {Object} [options.query] - a hash of key/value pairs that can be passed to the server as additional information for use when determining what data to return
- @param {Object} [options.statusCode] - a collection of status codes and callbacks to fire when the request to the server returns on of those codes. For more info see the statusCode option on the <a href="http://api.jquery.com/jQuery.ajax/">jQuery.ajax page</a>.
- @param {Function} [options.success] - a callback to be called when the result of the request to the server is successful
- @returns {Object} A deferred implementing the promise interface similar to the jqXHR created by jQuery.ajax
- @example
- var myPipe = AeroGear.Pipeline( "tasks" ).pipes[ 0 ];
-
- // Get a set of key/value pairs of all data on the server associated with this pipe
- var allData = myPipe.read();
-
- // A data object can be passed to filter the data and in the case of REST,
- // this object is converted to query string parameters which the server can use.
- // The values would be determined by what the server is expecting
- var filteredData = myPipe.read({
- query: {
- limit: 10,
- date: "2012-08-01"
- ...
- }
- });
- */
- AeroGear.Pipeline.adapters.Rest.prototype.read = function( options ) {
- var url, success, error, extraOptions,
- that = this,
- recordId = this.getRecordId(),
- ajaxSettings = this.getAjaxSettings(),
- pageConfig = this.getPageConfig();
-
- options = options ? options : {};
- options.query = options.query ? options.query : {};
-
- if ( options[ recordId ] ) {
- url = ajaxSettings.url + "/" + options[ recordId ];
- } else {
- url = ajaxSettings.url;
- }
-
- // Handle paging
- if ( pageConfig && options.paging !== false ) {
- // Set custom paging to defaults if not used
- if ( !options.paging ) {
- options.paging = {
- offset: options.offsetValue || 0,
- limit: options.limitValue || 10
- };
- }
-
- // Apply paging to request
- options.query = options.query || {};
- for ( var item in options.paging ) {
- options.query[ item ] = options.paging[ item ];
- }
- }
-
- success = function( data, textStatus, jqXHR ) {
- var paramMap;
-
- // Generate paged response
- if ( pageConfig && options.paging !== false ) {
- paramMap = that[ pageConfig.metadataLocation + "PageParser" ]( pageConfig.metadataLocation === "body" ? data : jqXHR );
-
- [ "previous", "next" ].forEach( function( element ) {
- data[ element ] = (function( pipe, parameters, options ) {
- return function( callbacks ) {
- options.paging = true;
- options.offsetValue = options.limitValue = undefined;
- options.query = parameters;
- options.success = callbacks && callbacks.success ? callbacks.success : options.success;
- options.error = callbacks && callbacks.error ? callbacks.error : options.error;
-
- return pipe.read( options );
- };
- })( that, paramMap[ pageConfig[ element + "Identifier" ] ], options );
- });
- }
-
- if ( options.success ) {
- options.success.apply( this, arguments );
- }
- };
- error = function( jqXHR, textStatus, errorThrown ) {
- jqXHR = that.formatJSONError( jqXHR );
- if ( options.error ) {
- options.error.apply( this, arguments );
- }
- };
- extraOptions = {
- type: "GET",
- data: options.query,
- success: success,
- error: error,
- url: url,
- statusCode: options.statusCode,
- complete: options.complete,
- headers: options.headers
- };
-
- if( options.jsonp ) {
- extraOptions.dataType = "jsonp";
- extraOptions.jsonp = options.jsonp.callback ? options.jsonp.callback : "callback";
- if( options.jsonp.customCallback ) {
- extraOptions.jsonpCallback = options.jsonp.customCallback;
- }
- }
-
- return $.ajax( this.addAuthIdentifier( $.extend( {}, this.getAjaxSettings(), extraOptions ) ) );
- };
-
- /**
- Save data asynchronously to the server. If this is a new object (doesn't have a record identifier provided by the server), the data is created on the server (POST) and then that record is sent back to the client including the new server-assigned id, otherwise, the data on the server is updated (PUT).
- @param {Object} data - For new data, this will be an object representing the data to be saved to the server. For updating data, a hash of key/value pairs one of which must be the `recordId` you set during creation of the pipe representing the identifier the server will use to update this record and then any other number of pairs representing the data. The data object is then stringified and passed to the server to be processed.
- @param {Object} [options={}] - Additional options
- @param {Function} [options.complete] - a callback to be called when the result of the request to the server is complete, regardless of success
- @param {Function} [options.error] - a callback to be called when the request to the server results in an error
- @param {Object} [options.statusCode] - a collection of status codes and callbacks to fire when the request to the server returns on of those codes. For more info see the statusCode option on the <a href="http://api.jquery.com/jQuery.ajax/">jQuery.ajax page</a>.
- @param {Function} [options.success] - a callback to be called when the result of the request to the server is successful
- @returns {Object} A deferred implementing the promise interface similar to the jqXHR created by jQuery.ajax
- @example
- var myPipe = AeroGear.Pipeline( "tasks" ).pipes[ 0 ];
-
- // Store a new task
- myPipe.save({
- title: "Created Task",
- date: "2012-07-13",
- ...
- });
-
- // Pass a success and error callback, in this case using the REST pipe and jQuery.ajax so the functions take the same parameters.
- myPipe.save({
- title: "Another Created Task",
- date: "2012-07-13",
- ...
- },
- {
- success: function( data, textStatus, jqXHR ) {
- console.log( "Success" );
- },
- error: function( jqXHR, textStatus, errorThrown ) {
- console.log( "Error" );
- }
- });
-
- // Update an existing piece of data
- var toUpdate = myPipe.data[ 0 ];
- toUpdate.data.title = "Updated Task";
- myPipe.save( toUpdate );
- */
- AeroGear.Pipeline.adapters.Rest.prototype.save = function( data, options ) {
- var that = this,
- recordId = this.getRecordId(),
- ajaxSettings = this.getAjaxSettings(),
- type,
- url,
- success,
- error,
- extraOptions;
-
- data = data || {};
- options = options || {};
- type = data[ recordId ] ? "PUT" : "POST";
-
- if ( data[ recordId ] ) {
- url = ajaxSettings.url + "/" + data[ recordId ];
- } else {
- url = ajaxSettings.url;
- }
-
- success = function( data, textStatus, jqXHR ) {
- if ( options.success ) {
- options.success.apply( this, arguments );
- }
- };
- error = function( jqXHR, textStatus, errorThrown ) {
- jqXHR = that.formatJSONError( jqXHR );
- if ( options.error ) {
- options.error.apply( this, arguments );
- }
- };
- extraOptions = $.extend( {}, ajaxSettings, {
- data: data,
- type: type,
- url: url,
- success: success,
- error: error,
- statusCode: options.statusCode,
- complete: options.complete,
- headers: options.headers
- });
-
- // Stringify data if we actually want to POST/PUT JSON data
- if ( extraOptions.contentType === "application/json" && extraOptions.data && typeof extraOptions.data !== "string" ) {
- extraOptions.data = JSON.stringify( extraOptions.data );
- }
-
- return $.ajax( this.addAuthIdentifier( $.extend( {}, this.getAjaxSettings(), extraOptions ) ) );
- };
-
- /**
- Remove data asynchronously from the server. Passing nothing will inform the server to remove all data at this pipe's endpoint.
- @param {String|Object} [data] - A variety of objects can be passed to specify the item(s) to remove
- @param {Object} [options={}] - Additional options
- @param {Function} [options.complete] - a callback to be called when the result of the request to the server is complete, regardless of success
- @param {Function} [options.error] - a callback to be called when the request to the server results in an error
- @param {Object} [options.statusCode] - a collection of status codes and callbacks to fire when the request to the server returns on of those codes. For more info see the statusCode option on the <a href="http://api.jquery.com/jQuery.ajax/">jQuery.ajax page</a>.
- @param {Function} [options.success] - a callback to be called when the result of the request to the server is successful
- @returns {Object} A deferred implementing the promise interface similar to the jqXHR created by jQuery.ajax
- @example
- var myPipe = AeroGear.Pipeline( "tasks" ).pipes[ 0 ];
-
- // Store a new task
- myPipe.save({
- title: "Created Task"
- });
-
- // Store another new task
- myPipe.save({
- title: "Another Created Task"
- });
-
- // Store one more new task
- myPipe.save({
- title: "And Another Created Task"
- });
-
- // Remove a particular item from the server by its id
- var toRemove = myPipe.data[ 0 ];
- myPipe.remove( toRemove.id );
-
- // Remove an item from the server using the data object
- toRemove = myPipe.data[ 0 ];
- myPipe.remove( toRemove );
-
- // Delete all remaining data from the server associated with this pipe
- myPipe.remove();
- */
- AeroGear.Pipeline.adapters.Rest.prototype.remove = function( toRemove, options ) {
- var that = this,
- recordId = this.getRecordId(),
- ajaxSettings = this.getAjaxSettings(),
- delPath = "",
- delId,
- url,
- success,
- error,
- extraOptions;
-
- if ( typeof toRemove === "string" || typeof toRemove === "number" ) {
- delId = toRemove;
- } else if ( toRemove && toRemove[ recordId ] ) {
- delId = toRemove[ recordId ];
- } else if ( toRemove && !options ) {
- // No remove item specified so treat as options
- options = toRemove;
- }
-
- options = options || {};
-
- delPath = delId ? "/" + delId : "";
- url = ajaxSettings.url + delPath;
-
- success = function( data, textStatus, jqXHR ) {
- if ( options.success ) {
- options.success.apply( this, arguments );
- }
- };
- error = function( jqXHR, textStatus, errorThrown ) {
- jqXHR = that.formatJSONError( jqXHR );
- if ( options.error ) {
- options.error.apply( this, arguments );
- }
- };
- extraOptions = {
- type: "DELETE",
- url: url,
- success: success,
- error: error,
- statusCode: options.statusCode,
- complete: options.complete,
- headers: options.headers
- };
-
- return $.ajax( this.addAuthIdentifier( $.extend( {}, ajaxSettings, extraOptions ) ) );
- };
-})( AeroGear, jQuery, uuid );
-
-(function( AeroGear, $, undefined ) {
- /**
- A collection of data connections (stores) and their corresponding data models. This object provides a standard way to interact with client side data no matter the data format or storage mechanism used.
- @class
- @augments AeroGear.Core
- @param {String|Array|Object} [config] - A configuration for the store(s) being created along with the DataManager. If an object or array containing objects is used, the objects can have the following properties:
- @param {String} config.name - the name that the store will later be referenced by
- @param {String} [config.type="memory"] - the type of store as determined by the adapter used
- @param {String} [config.recordId="id"] - the identifier used to denote the unique id for each record in the data associated with this store
- @param {Object} [config.settings={}] - the settings to be passed to the adapter
- @returns {object} dataManager - The created DataManager containing any stores that may have been created
- @example
- // Create an empty DataManager
- var dm = AeroGear.DataManager();
-
- // Create a single store using the default adapter
- var dm2 = AeroGear.DataManager( "tasks" );
-
- // Create multiple stores using the default adapter
- var dm3 = AeroGear.DataManager( [ "tasks", "projects" ] );
- */
- AeroGear.DataManager = function( config ) {
- // Allow instantiation without using new
- if ( !( this instanceof AeroGear.DataManager ) ) {
- return new AeroGear.DataManager( config );
- }
-
- // Super Constructor
- AeroGear.Core.call( this );
-
- this.lib = "DataManager";
- this.type = config ? config.type || "Memory" : "Memory";
-
- /**
- The name used to reference the collection of data store instances created from the adapters
- @memberOf AeroGear.DataManager
- @type Object
- @default stores
- */
- this.collectionName = "stores";
-
- this.add( config );
- };
-
- AeroGear.DataManager.prototype = AeroGear.Core;
- AeroGear.DataManager.constructor = AeroGear.DataManager;
-
- /**
- The adapters object is provided so that adapters can be added to the AeroGear.DataManager namespace dynamically and still be accessible to the add method
- @augments AeroGear.DataManager
- */
- AeroGear.DataManager.adapters = {};
-
- // Constants
- AeroGear.DataManager.STATUS_NEW = 1;
- AeroGear.DataManager.STATUS_MODIFIED = 2;
- AeroGear.DataManager.STATUS_REMOVED = 0;
-})( AeroGear, jQuery );
-
-(function( AeroGear, $, uuid, undefined ) {
- /**
- The Memory adapter is the default type used when creating a new store. Data is simply stored in a data var and is lost on unload (close window, leave page, etc.)
- @constructs AeroGear.DataManager.adapters.Memory
- @param {String} storeName - the name used to reference this particular store
- @param {Object} [settings={}] - the settings to be passed to the adapter
- @param {String} [settings.recordId="id"] - the name of the field used to uniquely identify a "record" in the data
- @returns {Object} The created store
- */
- AeroGear.DataManager.adapters.Memory = function( storeName, settings ) {
- // Allow instantiation without using new
- if ( !( this instanceof AeroGear.DataManager.adapters.Memory ) ) {
- return new AeroGear.DataManager.adapters.Memory( storeName, settings );
- }
-
- settings = settings || {};
-
- // Private Instance vars
- var recordId = settings.recordId ? settings.recordId : "id",
- type = "Memory",
- data = null;
-
- // Privileged Methods
- /**
- Returns the value of the private recordId var
- @private
- @augments Memory
- @returns {String}
- */
- this.getRecordId = function() {
- return recordId;
- };
-
- /**
- Returns the value of the private data var
- @private
- @augments Memory
- @returns {Array}
- */
- this.getData = function() {
- return data;
- };
-
- /**
- Sets the value of the private data var
- @private
- @augments Memory
- */
- this.setData = function( newData ) {
- data = newData;
- };
-
- /**
- Empties the value of the private data var
- @private
- @augments Memory
- */
- this.emptyData = function() {
- data = null;
- };
-
- /**
- Adds a record to the store's data set
- @private
- @augments Memory
- */
- this.addDataRecord = function( record ) {
- data = data || [];
- data.push( record );
- };
-
- /**
- Adds a record to the store's data set
- @private
- @augments Memory
- */
- this.updateDataRecord = function( index, record ) {
- data[ index ] = record;
- };
-
- /**
- Removes a single record from the store's data set
- @private
- @augments Memory
- */
- this.removeDataRecord = function( index ) {
- data.splice( index, 1 );
- };
-
- /**
- Little utility used to compare nested object values in the filter method
- @private
- @augments Memory
- @param {String} nestedKey - Filter key to test
- @param {Object} nestedFilter - Filter object to test
- @param {Object} nestedValue - Value object to test
- @returns {Boolean}
- */
- this.traverseObjects = function( nestedKey, nestedFilter, nestedValue ) {
- while ( typeof nestedFilter === "object" ) {
- if ( nestedValue ) {
- // Value contains this key so continue checking down the object tree
- nestedKey = Object.keys( nestedFilter )[ 0 ];
- nestedFilter = nestedFilter[ nestedKey ];
- nestedValue = nestedValue[ nestedKey ];
- } else {
- break;
- }
- }
- if ( nestedFilter === nestedValue ) {
- return true;
- } else {
- return false;
- }
- };
- };
-
- // Public Methods
- /**
- Read data from a store
- @param {String|Number} [id] - Usually a String or Number representing a single "record" in the data set or if no id is specified, all data is returned
- @returns {Array} Returns data from the store, optionally filtered by an id
- @example
- var dm = AeroGear.DataManager( "tasks" ).stores[ 0 ];
-
- // Get an array of all data in the store
- var allData = dm.read();
- */
- AeroGear.DataManager.adapters.Memory.prototype.read = function( id ) {
- var filter = {};
- filter[ this.getRecordId() ] = id;
- return id ? this.filter( filter ) : this.getData();
- };
-
- /**
- Saves data to the store, optionally clearing and resetting the data
- @param {Object|Array} data - An object or array of objects representing the data to be saved to the server. When doing an update, one of the key/value pairs in the object to update must be the `recordId` you set during creation of the store representing the unique identifier for a "record" in the data set.
- @param {Boolean} [reset] - If true, this will empty the current data and set it to the data being saved
- @returns {Array} Returns the updated data from the store
- @example
- var dm = AeroGear.DataManager( "tasks" ).stores[ 0 ];
-
- // Store a new task
- dm.save({
- title: "Created Task",
- date: "2012-07-13",
- ...
- });
-
- // Update an existing piece of data
- var toUpdate = dm.read()[ 0 ];
- toUpdate.data.title = "Updated Task";
- dm.save( toUpdate );
- */
- AeroGear.DataManager.adapters.Memory.prototype.save = function( data, reset ) {
- var itemFound = false;
-
- data = AeroGear.isArray( data ) ? data : [ data ];
-
- if ( reset ) {
- this.setData( data );
- } else {
- if ( this.getData() ) {
- for ( var i = 0; i < data.length; i++ ) {
- for( var item in this.getData() ) {
- if ( this.getData()[ item ][ this.getRecordId() ] === data[ i ][ this.getRecordId() ] ) {
- this.updateDataRecord( item, data[ i ] );
- itemFound = true;
- break;
- }
- }
- if ( !itemFound ) {
- this.addDataRecord( data[ i ] );
- }
-
- itemFound = false;
- }
- } else {
- this.setData( data );
- }
- }
-
- return this.getData();
- };
-
- /**
- Removes data from the store
- @param {String|Object|Array} toRemove - A variety of objects can be passed to remove to specify the item or if nothing is provided, all data is removed
- @returns {Array} Returns the updated data from the store
- @example
- var dm = AeroGear.DataManager( "tasks" ).stores[ 0 ];
-
- // Store a new task
- dm.save({
- title: "Created Task"
- });
-
- // Store another new task
- dm.save({
- title: "Another Created Task"
- });
-
- // Store one more new task
- dm.save({
- title: "And Another Created Task"
- });
-
- // Remove a particular item from the store by its id
- var toRemove = dm.read()[ 0 ];
- dm.remove( toRemove.id );
-
- // Remove an item from the store using the data object
- toRemove = dm.read()[ 0 ];
- dm.remove( toRemove );
-
- // Delete all remaining data from the store
- dm.remove();
- */
- AeroGear.DataManager.adapters.Memory.prototype.remove = function( toRemove ) {
- if ( !toRemove ) {
- // empty data array and return
- this.emptyData();
- return this.getData();
- } else {
- toRemove = AeroGear.isArray( toRemove ) ? toRemove : [ toRemove ];
- }
- var delId,
- data,
- item;
-
- for ( var i = 0; i < toRemove.length; i++ ) {
- if ( typeof toRemove[ i ] === "string" || typeof toRemove[ i ] === "number" ) {
- delId = toRemove[ i ];
- } else if ( toRemove ) {
- delId = toRemove[ i ][ this.getRecordId() ];
- } else {
- // Missing record id so just skip this item in the arrray
- continue;
- }
-
- data = this.getData( true );
- for( item in data ) {
- if ( data[ item ][ this.getRecordId() ] === delId ) {
- this.removeDataRecord( item );
- }
- }
- }
-
- return this.getData();
- };
-
- /**
- Filter the current store's data
- @param {Object} [filterParameters] - An object containing key value pairs on which to filter the store's data. To filter a single parameter on multiple values, the value can be an object containing a data key with an Array of values to filter on and its own matchAny key that will override the global matchAny for that specific filter parameter.
- @param {Boolean} [matchAny] - When true, an item is included in the output if any of the filter parameters is matched.
- @returns {Array} Returns a filtered array of data objects based on the contents of the store's data object and the filter parameters. This method only returns a copy of the data and leaves the original data object intact.
- @example
- var dm = AeroGear.DataManager( "tasks" ).stores[ 0 ];
-
- // An object can be passed to filter the data
- var filteredData = dm.filter({
- date: "2012-08-01"
- ...
- });
- */
- AeroGear.DataManager.adapters.Memory.prototype.filter = function( filterParameters, matchAny ) {
- var filtered, key, j, k, l, nestedKey, nestedFilter, nestedValue,
- that = this;
-
- if ( !filterParameters ) {
- filtered = this.getData() || [];
- return filtered;
- }
-
- filtered = this.getData().filter( function( value, index, array) {
- var match = matchAny ? false : true,
- keys = Object.keys( filterParameters ),
- filterObj, paramMatch, paramResult;
-
- for ( key = 0; key < keys.length; key++ ) {
- if ( filterParameters[ keys[ key ] ].data ) {
- // Parameter value is an object
- filterObj = filterParameters[ keys[ key ] ];
- paramResult = filterObj.matchAny ? false : true;
-
- for ( j = 0; j < filterObj.data.length; j++ ) {
- if( AeroGear.isArray( value[ keys[ key ] ] ) ) {
- if( value[ keys [ key ] ].length ) {
- if( $( value[ keys ] ).not( filterObj.data ).length === 0 && $( filterObj.data ).not( value[ keys ] ).length === 0 ) {
- paramResult = true;
- break;
- } else {
- for( k = 0; k < value[ keys[ key ] ].length; k++ ) {
- if ( filterObj.matchAny && filterObj.data[ j ] === value[ keys[ key ] ][ k ] ) {
- // At least one value must match and this one does so return true
- paramResult = true;
- if( matchAny ) {
- break;
- } else {
- for( l = 0; l < value[ keys[ key ] ].length; l++ ) {
- if( !matchAny && filterObj.data[ j ] !== value[ keys[ key ] ][ l ] ) {
- // All must match but this one doesn't so return false
- paramResult = false;
- break;
- }
- }
- }
- }
- if ( !filterObj.matchAny && filterObj.data[ j ] !== value[ keys[ key ] ][ k ] ) {
- // All must match but this one doesn't so return false
- paramResult = false;
- break;
- }
- }
- }
- } else {
- paramResult = false;
- }
- } else {
- if ( typeof filterObj.data[ j ] === "object" ) {
- if ( filterObj.matchAny && that.traverseObjects( keys[ key ], filterObj.data[ j ], value[ keys[ key ] ] ) ) {
- // At least one value must match and this one does so return true
- paramResult = true;
- break;
- }
- if ( !filterObj.matchAny && !that.traverseObjects( keys[ key ], filterObj.data[ j ], value[ keys[ key ] ] ) ) {
- // All must match but this one doesn't so return false
- paramResult = false;
- break;
- }
- } else {
- if ( filterObj.matchAny && filterObj.data[ j ] === value[ keys[ key ] ] ) {
- // At least one value must match and this one does so return true
- paramResult = true;
- break;
- }
- if ( !filterObj.matchAny && filterObj.data[ j ] !== value[ keys[ key ] ] ) {
- // All must match but this one doesn't so return false
- paramResult = false;
- break;
- }
- }
- }
- }
- } else {
- // Filter on parameter value
- if( AeroGear.isArray( value[ keys[ key ] ] ) ) {
- paramResult = matchAny ? false: true;
-
- if( value[ keys[ key ] ].length ) {
- for(j = 0; j < value[ keys[ key ] ].length; j++ ) {
- if( matchAny && filterParameters[ keys[ key ] ] === value[ keys[ key ] ][ j ] ) {
- //at least one must match and this one does so return true
- paramResult = true;
- break;
- }
- if( !matchAny && filterParameters[ keys[ key ] ] !== value[ keys[ key ] ][ j ] ) {
- //All must match but this one doesn't so return false
- paramResult = false;
- break;
- }
- }
- } else {
- paramResult = false;
- }
- } else {
- if ( typeof filterParameters[ keys[ key ] ] === "object" ) {
- paramResult = that.traverseObjects( keys[ key ], filterParameters[ keys[ key ] ], value[ keys[ key ] ] );
- } else {
- paramResult = filterParameters[ keys[ key ] ] === value[ keys[ key ] ] ? true : false;
- }
- }
- }
-
- if ( matchAny && paramResult ) {
- // At least one item must match and this one does so return true
- match = true;
- break;
- }
- if ( !matchAny && !paramResult ) {
- // All must match but this one doesn't so return false
- match = false;
- break;
- }
- }
-
- return match;
- });
-
- return filtered;
- };
-})( AeroGear, jQuery, uuid );
-
-(function( AeroGear, $, uuid, undefined ) {
- /**
- The SessionLocal adapter extends the Memory adapter to store data in either session or local storage which makes it a little more persistent than memory
- @constructs AeroGear.DataManager.adapters.SessionLocal
- @mixes AeroGear.DataManager.adapters.Memory
- @param {String} storeName - the name used to reference this particular store
- @param {Object} [settings={}] - the settings to be passed to the adapter
- @param {String} [settings.recordId="id"] - the name of the field used to uniquely identify a "record" in the data
- @param {String} [settings.storageType="sessionStorage"] - the type of store can either be sessionStorage or localStorage
- @returns {Object} The created store
- */
- AeroGear.DataManager.adapters.SessionLocal = function( storeName, settings ) {
- // Allow instantiation without using new
- if ( !( this instanceof AeroGear.DataManager.adapters.SessionLocal ) ) {
- return new AeroGear.DataManager.adapters.SessionLocal( storeName, settings );
- }
-
- AeroGear.DataManager.adapters.Memory.apply( this, arguments );
-
- // Private Instance vars
- var data = null,
- type = "SessionLocal",
- storeType = settings.storageType || "sessionStorage",
- name = storeName,
- appContext = document.location.pathname.replace(/[\/\.]/g,"-"),
- storeKey = name + appContext,
- currentData = JSON.parse( window[ storeType ].getItem( storeKey ) );
-
- // Initialize data from the persistent store if it exists
- if ( currentData ) {
- AeroGear.DataManager.adapters.Memory.prototype.save.call( this, currentData, true );
- }
-
- // Privileged Methods
- /**
- Returns the value of the private storeType var
- @private
- @augments SessionLocal
- @returns {String}
- */
- this.getStoreType = function() {
- return storeType;
- };
-
- /**
- Returns the value of the private storeKey var
- @private
- @augments SessionLocal
- @returns {String}
- */
- this.getStoreKey = function() {
- return storeKey;
- };
- };
-
- // Inherit from the Memory adapter
- AeroGear.DataManager.adapters.SessionLocal.prototype = Object.create( new AeroGear.DataManager.adapters.Memory(), {
- // Public Methods
- save: {
- value: function( data, options ) {
- // Call the super method
- var reset = options && options.reset ? options.reset : false,
- oldData = window[ this.getStoreType() ].getItem( this.getStoreKey() ),
- newData = AeroGear.DataManager.adapters.Memory.prototype.save.apply( this, [ arguments[ 0 ], reset ] );
-
- // Sync changes to persistent store
- try {
- window[ this.getStoreType() ].setItem( this.getStoreKey(), JSON.stringify( newData ) );
- if ( options && options.storageSuccess ) {
- options.storageSuccess( newData );
- }
- } catch( error ) {
- oldData = oldData ? JSON.parse( oldData ) : [];
- newData = AeroGear.DataManager.adapters.Memory.prototype.save.apply( this, [ oldData, true ] );
- if ( options && options.storageError ) {
- options.storageError( error, data );
- } else {
- throw error;
- }
- }
-
- return newData;
- }, enumerable: true, configurable: true, writable: true
- },
- remove: {
- value: function( toRemove ) {
- // Call the super method
- var newData = AeroGear.DataManager.adapters.Memory.prototype.remove.apply( this, arguments );
-
- // Sync changes to persistent store
- window[ this.getStoreType() ].setItem( this.getStoreKey(), JSON.stringify( newData ) );
-
- return newData;
- }, enumerable: true, configurable: true, writable: true
- }
- });
-})( AeroGear, jQuery, uuid );
-
-(function( AeroGear, $, undefined ) {
- /**
- The AeroGear.Auth namespace provides an authentication and enrollment API. Through the use of adapters, this library provides common methods like enroll, login and logout that will just work.
- @class
- @augments AeroGear.Core
- @param {String|Array|Object} [config] - A configuration for the modules(s) being created along with the authenticator. If an object or array containing objects is used, the objects can have the following properties:
- @param {String} config.name - the name that the module will later be referenced by
- @param {String} [config.type="rest"] - the type of module as determined by the adapter used
- @param {Object} [config.settings={}] - the settings to be passed to the adapter
- @returns {Object} The created authenticator containing any auth modules that may have been created
- @example
- // Create an empty authenticator
- var auth = AeroGear.Auth();
-
- // Create a single module using the default adapter
- var auth2 = AeroGear.Auth( "myAuth" );
-
- // Create multiple modules using the default adapter
- var auth3 = AeroGear.Auth( [ "someAuth", "anotherAuth" ] );
- */
- AeroGear.Auth = function( config ) {
- // Allow instantiation without using new
- if ( !( this instanceof AeroGear.Auth ) ) {
- return new AeroGear.Auth( config );
- }
- // Super Constructor
- AeroGear.Core.call( this );
-
- this.lib = "Auth";
- this.type = config ? config.type || "Rest" : "Rest";
-
- /**
- The name used to reference the collection of authentication module instances created from the adapters
- @memberOf AeroGear.Auth
- @type Object
- @default modules
- */
- this.collectionName = "modules";
-
- this.add( config );
- };
-
- AeroGear.Auth.prototype = AeroGear.Core;
- AeroGear.Auth.constructor = AeroGear.Auth;
-
- /**
- The adapters object is provided so that adapters can be added to the AeroGear.Auth namespace dynamically and still be accessible to the add method
- @augments AeroGear.Auth
- */
- AeroGear.Auth.adapters = {};
-})( AeroGear, jQuery );
-
-(function( AeroGear, $, undefined ) {
- /**
- The REST adapter is the default type used when creating a new authentication module. It uses jQuery.ajax to communicate with the server.
- @constructs AeroGear.Auth.adapters.Rest
- @param {String} moduleName - the name used to reference this particular auth module
- @param {Object} [settings={}] - the settings to be passed to the adapter
- @param {Boolean} [settings.agAuth] - True if this adapter should use AeroGear's token based authentication model
- @param {String} [settings.baseURL] - defines the base URL to use for an endpoint
- @param {Object} [settings.endpoints={}] - a set of REST endpoints that correspond to the different public methods including enroll, login and logout
- @param {String} [settings.tokenName="Auth-Token"] - defines the name used for the token header when using agAuth
- @returns {Object} The created auth module
- */
- AeroGear.Auth.adapters.Rest = function( moduleName, settings ) {
- // Allow instantiation without using new
- if ( !( this instanceof AeroGear.Auth.adapters.Rest ) ) {
- return new AeroGear.Auth.adapters.Rest( moduleName, settings );
- }
-
- settings = settings || {};
-
- // Private Instance vars
- var endpoints = settings.endpoints || {},
- type = "Rest",
- name = moduleName,
- agAuth = !!settings.agAuth,
- baseURL = settings.baseURL,
- tokenName = settings.tokenName || "Auth-Token";
-
- // Privileged methods
- /**
- Adds the auth token to the headers and returns the modified version of the settings
- @private
- @augments Rest
- @param {Object} settings - the settings object that will have the auth identifier added
- @returns {Object} Settings extended with auth identifier
- */
- this.addAuthIdentifier = function( settings ) {
- settings.headers = settings.headers ? settings.headers : {};
- settings.headers[ tokenName ] = sessionStorage.getItem( "ag-auth-" + name );
- return $.extend( {}, settings );
- };
-
- /**
- Removes the stored token effectively telling the client it must re-authenticate with the server
- @private
- @augments Rest
- */
- this.deauthorize = function() {
- sessionStorage.removeItem( "ag-auth-" + name );
- };
-
-
- /**
- Returns the value of the private settings var
- @private
- @augments Rest
- */
- this.getSettings = function() {
- return settings;
- };
-
-
- /**
- Returns the value of the private settings var
- @private
- @augments Rest
- */
- this.getEndpoints = function() {
- return endpoints;
- };
-
- /**
- Returns the value of the private name var
- @private
- @augments Rest
- */
- this.getName = function() {
- return name;
- };
-
- /**
- Returns the value of the private agAuth var which determines whether or not the AeroGear style authentication token should be used
- @private
- @augments Rest
- */
- this.getAGAuth = function() {
- return agAuth;
- };
-
- /**
- Returns the value of the private baseURL var
- @private
- @augments Rest
- */
- this.getBaseURL = function() {
- return baseURL;
- };
-
- /**
- Returns the value of the private tokenName var
- @private
- @augments Rest
- */
- this.getTokenName = function() {
- return tokenName;
- };
- };
-
- //Public Methods
- /**
- Enroll a new user in the authentication system
- @param {Object} data - User profile to enroll
- @param {Object} [options={}] - Options to pass to the enroll method
- @param {String} [options.baseURL] - defines the base URL to use for an endpoint
- @param {String} [options.contentType] - set the content type for the AJAX request (defaults to application/json when using agAuth)
- @param {String} [options.dataType] - specify the data expected to be returned by the server (defaults to json when using agAuth)
- @param {Function} [options.error] - callback to be executed if the AJAX request results in an error
- @param {Function} [options.success] - callback to be executed if the AJAX request results in success
- @returns {Object} The jqXHR created by jQuery.ajax
- @example
- var auth = AeroGear.Auth( "userAuth" ).modules[ 0 ],
- data = { userName: "user", password: "abc123", name: "John" };
-
- // Enroll a new user
- auth.enroll( data );
- */
- AeroGear.Auth.adapters.Rest.prototype.enroll = function( data, options ) {
- options = options || {};
-
- var that = this,
- name = this.getName(),
- tokenName = this.getTokenName(),
- baseURL = this.getBaseURL(),
- endpoints = this.getEndpoints(),
- agAuth = this.getAGAuth(),
- success = function( data, textStatus, jqXHR ) {
- sessionStorage.setItem( "ag-auth-" + name, that.getAGAuth() ? jqXHR.getResponseHeader( tokenName ) : "true" );
-
- if ( options.success ) {
- options.success.apply( this, arguments );
- }
- },
- error = function( jqXHR, textStatus, errorThrown ) {
- var args;
-
- try {
- jqXHR.responseJSON = JSON.parse( jqXHR.responseText );
- args = [ jqXHR, textStatus, errorThrown ];
- } catch( error ) {
- args = arguments;
- }
-
- if ( options.error ) {
- options.error.apply( this, args );
- }
- },
- extraOptions = {
- success: success,
- error: error,
- data: data
- },
- url = "";
-
- if ( options.contentType ) {
- extraOptions.contentType = options.contentType;
- } else if ( agAuth ) {
- extraOptions.contentType = "application/json";
- }
- if ( options.dataType ) {
- extraOptions.dataType = options.dataType;
- } else if ( agAuth ) {
- extraOptions.dataType = "json";
- }
- if ( options.baseURL ) {
- url = options.baseURL;
- } else if ( baseURL ) {
- url = baseURL;
- }
- if ( endpoints.enroll ) {
- url += endpoints.enroll;
- } else {
- url += "auth/enroll";
- }
- if ( url.length ) {
- extraOptions.url = url;
- }
-
- return $.ajax( $.extend( {}, this.getSettings(), { type: "POST" }, extraOptions ) );
- };
-
- /**
- Authenticate a user
- @param {Object} data - A set of key value pairs representing the user's credentials
- @param {Object} [options={}] - An object containing key/value pairs representing options
- @param {String} [options.baseURL] - defines the base URL to use for an endpoint
- @param {String} [options.contentType] - set the content type for the AJAX request (defaults to application/json when using agAuth)
- @param {String} [options.dataType] - specify the data expected to be returned by the server (defaults to json when using agAuth)
- @param {Function} [options.error] - callback to be executed if the AJAX request results in an error
- @param {String} [options.success] - callback to be executed if the AJAX request results in success
- @returns {Object} The jqXHR created by jQuery.ajax
- @example
- var auth = AeroGear.Auth( "userAuth" ).modules[ 0 ],
- data = { userName: "user", password: "abc123" };
-
- // Enroll a new user
- auth.login( data );
- */
- AeroGear.Auth.adapters.Rest.prototype.login = function( data, options ) {
- options = options || {};
-
- var that = this,
- name = this.getName(),
- tokenName = this.getTokenName(),
- baseURL = this.getBaseURL(),
- endpoints = this.getEndpoints(),
- agAuth = this.getAGAuth(),
- success = function( data, textStatus, jqXHR ) {
- sessionStorage.setItem( "ag-auth-" + name, that.getAGAuth() ? jqXHR.getResponseHeader( tokenName ) : "true" );
-
- if ( options.success ) {
- options.success.apply( this, arguments );
- }
- },
- error = function( jqXHR, textStatus, errorThrown ) {
- var args;
-
- try {
- jqXHR.responseJSON = JSON.parse( jqXHR.responseText );
- args = [ jqXHR, textStatus, errorThrown ];
- } catch( error ) {
- args = arguments;
- }
-
- if ( options.error ) {
- options.error.apply( this, args );
- }
- },
- extraOptions = {
- success: success,
- error: error,
- data: data
- },
- url = "";
-
- if ( options.contentType ) {
- extraOptions.contentType = options.contentType;
- } else if ( agAuth ) {
- extraOptions.contentType = "application/json";
- }
- if ( options.dataType ) {
- extraOptions.dataType = options.dataType;
- } else if ( agAuth ) {
- extraOptions.dataType = "json";
- }
- if ( options.baseURL ) {
- url = options.baseURL;
- } else if ( baseURL ) {
- url = baseURL;
- }
- if ( endpoints.login ) {
- url += endpoints.login;
- } else {
- url += "auth/login";
- }
- if ( url.length ) {
- extraOptions.url = url;
- }
-
- return $.ajax( $.extend( {}, this.getSettings(), { type: "POST" }, extraOptions ) );
- };
-
- /**
- End a user's authenticated session
- @param {Object} [options={}] - An object containing key/value pairs representing options
- @param {String} [options.baseURL] - defines the base URL to use for an endpoint
- @param {Function} [options.error] - callback to be executed if the AJAX request results in an error
- @param {String} [options.success] - callback to be executed if the AJAX request results in success
- @returns {Object} The jqXHR created by jQuery.ajax
- @example
- var auth = AeroGear.Auth( "userAuth" ).modules[ 0 ];
-
- // Enroll a new user
- auth.logout();
- */
- AeroGear.Auth.adapters.Rest.prototype.logout = function( options ) {
- options = options || {};
-
- var that = this,
- name = this.getName(),
- tokenName = this.getTokenName(),
- baseURL = this.getBaseURL(),
- endpoints = this.getEndpoints(),
- success = function( data, textStatus, jqXHR ) {
- that.deauthorize();
-
- if ( options.success ) {
- options.success.apply( this, arguments );
- }
- },
- error = function( jqXHR, textStatus, errorThrown ) {
- var args;
-
- try {
- jqXHR.responseJSON = JSON.parse( jqXHR.responseText );
- args = [ jqXHR, textStatus, errorThrown ];
- } catch( error ) {
- args = arguments;
- }
-
- if ( options.error ) {
- options.error.apply( this, args );
- }
- },
- extraOptions = {
- success: success,
- error: error
- },
- url = "";
-
- if ( options.baseURL ) {
- url = options.baseURL;
- } else if ( baseURL ) {
- url = baseURL;
- }
- if ( endpoints.logout ) {
- url += endpoints.logout;
- } else {
- url += "auth/logout";
- }
- if ( url.length ) {
- extraOptions.url = url;
- }
-
- extraOptions.headers = {};
- extraOptions.headers[ tokenName ] = sessionStorage.getItem( "ag-auth-" + name );
-
- return $.ajax( $.extend( {}, this.getSettings(), { type: "POST" }, extraOptions ) );
- };
-})( AeroGear, jQuery );
View
1  dist/aerogear.js.map
@@ -1 +0,0 @@
-{"version":3,"file":"dist/aerogear.min.js","sources":["dist/aerogear.js"],"names":["AeroGear","Core","this","add","config","i","current","collection","collectionName","lib","adapters","type","isArray","length","name","settings","remove","obj","toString","call","parse","s","buf","offset","ii","toLowerCase","replace","byte","_hexToByte","unparse","bth","_byteToHex","v1","options","b","clockseq","_clockseq","msecs","Date","getTime","nsecs","_lastNSecs","dt","_lastMSecs","Error","tl","tmh","node","_nodeId","n","v4","BufferClass","rnds","random","rng","_rng","mathRNG","nodeRNG","whatwgRNG","_global","_rndBytes","Array","r","Math","crypto","getRandomValues","_rnds","Uint32Array","c","_rb","require","randomBytes","e","Buffer","substr","_seedBytes","uuid","module","exports","_previousRoot","noConflict","Pipeline","prototype","constructor","jQuery","$","undefined","Rest","pipeName","endpoint","ajaxSettings","url","baseURL","contentType","dataType","recordId","authenticator","pageConfig","addAuthIdentifier","deauthorize","getAjaxSettings","getRecordId","getPageConfig","updatePageConfig","newConfig","reset","metadataLocation","previousIdentifier","nextIdentifier","parameterProvider","extend","webLinkingPageParser","jqXHR","linkAr","linksAr","currentLink","params","identifier","query","getResponseHeader","split","link","trim","item","indexOf","lastIndexOf","headerPageParser","previousQueryString","nextQueryString","pagingMetadata","bodyPageParser","body","formatJSONError","xhr","responseJSON","JSON","responseText","error","read","success","extraOptions","that","paging","offsetValue","limit","limitValue","data","textStatus","paramMap","forEach","element","pipe","parameters","callbacks","apply","arguments","statusCode","complete","headers","jsonp","callback","customCallback","jsonpCallback","ajax","save","stringify","toRemove","delId","delPath","DataManager","STATUS_NEW","STATUS_MODIFIED","STATUS_REMOVED","Memory","storeName","getData","setData","newData","emptyData","addDataRecord","record","push","updateDataRecord","index","removeDataRecord","splice","traverseObjects","nestedKey","nestedFilter","nestedValue","Object","keys","id","filter","itemFound","filterParameters","matchAny","filtered","key","j","k","l","value","filterObj","paramResult","match","not","SessionLocal","storeType","storageType","appContext","document","location","pathname","storeKey","currentData","window","getItem","getStoreType","getStoreKey","create","oldData","setItem","storageSuccess","storageError","enumerable","configurable","writable","Auth","moduleName","endpoints","agAuth","tokenName","sessionStorage","removeItem","getSettings","getEndpoints","getName","getAGAuth","getBaseURL","getTokenName","enroll","errorThrown","args","login","logout"],"mappings":"AAmBA,GAAIA,YAOJA,UAASC,KAAO,WAEZ,GAAKC,eAAgBF,UAASC,KAC1B,KAAM,mDASVC,MAAKC,IAAM,SAAWC,GAClB,GAAIC,GACAC,EACAC,EAAaL,KAAMA,KAAKM,mBAE5B,KAAMJ,EACF,MAAOF,KACJ,IAAuB,gBAAXE,GAEfG,EAAYH,GAAWJ,SAAUE,KAAKO,KAAMC,SAAUR,KAAKS,MAAQP,OAChE,IAAKJ,SAASY,QAASR,GAE1B,IAAMC,EAAI,EAAOD,EAAOS,OAAXR,EAAmBA,IAC5BC,EAAUF,EAAQC,GAEM,gBAAZC,GACRC,EAAYD,GAAYN,SAAUE,KAAKO,KAAMC,SAAUR,KAAKS,MAAQL,GAEpEC,EAAYD,EAAQQ,MAASd,SAAUE,KAAKO,KAAMC,SAAUJ,EAAQK,MAAQT,KAAKS,MAAQL,EAAQQ,KAAMR,EAAQS,kBAKvHR,GAAYH,EAAOU,MAASd,SAAUE,KAAKO,KAAMC,SAAUN,EAAOO,MAAQT,KAAKS,MAAQP,EAAOU,KAAMV,EAAOW,aAM/G,OAFAb,MAAMA,KAAKM,gBAAmBD,EAEvBL,MAQXA,KAAKc,OAAS,SAAUZ,GACpB,G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AMiB,MAAOxJ,KAAMiP,IAGnCvG,GACID,QAASA,EACTF,MAAOA,GAEX9C,EAAM,EAmBV,OAjBK1D,GAAQ2D,QACTD,EAAM1D,EAAQ2D,QACNA,IACRD,EAAMC,GAGND,GADC2I,EAAUe,OACJf,EAAUe,OAEV,cAEN1J,EAAI9E,SACL+H,EAAajD,IAAMA,GAGvBiD,EAAakB,WACblB,EAAakB,QAAS0E,GAAcC,eAAehB,QAAS,WAAa3M,GAElEuE,EAAE8E,KAAM9E,EAAEyB,UAAY5G,KAAKyO,eAAiBhO,KAAM,QAAUiI,MAEvE5I,SAAUoF"}
View
17 dist/aerogear.min.js
@@ -1,17 +0,0 @@
-/*! AeroGear JavaScript Library - v1.0.0-M3 - 2013-02-15
-* https://github.com/aerogear/aerogear-js
-* JBoss, Home of Professional Open Source
-* Copyright Red Hat, Inc., and individual contributors
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-* http://www.apache.org/licenses/LICENSE-2.0
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-var AeroGear={};AeroGear.Core=function(){if(this instanceof AeroGear.Core)throw"Invalid instantiation of base class AeroGear.Core";this.add=function(e){var t,r,a=this[this.collectionName]||{};if(!e)return this;if("string"==typeof e)a[e]=AeroGear[this.lib].adapters[this.type](e);else if(AeroGear.isArray(e))for(t=0;e.length>t;t++)r=e[t],"string"==typeof r?a[r]=AeroGear[this.lib].adapters[this.type](r):a[r.name]=AeroGear[this.lib].adapters[r.type||this.type](r.name,r.settings||{});else a[e.name]=AeroGear[this.lib].adapters[e.type||this.type](e.name,e.settings||{});return this[this.collectionName]=a,this},this.remove=function(e){var t,r,a=this[this.collectionName]||{};if("string"==typeof e)delete a[e];else if(AeroGear.isArray(e))for(t=0;e.length>t;t++)r=e[t],"string"==typeof r?delete a[r]:delete a[r.name];else e&&delete a[e.name];return this[this.collectionName]=a,this}},AeroGear.isArray=function(e){return"[object Array]"==={}.toString.call(e)},function(){function e(e,t,r){var a=t&&r||0,n=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){16>n&&(t[a+n++]=l[e])});16>n;)t[a+n++]=0;return t}function t(e,t){var r=t||0,a=g;return a[e[r++]]+a[e[r++]]+a[e[r++]]+a[e[r++]]+"-"+a[e[r++]]+a[e[r++]]+"-"+a[e[r++]]+a[e[r++]]+"-"+a[e[r++]]+a[e[r++]]+"-"+a[e[r++]]+a[e[r++]]+a[e[r++]]+a[e[r++]]+a[e[r++]]+a[e[r++]]}function r(e,r,a){var n=r&&a||0,i=r||[];e=e||{};var s=null!=e.clockseq?e.clockseq:A,o=null!=e.msecs?e.msecs:(new Date).getTime(),u=null!=e.nsecs?e.nsecs:S+1,c=o-b+(u-S)/1e4;if(0>c&&null==e.clockseq&&(s=16383&s+1),(0>c||o>b)&&null==e.nsecs&&(u=0),u>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");b=o,S=u,A=s,o+=122192928e5;var p=(1e4*(268435455&o)+u)%4294967296;i[n++]=255&p>>>24,i[n++]=255&p>>>16,i[n++]=255&p>>>8,i[n++]=255&p;var d=268435455&1e4*(o/4294967296);i[n++]=255&d>>>8,i[n++]=255&d,i[n++]=16|15&d>>>24,i[n++]=255&d>>>16,i[n++]=128|s>>>8,i[n++]=255&s;for(var h=e.node||v,f=0;6>f;f++)i[n+f]=h[f];return r?r:t(i)}function a(e,r,a){var n=r&&a||0;"string"==typeof e&&(r="binary"==e?new f(16):null,e=null),e=e||{};var i=e.random||(e.rng||h)();if(i[6]=64|15&i[6],i[8]=128|63&i[8],r)for(var s=0;16>s;s++)r[n+s]=i[s];return r||t(i)}var n,i,s,o=this,u=Array(16);if(n=function(){for(var e,e,t=u,r=0,r=0;16>r;r++)0==(3&r)&&(e=4294967296*Math.random()),t[r]=255&e>>>((3&r)<<3);return t},o.crypto&&crypto.getRandomValues){var c=new Uint32Array(4);s=function(){crypto.getRandomValues(c);for(var e=0;16>e;e++)u[e]=255&c[e>>2]>>>8*(3&e);return u}}try{var p=require("crypto").randomBytes;i=p&&function(){return p(16)}}catch(d){}for(var h=i||s||n,f="function"==typeof Buffer?Buffer:Array,g=[],l={},y=0;256>y;y++)g[y]=(y+256).toString(16).substr(1),l[g[y]]=y;var m=h(),v=[1|m[0],m[1],m[2],m[3],m[4],m[5]],A=16383&(m[6]<<8|m[7]),b=0,S=0,I=a;if(I.v1=r,I.v4=a,I.parse=e,I.unparse=t,I.BufferClass=f,I.mathRNG=n,I.nodeRNG=i,I.whatwgRNG=s,"undefined"!=typeof module)module.exports=I;else{var R=o.uuid;I.noConflict=function(){return o.uuid=R,I},o.uuid=I}}(),function(e){e.Pipeline=function(t){return this instanceof e.Pipeline?(e.Core.call(this),this.lib="Pipeline",this.type=t?t.type||"Rest":"Rest",this.collectionName="pipes",this.add(t),undefined):new e.Pipeline(t)},e.Pipeline.prototype=e.Core,e.Pipeline.constructor=e.Pipeline,e.Pipeline.adapters={}}(AeroGear,jQuery),function(e,t,r,a){e.Pipeline.adapters.Rest=function(r,n){if(!(this instanceof e.Pipeline.adapters.Rest))return new e.Pipeline.adapters.Rest(r,n);n=n||{};var i=n.endpoint||r,s={url:n.baseURL?n.baseURL+i:i,contentType:"application/json",dataType:"json"},o=n.recordId||"id",u=n.authenticator||null,c=n.pageConfig;this.addAuthIdentifier=function(e){return u?u.addAuthIdentifier(e):e},this.deauthorize=function(){u&&u.deauthorize()},this.getAjaxSettings=function(){return s},this.getRecordId=function(){return o},this.getPageConfig=function(){return c},this.updatePageConfig=function(e,r){r?(c={},c.metadataLocation=e.metadataLocation?e.metadataLocation:"webLinking",c.previousIdentifier=e.previousIdentifier?e.previousIdentifier:"previous",c.nextIdentifier=e.nextIdentifier?e.nextIdentifier:"next",c.parameterProvider=e.parameterProvider?e.parameterProvider:null):t.extend(c,e)},c&&this.updatePageConfig(c,!0),this.webLinkingPageParser=function(e){var t,r,n,i,s,o={};r=e.getResponseHeader("Link").split(",");for(var u in r){t=r[u].trim().split(";");for(var p in t)n=t[p].trim(),0===n.indexOf("<")&&n.lastIndexOf(">")===t[p].length-1?i=n.substr(1,n.length-2).split("?")[1]:0===n.indexOf("rel=")&&(n.indexOf(c.previousIdentifier)>=0?s=c.previousIdentifier:n.indexOf(c.nextIdentifier)>=0&&(s=c.nextIdentifier));s&&(o[s]=i,s=a)}return o},this.headerPageParser=function(e){var t=e.getResponseHeader(c.previousIdentifier),r=e.getResponseHeader(c.nextIdentifier),a={},n={};return c.parameterProvider?(a=c.parameterProvider(e),n[c.previousIdentifier]=a[c.previousIdentifier],n[c.nextIdentifier]=a[c.nextIdentifier]):(n[c.previousIdentifier]=t?t.split("?")[1]:null,n[c.nextIdentifier]=r?r.split("?")[1]:null),n},this.bodyPageParser=function(e){var t={},r={};return c.parameterProvider?(r=c.parameterProvider(e),t[c.previousIdentifier]=r[c.previousIdentifier],t[c.nextIdentifier]=r[c.nextIdentifier]):(t[c.previousIdentifier]=e[c.previousIdentifier],t[c.nextIdentifier]=e[c.nextIdentifier]),t},this.formatJSONError=function(e){if("json"===this.getAjaxSettings().dataType)try{e.responseJSON=JSON.parse(e.responseText)}catch(t){}return e}},e.Pipeline.adapters.Rest.prototype.read=function(e){var r,n,i,s,o=this,u=this.getRecordId(),c=this.getAjaxSettings(),p=this.getPageConfig();if(e=e?e:{},e.query=e.query?e.query:{},r=e[u]?c.url+"/"+e[u]:c.url,p&&e.paging!==!1){e.paging||(e.paging={offset:e.offsetValue||0,limit:e.limitValue||10}),e.query=e.query||{};for(var d in e.paging)e.query[d]=e.paging[d]}return n=function(t,r,n){var i;p&&e.paging!==!1&&(i=o[p.metadataLocation+"PageParser"]("body"===p.metadataLocation?t:n),["previous","next"].forEach(function(r){t[r]=function(e,t,r){return function(n){return r.paging=!0,r.offsetValue=r.limitValue=a,r.query=t,r.success=n&&n.success?n.success:r.success,r.error=n&&n.error?n.error:r.error,e.read(r)}}(o,i[p[r+"Identifier"]],e)})),e.success&&e.success.apply(this,arguments)},i=function(t){t=o.formatJSONError(t),e.error&&e.error.apply(this,arguments)},s={type:"GET",data:e.query,success:n,error:i,url:r,statusCode:e.statusCode,complete:e.complete,headers:e.headers},e.jsonp&&(s.dataType="jsonp",s.jsonp=e.jsonp.callback?e.jsonp.callback:"callback",e.jsonp.customCallback&&(s.jsonpCallback=e.jsonp.customCallback)),t.ajax(this.addAuthIdentifier(t.extend({},this.getAjaxSettings(),s)))},e.Pipeline.adapters.Rest.prototype.save=function(e,r){var a,n,i,s,o,u=this,c=this.getRecordId(),p=this.getAjaxSettings();return e=e||{},r=r||{},a=e[c]?"PUT":"POST",n=e[c]?p.url+"/"+e[c]:p.url,i=function(){r.success&&r.success.apply(this,arguments)},s=function(e){e=u.formatJSONError(e),r.error&&r.error.apply(this,arguments)},o=t.extend({},p,{data:e,type:a,url:n,success:i,error:s,statusCode:r.statusCode,complete:r.complete,headers:r.headers}),"application/json"===o.contentType&&o.data&&"string"!=typeof o.data&&(o.data=JSON.stringify(o.data)),t.ajax(this.addAuthIdentifier(t.extend({},this.getAjaxSettings(),o)))},e.Pipeline.adapters.Rest.prototype.remove=function(e,r){var a,n,i,s,o,u=this,c=this.getRecordId(),p=this.getAjaxSettings(),d="";return"string"==typeof e||"number"==typeof e?a=e:e&&e[c]?a=e[c]:e&&!r&&(r=e),r=r||{},d=a?"/"+a:"",n=p.url+d,i=function(){r.success&&r.success.apply(this,arguments)},s=function(e){e=u.formatJSONError(e),r.error&&r.error.apply(this,arguments)},o={type:"DELETE",url:n,success:i,error:s,statusCode:r.statusCode,complete:r.complete,headers:r.headers},t.ajax(this.addAuthIdentifier(t.extend({},p,o)))}}(AeroGear,jQuery,uuid),function(e){e.DataManager=function(t){return this instanceof e.DataManager?(e.Core.call(this),this.lib="DataManager",this.type=t?t.type||"Memory":"Memory",this.collectionName="stores",this.add(t),undefined):new e.DataManager(t)},e.DataManager.prototype=e.Core,e.DataManager.constructor=e.DataManager,e.DataManager.adapters={},e.DataManager.STATUS_NEW=1,e.DataManager.STATUS_MODIFIED=2,e.DataManager.STATUS_REMOVED=0}(AeroGear,jQuery),function(e,t){e.DataManager.adapters.Memory=function(t,r){if(!(this instanceof e.DataManager.adapters.Memory))return new e.DataManager.adapters.Memory(t,r);r=r||{};var a=r.recordId?r.recordId:"id",n=null;this.getRecordId=function(){return a},this.getData=function(){return n},this.setData=function(e){n=e},this.emptyData=function(){n=null},this.addDataRecord=function(e){n=n||[],n.push(e)},this.updateDataRecord=function(e,t){n[e]=t},this.removeDataRecord=function(e){n.splice(e,1)},this.traverseObjects=function(e,t,r){for(;"object"==typeof t&&r;)e=Object.keys(t)[0],t=t[e],r=r[e];return t===r?!0:!1}},e.DataManager.adapters.Memory.prototype.read=function(e){var t={};return t[this.getRecordId()]=e,e?this.filter(t):this.getData()},e.DataManager.adapters.Memory.prototype.save=function(t,r){var a=!1;if(t=e.isArray(t)?t:[t],r)this.setData(t);else if(this.getData())for(var n=0;t.length>n;n++){for(var i in this.getData())if(this.getData()[i][this.getRecordId()]===t[n][this.getRecordId()]){this.updateDataRecord(i,t[n]),a=!0;break}a||this.addDataRecord(t[n]),a=!1}else this.setData(t);return this.getData()},e.DataManager.adapters.Memory.prototype.remove=function(t){if(!t)return this.emptyData(),this.getData();t=e.isArray(t)?t:[t];for(var r,a,n,i=0;t.length>i;i++){if("string"==typeof t[i]||"number"==typeof t[i])r=t[i];else{if(!t)continue;r=t[i][this.getRecordId()]}a=this.getData(!0);for(n in a)a[n][this.getRecordId()]===r&&this.removeDataRecord(n)}return this.getData()},e.DataManager.adapters.Memory.prototype.filter=function(r,a){var n,i,s,o,u,c=this;return n=r?this.getData().filter(function(n){var p,d,h=a?!1:!0,f=Object.keys(r);for(i=0;f.length>i;i++){if(r[f[i]].data)for(p=r[f[i]],d=p.matchAny?!1:!0,s=0;p.data.length>s;s++)if(e.isArray(n[f[i]]))if(n[f[i]].length){if(0===t(n[f]).not(p.data).length&&0===t(p.data).not(n[f]).length){d=!0;break}for(o=0;n[f[i]].length>o;o++){if(p.matchAny&&p.data[s]===n[f[i]][o]){if(d=!0,a)break;for(u=0;n[f[i]].length>u;u++)if(!a&&p.data[s]!==n[f[i]][u]){d=!1;break}}if(!p.matchAny&&p.data[s]!==n[f[i]][o]){d=!1;break}}}else d=!1;else if("object"==typeof p.data[s]){if(p.matchAny&&c.traverseObjects(f[i],p.data[s],n[f[i]])){d=!0;break}if(!p.matchAny&&!c.traverseObjects(f[i],p.data[s],n[f[i]])){d=!1;break}}else{if(p.matchAny&&p.data[s]===n[f[i]]){d=!0;break}if(!p.matchAny&&p.data[s]!==n[f[i]]){d=!1;break}}else if(e.isArray(n[f[i]]))if(d=a?!1:!0,n[f[i]].length)for(s=0;n[f[i]].length>s;s++){if(a&&r[f[i]]===n[f[i]][s]){d=!0;break}if(!a&&r[f[i]]!==n[f[i]][s]){d=!1;break}}else d=!1;else d="object"==typeof r[f[i]]?c.traverseObjects(f[i],r[f[i]],n[f[i]]):r[f[i]]===n[f[i]]?!0:!1;if(a&&d){h=!0;break}if(!a&&!d){h=!1;break}}return h}):this.getData()||[]}}(AeroGear,jQuery,uuid),function(e){e.DataManager.adapters.SessionLocal=function(t,r){if(!(this instanceof e.DataManager.adapters.SessionLocal))return new e.DataManager.adapters.SessionLocal(t,r);e.DataManager.adapters.Memory.apply(this,arguments);var a=r.storageType||"sessionStorage",n=t,i=document.location.pathname.replace(/[\/\.]/g,"-"),s=n+i,o=JSON.parse(window[a].getItem(s));o&&e.DataManager.adapters.Memory.prototype.save.call(this,o,!0),this.getStoreType=function(){return a},this.getStoreKey=function(){return s}},e.DataManager.adapters.SessionLocal.prototype=Object.create(new e.DataManager.adapters.Memory,{save:{value:function(t,r){var a=r&&r.reset?r.reset:!1,n=window[this.getStoreType()].getItem(this.getStoreKey()),i=e.DataManager.adapters.Memory.prototype.save.apply(this,[arguments[0],a]);try{window[this.getStoreType()].setItem(this.getStoreKey(),JSON.stringify(i)),r&&r.storageSuccess&&r.storageSuccess(i)}catch(s){if(n=n?JSON.parse(n):[],i=e.DataManager.adapters.Memory.prototype.save.apply(this,[n,!0]),!r||!r.storageError)throw s;r.storageError(s,t)}return i},enumerable:!0,configurable:!0,writable:!0},remove:{value:function(){var t=e.DataManager.adapters.Memory.prototype.remove.apply(this,arguments);return window[this.getStoreType()].setItem(this.getStoreKey(),JSON.stringify(t)),t},enumerable:!0,configurable:!0,writable:!0}})}(AeroGear,jQuery,uuid),function(e){e.Auth=function(t){return this instanceof e.Auth?(e.Core.call(this),this.lib="Auth",this.type=t?t.type||"Rest":"Rest",this.collectionName="modules",this.add(t),undefined):new e.Auth(t)},e.Auth.prototype=e.Core,e.Auth.constructor=e.Auth,e.Auth.adapters={}}(AeroGear,jQuery),function(e,t){e.Auth.adapters.Rest=function(r,a){if(!(this instanceof e.Auth.adapters.Rest))return new e.Auth.adapters.Rest(r,a);a=a||{};var n=a.endpoints||{},i=r,s=!!a.agAuth,o=a.baseURL,u=a.tokenName||"Auth-Token";this.addAuthIdentifier=function(e){return e.headers=e.headers?e.headers:{},e.headers[u]=sessionStorage.getItem("ag-auth-"+i),t.extend({},e)},this.deauthorize=function(){sessionStorage.removeItem("ag-auth-"+i)},this.getSettings=function(){return a},this.getEndpoints=function(){return n},this.getName=function(){return i},this.getAGAuth=function(){return s},this.getBaseURL=function(){return o},this.getTokenName=function(){return u}},e.Auth.adapters.Rest.prototype.enroll=function(e,r){r=r||{};var a=this,n=this.getName(),i=this.getTokenName(),s=this.getBaseURL(),o=this.getEndpoints(),u=this.getAGAuth(),c=function(e,t,s){sessionStorage.setItem("ag-auth-"+n,a.getAGAuth()?s.getResponseHeader(i):"true"),r.success&&r.success.apply(this,arguments)},p=function(e,t,a){var n;try{e.responseJSON=JSON.parse(e.responseText),n=[e,t,a]}catch(i){n=arguments}r.error&&r.error.apply(this,n)},d={success:c,error:p,data:e},h="";return r.contentType?d.contentType=r.contentType:u&&(d.contentType="application/json"),r.dataType?d.dataType=r.dataType:u&&(d.dataType="json"),r.baseURL?h=r.baseURL:s&&(h=s),h+=o.enroll?o.enroll:"auth/enroll",h.length&&(d.url=h),t.ajax(t.extend({},this.getSettings(),{type:"POST"},d))},e.Auth.adapters.Rest.prototype.login=function(e,r){r=r||{};var a=this,n=this.getName(),i=this.getTokenName(),s=this.getBaseURL(),o=this.getEndpoints(),u=this.getAGAuth(),c=function(e,t,s){sessionStorage.setItem("ag-auth-"+n,a.getAGAuth()?s.getResponseHeader(i):"true"),r.success&&r.success.apply(this,arguments)},p=function(e,t,a){var n;try{e.responseJSON=JSON.parse(e.responseText),n=[e,t,a]}catch(i){n=arguments}r.error&&r.error.apply(this,n)},d={success:c,error:p,data:e},h="";return r.contentType?d.contentType=r.contentType:u&&(d.contentType="application/json"),r.dataType?d.dataType=r.dataType:u&&(d.dataType="json"),r.baseURL?h=r.baseURL:s&&(h=s),h+=o.login?o.login:"auth/login",h.length&&(d.url=h),t.ajax(t.extend({},this.getSettings(),{type:"POST"},d))},e.Auth.adapters.Rest.prototype.logout=function(e){e=e||{};var r=this,a=this.getName(),n=this.getTokenName(),i=this.getBaseURL(),s=this.getEndpoints(),o=function(){r.deauthorize(),e.success&&e.success.apply(this,arguments)},u=function(t,r,a){var n;try{t.responseJSON=JSON.parse(t.responseText),n=[t,r,a]}catch(i){n=arguments}e.error&&e.error.apply(this,n)},c={success:o,error:u},p="";return e.baseURL?p=e.baseURL:i&&(p=i),p+=s.logout?s.logout:"auth/logout",p.length&&(c.url=p),c.headers={},c.headers[n]=sessionStorage.getItem("ag-auth-"+a),t.ajax(t.extend({},this.getSettings(),{type:"POST"},c))}}(AeroGear,jQuery);
-//@ sourceMappingURL=dist/aerogear.js.map
View
122 docs/134779558e.html
@@ -1,122 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>AeroGear.js API Documentation</title>
-
- <script src="scripts/prettify/prettify.js"> </script>
- <script src="scripts/prettify/lang-css.js"> </script>
- <!--[if lt IE 9]>
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
- <![endif]-->
- <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
- <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
-</head>
-
-<body>
-
-<div id="main">
-
- <h1 class="page-title">Source: data-manager/aerogear.datamanager.js</h1>
-
-
-
-
-
- <section>
- <article>
- <pre class="prettyprint source"><code>/* AeroGear JavaScript Library
-* https://github.com/aerogear/aerogear-js
-* JBoss, Home of Professional Open Source
-* Copyright Red Hat, Inc., and individual contributors
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-* http://www.apache.org/licenses/LICENSE-2.0
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-(function( AeroGear, $, undefined ) {
- /**
- A collection of data connections (stores) and their corresponding data models. This object provides a standard way to interact with client side data no matter the data format or storage mechanism used.
- @class
- @augments AeroGear.Core
- @param {String|Array|Object} [config] - A configuration for the store(s) being created along with the DataManager. If an object or array containing objects is used, the objects can have the following properties:
- @param {String} config.name - the name that the store will later be referenced by
- @param {String} [config.type="memory"] - the type of store as determined by the adapter used
- @param {String} [config.recordId="id"] - the identifier used to denote the unique id for each record in the data associated with this store
- @param {Object} [config.settings={}] - the settings to be passed to the adapter
- @returns {object} dataManager - The created DataManager containing any stores that may have been created