Permalink
Browse files

Updated to 1.0.4, updated license.

  • Loading branch information...
1 parent 68c4820 commit 7bc63ef989c95e4de8029e7b55bd7e2c10fd8008 @vseventer vseventer committed Jul 25, 2013
Showing with 110 additions and 69 deletions.
  1. +22 −24 LICENSE
  2. +17 −1 README.md
  3. +54 −26 kinvey.js
  4. +17 −18 package.json
View
46 LICENSE
@@ -176,27 +176,25 @@
END OF TERMS AND CONDITIONS
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
+
+Summary:
+
+ * promiscuous-0.3 [MIT] - used for promises.
+
+SECTION 1: BSD-STYLE, MIT-STYLE, OR SIMILAR STYLE LICENSES
+ >>> promiscuous
+
+
+--------------- SECTION 1: BSD-STYLE, MIT-STYLE, OR SIMILAR STYLE LICENSES ----------
+
+BSD-STYLE, MIT-STYLE, OR SIMILAR STYLE is applicable to the following component(s).
+
+>>> promiscuous
+
+ Copyright (c) 2013 Ruben Verborgh
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
18 README.md
@@ -66,4 +66,20 @@ Kinvey.ping({
```
## What’s next?
-You are now ready to start building your awesome apps! Next we recommend diving into the [User guide](http://devcenter.kinvey.com/nodejs/guides/users) or [Data store guide](http://devcenter.kinvey.com/nodejs/guides/datastore) to learn more about our service, or explore the [sample apps](http://devcenter.kinvey.com/nodejs/samples) to go straight to working projects.
+You are now ready to start building your awesome apps! Next we recommend diving into the [User guide](http://devcenter.kinvey.com/nodejs/guides/users) or [Data store guide](http://devcenter.kinvey.com/nodejs/guides/datastore) to learn more about our service, or explore the [sample apps](http://devcenter.kinvey.com/nodejs/samples) to go straight to working projects.
+
+## License
+
+ Copyright 2013 Kinvey, Inc.
+
+ 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.
View
80 kinvey.js
@@ -1,24 +1,18 @@
/*!
- * Copyright (c) 2013 Kinvey, Inc. All rights reserved.
+ * Copyright (c) 2013 Kinvey, Inc.
*
- * Licensed to Kinvey, Inc. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Kinvey, Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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.
*/
-// Wrap in [IIFE](https://www.wikipedia.org/wiki/Immediately-invoked_function_expression).
(function() {
// Setup.
@@ -110,7 +104,7 @@
* @type {string}
* @default
*/
- Kinvey.SDK_VERSION = '1.0.3';
+ Kinvey.SDK_VERSION = '1.0.4';
// Properties.
// -----------
@@ -986,7 +980,7 @@
* @property {boolean} [fileTls=true] Use the https protocol to communicate
* with GCS.
* @property {integer} [fileTtl] A custom expiration time (in seconds).
- * @property {boolean} [nocache] Use cache busting.
+ * @property {boolean} [nocache=true] Use cache busting.
* @property {boolean} [offline] Initiate the request locally.
* @property {boolean} [refresh] Persist the response locally.
* @property {Object} [relations] Map of relational fields to collections.
@@ -1485,7 +1479,7 @@
}
// Return the device information string.
- var parts = ['js-nodejs/1.0.3'];
+ var parts = ['js-nodejs/1.0.4'];
if(0 !== libraries.length) { // Add external library information.
parts.push('(' + libraries.sort().join(', ') + ')');
}
@@ -2479,6 +2473,8 @@
}
};
+ /* jshint sub: true */
+
// Files.
// ------
@@ -2816,7 +2812,7 @@
data.mimeType = data.mimeType || file.mimeType || file.type || 'application/octet-stream';
// Apply options.
- if(options.public) {
+ if(options['public']) {
data._public = true;
}
options.contentType = data.mimeType;
@@ -2875,6 +2871,38 @@
// Metadata.
// ---------
+ // Patch JavaScript implementations lacking ISO-8601 date support.
+ // http://jsfiddle.net/mplungjan/QkasD/
+ var fromISO = function(dateString) {
+ var date = Date.parse(dateString);
+ if(date) {
+ return new Date(date);
+ }
+
+ // Patch here.
+ var regex = /^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):?(\d\d))?$/;
+ var match = dateString.match(regex);
+ if(null != match[1]) {
+ var day = match[1].split(/\D/).map(function(segment) {
+ return root.parseInt(segment, 10) || 0;
+ });
+ day[1] -= 1; // Months range 0–11.
+ day = new Date(Date.UTC.apply(Date, day));
+
+ // Adjust for timezone.
+ if(null != match[5]) {
+ var timezone = root.parseInt(match[5], 10) / 100 * 60;
+ timezone += (null != match[6] ? root.parseInt(match[6], 10) : 0);
+ timezone *= ('+' === match[4]) ? -1 : 1;
+ if(timezone) {
+ day.setUTCMinutes(day.getUTCMinutes() * timezone);
+ }
+ }
+ return day;
+ }
+ return NaN; // Invalid.
+ };
+
// Wrapper for accessing the `_acl` and `_kmd` properties of a document
// (i.e. entity and users).
@@ -2930,7 +2958,7 @@
*/
getCreatedAt: function() {
if(null != this._document._kmd && null != this._document._kmd.ect) {
- return new Date(this._document._kmd.ect);
+ return fromISO(this._document._kmd.ect);
}
return null;
},
@@ -2954,7 +2982,7 @@
*/
getLastModified: function() {
if(null != this._document._kmd && null != this._document._kmd.lmt) {
- return new Date(this._document._kmd.lmt);
+ return fromISO(this._document._kmd.lmt);
}
return null;
},
@@ -4444,7 +4472,7 @@
coord[1] = parseFloat(coord[1]);
// `$nearSphere` and `$maxDistance` are separate filters.
- var result = this._addFilter(field, '$near', [coord[0], coord[1]]);
+ var result = this._addFilter(field, '$nearSphere', [coord[0], coord[1]]);
if(null != maxDistance) {
this._addFilter(field, '$maxDistance', maxDistance);
}
@@ -5947,9 +5975,9 @@
}
}
- // If `options.nocache`, add a cache busting query string. This is useful
- // for Android < 4.0 which caches all requests aggressively.
- if(options.nocache) {
+ // Unless `options.nocache` is false, add a cache busting query string.
+ // This is useful for Android < 4.0 which caches all requests aggressively.
+ if(false !== options.nocache) {
flags._ = Math.random().toString(36).substr(2);
}
View
35 package.json
@@ -1,23 +1,22 @@
{
- "author": "Kinvey, Inc <support@kinvey.com> (http://www.kinvey.com)",
- "name": "kinvey",
- "description": "Kinvey JavaScript Library for Node.js.",
- "version": "1.0.3",
- "homepage": "http://www.kinvey.com",
- "bugs": {
- "email": "support@kinvey.com"
- },
- "repository": {
- "type": "git",
- "url": "git@github.com:Kinvey/kinvey-nodejs.git"
- },
- "main": "./kinvey.js",
- "engines": {
- "node": ">=0.8"
+ "name" : "kinvey",
+ "version" : "1.0.4",
+ "description" : "Kinvey JavaScript Library for Node.js.",
+ "homepage" : "http://www.kinvey.com",
+ "bugs" : { "email": "support@kinvey.com" },
+ "licenses" : [{
+ "type" : "Apache-2.0",
+ "url" : "http://www.apache.org/licenses/LICENSE-2.0"
+ }],
+ "author" : "Kinvey, Inc.",
+ "main" : "./kinvey.js",
+ "repository" : {
+ "type" : "git",
+ "url" : "git@github.com:Kinvey/kinvey-nodejs.git"
},
"dependencies": {
"promiscuous": "~0.3"
},
- "devDependencies": {},
- "scripts": {}
-}
+ "devDependencies" : {},
+ "engines" : { "node": ">=0.8" }
+}

0 comments on commit 7bc63ef

Please sign in to comment.