Skip to content

Commit

Permalink
Handle array of errors.
Browse files Browse the repository at this point in the history
relicense as Artistic-2.0 only

update/insert copyright headers

Set to no compression when using change stream

Implement getEndpoints()

* Implement getEndpoints
* Deprecate getHttpMethod
* Deprecate getFullPath

2.27.0

 * Implement getEndpoints() (Amir Jafarian)
 * Set to no compression when using change stream (Candy)
 * update/insert copyright headers (Ryan Graham)
 * relicense as Artistic-2.0 only (Ryan Graham)
 * Handle array of errors. (Richard Pringle)

Add integration tests for coercion in REST

Implement comprehensive test suite describing coercion of input
arguments in the REST adapter.

The test-suite produces test/rest-coercion/report.csv that can be used
to compare results across different strong-remoting versions.

[back-port of strongloop#304]

Fix integration tests for coercion in REST

Address style violations, fix bug discovered by jshint.

Add http source "formData"

Add "formData" as an alias for "form", to make remoting metadata
close to Swagger.

[back-port of 2e4a500 and aa0bda6]

Prioritise auth errors over sharedCtor errors

Return 401 Not Authorized when making an unauthorised request
to a prototype method for a model instance that does not exist.

Potentially breaking change affecting prototype methods:
Hooks registered before "invoke" phase (i.e. "auth" phase and any custom
phases inserted before "invoke") will be called even when the model
instance was not found. The property "ctx.instance" will be undefined
in such case, hook handlers must account for this case.

2.28.0

 * Prioritise auth errors over sharedCtor errors (Miroslav Bajtoš)
 * Add http source "formData" (Fabian Off)
 * Fix integration tests for coercion in REST (Miroslav Bajtoš)
 * Add integration tests for coercion in REST (Miroslav Bajtoš)

2.28.1

Introduce support for integer datatype

There is  single datatype in Javascript for
representing numbers: i.e. `numbers`. This is a
patch to fix strong-remoting#317 - a feature
to support data type: `integer`. Includes
following changes:
- Update `convertValueToTargetType()` &
 `convertToBasicRemotingType()`
- Update `SharedMethod.getType()`
- Make `integer` check strict by-default.
 i.e. If argument and/or returned values are
 decimal or `> MAX_SAFE_INTEGER`, for
 argument: send `400`, for returns: send
 `500`
- Rework `convert` method to ignore all arrays
 except "array of integers"
- Add tests to rest-coercion integration
 tests
- Update test cases for integer data type
- Update shared-method.js to include
 support for Node v.0.10.x

2.29.0

 * Introduce support for integer datatype (gunjpan)

Backport of strongloop#329

Revert globalization of assert() messages

Remove the usage of deprecated methods

Backport from strong-remoting/strongloop#333

Add new API for finding/disabling remote methods

2.30.0

 * Add new API for finding/disabling remote methods (Candy)
 * Remove the usage of deprecated methods (Amir Jafarian)
 * Revert globalization of assert() messages (Miroslav Bajtoš)
 * Backport of strongloop#329 (deepakrkris)

Update dependencies

2.31.0

 * Update dependencies (Miroslav Bajtoš)

Fix tests to use res.get instead of res.headers

The latter is case-sensitive and expects header names in lower-case.

Backport strongloop#345

Add rest-coercion tests for zero-prefixed numbers

Don't convert arg values returned by http function

When an argument provides "http" mapping as a custom function, then
we should not traverse the return value to detect buffers and dates.
The return value could be a complex object, e.g. the full remoting
context, in which case the traversal takes too long (in order of
second!).

Deprecate built-in CORS middleware

Push the responsibility of enabling/configuring CORS back to the
application developer.

Add translation files

Update translation files - round#2

Fix support for hooks returning a Promise

Fix the code to correctly recurse and invoke next hooks after the
promise returned by the first hook callback was resolved.

2.32.0

 * Fix support for hooks returning a Promise (Miroslav Bajtoš)
 * Update translation files - round#2 (Candy)
 * Add translation files (Amir Jafarian)
 * Deprecate built-in CORS middleware (Miroslav Bajtoš)
 * Don't convert arg values returned by http function (Miroslav Bajtoš)
 * Add rest-coercion tests for zero-prefixed numbers (Miroslav Bajtoš)
 * Fix tests to use res.get instead of res.headers (Miroslav Bajtoš)

Update ja translation file

2.32.1

 * Update ja translation file (Candy)

Distinguish between "file" and "File" result types

Fix regression introduced by a85068e where we started to treat "File"
models as the new built-in type "file".

In this commit, the implementation is fixed to recognize only the
following form as the built-in file:

    { type: 'file' }

All other spellings, most notably "File", are treated as custom types
(models) now.

2.32.2

 * Distinguish between "file" and "File" result types (Fabien Franzen)

lockdown dependency for http-auth

Due to a recent release of 2.5.10 which broke node 10/12 support
this commit locks down dependency before 2.5.11 is released
as some registry will still pick up unpublished version (2.5.10)
2.4.11 is released with apache-md5, apache-crypt locked down

See http-auth/http-auth/commit/0097ed6195986942a65e14b38b3f30281c9f6435

Stop changing read-only Number property

Rework the code defining missing ES5/ES6 Number properties to not touch
the existing properties. This is needed to prevent errors like the
following:

    TypeError: Cannot assign to read only property 'MAX_SAFE_INTEGER'
    of function Number() { [native code] }"]

2.32.3

 * lockdown dependency for http-auth (David Cheung)
 * Stop changing read-only Number property (Kogulan Baskaran)

Stringify object query params as JSON [2.x]

Stringify query params which are objects in a way in which empty ararys
and null values are preserved instead of removed
(default querystring implementation).

backport of: strongloop#325

Rest-adapter errorHandler set content-type `json`

the defaultHandler always res.sends an object
therefore make sense to always set response header as such

Release LB2 LTS

Enable remote methods to be disabled by alias

2.33.0

 * Enable remote methods to be disabled by alias (Rémi Bèges)
 * Release LB2 LTS (Simon Ho)
 * Rest-adapter errorHandler set content-type `json` (David Cheung)
 * Stringify object query params as JSON [2.x] (Horia Radu)

Cache getRestMethodByName

This function in RestAdapter is slow due
to creating RestMethods each time.
This can be cached initially, and rechecked
if the entry was not found.

add unit test

updating for review
  • Loading branch information
Richard Pringle authored and Traksewt committed Mar 15, 2017
1 parent e5bd14a commit f6b59f1
Show file tree
Hide file tree
Showing 91 changed files with 4,849 additions and 227 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
node_modules/
/coverage/
dist

8 changes: 3 additions & 5 deletions .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"allowComments": false,
"allowRegex": true
},
"validateJSDoc": {
"checkParamNames": false,
"checkRedundantParams": false,
"requireParamTypes": true
}
"jsDoc": false,
"disallowSpaceAfterObjectKeys": false,
"requireSpaceBeforeObjectValues": false,
}
105 changes: 105 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,108 @@
2017-03-13, Version 2.33.0
==========================

* Enable remote methods to be disabled by alias (Rémi Bèges)

* Release LB2 LTS (Simon Ho)

* Rest-adapter errorHandler set content-type `json` (David Cheung)

* Stringify object query params as JSON [2.x] (Horia Radu)


2016-10-20, Version 2.32.3
==========================

* lockdown dependency for http-auth (David Cheung)

* Stop changing read-only Number property (Kogulan Baskaran)


2016-10-14, Version 2.32.2
==========================

* Distinguish between "file" and "File" result types (Fabien Franzen)


2016-10-13, Version 2.32.1
==========================

* Update ja translation file (Candy)


2016-10-04, Version 2.32.0
==========================

* Fix support for hooks returning a Promise (Miroslav Bajtoš)

* Update translation files - round#2 (Candy)

* Add translation files (Amir Jafarian)

* Deprecate built-in CORS middleware (Miroslav Bajtoš)

* Don't convert arg values returned by http function (Miroslav Bajtoš)

* Add rest-coercion tests for zero-prefixed numbers (Miroslav Bajtoš)

* Fix tests to use res.get instead of res.headers (Miroslav Bajtoš)


2016-09-05, Version 2.31.0
==========================

* Update dependencies (Miroslav Bajtoš)


2016-08-17, Version 2.30.0
==========================

* Add new API for finding/disabling remote methods (Candy)

* Remove the usage of deprecated methods (Amir Jafarian)

* Revert globalization of assert() messages (Miroslav Bajtoš)

* Backport of #329 (deepakrkris)


2016-07-27, Version 2.29.0
==========================

* Introduce support for integer datatype (gunjpan)


2016-06-21, Version 2.28.1
==========================



2016-06-21, Version 2.28.0
==========================

* Prioritise auth errors over sharedCtor errors (Miroslav Bajtoš)

* Add http source "formData" (Fabian Off)

* Fix integration tests for coercion in REST (Miroslav Bajtoš)

* Add integration tests for coercion in REST (Miroslav Bajtoš)


2016-06-07, Version 2.27.0
==========================

* Implement getEndpoints() (Amir Jafarian)

* Set to no compression when using change stream (Candy)

* update/insert copyright headers (Ryan Graham)

* relicense as Artistic-2.0 only (Ryan Graham)

* Handle array of errors. (Richard Pringle)


2016-02-26, Version 2.26.0
==========================

Expand Down
5 changes: 5 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright IBM Corp. 2014,2016. All Rights Reserved.
// Node module: strong-remoting
// This file is licensed under the Artistic License 2.0.
// License text available at https://opensource.org/licenses/Artistic-2.0

/*global module:false*/
module.exports = function(grunt) {

Expand Down
213 changes: 207 additions & 6 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,210 @@
Copyright (c) 2013-2015 StrongLoop, Inc.
Copyright (c) IBM Corp. 2013,2016. All Rights Reserved.
Node module: strong-remoting
This project is licensed under the Artistic License 2.0, full text below.

strong-remoting uses a dual license model.
--------

You may use this library under the terms of the [Artistic 2.0 license][],
or under the terms of the [StrongLoop Subscription Agreement][].
The Artistic License 2.0

[Artistic 2.0 license]: http://opensource.org/licenses/Artistic-2.0
[StrongLoop Subscription Agreement]: http://strongloop.com/license
Copyright (c) 2000-2006, The Perl Foundation.

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble

This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.

You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.

Definitions

"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.

"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.

"You" and "your" means any person who would like to copy,
distribute, or modify the Package.

"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.

"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.

"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.

"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.

"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.

"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.

"Source" form means the source code, documentation source, and
configuration files for the Package.

"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.


Permission for Use and Modification Without Distribution

(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.


Permissions for Redistribution of the Standard Version

(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.

(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.


Distribution of Modified Versions of the Package as Source

(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:

(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.

(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.

(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under

(i) the Original License or

(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.


Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source

(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.

(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.


Aggregating or Linking the Package

(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.

(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.


Items That are Not Considered Part of a Modified Version

(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.


General Provisions

(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.

(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.

(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.

(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.

(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------

0 comments on commit f6b59f1

Please sign in to comment.