go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/frontend/ui/patches/ts-proto+1.161.1.patch (about)

     1  diff --git a/node_modules/ts-proto/build/generate-services.js b/node_modules/ts-proto/build/generate-services.js
     2  index 8117f7f..3c53729 100644
     3  --- a/node_modules/ts-proto/build/generate-services.js
     4  +++ b/node_modules/ts-proto/build/generate-services.js
     5  @@ -87,8 +87,8 @@ function generateRegularRpcMethod(ctx, methodDesc) {
     6       ];
     7       const maybeCtx = options.context ? "ctx," : "";
     8       const maybeAbortSignal = options.useAbortSignal ? "abortSignal || undefined," : "";
     9  -    let encode = (0, ts_poet_1.code) `${rawInputType}.encode(request).finish()`;
    10  -    let decode = (0, ts_poet_1.code) `data => ${rawOutputType}.decode(${Reader}.create(data))`;
    11  +    let encode = (0, ts_poet_1.code) `${rawInputType}.toJSON(request)`;
    12  +    let decode = (0, ts_poet_1.code) `data => ${rawOutputType}.fromJSON(data)`;
    13       // if (options.useDate && rawOutputType.toString().includes("Timestamp")) {
    14       //   decode = code`data => ${utils.fromTimestamp}(${rawOutputType}.decode(${Reader}.create(data)))`;
    15       // }
    16  @@ -158,6 +158,7 @@ function generateServiceClientImpl(ctx, fileDesc, serviceDesc) {
    17       chunks.push((0, ts_poet_1.code) `export class ${name}ClientImpl${t} implements ${(0, ts_poet_1.def)(i)} {`);
    18       // Create the constructor(rpc: Rpc)
    19       const rpcType = options.context ? "Rpc<Context>" : "Rpc";
    20  +    chunks.push((0, ts_poet_1.code) `static readonly DEFAULT_SERVICE = ${serviceNameConst};`);
    21       chunks.push((0, ts_poet_1.code) `private readonly rpc: ${rpcType};`);
    22       chunks.push((0, ts_poet_1.code) `private readonly service: string;`);
    23       chunks.push((0, ts_poet_1.code) `constructor(rpc: ${rpcType}, opts?: {service?: string}) {`);
    24  @@ -284,7 +285,7 @@ function generateRpcType(ctx, hasStreamingMethods) {
    25       const maybeContext = options.context ? "<Context>" : "";
    26       const maybeContextParam = options.context ? "ctx: Context," : "";
    27       const maybeAbortSignalParam = options.useAbortSignal ? "abortSignal?: AbortSignal," : "";
    28  -    const methods = [[(0, ts_poet_1.code) `request`, (0, ts_poet_1.code) `Uint8Array`, (0, ts_poet_1.code) `Promise<Uint8Array>`]];
    29  +    const methods = [[(0, ts_poet_1.code) `request`, (0, ts_poet_1.code) `unknown`, (0, ts_poet_1.code) `Promise<unknown>`]];
    30       if (hasStreamingMethods) {
    31           const observable = (0, types_1.observableType)(ctx, true);
    32           methods.push([(0, ts_poet_1.code) `clientStreamingRequest`, (0, ts_poet_1.code) `${observable}<Uint8Array>`, (0, ts_poet_1.code) `Promise<Uint8Array>`]);