google-gax
Advanced tools
Comparing version 2.30.2 to 2.30.3
@@ -95,3 +95,11 @@ "use strict"; | ||
if (!cancelRequested || err.name !== 'AbortError') { | ||
callback(err); | ||
if (rpc.responseStream) { | ||
if (callback) { | ||
callback(err); | ||
} | ||
streamArrayParser.emit('error', err); | ||
} | ||
else { | ||
callback(err); | ||
} | ||
} | ||
@@ -98,0 +106,0 @@ }); |
@@ -26,4 +26,5 @@ /** | ||
streaming: boolean; | ||
constructor(streamType: StreamType); | ||
rest?: boolean; | ||
constructor(streamType: StreamType, rest?: boolean); | ||
getApiCaller(settings: CallSettings): APICaller; | ||
} |
@@ -24,5 +24,6 @@ "use strict"; | ||
class StreamDescriptor { | ||
constructor(streamType) { | ||
constructor(streamType, rest) { | ||
this.type = streamType; | ||
this.streaming = true; | ||
this.rest = rest; | ||
} | ||
@@ -29,0 +30,0 @@ getApiCaller(settings) { |
@@ -53,2 +53,3 @@ /** | ||
private _responseHasSent; | ||
rest?: boolean; | ||
/** | ||
@@ -62,3 +63,3 @@ * StreamProxy is a proxy to gRPC-streaming method. | ||
*/ | ||
constructor(type: StreamType, callback: APICallback); | ||
constructor(type: StreamType, callback: APICallback, rest?: boolean); | ||
cancel(): void; | ||
@@ -65,0 +66,0 @@ /** |
@@ -19,3 +19,2 @@ "use strict"; | ||
exports.StreamProxy = exports.StreamType = void 0; | ||
const streamArrayParser_1 = require("../streamArrayParser"); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
@@ -47,3 +46,3 @@ const duplexify = require('duplexify'); | ||
*/ | ||
constructor(type, callback) { | ||
constructor(type, callback, rest) { | ||
super(undefined, undefined, { | ||
@@ -58,2 +57,3 @@ objectMode: true, | ||
this._responseHasSent = false; | ||
this.rest = rest; | ||
} | ||
@@ -74,5 +74,2 @@ cancel() { | ||
const eventsToForward = ['metadata', 'response', 'status']; | ||
if (stream instanceof streamArrayParser_1.StreamArrayParser) { | ||
eventsToForward.push('data', 'end', 'error'); | ||
} | ||
eventsToForward.forEach(event => { | ||
@@ -118,22 +115,27 @@ stream.on(event, this.emit.bind(this, event)); | ||
if (this.type === StreamType.SERVER_STREAMING) { | ||
const retryStream = retryRequest(null, { | ||
objectMode: true, | ||
request: () => { | ||
if (this._isCancelCalled) { | ||
if (this.stream) { | ||
this.stream.cancel(); | ||
const stream = apiCall(argument, this._callback); | ||
this.stream = stream; | ||
if (this.rest) { | ||
this.setReadable(stream); | ||
} | ||
else { | ||
const retryStream = retryRequest(null, { | ||
objectMode: true, | ||
request: () => { | ||
if (this._isCancelCalled) { | ||
if (this.stream) { | ||
this.stream.cancel(); | ||
} | ||
return; | ||
} | ||
return; | ||
} | ||
const stream = apiCall(argument, this._callback); | ||
this.stream = stream; | ||
this.forwardEvents(stream); | ||
return stream; | ||
}, | ||
retries: retryRequestOptions.retries, | ||
currentRetryAttempt: retryRequestOptions.currentRetryAttempt, | ||
noResponseRetries: retryRequestOptions.noResponseRetries, | ||
shouldRetryFn: retryRequestOptions.shouldRetryFn, | ||
}); | ||
this.setReadable(retryStream); | ||
this.forwardEvents(stream); | ||
return stream; | ||
}, | ||
retries: retryRequestOptions.retries, | ||
currentRetryAttempt: retryRequestOptions.currentRetryAttempt, | ||
noResponseRetries: retryRequestOptions.noResponseRetries, | ||
shouldRetryFn: retryRequestOptions.shouldRetryFn, | ||
}); | ||
this.setReadable(retryStream); | ||
} | ||
return; | ||
@@ -140,0 +142,0 @@ } |
@@ -32,3 +32,3 @@ "use strict"; | ||
init(callback) { | ||
return new streaming_1.StreamProxy(this.descriptor.type, callback); | ||
return new streaming_1.StreamProxy(this.descriptor.type, callback, this.descriptor.rest); | ||
} | ||
@@ -35,0 +35,0 @@ wrap(func) { |
{ | ||
"name": "google-gax", | ||
"version": "2.30.2", | ||
"version": "2.30.3", | ||
"description": "Google API Extensions", | ||
@@ -18,3 +18,3 @@ "main": "build/src/index.js", | ||
"@grpc/grpc-js": "~1.6.0", | ||
"@grpc/proto-loader": "^0.6.1", | ||
"@grpc/proto-loader": "0.6.9", | ||
"@types/long": "^4.0.0", | ||
@@ -21,0 +21,0 @@ "abort-controller": "^3.0.0", |
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
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10932883
163718
+ Added@grpc/proto-loader@0.6.9(transitive)
- Removed@grpc/proto-loader@0.6.13(transitive)
- Removedprotobufjs@6.11.4(transitive)
Updated@grpc/proto-loader@0.6.9