Skip to content

Commit 82b3db5

Browse files
authored
Migrate from JSDoc to TypeDoc (#3375)
1 parent c1f943e commit 82b3db5

9 files changed

Lines changed: 201 additions & 276 deletions

File tree

gremlin-js/gremlin-javascript/lib/driver/client.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export type RequestOptions = {
3333
params?: Record<string, any>;
3434
};
3535

36-
type ClientOptions = ConnectionOptions & RequestOptions & { processor?: string };
36+
export type ClientOptions = ConnectionOptions & RequestOptions & { processor?: string };
3737

3838
/**
3939
* A {@link Client} contains methods to send messages to a Gremlin Server.
@@ -44,22 +44,7 @@ export default class Client {
4444
/**
4545
* Creates a new instance of {@link Client}.
4646
* @param {String} url The resource uri.
47-
* @param {Object} [options] The connection options.
48-
* @param {Array} [options.ca] Trusted certificates.
49-
* @param {String|Array|Buffer} [options.cert] The certificate key.
50-
* @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs.
51-
* @param {GraphBinaryReader} [options.reader] The reader to use.
52-
* @param {Boolean} [options.rejectUnauthorized] Determines whether to verify or not the server certificate.
53-
* @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
54-
* @param {GraphBinaryWriter} [options.writer] The writer to use.
55-
* @param {Authenticator} [options.authenticator] The authentication handler to use.
56-
* @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request.
57-
* @param {Boolean} [options.enableUserAgentOnConnect] Determines if a user agent will be sent during connection handshake. Defaults to: true
58-
* @param {String} [options.processor] The name of the opProcessor to use, leave it undefined or set 'session' when session mode.
59-
* @param {String} [options.session] The sessionId of Client in session mode. Defaults to null means session-less Client.
60-
* @param {http.Agent} [options.agent] The http.Agent implementation to use.
61-
* @param {RequestInterceptor|RequestInterceptor[]} [options.interceptors] One or more request interceptors to apply before each HTTP request.
62-
* @constructor
47+
* @param {ClientOptions} [options] The connection options.
6348
*/
6449
constructor(
6550
url: string,

gremlin-js/gremlin-javascript/lib/driver/connection.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,7 @@ export default class Connection extends EventEmitter {
8181
/**
8282
* Creates a new instance of {@link Connection}.
8383
* @param {String} url The resource uri.
84-
* @param {Object} [options] The connection options.
85-
* @param {Array} [options.ca] Trusted certificates.
86-
* @param {String|Array|Buffer} [options.cert] The certificate key.
87-
* @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs.
88-
* @param {GraphBinaryReader} [options.reader] The reader to use.
89-
* @param {Boolean} [options.rejectUnauthorized] Determines whether to verify or not the server certificate.
90-
* @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
91-
* @param {GraphBinaryWriter} [options.writer] The writer to use. Set to null to skip serialization.
92-
* @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request.
93-
* @param {Boolean} [options.enableUserAgentOnConnect] Determines if a user agent will be sent during connection handshake. Defaults to: true
94-
* @param {http.Agent} [options.agent] The http.Agent implementation to use.
95-
* @param {RequestInterceptor|RequestInterceptor[]} [options.interceptors] One or more request interceptors to apply before each HTTP request.
96-
* @constructor
84+
* @param {ConnectionOptions} [options] The connection options.
9785
*/
9886
constructor(
9987
readonly url: string,

gremlin-js/gremlin-javascript/lib/driver/driver-remote-connection.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import GremlinLang from '../process/gremlin-lang.js';
3030
import { ConnectionOptions } from './connection.js';
3131

3232
/**
33-
* Represents the default {@link RemoteConnection} implementation.
33+
* Represents the default `RemoteConnection` implementation.
3434
*/
3535
export default class DriverRemoteConnection extends RemoteConnection {
3636
private readonly _client: Client;
@@ -39,19 +39,6 @@ export default class DriverRemoteConnection extends RemoteConnection {
3939
* Creates a new instance of {@link DriverRemoteConnection}.
4040
* @param {String} url The resource uri.
4141
* @param {ConnectionOptions} [options] The connection options.
42-
* @param {Array} [options.ca] Trusted certificates.
43-
* @param {String|Array|Buffer} [options.cert] The certificate key.
44-
* @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs.
45-
* @param {GraphBinaryReader} [options.reader] The reader to use.
46-
* @param {Boolean} [options.rejectUnauthorized] Determines whether to verify or not the server certificate.
47-
* @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
48-
* @param {GraphBinaryWriter} [options.writer] The writer to use.
49-
* @param {Authenticator} [options.authenticator] The authentication handler to use.
50-
* @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request.
51-
* @param {Boolean} [options.enableUserAgentOnConnect] Determines if a user agent will be sent during connection handshake. Defaults to: true
52-
* @param {http.Agent} [options.agent] The http.Agent implementation to use.
53-
* @param {RequestInterceptor|RequestInterceptor[]} [options.interceptors] One or more request interceptors to apply before each HTTP request.
54-
* @constructor
5542
*/
5643
constructor(url: string, options: ConnectionOptions = {}) {
5744
super(url, options);

gremlin-js/gremlin-javascript/lib/process/anonymous-traversal.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ import GremlinLang from './gremlin-lang.js';
3030
*/
3131
export default class AnonymousTraversalSource {
3232
/**
33-
* Creates a new instance of {@code AnonymousTraversalSource}.
34-
* @param {Function} [traversalSourceClass] Optional {@code GraphTraversalSource} constructor.
35-
* @param {Function} [traversalClass] Optional {@code GraphTraversal} constructor.
33+
* Creates a new instance of `AnonymousTraversalSource`.
34+
* @param {Function} [traversalSourceClass] Optional `GraphTraversalSource` constructor.
35+
* @param {Function} [traversalClass] Optional `GraphTraversal` constructor.
3636
*/
3737
constructor(
3838
readonly traversalSourceClass?: typeof GraphTraversalSource,
3939
readonly traversalClass?: typeof GraphTraversal,
4040
) {}
4141

4242
/**
43-
* Constructs an {@code AnonymousTraversalSource} which will then be configured to spawn a
43+
* Constructs an `AnonymousTraversalSource` which will then be configured to spawn a
4444
* {@link GraphTraversalSource}.
45-
* @param {Function} [traversalSourceClass] Optional {@code GraphTraversalSource} constructor.
46-
* @param {Function} [traversalClass] Optional {@code GraphTraversalSource} constructor.
45+
* @param {Function} [traversalSourceClass] Optional `GraphTraversalSource` constructor.
46+
* @param {Function} [traversalClass] Optional `GraphTraversalSource` constructor.
4747
* @returns {AnonymousTraversalSource}.
4848
*/
4949
static traversal(traversalSourceClass?: typeof GraphTraversalSource, traversalClass?: typeof GraphTraversal) {

gremlin-js/gremlin-javascript/lib/process/graph-traversal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class GraphTraversalSource {
113113
/**
114114
* Graph Traversal Source with method.
115115
* @param {String} key
116-
* @param {Object} value if not specified, the value with default to {@code true}
116+
* @param {Object} value if not specified, the value with default to `true`
117117
* @returns {GraphTraversalSource}
118118
*/
119119
with_(key: string, value: object | undefined = undefined): GraphTraversalSource {

gremlin-js/gremlin-javascript/lib/process/traversal-strategy.ts

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export class TraversalStrategies {
3030
/**
3131
* Creates a new instance of TraversalStrategies.
3232
* @param {TraversalStrategies} [parent] The parent strategies from where to clone the values from.
33-
* @constructor
3433
*/
3534
constructor(parent?: TraversalStrategies) {
3635
if (parent) {
@@ -106,7 +105,7 @@ export class ElementIdStrategy extends TraversalStrategy {
106105

107106
export class HaltedTraverserStrategy extends TraversalStrategy {
108107
/**
109-
* @param {String} haltedTraverserFactory full qualified class name in Java of a {@code HaltedTraverserFactory} implementation
108+
* @param {String} haltedTraverserFactory full qualified class name in Java of a `HaltedTraverserFactory` implementation
110109
*/
111110
constructor({haltedTraverserFactory = ""}) {
112111
super({haltedTraverserFactory: haltedTraverserFactory});
@@ -127,14 +126,19 @@ export class OptionsStrategy extends TraversalStrategy {
127126

128127
export class PartitionStrategy extends TraversalStrategy {
129128
/**
130-
* @param {Object} [options]
131-
* @param {String} [options.partitionKey] name of the property key to partition by
132-
* @param {String} [options.writePartition] the value of the currently write partition
133-
* @param {Array<String>} [options.readPartitions] list of strings representing the partitions to include for reads
134-
* @param {boolean} [options.includeMetaProperties] determines if meta-properties should be included in partitioning defaulting to false
129+
* @param options
130+
* @param options.partitionKey - name of the property key to partition by
131+
* @param options.writePartition - the value of the currently write partition
132+
* @param options.readPartitions - list of strings representing the partitions to include for reads
133+
* @param options.includeMetaProperties - determines if meta-properties should be included in partitioning defaulting to false
135134
*/
136-
constructor(options: TraversalStrategyConfiguration) {
137-
super(options);
135+
constructor({partitionKey, writePartition, readPartitions, includeMetaProperties}: {partitionKey?: string, writePartition?: string, readPartitions?: string[], includeMetaProperties?: boolean} = {}) {
136+
const config: Record<string, any> = {};
137+
if (partitionKey !== undefined) config.partitionKey = partitionKey;
138+
if (writePartition !== undefined) config.writePartition = writePartition;
139+
if (readPartitions !== undefined) config.readPartitions = readPartitions;
140+
if (includeMetaProperties !== undefined) config.includeMetaProperties = includeMetaProperties;
141+
super(config);
138142
}
139143
}
140144

@@ -146,33 +150,29 @@ export class ProfileStrategy extends TraversalStrategy {
146150

147151
export class SubgraphStrategy extends TraversalStrategy {
148152
/**
149-
* @param {Object} [options]
150-
* @param {GraphTraversal} [options.vertices] name of the property key to partition by
151-
* @param {GraphTraversal} [options.edges] the value of the currently write partition
152-
* @param {GraphTraversal} [options.vertexProperties] list of strings representing the partitions to include for reads
153-
* @param {boolean} [options.checkAdjacentVertices] enables the strategy to apply the {@code vertices} filter to the adjacent vertices of an edge.
153+
* @param options
154+
* @param options.vertices - traversal to filter vertices
155+
* @param options.edges - traversal to filter edges
156+
* @param options.vertexProperties - traversal to filter vertex properties
157+
* @param options.checkAdjacentVertices - enables the strategy to apply the `vertices` filter to the adjacent vertices of an edge.
154158
*/
155-
constructor(options: TraversalStrategyConfiguration) {
156-
super(options);
157-
if (this.configuration.vertices instanceof Traversal) {
158-
this.configuration.vertices = this.configuration.vertices.gremlinLang;
159-
}
160-
if (this.configuration.edges instanceof Traversal) {
161-
this.configuration.edges = this.configuration.edges.gremlinLang;
162-
}
163-
if (this.configuration.vertexProperties instanceof Traversal) {
164-
this.configuration.vertexProperties = this.configuration.vertexProperties.gremlinLang;
165-
}
159+
constructor({vertices, edges, vertexProperties, checkAdjacentVertices}: {vertices?: any, edges?: any, vertexProperties?: any, checkAdjacentVertices?: boolean} = {}) {
160+
const config: Record<string, any> = {};
161+
if (vertices !== undefined) config.vertices = vertices instanceof Traversal ? vertices.gremlinLang : vertices;
162+
if (edges !== undefined) config.edges = edges instanceof Traversal ? edges.gremlinLang : edges;
163+
if (vertexProperties !== undefined) config.vertexProperties = vertexProperties instanceof Traversal ? vertexProperties.gremlinLang : vertexProperties;
164+
if (checkAdjacentVertices !== undefined) config.checkAdjacentVertices = checkAdjacentVertices;
165+
super(config);
166166
}
167167
}
168168

169169
export class ProductiveByStrategy extends TraversalStrategy {
170170
/**
171-
* @param {Object} [options]
172-
* @param {Array<String>} [options.productiveKeys] set of keys that will always be productive
171+
* @param options
172+
* @param options.productiveKeys - set of keys that will always be productive
173173
*/
174-
constructor(options: TraversalStrategyConfiguration) {
175-
super(options);
174+
constructor({productiveKeys = []} = {}) {
175+
super({productiveKeys});
176176
}
177177
}
178178

@@ -313,8 +313,9 @@ export class ReadOnlyStrategy extends TraversalStrategy {
313313

314314
export class EdgeLabelVerificationStrategy extends TraversalStrategy {
315315
/**
316-
* @param {boolean} logWarnings determines if warnings should be written to the logger when verification fails
317-
* @param {boolean} throwException determines if exceptions should be thrown when verifications fails
316+
* @param options
317+
* @param options.logWarnings - determines if warnings should be written to the logger when verification fails
318+
* @param options.throwException - determines if exceptions should be thrown when verifications fails
318319
*/
319320
constructor({logWarnings = false, throwException = false} = {}) {
320321
super({
@@ -326,9 +327,10 @@ export class EdgeLabelVerificationStrategy extends TraversalStrategy {
326327

327328
export class ReservedKeysVerificationStrategy extends TraversalStrategy {
328329
/**
329-
* @param {boolean} logWarnings determines if warnings should be written to the logger when verification fails
330-
* @param {boolean} throwException determines if exceptions should be thrown when verifications fails
331-
* @param {Array<String>} keys the list of reserved keys to verify
330+
* @param options
331+
* @param options.logWarnings - determines if warnings should be written to the logger when verification fails
332+
* @param options.throwException - determines if exceptions should be thrown when verifications fails
333+
* @param options.keys - the list of reserved keys to verify
332334
*/
333335
constructor({ logWarnings = false, throwException = false, keys = ['id', 'label'] } = {}) {
334336
super({

gremlin-js/gremlin-javascript/lib/process/traversal.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ class PeerPressure {
255255
export class P<T1 = any, T2 = any> {
256256
/**
257257
* Represents an operation.
258-
* @constructor
259258
*/
260259
constructor(
261260
public operator: string,
@@ -379,7 +378,6 @@ function createP(operator: string, args: any) {
379378
export class TextP<T1 = any, T2 = any> {
380379
/**
381380
* Represents an operation.
382-
* @constructor
383381
*/
384382
constructor(
385383
public operator: string,

gremlin-js/gremlin-javascript/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@
6767
"eslint-config-prettier": "^10.0.1",
6868
"eslint-plugin-prettier": "^5.0.0",
6969
"globals": "^15.14.0",
70-
"jsdoc": "^4.0.5",
7170
"js-yaml": "^3.14.2",
7271
"mocha": "^11.7.5",
7372
"prettier": "^3.0.0",
7473
"ts-node": "^10.9.2",
74+
"typedoc": "^0.28.18",
7575
"typescript": "^5.4.2"
7676
},
7777
"repository": {
@@ -98,7 +98,7 @@
9898
"features-docker": "npm run features-graphbinary-docker",
9999
"features-graphbinary-docker": "cross-env NODE_OPTIONS='--loader ts-node/esm' TS_NODE_PROJECT='tsconfig.test.json' CLIENT_MIMETYPE='application/vnd.graphbinary-v4.0' cucumber-js --tags \"not @DataBigDecimal and not @DataBigInt and not @DataUUID and not @DataLong and not @StepWrite\" --import test/cucumber ../gremlin-test/",
100100
"lint": "eslint --ext .js .",
101-
"doc": "jsdoc -r -d doc -R README.md lib/"
101+
"doc": "typedoc --out doc --readme README.md --entryPointStrategy expand --entryPoints 'lib/**/*.ts' --tsconfig tsconfig.json --exclude 'lib/language/grammar/**'"
102102
},
103103
"engines": {
104104
"node": ">=22"

0 commit comments

Comments
 (0)