Socket
Socket
Sign inDemoInstall

pip-services3-commons-node

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.6 to 3.0.8

src/commands/Command.ts

2

CHANGELOG.md

@@ -1,2 +0,2 @@

# Portable abstractions and patterns for Pip.Services in Node.js Changelog
# <img src="https://uploads-ssl.webflow.com/5ea5d3315186cf5ec60c3ee4/5edf1c94ce4c859f2b188094_logo.svg" alt="Pip.Services Logo" width="200"> <br/> Portable Abstractions and Patterns for Node.js ChangeLog

@@ -3,0 +3,0 @@ ## <a name="3.0.0"></a> 3.0.0 (2018-08-21)

{
"name": "pip-services3-commons",
"registry": "pipdevs",
"version": "3.0.5",
"version": "3.0.8",
"build": "0"
}

@@ -17,4 +17,4 @@ import { StringValueMap } from '../data/StringValueMap';

* ConfigParams are used to pass configurations to [[IConfigurable]] objects.
* They also serve as a basis for more concrete configurations such as [[https://rawgit.com/pip-services-node/pip-services-components-node/master/doc/api/classes/connect.connectionparams.html ConnectionParams]]
* or [[https://rawgit.com/pip-services-node/pip-services-components-node/master/doc/api/classes/auth.credentialparams.html CredentialParams]] (in the Pip.Services components package).
* They also serve as a basis for more concrete configurations such as [[https://pip-services3-node.github.io/pip-services3-components-node/classes/connect.connectionparams.html ConnectionParams]]
* or [[https://pip-services3-node.github.io/pip-services3-components-node/classes/auth.credentialparams.html CredentialParams]] (in the Pip.Services components package).
*

@@ -21,0 +21,0 @@ * @see [[IConfigurable]]

@@ -36,4 +36,4 @@ "use strict";

* ConfigParams are used to pass configurations to [[IConfigurable]] objects.
* They also serve as a basis for more concrete configurations such as [[https://rawgit.com/pip-services-node/pip-services-components-node/master/doc/api/classes/connect.connectionparams.html ConnectionParams]]
* or [[https://rawgit.com/pip-services-node/pip-services-components-node/master/doc/api/classes/auth.credentialparams.html CredentialParams]] (in the Pip.Services components package).
* They also serve as a basis for more concrete configurations such as [[https://pip-services3-node.github.io/pip-services3-components-node/classes/connect.connectionparams.html ConnectionParams]]
* or [[https://pip-services3-node.github.io/pip-services3-components-node/classes/auth.credentialparams.html CredentialParams]] (in the Pip.Services components package).
*

@@ -40,0 +40,0 @@ * @see [[IConfigurable]]

@@ -8,4 +8,4 @@ /**

* Contains the implementation of the config design pattern. The [[IConfigurable configurable interface]]
* contains just one method - "configure", which takes ConfigParams as a parameter (extends
* StringValueMap class). If any object needs to be configurable, we implement this interface
* contains just one method - "configure", which takes [[ConfigParams]] as a parameter (extends
* [[StringValueMap]] class). If any object needs to be configurable, we implement this interface
* and parse the ConfigParams that the method received.

@@ -12,0 +12,0 @@ */

@@ -10,4 +10,4 @@ "use strict";

* Contains the implementation of the config design pattern. The [[IConfigurable configurable interface]]
* contains just one method - "configure", which takes ConfigParams as a parameter (extends
* StringValueMap class). If any object needs to be configurable, we implement this interface
* contains just one method - "configure", which takes [[ConfigParams]] as a parameter (extends
* [[StringValueMap]] class). If any object needs to be configurable, we implement this interface
* and parse the ConfigParams that the method received.

@@ -14,0 +14,0 @@ */

@@ -40,2 +40,6 @@ "use strict";

this.total = BooleanConverter_1.BooleanConverter.toBooleanWithDefault(total, false);
// This is for correctly using PagingParams with gRPC. gRPC defaults to 0 when take is null,
// so we have to set it back to null if we get 0 in the constructor.
if (this.take == 0)
this.take = null;
}

@@ -42,0 +46,0 @@ /**

@@ -74,3 +74,3 @@ "use strict";

}
builder += _super.prototype[index];
builder += this[index];
}

@@ -77,0 +77,0 @@ return builder;

@@ -13,4 +13,4 @@ import { TypeCode } from '../convert/TypeCode';

* This class is widely used in Pip.Services as a basis for variety of classes, such as
* [[ConfigParams]], [[https://rawgit.com/pip-services-node/pip-services-components-node/master/doc/api/classes/connect.connectionparams.html ConnectionParams]],
* [[https://rawgit.com/pip-services-node/pip-services-components-node/master/doc/api/classes/auth.credentialparams.html CredentialParams]] and others.
* [[ConfigParams]], [[https://pip-services3-node.github.io/pip-services3-components-node/classes/connect.connectionparams.html ConnectionParams]],
* [[https://pip-services3-node.github.io/pip-services3-components-node/classes/auth.credentialparams.html CredentialParams]] and others.
*

@@ -17,0 +17,0 @@ * ### Example ###

@@ -26,4 +26,4 @@ "use strict";

* This class is widely used in Pip.Services as a basis for variety of classes, such as
* [[ConfigParams]], [[https://rawgit.com/pip-services-node/pip-services-components-node/master/doc/api/classes/connect.connectionparams.html ConnectionParams]],
* [[https://rawgit.com/pip-services-node/pip-services-components-node/master/doc/api/classes/auth.credentialparams.html CredentialParams]] and others.
* [[ConfigParams]], [[https://pip-services3-node.github.io/pip-services3-components-node/classes/connect.connectionparams.html ConnectionParams]],
* [[https://pip-services3-node.github.io/pip-services3-components-node/classes/auth.credentialparams.html CredentialParams]] and others.
*

@@ -30,0 +30,0 @@ * ### Example ###

@@ -13,3 +13,3 @@ /**

* - An existing exception class can be used.
* - A child class that extends ApplicationException can we written.
* - A child class that extends [[ApplicationException]] can we written.
* - A exception can be wrapped around (into?) an existing application exception.

@@ -16,0 +16,0 @@ *

@@ -15,3 +15,3 @@ "use strict";

* - An existing exception class can be used.
* - A child class that extends ApplicationException can we written.
* - A child class that extends [[ApplicationException]] can we written.
* - A exception can be wrapped around (into?) an existing application exception.

@@ -18,0 +18,0 @@ *

/**
* Helper class that closes previously opened components.
*
* [[ICloseable]]
* [[IClosable]]
*/

@@ -6,0 +6,0 @@ export declare class Closer {

@@ -11,3 +11,3 @@ "use strict";

*
* [[ICloseable]]
* [[IClosable]]
*/

@@ -14,0 +14,0 @@ var Closer = /** @class */ (function () {

@@ -7,3 +7,3 @@ /** @module run */

* For components that perform opening on demand consider using
* [[ICloseable]] interface instead.
* [[IClosable]] interface instead.
*

@@ -10,0 +10,0 @@ * @see [[IOpenable]]

@@ -64,2 +64,10 @@ /** @module validate */

getActual(): any;
toJSON(): {
path: string;
type: ValidationResultType;
code: string;
message: string;
expected: any;
actual: any;
};
}

@@ -83,2 +83,12 @@ "use strict";

};
ValidationResult.prototype.toJSON = function () {
return {
path: this._path,
type: this._type,
code: this._code,
message: this._message,
expected: this._expected,
actual: this._actual
};
};
return ValidationResult;

@@ -85,0 +95,0 @@ }());

{
"name": "pip-services3-commons-node",
"version": "3.0.6",
"version": "3.0.8",
"author": "Conceptual Vision Consulting LLC",

@@ -43,4 +43,4 @@ "description": "Portable abstractions and patterns for Pip.Services in Node.js",

"retest": "tsc && mocha -t 10000 -R spec -u tdd --recursive ./obj/test",
"docgen": "typedoc --out doc/api src --mode modules --excludeExternals --excludePrivate --target ES5 --ignoreCompilerErrors",
"docgen2": "typedoc --out doc/api src --mode file --excludeExternals --target ES5 --ignoreCompilerErrors --readme doc/ApiReference.md"
"docgen": "typedoc --out docs src --mode modules --excludeExternals --excludePrivate --target ES5 --ignoreCompilerErrors",
"docgen2": "typedoc --out docs src --mode file --excludeExternals --target ES5 --ignoreCompilerErrors --readme docs/ApiReference.md"
},

@@ -47,0 +47,0 @@ "dependencies": {

@@ -1,34 +0,154 @@

# <img src="https://github.com/pip-services/pip-services/raw/master/design/Logo.png" alt="Pip.Services Logo" style="max-width:30%"> <br/> Portable Abstractions and Patterns for Node.js
# <img src="https://uploads-ssl.webflow.com/5ea5d3315186cf5ec60c3ee4/5edf1c94ce4c859f2b188094_logo.svg" alt="Pip.Services Logo" width="200"> <br/> Portable Abstractions and Patterns for Node.js
This framework is part of the [Pip.Services](https://github.com/pip-services/pip-services) project.
It provides portable abstractions and patterns that can be used to implement non-trivial business logic in applications and services.
This module is a part of the [Pip.Services](http://pip.services.org) polyglot microservices toolkit.
It provides a set of basic patterns used in microservices or backend services.
Also the module implemenets a reasonably thin abstraction layer over most fundamental functions across
all languages supported by the toolkit to facilitate symmetric implementation.
This framework's key difference is its portable implementation across a variety of different languages.
It currently supports Java, .NET, Python, Node.js, and Golang. The code provides a reasonably thin abstraction layer
over most fundamental functions and delivers symmetric implementation that can be quickly ported between different platforms.
This module contains the following packages:
- **Commands** - commanding and eventing patterns
- **Config** - configuration pattern
- **Convert** - portable value converters
- **Data** - data patterns
- **Errors**- application errors
- **Random** - random data generators
- **Refer** - locator inversion of control (IoC) pattern
- **Reflect** - portable reflection utilities
- **Run** - component life-cycle management patterns
- **Validate** - validation patterns
The framework's functionality is decomposed into several packages:
<a name="links"></a> Quick links:
- [**Commands**](https://pip-services3-node.github.io/pip-services3-commons-node/modules/commands.html) - commanding and eventing patterns
- [**Config**](https://pip-services3-node.github.io/pip-services3-commons-node/modules/config.html) - configuration framework
- [**Convert**](https://pip-services3-node.github.io/pip-services3-commons-node/modules/convert.html) - soft value converters
- [**Data**](https://pip-services3-node.github.io/pip-services3-commons-node/modules/data.html) - data patterns
- [**Errors**](https://pip-services3-node.github.io/pip-services3-commons-node/modules/errors.html) - application errors
- [**Random**](https://pip-services3-node.github.io/pip-services3-commons-node/modules/random.html) - random data generators
- [**Refer**](https://pip-services3-node.github.io/pip-services3-commons-node/modules/refer.html) - locator (IoC) pattern
- [**Reflect**](https://pip-services3-node.github.io/pip-services3-commons-node/modules/reflect.html) - reflection framework
- [**Run**](https://pip-services3-node.github.io/pip-services3-commons-node/modules/run.html) - execution framework
- [**Validate**](https://pip-services3-node.github.io/pip-services3-commons-node/modules/validate.html) - validation framework
* [Configuration Pattern](https://www.pipservices.org/recipies/configuration)
* [Locator Pattern](https://www.pipservices.org/recipies/references)
* [Component Lifecycle](https://www.pipservices.org/recipies/component-lifecycle)
* [Components with Active Logic](https://www.pipservices.org/recipies/active-logic)
* [Data Patterns](https://www.pipservices.org/recipies/memory-persistence)
* [API Reference](https://pip-services3-node.github.io/pip-services3-commons-node/globals.html)
* [Change Log](CHANGELOG.md)
* [Get Help](https://www.pipservices.org/community/help)
* [Contribute](https://www.pipservices.org/community/contribute)
Quick Links:
## Use
* [Downloads](https://github.com/pip-services3-node/pip-services3-commons-node/blob/master/docs/Downloads.md)
* [API Reference](https://pip-services3-node.github.io/pip-services3-commons-node/globals.html)
* [Building and Testing](https://github.com/pip-services3-node/pip-services3-commons-node/blob/master/docs/Development.md)
* [Contributing](https://github.com/pip-services3-node/pip-services3-commons-node/blob/master/docs/Development.md#contrib)
Install the NPM package as
```bash
npm install pip-services3-commons-node --save
```
## Acknowledgements
Then you are ready to start using the Pip.Services patterns to augment your backend code.
The library is created and maintained by **Sergey Seroukhov**.
For instance, here is how you can implement a component, that receives configuration, get assigned references,
can be opened and closed using the patterns from this module.
```typescript
import { IConfigurable } from 'pip-services3-commons-node';
import { ConfigParams } from 'pip-services3-commons-node';
import { IReferenceable } from 'pip-services3-commons-node';
import { IReferences } from 'pip-services3-commons-node';
import { Descriptor } from 'pip-services3-commons-node';
import { IOpenable } from 'pip-services3-commons-node';
export class MyComponentA implements IConfigurable, IReferenceable, IOpenable {
private _param1: string = "ABC";
private _param2: number = 123;
private _anotherComponent: MyComponentB;
private _opened: boolean = true;
public configure(config: ConfigParams): void {
this._param1 = config.getAsStringWithDefault("param1", this._param1);
this._param2 = config.getAsIntegerWithDefault("param2", this._param2);
}
public setReferences(refs: IReferences): void {
this._anotherComponent = refs.getOneRequired<MyComponentB>(
new Descriptor("myservice", "mycomponent-b", "*", "*", "1.0")
);
}
public isOpen(): boolean {
return this._opened;
}
public open(correlationId: string, callback: (err: any) => void): void {
this._opened = true;
console.log("MyComponentA has been opened.");
callback(null);
}
public close(correlationId: string, callback: (err: any) => void): void {
this._opened = true;
console.log("MyComponentA has been closed.");
callback(null);
}
}
```
Then here is how the component can be used in the code
```typescript
import { ConfigParams } from 'pip-services3-commons-node';
import { References } from 'pip-services3-commons-node';
import { Descriptor } from 'pip-services3-commons-node';
let myComponentA = new MyComponentA();
// Configure the component
myComponentA.configure(ConfigParams.fromTuples(
'param1', 'XYZ',
'param2', 987
));
// Set references to the component
myComponentB.setReferences(References.fromTuples(
new Descriptor("myservice", "mycomponent-b", "default", "default", "1.0", myComponentB
));
// Open the component
myComponentB.open("123", (err) => {
console.log("MyComponentA has been opened.");
...
});
```
## Develop
For development you shall install the following prerequisites:
* Node.js 8+
* Visual Studio Code or another IDE of your choice
* Docker
* Typescript
Install dependencies:
```bash
npm install
```
Compile the code:
```bash
tsc
```
Run automated tests:
```bash
npm test
```
Generate API documentation:
```bash
./docgen.ps1
```
Before committing changes run dockerized build and test as:
```bash
./build.ps1
./test.ps1
./clear.ps1
```
## Contacts
The module is created and maintained by **Sergey Seroukhov**.
The documentation is written by **Egor Nuzhnykh**, **Alexey Dvoykin**, **Mark Makarychev**.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc