Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/functions/functions-api-client-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { App } from '../app';
import { FirebaseApp } from '../app/firebase-app';
import {
HttpRequestConfig, HttpClient, RequestResponseError, AuthorizedHttpClient
AuthorizedHttpClient, HttpClient, HttpRequestConfig, RequestResponse, RequestResponseError
} from '../utils/api-request';
import { PrefixedFirebaseError } from '../utils/error';
import * as utils from '../utils/index';
Expand Down Expand Up @@ -121,7 +121,11 @@ export class FunctionsApiClient {
* @param extensionId - Optional canonical ID of the extension.
* @param opts - Optional options when enqueuing a new task.
*/
public async enqueue(data: any, functionName: string, extensionId?: string, opts?: TaskOptions): Promise<void> {
public async enqueue(
data: any,
functionName: string,
extensionId?: string,
opts?: TaskOptions): Promise<RequestResponse | void> {
if (!validator.isNonEmptyString(functionName)) {
throw new FirebaseFunctionsError(
'invalid-argument', 'Function name must be a non empty string');
Expand Down Expand Up @@ -159,7 +163,7 @@ export class FunctionsApiClient {
task: taskPayload,
}
};
await this.httpClient.send(request);
return await this.httpClient.send(request);
} catch (err: unknown) {
if (err instanceof RequestResponseError) {
if (err.response.status === 409) {
Expand Down
3 changes: 2 additions & 1 deletion src/functions/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import { App } from '../app';
import { FirebaseFunctionsError, FunctionsApiClient } from './functions-api-client-internal';
import { TaskOptions } from './functions-api';
import { RequestResponse } from '../utils/api-request';
import * as validator from '../utils/validator';

/**
Expand Down Expand Up @@ -99,7 +100,7 @@ export class TaskQueue<Args = Record<string, any>> {
* @param opts - Optional options when enqueuing a new task.
* @returns A promise that resolves when the task has successfully been added to the queue.
*/
public enqueue(data: Args, opts?: TaskOptions): Promise<void> {
public enqueue(data: Args, opts?: TaskOptions): Promise<RequestResponse | void> {
return this.client.enqueue(data, this.functionName, this.extensionId, opts);
}

Expand Down