ts-proto 1.148.0 → 1.148.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -347,7 +347,10 @@ function createInvokeMethod(ctx) {
|
|
|
347
347
|
},
|
|
348
348
|
});
|
|
349
349
|
observer.add(() => {
|
|
350
|
-
|
|
350
|
+
${!useAbortSignal
|
|
351
|
+
? `return client.close();`
|
|
352
|
+
: `if (!abortSignal || !abortSignal.aborted)
|
|
353
|
+
return client.close();`}
|
|
351
354
|
});
|
|
352
355
|
|
|
353
356
|
${maybeAbortSignal}
|
|
@@ -6,8 +6,6 @@ const types_1 = require("./types");
|
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
const sourceInfo_1 = require("./sourceInfo");
|
|
8
8
|
const main_1 = require("./main");
|
|
9
|
-
const hash = (0, ts_poet_1.imp)("hash*object-hash");
|
|
10
|
-
const dataloader = (0, ts_poet_1.imp)("DataLoader*dataloader");
|
|
11
9
|
/**
|
|
12
10
|
* Generates an interface for `serviceDesc`.
|
|
13
11
|
*
|
|
@@ -188,9 +186,12 @@ function generateServiceClientImpl(ctx, fileDesc, serviceDesc) {
|
|
|
188
186
|
}
|
|
189
187
|
exports.generateServiceClientImpl = generateServiceClientImpl;
|
|
190
188
|
/** We've found a BatchXxx method, create a synthetic GetXxx method that calls it. */
|
|
191
|
-
function generateBatchingRpcMethod(
|
|
189
|
+
function generateBatchingRpcMethod(ctx, batchMethod) {
|
|
192
190
|
const { methodDesc, singleMethodName, inputFieldName, inputType, outputFieldName, outputType, mapType, uniqueIdentifier, } = batchMethod;
|
|
193
191
|
(0, utils_1.assertInstanceOf)(methodDesc, utils_1.FormattedMethodDescriptor);
|
|
192
|
+
const { options } = ctx;
|
|
193
|
+
const hash = options.esModuleInterop ? (0, ts_poet_1.imp)("hash=object-hash") : (0, ts_poet_1.imp)("hash*object-hash");
|
|
194
|
+
const dataloader = options.esModuleInterop ? (0, ts_poet_1.imp)("DataLoader=dataloader") : (0, ts_poet_1.imp)("DataLoader*dataloader");
|
|
194
195
|
// Create the `(keys) => ...` lambda we'll pass to the DataLoader constructor
|
|
195
196
|
const lambda = [];
|
|
196
197
|
lambda.push((0, ts_poet_1.code) `
|
|
@@ -230,6 +231,9 @@ function generateBatchingRpcMethod(_ctx, batchMethod) {
|
|
|
230
231
|
/** We're not going to batch, but use DataLoader for per-request caching. */
|
|
231
232
|
function generateCachingRpcMethod(ctx, fileDesc, serviceDesc, methodDesc) {
|
|
232
233
|
(0, utils_1.assertInstanceOf)(methodDesc, utils_1.FormattedMethodDescriptor);
|
|
234
|
+
const { options } = ctx;
|
|
235
|
+
const hash = options.esModuleInterop ? (0, ts_poet_1.imp)("hash=object-hash") : (0, ts_poet_1.imp)("hash*object-hash");
|
|
236
|
+
const dataloader = options.esModuleInterop ? (0, ts_poet_1.imp)("DataLoader=dataloader") : (0, ts_poet_1.imp)("DataLoader*dataloader");
|
|
233
237
|
const inputType = (0, types_1.requestType)(ctx, methodDesc);
|
|
234
238
|
const outputType = (0, types_1.responseType)(ctx, methodDesc);
|
|
235
239
|
const uniqueIdentifier = `${(0, utils_1.maybePrefixPackage)(fileDesc, serviceDesc.name)}.${methodDesc.name}`;
|