Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate internal APIs from public ones #568

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8b330ab
Fix .npmignore
puzpuzpuz Aug 10, 2020
29e7d45
* Start marking internal modules and members
puzpuzpuz Aug 10, 2020
b761f47
* Continue marking internal modules and members
puzpuzpuz Aug 10, 2020
636a163
Fix HazelcastClient.getConfig
puzpuzpuz Aug 10, 2020
986ded6
Mark private properties and methods as internal in HazelcastClient
puzpuzpuz Aug 11, 2020
9a5b0a4
Mark InternalIndexConfig with internal tag
puzpuzpuz Aug 11, 2020
28afcdb
Move typings for long and bluebird into non-dev dependencies
puzpuzpuz Aug 11, 2020
fc546c2
Remove internal modules from index
puzpuzpuz Aug 11, 2020
759f8b3
Fix initLoadBalancer signature
puzpuzpuz Aug 11, 2020
dafa6c2
Mark Data related DataInput/DataOutput methods with internal tag
puzpuzpuz Aug 11, 2020
b5d4759
Mark codecs with internal tag
puzpuzpuz Aug 11, 2020
86349ad
Extract interfaces for Address and Member
puzpuzpuz Aug 11, 2020
804ef0d
Mark FieldType as public API
puzpuzpuz Aug 11, 2020
8d9acc7
Remove internal types from index
puzpuzpuz Aug 11, 2020
3e53d80
Fix Aggregators return types
puzpuzpuz Aug 11, 2020
9073d6c
Fix ClassDefinitionTest
puzpuzpuz Aug 11, 2020
c9571a9
Add test for declarations produced by tsc
puzpuzpuz Aug 11, 2020
4ec9390
Fix tests
puzpuzpuz Aug 11, 2020
5a3c30e
Move user code validation files to subdir
puzpuzpuz Aug 11, 2020
7413fed
Fix ConnectionManagerTest
puzpuzpuz Aug 11, 2020
ce4e1ea
Improve documentation
puzpuzpuz Aug 11, 2020
bf18004
Add typedoc config file
puzpuzpuz Aug 11, 2020
276b4df
Improve jsdoc
puzpuzpuz Aug 11, 2020
7c01fb9
Add SSLOptionsFactory to index
puzpuzpuz Aug 11, 2020
2553b7c
Improve code style and jsdoc
puzpuzpuz Aug 11, 2020
8ea4069
Improve jsdoc
puzpuzpuz Aug 11, 2020
d423aba
Improve tsdoc in HazelcastClient
puzpuzpuz Aug 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
.vscode/
.nyc_output/
benchmark/
code_samples/
Expand All @@ -7,6 +8,8 @@ docs/
scripts/
src/
test/
tsconfig.json
typedoc.json
.editorconfig
.eslintignore
.eslintrc.js
Expand All @@ -15,6 +18,5 @@ test/
DOCUMENTATION.md
download-remote-controller.js
*.iml
.editorconfig
*.jar
*.log
6 changes: 3 additions & 3 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2694,7 +2694,7 @@ An example configuration is shown below.
```javascript
const readFile = util.promisify(fs.readFile);

class SSLFactory {
class SSLOptionsFactory {
async init(properties) {
const promises = [];
this.keepOrder = properties.userDefinedProperty1;
Expand Down Expand Up @@ -2732,7 +2732,7 @@ const cfg = {
network: {
ssl: {
enabled: true,
sslOptionsFactory: new SSLFactory(),
sslOptionsFactory: new SSLOptionsFactory(),
sslOptionsFactoryProperties: {
caPath: 'ca.pem',
keyPath: 'key.pem',
Expand All @@ -2744,7 +2744,7 @@ const cfg = {
};
```

The client calls the method `init` with the properties section defined in the configuration. Then the client calls the method `getSSLOptions` of `SSLFactory` to create the `options` object.
The client calls the `init()` method with the `properties` configuration option. Then the client calls the `getSSLOptions()` method of `SSLOptionsFactory` to create the `options` object.

## 8.2. Credentials

Expand Down
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"version": "4.0.0",
"description": "Hazelcast - open source In-Memory Data Grid - client for Node.js",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"dependencies": {
"bluebird": "3.7.2",
"long": "4.0.0"
"@types/bluebird": "3.5.32",
"long": "4.0.0",
"@types/long": "4.0.1"
},
"devDependencies": {
"@types/bluebird": "^3.5.32",
"@types/long": "^4.0.1",
"@types/node": "^8.10.60",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
Expand All @@ -24,6 +25,7 @@
"rimraf": "^3.0.2",
"sinon": "^9.0.2",
"thrift": "^0.12.0",
"typedoc": "^0.18.0",
"typescript": "^3.9.5",
"winston": "^3.2.1"
},
Expand All @@ -35,10 +37,11 @@
"compile": "tsc",
"pretest": "node download-remote-controller.js",
"test": "mocha --recursive",
"validate-user-code": "tsc --build test/user_code/tsconfig.json",
"precoverage": "node download-remote-controller.js",
"coverage": "rimraf coverage && nyc node_modules/mocha/bin/_mocha -- --recursive --reporter-options mochaFile=report.xml --reporter mocha-junit-reporter",
"pregenerate-docs": "rimraf docs",
"generate-docs": "typedoc --out docs/ --exclude **/codec/**/* src/ --excludeExternals --ignoreCompilerErrors --excludePrivate",
"generate-docs": "typedoc --options typedoc.json",
"lint": "eslint --ext .ts ."
},
"repository": {
Expand All @@ -57,6 +60,5 @@
"bugs": {
"url": "https://github.com/hazelcast/hazelcast-nodejs-client/issues"
},
"homepage": "https://github.com/hazelcast/hazelcast-nodejs-client#readme",
"typings": "./lib/index"
"homepage": "https://github.com/hazelcast/hazelcast-nodejs-client#readme"
}
27 changes: 25 additions & 2 deletions src/Address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,30 @@ import {CLUSTER_DATA_FACTORY_ID, CLUSTER_DATA_ADDRESS_CLASS_ID} from './ClusterD
import {DataInput, DataOutput} from './serialization/Data';
import {IdentifiedDataSerializable} from './serialization/Serializable';

export class Address implements IdentifiedDataSerializable {
/**
* Represents a network address (e.g. of the client or a cluster member).
*/
export interface Address {

/**
* Host name or IP address.
*/
host: string;

/**
* Port number.
*/
port: number;

/**
* Returns string representation of the address.
*/
toString(): string;

}

/** @internal */
export class AddressImpl implements Address, IdentifiedDataSerializable {

factoryId = CLUSTER_DATA_FACTORY_ID;
classId = CLUSTER_DATA_ADDRESS_CLASS_ID;
Expand Down Expand Up @@ -49,7 +72,7 @@ export class Address implements IdentifiedDataSerializable {
output.writeUTF(this.host);
}

equals(other: Address): boolean {
equals(other: AddressImpl): boolean {
if (other === this) {
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/BitsUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @ignore *//** */

/** @internal */
export class BitsUtil {
static BYTE_SIZE_IN_BYTES = 1;
static BOOLEAN_SIZE_IN_BYTES = 1;
Expand Down
2 changes: 2 additions & 0 deletions src/BuildInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @ignore *//** */

const clientVersion = require('../package.json').version;

/** @internal */
export class BuildInfo {

public static readonly UNKNOWN_VERSION_ID = -1;
Expand Down
4 changes: 4 additions & 0 deletions src/ClientInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import {Address} from './Address';
import {UUID} from './core/UUID';

/**
* Local information of the client.
*/
export class ClientInfo {

/**
Expand All @@ -43,4 +46,5 @@ export class ClientInfo {
* Set of all labels of this client.
*/
labels: Set<string>;

}
10 changes: 10 additions & 0 deletions src/ClientMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @ignore *//** */

import {BitsUtil} from './BitsUtil';
import {ClientConnection} from './network/ClientConnection';
import {FixSizedTypesCodec} from './codec/builtin/FixSizedTypesCodec';

const MESSAGE_TYPE_OFFSET = 0;
const CORRELATION_ID_OFFSET = MESSAGE_TYPE_OFFSET + BitsUtil.INT_SIZE_IN_BYTES;
/** @internal */
export const RESPONSE_BACKUP_ACKS_OFFSET = CORRELATION_ID_OFFSET + BitsUtil.LONG_SIZE_IN_BYTES;
/** @internal */
export const PARTITION_ID_OFFSET = CORRELATION_ID_OFFSET + BitsUtil.LONG_SIZE_IN_BYTES;
const FRAGMENTATION_ID_OFFSET = 0;

/** @internal */
export const DEFAULT_FLAGS = 0;
const BEGIN_FRAGMENT_FLAG = 1 << 15;
const END_FRAGMENT_FLAG = 1 << 14;
Expand All @@ -34,8 +38,10 @@ const END_DATA_STRUCTURE_FLAG = 1 << 11;
const IS_NULL_FLAG = 1 << 10;
const IS_EVENT_FLAG = 1 << 9;

/** @internal */
export const SIZE_OF_FRAME_LENGTH_AND_FLAGS = BitsUtil.INT_SIZE_IN_BYTES + BitsUtil.SHORT_SIZE_IN_BYTES;

/** @internal */
export class Frame {
content: Buffer;
flags: number;
Expand Down Expand Up @@ -105,10 +111,14 @@ export class Frame {
}
}

/** @internal */
export const NULL_FRAME = new Frame(Buffer.allocUnsafe(0), IS_NULL_FLAG);
/** @internal */
export const BEGIN_FRAME = new Frame(Buffer.allocUnsafe(0), BEGIN_DATA_STRUCTURE_FLAG);
/** @internal */
export const END_FRAME = new Frame(Buffer.allocUnsafe(0), END_DATA_STRUCTURE_FLAG);

/** @internal */
export class ClientMessage {
startFrame: Frame;
endFrame: Frame;
Expand Down
8 changes: 6 additions & 2 deletions src/ClusterDataFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @ignore *//** */

import {IdentifiedDataSerializable} from './serialization/Serializable';
import {Address} from './Address';
import {AddressImpl} from './Address';

/** @internal */
export const CLUSTER_DATA_FACTORY_ID = 0;
/** @internal */
export const CLUSTER_DATA_ADDRESS_CLASS_ID = 1;

/** @internal */
export function clusterDataFactory(classId: number): IdentifiedDataSerializable {
if (classId === CLUSTER_DATA_ADDRESS_CLASS_ID) {
return new Address();
return new AddressImpl();
}
return null;
}
2 changes: 2 additions & 0 deletions src/DataStoreHashMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @ignore *//** */

import {Data} from './serialization/Data';

/** @internal */
export class DataKeyedHashMap<T> {

size: number;
Expand Down
2 changes: 2 additions & 0 deletions src/DistributedObjectInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @ignore *//** */

/** @internal */
export class DistributedObjectInfo {
serviceName: string;
name: string;
Expand Down
Loading