Skip to content

Commit

Permalink
chore!: dropp support for custom promises (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Apr 20, 2020
1 parent 966614d commit df462d3
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 45 deletions.
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

0 comments on commit df462d3

Please sign in to comment.