Skip to content

Commit

Permalink
feat: add google-gax status to exports (#912)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Chen committed Feb 7, 2020
1 parent c5b9442 commit 7d97384
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/src/index.ts
Expand Up @@ -91,6 +91,7 @@ export {
Precondition,
SetOptions,
} from './types';
export {Status as GrpcStatus} from 'google-gax';

const libVersion = require('../../package.json').version;
setLibVersion(libVersion);
Expand Down
5 changes: 5 additions & 0 deletions dev/test/typescript.ts
Expand Up @@ -34,6 +34,7 @@ import SetOptions = FirebaseFirestore.SetOptions;
import FirestoreDataConverter = FirebaseFirestore.FirestoreDataConverter;
import Timestamp = FirebaseFirestore.Timestamp;
import Settings = FirebaseFirestore.Settings;
import GrpcStatus = FirebaseFirestore.GrpcStatus;

// This test verifies the Typescript typings and is not meant for execution.
xdescribe('firestore.d.ts', () => {
Expand Down Expand Up @@ -352,4 +353,8 @@ xdescribe('firestore.d.ts', () => {
const seconds: number = timestamp.seconds;
const nanoseconds: number = timestamp.nanoseconds;
});

it('has typings for GrpcStatus', () => {
const status = GrpcStatus.ABORTED;
});
});
23 changes: 23 additions & 0 deletions types/firestore.d.ts
Expand Up @@ -1452,6 +1452,29 @@ declare namespace FirebaseFirestore {
* API and the underlying Firestore v1 RPCs.
*/
export const v1: {FirestoreClient: any, FirestoreAdminClient: any};

/**
* Status codes returned by Firestore's gRPC calls.
*/
export enum GrpcStatus {
OK = 0,
CANCELLED = 1,
UNKNOWN = 2,
INVALID_ARGUMENT = 3,
DEADLINE_EXCEEDED = 4,
NOT_FOUND = 5,
ALREADY_EXISTS = 6,
PERMISSION_DENIED = 7,
RESOURCE_EXHAUSTED = 8,
FAILED_PRECONDITION = 9,
ABORTED = 10,
OUT_OF_RANGE = 11,
UNIMPLEMENTED = 12,
INTERNAL = 13,
UNAVAILABLE = 14,
DATA_LOSS = 15,
UNAUTHENTICATED = 16
}
}

declare module '@google-cloud/firestore' {
Expand Down

0 comments on commit 7d97384

Please sign in to comment.