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

chore!: drop support for custom promises #970

Merged
merged 1 commit into from
Apr 20, 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
5 changes: 0 additions & 5 deletions src/iam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,11 @@ export type TestIamPermissionsCallback = ResourceCallback<
* // subscription.iam
*/
export class IAM {
// tslint:disable-next-line variable-name
Promise?: PromiseConstructor;
pubsub: PubSub;
request: typeof PubSub.prototype.request;
id: string;

constructor(pubsub: PubSub, id: string) {
if (pubsub.Promise) {
this.Promise = pubsub.Promise;
}
this.pubsub = pubsub;
this.request = pubsub.request.bind(pubsub);
this.id = id;
Expand Down
6 changes: 0 additions & 6 deletions src/publisher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,11 @@ export const BATCH_LIMITS: BatchPublishOptions = {
* @param {PublishOptions} [options] Configuration object.
*/
export class Publisher {
// tslint:disable-next-line variable-name
Promise?: PromiseConstructor;
topic: Topic;
settings!: PublishOptions;
queue: Queue;
orderedQueues: Map<string, OrderedQueue>;
constructor(topic: Topic, options?: PublishOptions) {
if (topic.Promise) {
this.Promise = topic.Promise;
}

this.setOptions(options);
this.topic = topic;
this.queue = new Queue(this);
Expand Down
5 changes: 0 additions & 5 deletions src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,8 @@ export type SeekResponse = [google.pubsub.v1.ISeekResponse];
export class Snapshot {
parent: Subscription | PubSub;
name: string;
// tslint:disable-next-line variable-name
Promise?: PromiseConstructor;
metadata?: google.pubsub.v1.ISnapshot;
constructor(parent: Subscription | PubSub, name: string) {
if (parent instanceof PubSub) {
this.Promise = parent.Promise;
}
this.parent = parent;
this.name = Snapshot.formatName_(parent.projectId, name);
}
Expand Down
5 changes: 0 additions & 5 deletions src/topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ export type MessageOptions = PubsubMessage & {json?: any};
* const topic = pubsub.topic('ordered-topic', {enableMessageOrdering: true});
*/
export class Topic {
// tslint:disable-next-line variable-name
Promise?: PromiseConstructor;
name: string;
parent: PubSub;
pubsub: PubSub;
Expand All @@ -114,9 +112,6 @@ export class Topic {
) as () => ObjectStream<Subscription>;

constructor(pubsub: PubSub, name: string, options?: PublishOptions) {
if (pubsub.Promise) {
this.Promise = pubsub.Promise;
}
/**
* The fully qualified name of this topic.
* @name Topic#name
Expand Down
5 changes: 0 additions & 5 deletions test/iam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe('IAM', () => {

const PUBSUB = ({
options: {},
Promise: {},
request: util.noop,
} as {}) as PubSub;
const ID = 'id';
Expand All @@ -53,10 +52,6 @@ describe('IAM', () => {
});

describe('initialization', () => {
it('should localize pubsub.Promise', () => {
assert.strictEqual(iam.Promise, PUBSUB.Promise);
});

it('should localize pubsub', () => {
assert.strictEqual(iam.pubsub, PUBSUB);
});
Expand Down
6 changes: 0 additions & 6 deletions test/publisher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ describe('Publisher', () => {
assert(promisified);
});

it('should localize Promise class if set', () => {
const t = {Promise} as Topic;
publisher = new Publisher(t);
assert.strictEqual(publisher.Promise, Promise);
});

it('should capture user options', () => {
const stub = sandbox.stub(Publisher.prototype, 'setOptions');

Expand Down
1 change: 0 additions & 1 deletion test/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ describe('PubSub', () => {
let pubsub: pubsubTypes.PubSub;
const OPTIONS = {
projectId: PROJECT_ID,
promise: {},
} as pubsubTypes.ClientConfig;

const PUBSUB_EMULATOR_HOST = process.env.PUBSUB_EMULATOR_HOST;
Expand Down
6 changes: 0 additions & 6 deletions test/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ describe('Snapshot', () => {
assert(promisified);
});

it('should localize parent.Promise', () => {
const pubsub = new PubSub();
snapshot = new Snapshot(pubsub, SNAPSHOT_NAME);
assert.strictEqual(snapshot.Promise, pubsub.Promise);
});

it('should localize the parent', () => {
assert.strictEqual(snapshot.parent, SUBSCRIPTION);
});
Expand Down
1 change: 0 additions & 1 deletion test/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ describe('Subscription', () => {

const PUBSUB = ({
projectId: PROJECT_ID,
Promise: {},
request: util.noop,
createSubscription: util.noop,
} as {}) as PubSub;
Expand Down
5 changes: 0 additions & 5 deletions test/topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ describe('Topic', () => {

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const PUBSUB: any = {
Promise: {},
projectId: PROJECT_ID,
createTopic: util.noop,
request: util.noop,
Expand Down Expand Up @@ -132,10 +131,6 @@ describe('Topic', () => {
assert(promisified);
});

it('should localize pubsub.Promise', () => {
assert.strictEqual(topic.Promise, PUBSUB.Promise);
});

it('should format the name', () => {
const formattedName = 'a/b/c/d';

Expand Down