aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/src/common.js
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2017-05-05 13:54:03 -0700
committerGravatar murgatroid99 <mlumish@google.com>2017-05-08 18:21:39 -0700
commitffac55dfd634a62d54c8f152bbbce2bb51e7bc31 (patch)
treeb6f4ae95bb905158c99dcdd8963b645a39ae108f /src/node/src/common.js
parentc2ad372d43c1fd31d9e9dabb8a5481c641b9a81a (diff)
Refactor client logic into superclass with generic methods, improve documentation
Diffstat (limited to 'src/node/src/common.js')
-rw-r--r--src/node/src/common.js67
1 files changed, 66 insertions, 1 deletions
diff --git a/src/node/src/common.js b/src/node/src/common.js
index 757969dbdd..4dad60e630 100644
--- a/src/node/src/common.js
+++ b/src/node/src/common.js
@@ -43,7 +43,8 @@ var _ = require('lodash');
/**
* Wrap a function to pass null-like values through without calling it. If no
- * function is given, just uses the identity;
+ * function is given, just uses the identity.
+ * @private
* @param {?function} func The function to wrap
* @return {function} The wrapped function
*/
@@ -90,3 +91,67 @@ exports.defaultGrpcOptions = {
enumsAsStrings: true,
deprecatedArgumentOrder: false
};
+
+// JSDoc definitions that are used in multiple other modules
+
+/**
+ * The EventEmitter class in the event standard module
+ * @external EventEmitter
+ * @see https://nodejs.org/api/events.html#events_class_eventemitter
+ */
+
+/**
+ * The Readable class in the stream standard module
+ * @external Readable
+ * @see https://nodejs.org/api/stream.html#stream_readable_streams
+ */
+
+/**
+ * The Writable class in the stream standard module
+ * @external Writable
+ * @see https://nodejs.org/api/stream.html#stream_writable_streams
+ */
+
+/**
+ * The Duplex class in the stream standard module
+ * @external Duplex
+ * @see https://nodejs.org/api/stream.html#stream_class_stream_duplex
+ */
+
+/**
+ * A serialization function
+ * @callback module:src/common~serialize
+ * @param {*} value The value to serialize
+ * @return {Buffer} The value serialized as a byte sequence
+ */
+
+/**
+ * A deserialization function
+ * @callback module:src/common~deserialize
+ * @param {Buffer} data The byte sequence to deserialize
+ * @return {*} The data deserialized as a value
+ */
+
+/**
+ * An object that completely defines a service method signature.
+ * @typedef {Object} module:src/common~MethodDefinition
+ * @property {string} path The method's URL path
+ * @property {boolean} requestStream Indicates whether the method accepts
+ * a stream of requests
+ * @property {boolean} responseStream Indicates whether the method returns
+ * a stream of responses
+ * @property {module:src/common~serialize} requestSerialize Serialization
+ * function for request values
+ * @property {module:src/common~serialize} responseSerialize Serialization
+ * function for response values
+ * @property {module:src/common~deserialize} requestDeserialize Deserialization
+ * function for request data
+ * @property {module:src/common~deserialize} responseDeserialize Deserialization
+ * function for repsonse data
+ */
+
+/**
+ * An object that completely defines a service.
+ * @typedef {Object.<string, module:src/common~MethodDefinition>}
+ * module:src/common~ServiceDefinition
+ */