Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add google-gax status to exports #912

Merged
merged 6 commits into from Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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