diff --git a/config/clients/js/template/client.mustache b/config/clients/js/template/client.mustache index 89562c34..f6da0bbb 100644 --- a/config/clients/js/template/client.mustache +++ b/config/clients/js/template/client.mustache @@ -134,7 +134,7 @@ export type ClientBatchCheckSingleClientResponse = { }); export interface ClientBatchCheckClientResponse { - responses: ClientBatchCheckSingleClientResponse[]; + result: ClientBatchCheckSingleClientResponse[]; } export interface ClientBatchCheckClientRequestOpts { @@ -632,7 +632,7 @@ export class {{appShortName}}Client extends BaseAPI { setHeaderIfNotSet(headers, CLIENT_METHOD_HEADER, "ClientBatchCheck"); setHeaderIfNotSet(headers, CLIENT_BULK_REQUEST_ID_HEADER, generateRandomIdWithNonUniqueFallback()); - const responses: ClientBatchCheckSingleClientResponse[] = []; + const result: ClientBatchCheckSingleClientResponse[] = []; for await (const singleCheckResponse of asyncPool(maxParallelRequests, body, (tuple) => this.check(tuple, { ...options, headers }) .then(response => { (response as ClientBatchCheckSingleClientResponse)._request = tuple; @@ -650,9 +650,9 @@ export class {{appShortName}}Client extends BaseAPI { }; }) )) { - responses.push(singleCheckResponse); + result.push(singleCheckResponse); } - return { responses }; + return { result }; } @@ -825,12 +825,12 @@ export class {{appShortName}}Client extends BaseAPI { context, })), { ...options, headers, maxParallelRequests }); - const firstErrorResponse = batchCheckResults.responses.find(response => (response as any).error); + const firstErrorResponse = batchCheckResults.result.find(response => (response as any).error); if (firstErrorResponse) { throw (firstErrorResponse as any).error; } - return { relations: batchCheckResults.responses.filter(result => result.allowed).map(result => result._request.relation) }; + return { relations: batchCheckResults.result.filter(result => result.allowed).map(result => result._request.relation) }; } /** diff --git a/config/clients/js/template/tests/client.test.ts.mustache b/config/clients/js/template/tests/client.test.ts.mustache index d80a22aa..1b7cff11 100644 --- a/config/clients/js/template/tests/client.test.ts.mustache +++ b/config/clients/js/template/tests/client.test.ts.mustache @@ -538,8 +538,8 @@ describe("{{appTitleCaseName}} Client", () => { expect(scope1.isDone()).toBe(true); expect(scope2.isDone()).toBe(true); expect(scope3.isDone()).toBe(false); - expect(response.responses.length).toBe(3); - expect(response.responses.sort((a, b) => String(a._request.object).localeCompare(b._request.object))) + expect(response.result.length).toBe(3); + expect(response.result.sort((a, b) => String(a._request.object).localeCompare(b._request.object))) .toMatchObject(expect.arrayContaining([ { _request: tuples[0], allowed: true, }, { _request: tuples[1], allowed: false },